@hyperjump/json-schema 0.18.3 → 0.18.4
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 +3 -130
- package/dist/json-schema-amd.js.map +1 -1
- package/dist/json-schema-amd.min.js +1 -1
- package/dist/json-schema-amd.min.js.map +1 -1
- package/dist/json-schema-cjs.js +3 -130
- package/dist/json-schema-cjs.js.map +1 -1
- package/dist/json-schema-cjs.min.js +1 -1
- package/dist/json-schema-cjs.min.js.map +1 -1
- package/dist/json-schema-esm.js +3 -130
- package/dist/json-schema-esm.js.map +1 -1
- package/dist/json-schema-esm.min.js +1 -1
- package/dist/json-schema-esm.min.js.map +1 -1
- package/dist/json-schema-iife.js +3 -130
- package/dist/json-schema-iife.js.map +1 -1
- package/dist/json-schema-iife.min.js +1 -1
- package/dist/json-schema-iife.min.js.map +1 -1
- package/dist/json-schema-system.js +3 -130
- package/dist/json-schema-system.js.map +1 -1
- package/dist/json-schema-system.min.js +1 -1
- package/dist/json-schema-system.min.js.map +1 -1
- package/dist/json-schema-umd.js +3 -130
- package/dist/json-schema-umd.js.map +1 -1
- package/dist/json-schema-umd.min.js +1 -1
- package/dist/json-schema-umd.min.js.map +1 -1
- package/package.json +3 -2
package/dist/json-schema-cjs.js
CHANGED
|
@@ -650,70 +650,7 @@ const safeResolveUrl$1 = (contextUrl, url) => {
|
|
|
650
650
|
return resolvedUrl;
|
|
651
651
|
};
|
|
652
652
|
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
const pathRelative$1 = (from, to) => {
|
|
656
|
-
if (from === to) {
|
|
657
|
-
return "";
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
let toStart = 1;
|
|
661
|
-
const fromLen = from.length - 1;
|
|
662
|
-
const toLen = to.length - toStart;
|
|
663
|
-
|
|
664
|
-
// Compare paths to find the longest common path from root
|
|
665
|
-
const length = fromLen < toLen ? fromLen : toLen;
|
|
666
|
-
let lastCommonSep = -1;
|
|
667
|
-
let i = 0;
|
|
668
|
-
for (; i < length; i++) {
|
|
669
|
-
const fromCode = from.charCodeAt(i + 1);
|
|
670
|
-
if (fromCode !== to.charCodeAt(toStart + i)) {
|
|
671
|
-
break;
|
|
672
|
-
} else if (fromCode === CHAR_BACKWARD_SLASH) {
|
|
673
|
-
lastCommonSep = i;
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
if (toLen > length) {
|
|
678
|
-
if (to.charCodeAt(toStart + i) === CHAR_BACKWARD_SLASH) {
|
|
679
|
-
return to.slice(toStart + i + 1);
|
|
680
|
-
}
|
|
681
|
-
if (i === 0) {
|
|
682
|
-
return to.slice(toStart + i);
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
if (fromLen > length) {
|
|
686
|
-
if (from.charCodeAt(i + 1) === CHAR_BACKWARD_SLASH) {
|
|
687
|
-
lastCommonSep = i;
|
|
688
|
-
} else if (length === 0) {
|
|
689
|
-
lastCommonSep = 0;
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
let out = "";
|
|
694
|
-
// Generate the relative path based on the path difference between `to` and `from`
|
|
695
|
-
for (i = lastCommonSep + 2; i <= from.length; ++i) {
|
|
696
|
-
if (i === from.length || from.charCodeAt(i) === CHAR_BACKWARD_SLASH) {
|
|
697
|
-
out += out.length === 0 ? ".." : "/..";
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
toStart += lastCommonSep;
|
|
702
|
-
|
|
703
|
-
// Lastly, append the rest of the destination (`to`) path that comes after
|
|
704
|
-
// the common path parts
|
|
705
|
-
if (out.length > 0) {
|
|
706
|
-
return `${out}${to.slice(toStart, to.length)}`;
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
if (to.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) {
|
|
710
|
-
++toStart;
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
return to.slice(toStart, to.length);
|
|
714
|
-
};
|
|
715
|
-
|
|
716
|
-
var common$1 = { jsonTypeOf: jsonTypeOf$2, splitUrl: splitUrl$4, safeResolveUrl: safeResolveUrl$1, pathRelative: pathRelative$1 };
|
|
653
|
+
var common$1 = { jsonTypeOf: jsonTypeOf$2, splitUrl: splitUrl$4, safeResolveUrl: safeResolveUrl$1 };
|
|
717
654
|
|
|
718
655
|
const nil$2 = "";
|
|
719
656
|
|
|
@@ -1219,7 +1156,7 @@ lib$2.allValues;
|
|
|
1219
1156
|
|
|
1220
1157
|
var fetch_browser = fetch;
|
|
1221
1158
|
|
|
1222
|
-
const { jsonTypeOf, splitUrl: splitUrl$3, safeResolveUrl
|
|
1159
|
+
const { jsonTypeOf, splitUrl: splitUrl$3, safeResolveUrl } = common$1;
|
|
1223
1160
|
|
|
1224
1161
|
|
|
1225
1162
|
|
|
@@ -1449,73 +1386,10 @@ const map = justCurryIt((fn, doc) => lib$2.pipeline([
|
|
|
1449
1386
|
|
|
1450
1387
|
const length = (doc) => value(doc).length;
|
|
1451
1388
|
|
|
1452
|
-
const toSchemaDefaultOptions = {
|
|
1453
|
-
parentId: "",
|
|
1454
|
-
parentDialect: "",
|
|
1455
|
-
includeEmbedded: true
|
|
1456
|
-
};
|
|
1457
|
-
const toSchema = (schemaDoc, options = {}) => {
|
|
1458
|
-
const fullOptions = { ...toSchemaDefaultOptions, ...options };
|
|
1459
|
-
|
|
1460
|
-
const schema = JSON.parse(JSON.stringify(schemaDoc.schema, (key, value) => {
|
|
1461
|
-
if (!reference.isReference(value)) {
|
|
1462
|
-
return value;
|
|
1463
|
-
}
|
|
1464
|
-
|
|
1465
|
-
const refValue = reference.value(value);
|
|
1466
|
-
const embeddedDialect = refValue.$schema || schemaDoc.schemaVersion;
|
|
1467
|
-
const embeddedToken = getConfig(embeddedDialect, "embeddedToken");
|
|
1468
|
-
if (!fullOptions.includeEmbedded && embeddedToken in refValue) {
|
|
1469
|
-
return;
|
|
1470
|
-
} else {
|
|
1471
|
-
return reference.value(value);
|
|
1472
|
-
}
|
|
1473
|
-
}));
|
|
1474
|
-
|
|
1475
|
-
const dynamicAnchorToken = getConfig(schemaDoc.schemaVersion, "dynamicAnchorToken");
|
|
1476
|
-
Object.entries(schemaDoc.dynamicAnchors)
|
|
1477
|
-
.forEach(([anchor, uri]) => {
|
|
1478
|
-
const pointer = splitUrl$3(uri)[1];
|
|
1479
|
-
lib$3.assign(pointer, schema, {
|
|
1480
|
-
[dynamicAnchorToken]: anchor,
|
|
1481
|
-
...lib$3.get(pointer, schema)
|
|
1482
|
-
});
|
|
1483
|
-
});
|
|
1484
|
-
|
|
1485
|
-
const anchorToken = getConfig(schemaDoc.schemaVersion, "anchorToken");
|
|
1486
|
-
Object.entries(schemaDoc.anchors)
|
|
1487
|
-
.filter(([anchor]) => anchor !== "")
|
|
1488
|
-
.forEach(([anchor, pointer]) => {
|
|
1489
|
-
lib$3.assign(pointer, schema, {
|
|
1490
|
-
[anchorToken]: anchor,
|
|
1491
|
-
...lib$3.get(pointer, schema)
|
|
1492
|
-
});
|
|
1493
|
-
});
|
|
1494
|
-
|
|
1495
|
-
const baseToken = getConfig(schemaDoc.schemaVersion, "baseToken");
|
|
1496
|
-
const id = relativeUri(fullOptions.parentId, schemaDoc.id);
|
|
1497
|
-
const dialect = fullOptions.parentDialect === schemaDoc.schemaVersion ? "" : schemaDoc.schemaVersion;
|
|
1498
|
-
return {
|
|
1499
|
-
...(id && { [baseToken]: id }),
|
|
1500
|
-
...(dialect && { $schema: dialect }),
|
|
1501
|
-
...schema
|
|
1502
|
-
};
|
|
1503
|
-
};
|
|
1504
|
-
|
|
1505
|
-
const relativeUri = (from, to) => {
|
|
1506
|
-
if (to.startsWith("file://")) {
|
|
1507
|
-
const pathToSchema = from.slice(7, from.lastIndexOf("/"));
|
|
1508
|
-
return from === "" ? "" : pathRelative(pathToSchema, to.slice(7));
|
|
1509
|
-
} else {
|
|
1510
|
-
return to;
|
|
1511
|
-
}
|
|
1512
|
-
};
|
|
1513
|
-
|
|
1514
1389
|
var schema$5 = {
|
|
1515
1390
|
setConfig, getConfig,
|
|
1516
1391
|
add: add$1, get, markValidated,
|
|
1517
|
-
uri, value, getAnchorPointer, typeOf, has, step, keys, entries, map, length
|
|
1518
|
-
toSchema
|
|
1392
|
+
uri, value, getAnchorPointer, typeOf, has, step, keys, entries, map, length
|
|
1519
1393
|
};
|
|
1520
1394
|
schema$5.setConfig;
|
|
1521
1395
|
schema$5.getConfig;
|
|
@@ -1532,7 +1406,6 @@ schema$5.keys;
|
|
|
1532
1406
|
schema$5.entries;
|
|
1533
1407
|
schema$5.map;
|
|
1534
1408
|
schema$5.length;
|
|
1535
|
-
schema$5.toSchema;
|
|
1536
1409
|
|
|
1537
1410
|
class InvalidSchemaError$1 extends Error {
|
|
1538
1411
|
constructor(output) {
|