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