@twin.org/data-json-ld 0.0.1-next.31 → 0.0.1-next.32
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/cjs/index.cjs +150 -54
- package/dist/esm/index.mjs +152 -56
- package/dist/types/models/jsonLdTypes.d.ts +8 -0
- package/docs/changelog.md +14 -0
- package/docs/reference/variables/JsonLdTypes.md +12 -0
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -85,6 +85,14 @@ const JsonLdTypes = {
|
|
|
85
85
|
* Represents JSON-LD Context Definition.
|
|
86
86
|
*/
|
|
87
87
|
ContextDefinition: "JsonLdContextDefinition",
|
|
88
|
+
/**
|
|
89
|
+
* Represents JSON-LD Context Definition Element.
|
|
90
|
+
*/
|
|
91
|
+
ContextDefinitionElement: "JsonLdContextDefinitionElement",
|
|
92
|
+
/**
|
|
93
|
+
* Represents JSON-LD Context Definition Root.
|
|
94
|
+
*/
|
|
95
|
+
ContextDefinitionRoot: "JsonLdContextDefinitionRoot",
|
|
88
96
|
/**
|
|
89
97
|
* Represents JSON-LD Expanded Term Definition.
|
|
90
98
|
*/
|
|
@@ -124,7 +132,7 @@ const JsonLdTypes = {
|
|
|
124
132
|
};
|
|
125
133
|
|
|
126
134
|
var type$e = "string";
|
|
127
|
-
var description$
|
|
135
|
+
var description$p = "Helper Types";
|
|
128
136
|
var JsonLdContainerTypeSchema = {
|
|
129
137
|
type: type$e,
|
|
130
138
|
"enum": [
|
|
@@ -134,10 +142,10 @@ var JsonLdContainerTypeSchema = {
|
|
|
134
142
|
"@graph",
|
|
135
143
|
"@type"
|
|
136
144
|
],
|
|
137
|
-
description: description$
|
|
145
|
+
description: description$p
|
|
138
146
|
};
|
|
139
147
|
|
|
140
|
-
var anyOf$
|
|
148
|
+
var anyOf$a = [
|
|
141
149
|
{
|
|
142
150
|
type: "array",
|
|
143
151
|
minItems: 2,
|
|
@@ -311,10 +319,10 @@ var anyOf$8 = [
|
|
|
311
319
|
maxItems: 2
|
|
312
320
|
}
|
|
313
321
|
];
|
|
314
|
-
var description$
|
|
322
|
+
var description$o = "Helper Types.";
|
|
315
323
|
var JsonLdContainerTypeArraySchema = {
|
|
316
|
-
anyOf: anyOf$
|
|
317
|
-
description: description$
|
|
324
|
+
anyOf: anyOf$a,
|
|
325
|
+
description: description$o
|
|
318
326
|
};
|
|
319
327
|
|
|
320
328
|
var type$d = "object";
|
|
@@ -388,11 +396,45 @@ var additionalProperties$b = {
|
|
|
388
396
|
}
|
|
389
397
|
]
|
|
390
398
|
};
|
|
391
|
-
var description$
|
|
399
|
+
var description$n = "A context definition defines a local context in a node object.";
|
|
392
400
|
var JsonLdContextDefinitionSchema = {
|
|
393
401
|
type: type$d,
|
|
394
402
|
properties: properties$6,
|
|
395
403
|
additionalProperties: additionalProperties$b,
|
|
404
|
+
description: description$n
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
var anyOf$9 = [
|
|
408
|
+
{
|
|
409
|
+
type: "null"
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
type: "string"
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinition"
|
|
416
|
+
}
|
|
417
|
+
];
|
|
418
|
+
var description$m = "A context definition element is used to define the types of a context definition.";
|
|
419
|
+
var JsonLdContextDefinitionElementSchema = {
|
|
420
|
+
anyOf: anyOf$9,
|
|
421
|
+
description: description$m
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
var anyOf$8 = [
|
|
425
|
+
{
|
|
426
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
type: "array",
|
|
430
|
+
items: {
|
|
431
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
];
|
|
435
|
+
var description$l = "A context definition root is used to define the root of a context definition.";
|
|
436
|
+
var JsonLdContextDefinitionRootSchema = {
|
|
437
|
+
anyOf: anyOf$8,
|
|
396
438
|
description: description$l
|
|
397
439
|
};
|
|
398
440
|
|
|
@@ -1382,145 +1424,143 @@ class JsonLdDataTypes {
|
|
|
1382
1424
|
*/
|
|
1383
1425
|
static registerTypes() {
|
|
1384
1426
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.Document}`, () => ({
|
|
1427
|
+
context: JsonLdContexts.ContextRoot,
|
|
1385
1428
|
type: JsonLdTypes.Document,
|
|
1386
1429
|
jsonSchema: async () => JsonLdDocumentSchema
|
|
1387
1430
|
}));
|
|
1388
1431
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.Object}`, () => ({
|
|
1432
|
+
context: JsonLdContexts.ContextRoot,
|
|
1389
1433
|
type: JsonLdTypes.Object,
|
|
1390
1434
|
jsonSchema: async () => JsonLdObjectSchema
|
|
1391
1435
|
}));
|
|
1392
1436
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.NodeObject}`, () => ({
|
|
1437
|
+
context: JsonLdContexts.ContextRoot,
|
|
1393
1438
|
type: JsonLdTypes.NodeObject,
|
|
1394
1439
|
jsonSchema: async () => JsonLdNodeObjectSchema
|
|
1395
1440
|
}));
|
|
1396
1441
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.NodePrimitive}`, () => ({
|
|
1442
|
+
context: JsonLdContexts.ContextRoot,
|
|
1397
1443
|
type: JsonLdTypes.NodePrimitive,
|
|
1398
1444
|
jsonSchema: async () => JsonLdNodePrimitiveSchema
|
|
1399
1445
|
}));
|
|
1400
1446
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.GraphObject}`, () => ({
|
|
1447
|
+
context: JsonLdContexts.ContextRoot,
|
|
1401
1448
|
type: JsonLdTypes.GraphObject,
|
|
1402
1449
|
jsonSchema: async () => JsonLdGraphObjectSchema
|
|
1403
1450
|
}));
|
|
1404
1451
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ValueObject}`, () => ({
|
|
1452
|
+
context: JsonLdContexts.ContextRoot,
|
|
1405
1453
|
type: JsonLdTypes.ValueObject,
|
|
1406
1454
|
jsonSchema: async () => JsonLdValueObjectSchema
|
|
1407
1455
|
}));
|
|
1408
1456
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ListObject}`, () => ({
|
|
1457
|
+
context: JsonLdContexts.ContextRoot,
|
|
1409
1458
|
type: JsonLdTypes.ListObject,
|
|
1410
1459
|
jsonSchema: async () => JsonLdListObjectSchema
|
|
1411
1460
|
}));
|
|
1412
1461
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ListObject}`, () => ({
|
|
1462
|
+
context: JsonLdContexts.ContextRoot,
|
|
1413
1463
|
type: JsonLdTypes.ListObject,
|
|
1414
1464
|
jsonSchema: async () => JsonLdListObjectSchema
|
|
1415
1465
|
}));
|
|
1416
1466
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.SetObject}`, () => ({
|
|
1467
|
+
context: JsonLdContexts.ContextRoot,
|
|
1417
1468
|
type: JsonLdTypes.SetObject,
|
|
1418
1469
|
jsonSchema: async () => JsonLdSetObjectSchema
|
|
1419
1470
|
}));
|
|
1420
1471
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.LanguageMap}`, () => ({
|
|
1472
|
+
context: JsonLdContexts.ContextRoot,
|
|
1421
1473
|
type: JsonLdTypes.LanguageMap,
|
|
1422
1474
|
jsonSchema: async () => JsonLdLanguageMapSchema
|
|
1423
1475
|
}));
|
|
1424
1476
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.IndexMap}`, () => ({
|
|
1477
|
+
context: JsonLdContexts.ContextRoot,
|
|
1425
1478
|
type: JsonLdTypes.IndexMap,
|
|
1426
1479
|
jsonSchema: async () => JsonLdIndexMapSchema
|
|
1427
1480
|
}));
|
|
1428
1481
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.IndexMapItem}`, () => ({
|
|
1482
|
+
context: JsonLdContexts.ContextRoot,
|
|
1429
1483
|
type: JsonLdTypes.IndexMapItem,
|
|
1430
1484
|
jsonSchema: async () => JsonLdIndexMapItemSchema
|
|
1431
1485
|
}));
|
|
1432
1486
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.IdMap}`, () => ({
|
|
1487
|
+
context: JsonLdContexts.ContextRoot,
|
|
1433
1488
|
type: JsonLdTypes.IdMap,
|
|
1434
1489
|
jsonSchema: async () => JsonLdIdMapSchema
|
|
1435
1490
|
}));
|
|
1436
1491
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.TypeMap}`, () => ({
|
|
1492
|
+
context: JsonLdContexts.ContextRoot,
|
|
1437
1493
|
type: JsonLdTypes.TypeMap,
|
|
1438
1494
|
jsonSchema: async () => JsonLdTypeMapSchema
|
|
1439
1495
|
}));
|
|
1440
1496
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.IncludedBlock}`, () => ({
|
|
1497
|
+
context: JsonLdContexts.ContextRoot,
|
|
1441
1498
|
type: JsonLdTypes.IncludedBlock,
|
|
1442
1499
|
jsonSchema: async () => JsonLdIncludedBlockSchema
|
|
1443
1500
|
}));
|
|
1444
1501
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContextDefinition}`, () => ({
|
|
1502
|
+
context: JsonLdContexts.ContextRoot,
|
|
1445
1503
|
type: JsonLdTypes.ContextDefinition,
|
|
1446
1504
|
jsonSchema: async () => JsonLdContextDefinitionSchema
|
|
1447
1505
|
}));
|
|
1506
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContextDefinitionElement}`, () => ({
|
|
1507
|
+
context: JsonLdContexts.ContextRoot,
|
|
1508
|
+
type: JsonLdTypes.ContextDefinitionElement,
|
|
1509
|
+
jsonSchema: async () => JsonLdContextDefinitionElementSchema
|
|
1510
|
+
}));
|
|
1511
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContextDefinitionRoot}`, () => ({
|
|
1512
|
+
context: JsonLdContexts.ContextRoot,
|
|
1513
|
+
type: JsonLdTypes.ContextDefinitionRoot,
|
|
1514
|
+
jsonSchema: async () => JsonLdContextDefinitionRootSchema
|
|
1515
|
+
}));
|
|
1448
1516
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ExpandedTermDefinition}`, () => ({
|
|
1517
|
+
context: JsonLdContexts.ContextRoot,
|
|
1449
1518
|
type: JsonLdTypes.ExpandedTermDefinition,
|
|
1450
1519
|
jsonSchema: async () => JsonLdExpandedTermDefinitionSchema
|
|
1451
1520
|
}));
|
|
1452
1521
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.Keyword}`, () => ({
|
|
1522
|
+
context: JsonLdContexts.ContextRoot,
|
|
1453
1523
|
type: JsonLdTypes.Keyword,
|
|
1454
1524
|
jsonSchema: async () => JsonLdKeywordSchema
|
|
1455
1525
|
}));
|
|
1456
1526
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ListOrSetItem}`, () => ({
|
|
1527
|
+
context: JsonLdContexts.ContextRoot,
|
|
1457
1528
|
type: JsonLdTypes.ListOrSetItem,
|
|
1458
1529
|
jsonSchema: async () => JsonLdListOrSetItemSchema
|
|
1459
1530
|
}));
|
|
1460
1531
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContainerType}`, () => ({
|
|
1532
|
+
context: JsonLdContexts.ContextRoot,
|
|
1461
1533
|
type: JsonLdTypes.ContainerType,
|
|
1462
1534
|
jsonSchema: async () => JsonLdContainerTypeSchema
|
|
1463
1535
|
}));
|
|
1464
1536
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContainerTypeArray}`, () => ({
|
|
1537
|
+
context: JsonLdContexts.ContextRoot,
|
|
1465
1538
|
type: JsonLdTypes.ContainerTypeArray,
|
|
1466
1539
|
jsonSchema: async () => JsonLdContainerTypeArraySchema
|
|
1467
1540
|
}));
|
|
1468
1541
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonPrimitive}`, () => ({
|
|
1542
|
+
context: JsonLdContexts.ContextRoot,
|
|
1469
1543
|
type: JsonLdTypes.JsonPrimitive,
|
|
1470
1544
|
jsonSchema: async () => JsonLdJsonPrimitiveSchema
|
|
1471
1545
|
}));
|
|
1472
1546
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonArray}`, () => ({
|
|
1547
|
+
context: JsonLdContexts.ContextRoot,
|
|
1473
1548
|
type: JsonLdTypes.JsonArray,
|
|
1474
1549
|
jsonSchema: async () => JsonLdJsonArraySchema
|
|
1475
1550
|
}));
|
|
1476
1551
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonObject}`, () => ({
|
|
1552
|
+
context: JsonLdContexts.ContextRoot,
|
|
1477
1553
|
type: JsonLdTypes.JsonObject,
|
|
1478
1554
|
jsonSchema: async () => JsonLdJsonObjectSchema
|
|
1479
1555
|
}));
|
|
1480
1556
|
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonValue}`, () => ({
|
|
1557
|
+
context: JsonLdContexts.ContextRoot,
|
|
1481
1558
|
type: JsonLdTypes.JsonValue,
|
|
1482
1559
|
jsonSchema: async () => JsonLdJsonValueSchema
|
|
1483
1560
|
}));
|
|
1484
1561
|
}
|
|
1485
1562
|
}
|
|
1486
1563
|
|
|
1487
|
-
// Copyright 2024 IOTA Stiftung.
|
|
1488
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
1489
|
-
/**
|
|
1490
|
-
* Class to help with JSON LD.
|
|
1491
|
-
*/
|
|
1492
|
-
class JsonLdHelper {
|
|
1493
|
-
/**
|
|
1494
|
-
* Validate a JSON-LD document.
|
|
1495
|
-
* @param document The JSON-LD document to validate.
|
|
1496
|
-
* @param validationFailures The list of validation failures to add to.
|
|
1497
|
-
* @param validationMode The validation mode to use, defaults to either.
|
|
1498
|
-
* @returns True if the document was valid.
|
|
1499
|
-
*/
|
|
1500
|
-
static async validate(document, validationFailures, validationMode) {
|
|
1501
|
-
if (core.Is.array(document)) {
|
|
1502
|
-
// If the document is an array of nodes, validate each node
|
|
1503
|
-
for (const node of document) {
|
|
1504
|
-
await JsonLdHelper.validate(node, validationFailures, validationMode);
|
|
1505
|
-
}
|
|
1506
|
-
}
|
|
1507
|
-
else if (core.Is.array(document["@graph"])) {
|
|
1508
|
-
// If the graph is an array of nodes, validate each node
|
|
1509
|
-
for (const node of document["@graph"]) {
|
|
1510
|
-
await JsonLdHelper.validate(node, validationFailures, validationMode);
|
|
1511
|
-
}
|
|
1512
|
-
}
|
|
1513
|
-
else if (core.Is.object(document)) {
|
|
1514
|
-
// If the graph is a single node, then use the validate the node schema
|
|
1515
|
-
const dataType = document["@type"];
|
|
1516
|
-
if (core.Is.stringValue(dataType)) {
|
|
1517
|
-
await dataCore.DataTypeHelper.validate("document", dataType, document, validationFailures, validationMode);
|
|
1518
|
-
}
|
|
1519
|
-
}
|
|
1520
|
-
return validationFailures.length === 0;
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
|
|
1524
1564
|
// Copyright 2024 IOTA Stiftung.
|
|
1525
1565
|
// SPDX-License-Identifier: Apache-2.0.
|
|
1526
1566
|
/**
|
|
@@ -1846,17 +1886,34 @@ class JsonLdProcessor {
|
|
|
1846
1886
|
break;
|
|
1847
1887
|
}
|
|
1848
1888
|
}
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1889
|
+
try {
|
|
1890
|
+
const response = await web.FetchHelper.fetchJson(JsonLdProcessor._CLASS_NAME, url, web.HttpMethod.GET, undefined, {
|
|
1891
|
+
cacheTtlMs: JsonLdProcessor.getCacheLimit(),
|
|
1892
|
+
headers: {
|
|
1893
|
+
[web.HeaderTypes.Accept]: web.MimeTypes.JsonLd
|
|
1894
|
+
}
|
|
1895
|
+
});
|
|
1896
|
+
return {
|
|
1897
|
+
documentUrl: url,
|
|
1898
|
+
document: response
|
|
1899
|
+
};
|
|
1900
|
+
}
|
|
1901
|
+
catch (err) {
|
|
1902
|
+
const error = core.BaseError.fromError(err);
|
|
1903
|
+
if (error.message.includes("is not valid JSON")) {
|
|
1904
|
+
const response = await web.FetchHelper.fetchJson(JsonLdProcessor._CLASS_NAME, url, web.HttpMethod.GET, undefined, {
|
|
1905
|
+
cacheTtlMs: JsonLdProcessor.getCacheLimit(),
|
|
1906
|
+
headers: {
|
|
1907
|
+
[web.HeaderTypes.Accept]: web.MimeTypes.Json
|
|
1908
|
+
}
|
|
1909
|
+
});
|
|
1910
|
+
return {
|
|
1911
|
+
documentUrl: url,
|
|
1912
|
+
document: response
|
|
1913
|
+
};
|
|
1854
1914
|
}
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
documentUrl: url,
|
|
1858
|
-
document: response
|
|
1859
|
-
};
|
|
1915
|
+
throw err;
|
|
1916
|
+
}
|
|
1860
1917
|
}
|
|
1861
1918
|
/**
|
|
1862
1919
|
* Handle common errors.
|
|
@@ -1875,6 +1932,45 @@ class JsonLdProcessor {
|
|
|
1875
1932
|
}
|
|
1876
1933
|
}
|
|
1877
1934
|
|
|
1935
|
+
// Copyright 2024 IOTA Stiftung.
|
|
1936
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
1937
|
+
/**
|
|
1938
|
+
* Class to help with JSON LD.
|
|
1939
|
+
*/
|
|
1940
|
+
class JsonLdHelper {
|
|
1941
|
+
/**
|
|
1942
|
+
* Validate a JSON-LD document.
|
|
1943
|
+
* @param document The JSON-LD document to validate.
|
|
1944
|
+
* @param validationFailures The list of validation failures to add to.
|
|
1945
|
+
* @param validationMode The validation mode to use, defaults to either.
|
|
1946
|
+
* @returns True if the document was valid.
|
|
1947
|
+
*/
|
|
1948
|
+
static async validate(document, validationFailures, validationMode) {
|
|
1949
|
+
if (core.Is.array(document)) {
|
|
1950
|
+
// If the document is an array of nodes, validate each node
|
|
1951
|
+
for (const node of document) {
|
|
1952
|
+
await JsonLdHelper.validate(node, validationFailures, validationMode);
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
else if (core.Is.array(document["@graph"])) {
|
|
1956
|
+
// If the graph is an array of nodes, validate each node
|
|
1957
|
+
for (const node of document["@graph"]) {
|
|
1958
|
+
await JsonLdHelper.validate(node, validationFailures, validationMode);
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
else if (core.Is.object(document)) {
|
|
1962
|
+
// Expand the document to ensure we have the full context for types
|
|
1963
|
+
// As the data types in the factories are not always fully qualified
|
|
1964
|
+
const expandedDoc = await JsonLdProcessor.expand(document);
|
|
1965
|
+
const expandedDataType = core.ArrayHelper.fromObjectOrArray(expandedDoc[0]["@type"]);
|
|
1966
|
+
if (core.Is.arrayValue(expandedDataType)) {
|
|
1967
|
+
await dataCore.DataTypeHelper.validate("document", expandedDataType[0], document, validationFailures, validationMode);
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
return validationFailures.length === 0;
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1878
1974
|
exports.JsonLdContexts = JsonLdContexts;
|
|
1879
1975
|
exports.JsonLdDataTypes = JsonLdDataTypes;
|
|
1880
1976
|
exports.JsonLdHelper = JsonLdHelper;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DataTypeHandlerFactory, DataTypeHelper } from '@twin.org/data-core';
|
|
2
|
-
import {
|
|
3
|
-
import { FetchHelper, HttpMethod,
|
|
2
|
+
import { SharedStore, Is, ObjectHelper, GeneralError, BaseError, ArrayHelper } from '@twin.org/core';
|
|
3
|
+
import { FetchHelper, HttpMethod, HeaderTypes, MimeTypes } from '@twin.org/web';
|
|
4
4
|
import jsonLd from 'jsonld';
|
|
5
5
|
|
|
6
6
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -83,6 +83,14 @@ const JsonLdTypes = {
|
|
|
83
83
|
* Represents JSON-LD Context Definition.
|
|
84
84
|
*/
|
|
85
85
|
ContextDefinition: "JsonLdContextDefinition",
|
|
86
|
+
/**
|
|
87
|
+
* Represents JSON-LD Context Definition Element.
|
|
88
|
+
*/
|
|
89
|
+
ContextDefinitionElement: "JsonLdContextDefinitionElement",
|
|
90
|
+
/**
|
|
91
|
+
* Represents JSON-LD Context Definition Root.
|
|
92
|
+
*/
|
|
93
|
+
ContextDefinitionRoot: "JsonLdContextDefinitionRoot",
|
|
86
94
|
/**
|
|
87
95
|
* Represents JSON-LD Expanded Term Definition.
|
|
88
96
|
*/
|
|
@@ -122,7 +130,7 @@ const JsonLdTypes = {
|
|
|
122
130
|
};
|
|
123
131
|
|
|
124
132
|
var type$e = "string";
|
|
125
|
-
var description$
|
|
133
|
+
var description$p = "Helper Types";
|
|
126
134
|
var JsonLdContainerTypeSchema = {
|
|
127
135
|
type: type$e,
|
|
128
136
|
"enum": [
|
|
@@ -132,10 +140,10 @@ var JsonLdContainerTypeSchema = {
|
|
|
132
140
|
"@graph",
|
|
133
141
|
"@type"
|
|
134
142
|
],
|
|
135
|
-
description: description$
|
|
143
|
+
description: description$p
|
|
136
144
|
};
|
|
137
145
|
|
|
138
|
-
var anyOf$
|
|
146
|
+
var anyOf$a = [
|
|
139
147
|
{
|
|
140
148
|
type: "array",
|
|
141
149
|
minItems: 2,
|
|
@@ -309,10 +317,10 @@ var anyOf$8 = [
|
|
|
309
317
|
maxItems: 2
|
|
310
318
|
}
|
|
311
319
|
];
|
|
312
|
-
var description$
|
|
320
|
+
var description$o = "Helper Types.";
|
|
313
321
|
var JsonLdContainerTypeArraySchema = {
|
|
314
|
-
anyOf: anyOf$
|
|
315
|
-
description: description$
|
|
322
|
+
anyOf: anyOf$a,
|
|
323
|
+
description: description$o
|
|
316
324
|
};
|
|
317
325
|
|
|
318
326
|
var type$d = "object";
|
|
@@ -386,11 +394,45 @@ var additionalProperties$b = {
|
|
|
386
394
|
}
|
|
387
395
|
]
|
|
388
396
|
};
|
|
389
|
-
var description$
|
|
397
|
+
var description$n = "A context definition defines a local context in a node object.";
|
|
390
398
|
var JsonLdContextDefinitionSchema = {
|
|
391
399
|
type: type$d,
|
|
392
400
|
properties: properties$6,
|
|
393
401
|
additionalProperties: additionalProperties$b,
|
|
402
|
+
description: description$n
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
var anyOf$9 = [
|
|
406
|
+
{
|
|
407
|
+
type: "null"
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
type: "string"
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinition"
|
|
414
|
+
}
|
|
415
|
+
];
|
|
416
|
+
var description$m = "A context definition element is used to define the types of a context definition.";
|
|
417
|
+
var JsonLdContextDefinitionElementSchema = {
|
|
418
|
+
anyOf: anyOf$9,
|
|
419
|
+
description: description$m
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
var anyOf$8 = [
|
|
423
|
+
{
|
|
424
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
type: "array",
|
|
428
|
+
items: {
|
|
429
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
];
|
|
433
|
+
var description$l = "A context definition root is used to define the root of a context definition.";
|
|
434
|
+
var JsonLdContextDefinitionRootSchema = {
|
|
435
|
+
anyOf: anyOf$8,
|
|
394
436
|
description: description$l
|
|
395
437
|
};
|
|
396
438
|
|
|
@@ -1380,145 +1422,143 @@ class JsonLdDataTypes {
|
|
|
1380
1422
|
*/
|
|
1381
1423
|
static registerTypes() {
|
|
1382
1424
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.Document}`, () => ({
|
|
1425
|
+
context: JsonLdContexts.ContextRoot,
|
|
1383
1426
|
type: JsonLdTypes.Document,
|
|
1384
1427
|
jsonSchema: async () => JsonLdDocumentSchema
|
|
1385
1428
|
}));
|
|
1386
1429
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.Object}`, () => ({
|
|
1430
|
+
context: JsonLdContexts.ContextRoot,
|
|
1387
1431
|
type: JsonLdTypes.Object,
|
|
1388
1432
|
jsonSchema: async () => JsonLdObjectSchema
|
|
1389
1433
|
}));
|
|
1390
1434
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.NodeObject}`, () => ({
|
|
1435
|
+
context: JsonLdContexts.ContextRoot,
|
|
1391
1436
|
type: JsonLdTypes.NodeObject,
|
|
1392
1437
|
jsonSchema: async () => JsonLdNodeObjectSchema
|
|
1393
1438
|
}));
|
|
1394
1439
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.NodePrimitive}`, () => ({
|
|
1440
|
+
context: JsonLdContexts.ContextRoot,
|
|
1395
1441
|
type: JsonLdTypes.NodePrimitive,
|
|
1396
1442
|
jsonSchema: async () => JsonLdNodePrimitiveSchema
|
|
1397
1443
|
}));
|
|
1398
1444
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.GraphObject}`, () => ({
|
|
1445
|
+
context: JsonLdContexts.ContextRoot,
|
|
1399
1446
|
type: JsonLdTypes.GraphObject,
|
|
1400
1447
|
jsonSchema: async () => JsonLdGraphObjectSchema
|
|
1401
1448
|
}));
|
|
1402
1449
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ValueObject}`, () => ({
|
|
1450
|
+
context: JsonLdContexts.ContextRoot,
|
|
1403
1451
|
type: JsonLdTypes.ValueObject,
|
|
1404
1452
|
jsonSchema: async () => JsonLdValueObjectSchema
|
|
1405
1453
|
}));
|
|
1406
1454
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ListObject}`, () => ({
|
|
1455
|
+
context: JsonLdContexts.ContextRoot,
|
|
1407
1456
|
type: JsonLdTypes.ListObject,
|
|
1408
1457
|
jsonSchema: async () => JsonLdListObjectSchema
|
|
1409
1458
|
}));
|
|
1410
1459
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ListObject}`, () => ({
|
|
1460
|
+
context: JsonLdContexts.ContextRoot,
|
|
1411
1461
|
type: JsonLdTypes.ListObject,
|
|
1412
1462
|
jsonSchema: async () => JsonLdListObjectSchema
|
|
1413
1463
|
}));
|
|
1414
1464
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.SetObject}`, () => ({
|
|
1465
|
+
context: JsonLdContexts.ContextRoot,
|
|
1415
1466
|
type: JsonLdTypes.SetObject,
|
|
1416
1467
|
jsonSchema: async () => JsonLdSetObjectSchema
|
|
1417
1468
|
}));
|
|
1418
1469
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.LanguageMap}`, () => ({
|
|
1470
|
+
context: JsonLdContexts.ContextRoot,
|
|
1419
1471
|
type: JsonLdTypes.LanguageMap,
|
|
1420
1472
|
jsonSchema: async () => JsonLdLanguageMapSchema
|
|
1421
1473
|
}));
|
|
1422
1474
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.IndexMap}`, () => ({
|
|
1475
|
+
context: JsonLdContexts.ContextRoot,
|
|
1423
1476
|
type: JsonLdTypes.IndexMap,
|
|
1424
1477
|
jsonSchema: async () => JsonLdIndexMapSchema
|
|
1425
1478
|
}));
|
|
1426
1479
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.IndexMapItem}`, () => ({
|
|
1480
|
+
context: JsonLdContexts.ContextRoot,
|
|
1427
1481
|
type: JsonLdTypes.IndexMapItem,
|
|
1428
1482
|
jsonSchema: async () => JsonLdIndexMapItemSchema
|
|
1429
1483
|
}));
|
|
1430
1484
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.IdMap}`, () => ({
|
|
1485
|
+
context: JsonLdContexts.ContextRoot,
|
|
1431
1486
|
type: JsonLdTypes.IdMap,
|
|
1432
1487
|
jsonSchema: async () => JsonLdIdMapSchema
|
|
1433
1488
|
}));
|
|
1434
1489
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.TypeMap}`, () => ({
|
|
1490
|
+
context: JsonLdContexts.ContextRoot,
|
|
1435
1491
|
type: JsonLdTypes.TypeMap,
|
|
1436
1492
|
jsonSchema: async () => JsonLdTypeMapSchema
|
|
1437
1493
|
}));
|
|
1438
1494
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.IncludedBlock}`, () => ({
|
|
1495
|
+
context: JsonLdContexts.ContextRoot,
|
|
1439
1496
|
type: JsonLdTypes.IncludedBlock,
|
|
1440
1497
|
jsonSchema: async () => JsonLdIncludedBlockSchema
|
|
1441
1498
|
}));
|
|
1442
1499
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContextDefinition}`, () => ({
|
|
1500
|
+
context: JsonLdContexts.ContextRoot,
|
|
1443
1501
|
type: JsonLdTypes.ContextDefinition,
|
|
1444
1502
|
jsonSchema: async () => JsonLdContextDefinitionSchema
|
|
1445
1503
|
}));
|
|
1504
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContextDefinitionElement}`, () => ({
|
|
1505
|
+
context: JsonLdContexts.ContextRoot,
|
|
1506
|
+
type: JsonLdTypes.ContextDefinitionElement,
|
|
1507
|
+
jsonSchema: async () => JsonLdContextDefinitionElementSchema
|
|
1508
|
+
}));
|
|
1509
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContextDefinitionRoot}`, () => ({
|
|
1510
|
+
context: JsonLdContexts.ContextRoot,
|
|
1511
|
+
type: JsonLdTypes.ContextDefinitionRoot,
|
|
1512
|
+
jsonSchema: async () => JsonLdContextDefinitionRootSchema
|
|
1513
|
+
}));
|
|
1446
1514
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ExpandedTermDefinition}`, () => ({
|
|
1515
|
+
context: JsonLdContexts.ContextRoot,
|
|
1447
1516
|
type: JsonLdTypes.ExpandedTermDefinition,
|
|
1448
1517
|
jsonSchema: async () => JsonLdExpandedTermDefinitionSchema
|
|
1449
1518
|
}));
|
|
1450
1519
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.Keyword}`, () => ({
|
|
1520
|
+
context: JsonLdContexts.ContextRoot,
|
|
1451
1521
|
type: JsonLdTypes.Keyword,
|
|
1452
1522
|
jsonSchema: async () => JsonLdKeywordSchema
|
|
1453
1523
|
}));
|
|
1454
1524
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ListOrSetItem}`, () => ({
|
|
1525
|
+
context: JsonLdContexts.ContextRoot,
|
|
1455
1526
|
type: JsonLdTypes.ListOrSetItem,
|
|
1456
1527
|
jsonSchema: async () => JsonLdListOrSetItemSchema
|
|
1457
1528
|
}));
|
|
1458
1529
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContainerType}`, () => ({
|
|
1530
|
+
context: JsonLdContexts.ContextRoot,
|
|
1459
1531
|
type: JsonLdTypes.ContainerType,
|
|
1460
1532
|
jsonSchema: async () => JsonLdContainerTypeSchema
|
|
1461
1533
|
}));
|
|
1462
1534
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContainerTypeArray}`, () => ({
|
|
1535
|
+
context: JsonLdContexts.ContextRoot,
|
|
1463
1536
|
type: JsonLdTypes.ContainerTypeArray,
|
|
1464
1537
|
jsonSchema: async () => JsonLdContainerTypeArraySchema
|
|
1465
1538
|
}));
|
|
1466
1539
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonPrimitive}`, () => ({
|
|
1540
|
+
context: JsonLdContexts.ContextRoot,
|
|
1467
1541
|
type: JsonLdTypes.JsonPrimitive,
|
|
1468
1542
|
jsonSchema: async () => JsonLdJsonPrimitiveSchema
|
|
1469
1543
|
}));
|
|
1470
1544
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonArray}`, () => ({
|
|
1545
|
+
context: JsonLdContexts.ContextRoot,
|
|
1471
1546
|
type: JsonLdTypes.JsonArray,
|
|
1472
1547
|
jsonSchema: async () => JsonLdJsonArraySchema
|
|
1473
1548
|
}));
|
|
1474
1549
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonObject}`, () => ({
|
|
1550
|
+
context: JsonLdContexts.ContextRoot,
|
|
1475
1551
|
type: JsonLdTypes.JsonObject,
|
|
1476
1552
|
jsonSchema: async () => JsonLdJsonObjectSchema
|
|
1477
1553
|
}));
|
|
1478
1554
|
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonValue}`, () => ({
|
|
1555
|
+
context: JsonLdContexts.ContextRoot,
|
|
1479
1556
|
type: JsonLdTypes.JsonValue,
|
|
1480
1557
|
jsonSchema: async () => JsonLdJsonValueSchema
|
|
1481
1558
|
}));
|
|
1482
1559
|
}
|
|
1483
1560
|
}
|
|
1484
1561
|
|
|
1485
|
-
// Copyright 2024 IOTA Stiftung.
|
|
1486
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
1487
|
-
/**
|
|
1488
|
-
* Class to help with JSON LD.
|
|
1489
|
-
*/
|
|
1490
|
-
class JsonLdHelper {
|
|
1491
|
-
/**
|
|
1492
|
-
* Validate a JSON-LD document.
|
|
1493
|
-
* @param document The JSON-LD document to validate.
|
|
1494
|
-
* @param validationFailures The list of validation failures to add to.
|
|
1495
|
-
* @param validationMode The validation mode to use, defaults to either.
|
|
1496
|
-
* @returns True if the document was valid.
|
|
1497
|
-
*/
|
|
1498
|
-
static async validate(document, validationFailures, validationMode) {
|
|
1499
|
-
if (Is.array(document)) {
|
|
1500
|
-
// If the document is an array of nodes, validate each node
|
|
1501
|
-
for (const node of document) {
|
|
1502
|
-
await JsonLdHelper.validate(node, validationFailures, validationMode);
|
|
1503
|
-
}
|
|
1504
|
-
}
|
|
1505
|
-
else if (Is.array(document["@graph"])) {
|
|
1506
|
-
// If the graph is an array of nodes, validate each node
|
|
1507
|
-
for (const node of document["@graph"]) {
|
|
1508
|
-
await JsonLdHelper.validate(node, validationFailures, validationMode);
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1511
|
-
else if (Is.object(document)) {
|
|
1512
|
-
// If the graph is a single node, then use the validate the node schema
|
|
1513
|
-
const dataType = document["@type"];
|
|
1514
|
-
if (Is.stringValue(dataType)) {
|
|
1515
|
-
await DataTypeHelper.validate("document", dataType, document, validationFailures, validationMode);
|
|
1516
|
-
}
|
|
1517
|
-
}
|
|
1518
|
-
return validationFailures.length === 0;
|
|
1519
|
-
}
|
|
1520
|
-
}
|
|
1521
|
-
|
|
1522
1562
|
// Copyright 2024 IOTA Stiftung.
|
|
1523
1563
|
// SPDX-License-Identifier: Apache-2.0.
|
|
1524
1564
|
/**
|
|
@@ -1844,17 +1884,34 @@ class JsonLdProcessor {
|
|
|
1844
1884
|
break;
|
|
1845
1885
|
}
|
|
1846
1886
|
}
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1887
|
+
try {
|
|
1888
|
+
const response = await FetchHelper.fetchJson(JsonLdProcessor._CLASS_NAME, url, HttpMethod.GET, undefined, {
|
|
1889
|
+
cacheTtlMs: JsonLdProcessor.getCacheLimit(),
|
|
1890
|
+
headers: {
|
|
1891
|
+
[HeaderTypes.Accept]: MimeTypes.JsonLd
|
|
1892
|
+
}
|
|
1893
|
+
});
|
|
1894
|
+
return {
|
|
1895
|
+
documentUrl: url,
|
|
1896
|
+
document: response
|
|
1897
|
+
};
|
|
1898
|
+
}
|
|
1899
|
+
catch (err) {
|
|
1900
|
+
const error = BaseError.fromError(err);
|
|
1901
|
+
if (error.message.includes("is not valid JSON")) {
|
|
1902
|
+
const response = await FetchHelper.fetchJson(JsonLdProcessor._CLASS_NAME, url, HttpMethod.GET, undefined, {
|
|
1903
|
+
cacheTtlMs: JsonLdProcessor.getCacheLimit(),
|
|
1904
|
+
headers: {
|
|
1905
|
+
[HeaderTypes.Accept]: MimeTypes.Json
|
|
1906
|
+
}
|
|
1907
|
+
});
|
|
1908
|
+
return {
|
|
1909
|
+
documentUrl: url,
|
|
1910
|
+
document: response
|
|
1911
|
+
};
|
|
1852
1912
|
}
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
documentUrl: url,
|
|
1856
|
-
document: response
|
|
1857
|
-
};
|
|
1913
|
+
throw err;
|
|
1914
|
+
}
|
|
1858
1915
|
}
|
|
1859
1916
|
/**
|
|
1860
1917
|
* Handle common errors.
|
|
@@ -1873,4 +1930,43 @@ class JsonLdProcessor {
|
|
|
1873
1930
|
}
|
|
1874
1931
|
}
|
|
1875
1932
|
|
|
1933
|
+
// Copyright 2024 IOTA Stiftung.
|
|
1934
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
1935
|
+
/**
|
|
1936
|
+
* Class to help with JSON LD.
|
|
1937
|
+
*/
|
|
1938
|
+
class JsonLdHelper {
|
|
1939
|
+
/**
|
|
1940
|
+
* Validate a JSON-LD document.
|
|
1941
|
+
* @param document The JSON-LD document to validate.
|
|
1942
|
+
* @param validationFailures The list of validation failures to add to.
|
|
1943
|
+
* @param validationMode The validation mode to use, defaults to either.
|
|
1944
|
+
* @returns True if the document was valid.
|
|
1945
|
+
*/
|
|
1946
|
+
static async validate(document, validationFailures, validationMode) {
|
|
1947
|
+
if (Is.array(document)) {
|
|
1948
|
+
// If the document is an array of nodes, validate each node
|
|
1949
|
+
for (const node of document) {
|
|
1950
|
+
await JsonLdHelper.validate(node, validationFailures, validationMode);
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
else if (Is.array(document["@graph"])) {
|
|
1954
|
+
// If the graph is an array of nodes, validate each node
|
|
1955
|
+
for (const node of document["@graph"]) {
|
|
1956
|
+
await JsonLdHelper.validate(node, validationFailures, validationMode);
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
else if (Is.object(document)) {
|
|
1960
|
+
// Expand the document to ensure we have the full context for types
|
|
1961
|
+
// As the data types in the factories are not always fully qualified
|
|
1962
|
+
const expandedDoc = await JsonLdProcessor.expand(document);
|
|
1963
|
+
const expandedDataType = ArrayHelper.fromObjectOrArray(expandedDoc[0]["@type"]);
|
|
1964
|
+
if (Is.arrayValue(expandedDataType)) {
|
|
1965
|
+
await DataTypeHelper.validate("document", expandedDataType[0], document, validationFailures, validationMode);
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
return validationFailures.length === 0;
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1876
1972
|
export { JsonLdContexts, JsonLdDataTypes, JsonLdHelper, JsonLdProcessor, JsonLdTypes };
|
|
@@ -62,6 +62,14 @@ export declare const JsonLdTypes: {
|
|
|
62
62
|
* Represents JSON-LD Context Definition.
|
|
63
63
|
*/
|
|
64
64
|
readonly ContextDefinition: "JsonLdContextDefinition";
|
|
65
|
+
/**
|
|
66
|
+
* Represents JSON-LD Context Definition Element.
|
|
67
|
+
*/
|
|
68
|
+
readonly ContextDefinitionElement: "JsonLdContextDefinitionElement";
|
|
69
|
+
/**
|
|
70
|
+
* Represents JSON-LD Context Definition Root.
|
|
71
|
+
*/
|
|
72
|
+
readonly ContextDefinitionRoot: "JsonLdContextDefinitionRoot";
|
|
65
73
|
/**
|
|
66
74
|
* Represents JSON-LD Expanded Term Definition.
|
|
67
75
|
*/
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @twin.org/data-json-ld - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.1-next.32](https://github.com/twinfoundation/data/compare/data-json-ld-v0.0.1-next.31...data-json-ld-v0.0.1-next.32) (2025-05-28)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* use fully qualified names for data type lookups ([b7b5c74](https://github.com/twinfoundation/data/commit/b7b5c746b0180a87baa976f6a7a76cedd53d8ff7))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/data-core bumped from 0.0.1-next.31 to 0.0.1-next.32
|
|
16
|
+
|
|
3
17
|
## [0.0.1-next.31](https://github.com/twinfoundation/data/compare/data-json-ld-v0.0.1-next.30...data-json-ld-v0.0.1-next.31) (2025-05-08)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -96,6 +96,18 @@ Represents JSON-LD Included block.
|
|
|
96
96
|
|
|
97
97
|
Represents JSON-LD Context Definition.
|
|
98
98
|
|
|
99
|
+
### ContextDefinitionElement
|
|
100
|
+
|
|
101
|
+
> `readonly` **ContextDefinitionElement**: `"JsonLdContextDefinitionElement"` = `"JsonLdContextDefinitionElement"`
|
|
102
|
+
|
|
103
|
+
Represents JSON-LD Context Definition Element.
|
|
104
|
+
|
|
105
|
+
### ContextDefinitionRoot
|
|
106
|
+
|
|
107
|
+
> `readonly` **ContextDefinitionRoot**: `"JsonLdContextDefinitionRoot"` = `"JsonLdContextDefinitionRoot"`
|
|
108
|
+
|
|
109
|
+
Represents JSON-LD Context Definition Root.
|
|
110
|
+
|
|
99
111
|
### ExpandedTermDefinition
|
|
100
112
|
|
|
101
113
|
> `readonly` **ExpandedTermDefinition**: `"JsonLdExpandedTermDefinition"` = `"JsonLdExpandedTermDefinition"`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/data-json-ld",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.32",
|
|
4
4
|
"description": "Models which define the structure of JSON LD",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@twin.org/core": "next",
|
|
18
|
-
"@twin.org/data-core": "0.0.1-next.
|
|
18
|
+
"@twin.org/data-core": "0.0.1-next.32",
|
|
19
19
|
"@twin.org/entity": "next",
|
|
20
20
|
"@twin.org/nameof": "next",
|
|
21
21
|
"@twin.org/web": "next",
|