@twin.org/data-json-ld 0.0.1-next.25 → 0.0.1-next.27
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 +38 -28
- package/dist/esm/index.mjs +39 -30
- package/dist/types/index.d.ts +1 -0
- package/dist/types/models/jsonLdContexts.d.ts +13 -0
- package/dist/types/models/jsonLdTypes.d.ts +0 -4
- package/docs/changelog.md +1 -1
- package/docs/reference/classes/JsonLdProcessor.md +1 -1
- package/docs/reference/index.md +2 -0
- package/docs/reference/type-aliases/JsonLdContexts.md +5 -0
- package/docs/reference/variables/JsonLdContexts.md +13 -0
- package/docs/reference/variables/JsonLdTypes.md +0 -6
- package/locales/en.json +1 -1
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -8,14 +8,23 @@ var jsonLd = require('jsonld');
|
|
|
8
8
|
// Copyright 2024 IOTA Stiftung.
|
|
9
9
|
// SPDX-License-Identifier: Apache-2.0.
|
|
10
10
|
/**
|
|
11
|
-
* The
|
|
11
|
+
* The contexts of JSON-LD data.
|
|
12
12
|
*/
|
|
13
13
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
14
|
-
const
|
|
14
|
+
const JsonLdContexts = {
|
|
15
15
|
/**
|
|
16
16
|
* Context Root.
|
|
17
17
|
*/
|
|
18
|
-
ContextRoot: "https://schema.twindev.org/json-ld/"
|
|
18
|
+
ContextRoot: "https://schema.twindev.org/json-ld/"
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// Copyright 2024 IOTA Stiftung.
|
|
22
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
23
|
+
/**
|
|
24
|
+
* The types of JSON-LD data.
|
|
25
|
+
*/
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
27
|
+
const JsonLdTypes = {
|
|
19
28
|
/**
|
|
20
29
|
* Represents JSON-LD Document.
|
|
21
30
|
*/
|
|
@@ -1372,103 +1381,103 @@ class JsonLdDataTypes {
|
|
|
1372
1381
|
* Register all the data types.
|
|
1373
1382
|
*/
|
|
1374
1383
|
static registerTypes() {
|
|
1375
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1384
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.Document}`, () => ({
|
|
1376
1385
|
type: JsonLdTypes.Document,
|
|
1377
1386
|
jsonSchema: async () => JsonLdDocumentSchema
|
|
1378
1387
|
}));
|
|
1379
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1388
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.Object}`, () => ({
|
|
1380
1389
|
type: JsonLdTypes.Object,
|
|
1381
1390
|
jsonSchema: async () => JsonLdObjectSchema
|
|
1382
1391
|
}));
|
|
1383
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1392
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.NodeObject}`, () => ({
|
|
1384
1393
|
type: JsonLdTypes.NodeObject,
|
|
1385
1394
|
jsonSchema: async () => JsonLdNodeObjectSchema
|
|
1386
1395
|
}));
|
|
1387
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1396
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.NodePrimitive}`, () => ({
|
|
1388
1397
|
type: JsonLdTypes.NodePrimitive,
|
|
1389
1398
|
jsonSchema: async () => JsonLdNodePrimitiveSchema
|
|
1390
1399
|
}));
|
|
1391
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1400
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.GraphObject}`, () => ({
|
|
1392
1401
|
type: JsonLdTypes.GraphObject,
|
|
1393
1402
|
jsonSchema: async () => JsonLdGraphObjectSchema
|
|
1394
1403
|
}));
|
|
1395
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1404
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ValueObject}`, () => ({
|
|
1396
1405
|
type: JsonLdTypes.ValueObject,
|
|
1397
1406
|
jsonSchema: async () => JsonLdValueObjectSchema
|
|
1398
1407
|
}));
|
|
1399
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1408
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ListObject}`, () => ({
|
|
1400
1409
|
type: JsonLdTypes.ListObject,
|
|
1401
1410
|
jsonSchema: async () => JsonLdListObjectSchema
|
|
1402
1411
|
}));
|
|
1403
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1412
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ListObject}`, () => ({
|
|
1404
1413
|
type: JsonLdTypes.ListObject,
|
|
1405
1414
|
jsonSchema: async () => JsonLdListObjectSchema
|
|
1406
1415
|
}));
|
|
1407
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1416
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.SetObject}`, () => ({
|
|
1408
1417
|
type: JsonLdTypes.SetObject,
|
|
1409
1418
|
jsonSchema: async () => JsonLdSetObjectSchema
|
|
1410
1419
|
}));
|
|
1411
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1420
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.LanguageMap}`, () => ({
|
|
1412
1421
|
type: JsonLdTypes.LanguageMap,
|
|
1413
1422
|
jsonSchema: async () => JsonLdLanguageMapSchema
|
|
1414
1423
|
}));
|
|
1415
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1424
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.IndexMap}`, () => ({
|
|
1416
1425
|
type: JsonLdTypes.IndexMap,
|
|
1417
1426
|
jsonSchema: async () => JsonLdIndexMapSchema
|
|
1418
1427
|
}));
|
|
1419
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1428
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.IndexMapItem}`, () => ({
|
|
1420
1429
|
type: JsonLdTypes.IndexMapItem,
|
|
1421
1430
|
jsonSchema: async () => JsonLdIndexMapItemSchema
|
|
1422
1431
|
}));
|
|
1423
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1432
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.IdMap}`, () => ({
|
|
1424
1433
|
type: JsonLdTypes.IdMap,
|
|
1425
1434
|
jsonSchema: async () => JsonLdIdMapSchema
|
|
1426
1435
|
}));
|
|
1427
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1436
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.TypeMap}`, () => ({
|
|
1428
1437
|
type: JsonLdTypes.TypeMap,
|
|
1429
1438
|
jsonSchema: async () => JsonLdTypeMapSchema
|
|
1430
1439
|
}));
|
|
1431
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1440
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.IncludedBlock}`, () => ({
|
|
1432
1441
|
type: JsonLdTypes.IncludedBlock,
|
|
1433
1442
|
jsonSchema: async () => JsonLdIncludedBlockSchema
|
|
1434
1443
|
}));
|
|
1435
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1444
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContextDefinition}`, () => ({
|
|
1436
1445
|
type: JsonLdTypes.ContextDefinition,
|
|
1437
1446
|
jsonSchema: async () => JsonLdContextDefinitionSchema
|
|
1438
1447
|
}));
|
|
1439
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1448
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ExpandedTermDefinition}`, () => ({
|
|
1440
1449
|
type: JsonLdTypes.ExpandedTermDefinition,
|
|
1441
1450
|
jsonSchema: async () => JsonLdExpandedTermDefinitionSchema
|
|
1442
1451
|
}));
|
|
1443
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1452
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.Keyword}`, () => ({
|
|
1444
1453
|
type: JsonLdTypes.Keyword,
|
|
1445
1454
|
jsonSchema: async () => JsonLdKeywordSchema
|
|
1446
1455
|
}));
|
|
1447
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1456
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ListOrSetItem}`, () => ({
|
|
1448
1457
|
type: JsonLdTypes.ListOrSetItem,
|
|
1449
1458
|
jsonSchema: async () => JsonLdListOrSetItemSchema
|
|
1450
1459
|
}));
|
|
1451
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1460
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContainerType}`, () => ({
|
|
1452
1461
|
type: JsonLdTypes.ContainerType,
|
|
1453
1462
|
jsonSchema: async () => JsonLdContainerTypeSchema
|
|
1454
1463
|
}));
|
|
1455
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1464
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContainerTypeArray}`, () => ({
|
|
1456
1465
|
type: JsonLdTypes.ContainerTypeArray,
|
|
1457
1466
|
jsonSchema: async () => JsonLdContainerTypeArraySchema
|
|
1458
1467
|
}));
|
|
1459
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1468
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonPrimitive}`, () => ({
|
|
1460
1469
|
type: JsonLdTypes.JsonPrimitive,
|
|
1461
1470
|
jsonSchema: async () => JsonLdJsonPrimitiveSchema
|
|
1462
1471
|
}));
|
|
1463
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1472
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonArray}`, () => ({
|
|
1464
1473
|
type: JsonLdTypes.JsonArray,
|
|
1465
1474
|
jsonSchema: async () => JsonLdJsonArraySchema
|
|
1466
1475
|
}));
|
|
1467
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1476
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonObject}`, () => ({
|
|
1468
1477
|
type: JsonLdTypes.JsonObject,
|
|
1469
1478
|
jsonSchema: async () => JsonLdJsonObjectSchema
|
|
1470
1479
|
}));
|
|
1471
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
1480
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonValue}`, () => ({
|
|
1472
1481
|
type: JsonLdTypes.JsonValue,
|
|
1473
1482
|
jsonSchema: async () => JsonLdJsonValueSchema
|
|
1474
1483
|
}));
|
|
@@ -1782,6 +1791,7 @@ class JsonLdProcessor {
|
|
|
1782
1791
|
}
|
|
1783
1792
|
}
|
|
1784
1793
|
|
|
1794
|
+
exports.JsonLdContexts = JsonLdContexts;
|
|
1785
1795
|
exports.JsonLdDataTypes = JsonLdDataTypes;
|
|
1786
1796
|
exports.JsonLdHelper = JsonLdHelper;
|
|
1787
1797
|
exports.JsonLdProcessor = JsonLdProcessor;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
import { DataTypeHandlerFactory, DataTypeHelper } from '@twin.org/data-core';
|
|
2
2
|
import { Is, ObjectHelper, GeneralError } from '@twin.org/core';
|
|
3
|
-
import { FetchHelper, HttpMethod,
|
|
3
|
+
import { FetchHelper, HttpMethod, MimeTypes, HeaderTypes } from '@twin.org/web';
|
|
4
4
|
import jsonLd from 'jsonld';
|
|
5
5
|
|
|
6
6
|
// Copyright 2024 IOTA Stiftung.
|
|
7
7
|
// SPDX-License-Identifier: Apache-2.0.
|
|
8
8
|
/**
|
|
9
|
-
* The
|
|
9
|
+
* The contexts of JSON-LD data.
|
|
10
10
|
*/
|
|
11
11
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
12
|
-
const
|
|
12
|
+
const JsonLdContexts = {
|
|
13
13
|
/**
|
|
14
14
|
* Context Root.
|
|
15
15
|
*/
|
|
16
|
-
ContextRoot: "https://schema.twindev.org/json-ld/"
|
|
16
|
+
ContextRoot: "https://schema.twindev.org/json-ld/"
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// Copyright 2024 IOTA Stiftung.
|
|
20
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
21
|
+
/**
|
|
22
|
+
* The types of JSON-LD data.
|
|
23
|
+
*/
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
25
|
+
const JsonLdTypes = {
|
|
17
26
|
/**
|
|
18
27
|
* Represents JSON-LD Document.
|
|
19
28
|
*/
|
|
@@ -1370,103 +1379,103 @@ class JsonLdDataTypes {
|
|
|
1370
1379
|
* Register all the data types.
|
|
1371
1380
|
*/
|
|
1372
1381
|
static registerTypes() {
|
|
1373
|
-
DataTypeHandlerFactory.register(`${
|
|
1382
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.Document}`, () => ({
|
|
1374
1383
|
type: JsonLdTypes.Document,
|
|
1375
1384
|
jsonSchema: async () => JsonLdDocumentSchema
|
|
1376
1385
|
}));
|
|
1377
|
-
DataTypeHandlerFactory.register(`${
|
|
1386
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.Object}`, () => ({
|
|
1378
1387
|
type: JsonLdTypes.Object,
|
|
1379
1388
|
jsonSchema: async () => JsonLdObjectSchema
|
|
1380
1389
|
}));
|
|
1381
|
-
DataTypeHandlerFactory.register(`${
|
|
1390
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.NodeObject}`, () => ({
|
|
1382
1391
|
type: JsonLdTypes.NodeObject,
|
|
1383
1392
|
jsonSchema: async () => JsonLdNodeObjectSchema
|
|
1384
1393
|
}));
|
|
1385
|
-
DataTypeHandlerFactory.register(`${
|
|
1394
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.NodePrimitive}`, () => ({
|
|
1386
1395
|
type: JsonLdTypes.NodePrimitive,
|
|
1387
1396
|
jsonSchema: async () => JsonLdNodePrimitiveSchema
|
|
1388
1397
|
}));
|
|
1389
|
-
DataTypeHandlerFactory.register(`${
|
|
1398
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.GraphObject}`, () => ({
|
|
1390
1399
|
type: JsonLdTypes.GraphObject,
|
|
1391
1400
|
jsonSchema: async () => JsonLdGraphObjectSchema
|
|
1392
1401
|
}));
|
|
1393
|
-
DataTypeHandlerFactory.register(`${
|
|
1402
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ValueObject}`, () => ({
|
|
1394
1403
|
type: JsonLdTypes.ValueObject,
|
|
1395
1404
|
jsonSchema: async () => JsonLdValueObjectSchema
|
|
1396
1405
|
}));
|
|
1397
|
-
DataTypeHandlerFactory.register(`${
|
|
1406
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ListObject}`, () => ({
|
|
1398
1407
|
type: JsonLdTypes.ListObject,
|
|
1399
1408
|
jsonSchema: async () => JsonLdListObjectSchema
|
|
1400
1409
|
}));
|
|
1401
|
-
DataTypeHandlerFactory.register(`${
|
|
1410
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ListObject}`, () => ({
|
|
1402
1411
|
type: JsonLdTypes.ListObject,
|
|
1403
1412
|
jsonSchema: async () => JsonLdListObjectSchema
|
|
1404
1413
|
}));
|
|
1405
|
-
DataTypeHandlerFactory.register(`${
|
|
1414
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.SetObject}`, () => ({
|
|
1406
1415
|
type: JsonLdTypes.SetObject,
|
|
1407
1416
|
jsonSchema: async () => JsonLdSetObjectSchema
|
|
1408
1417
|
}));
|
|
1409
|
-
DataTypeHandlerFactory.register(`${
|
|
1418
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.LanguageMap}`, () => ({
|
|
1410
1419
|
type: JsonLdTypes.LanguageMap,
|
|
1411
1420
|
jsonSchema: async () => JsonLdLanguageMapSchema
|
|
1412
1421
|
}));
|
|
1413
|
-
DataTypeHandlerFactory.register(`${
|
|
1422
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.IndexMap}`, () => ({
|
|
1414
1423
|
type: JsonLdTypes.IndexMap,
|
|
1415
1424
|
jsonSchema: async () => JsonLdIndexMapSchema
|
|
1416
1425
|
}));
|
|
1417
|
-
DataTypeHandlerFactory.register(`${
|
|
1426
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.IndexMapItem}`, () => ({
|
|
1418
1427
|
type: JsonLdTypes.IndexMapItem,
|
|
1419
1428
|
jsonSchema: async () => JsonLdIndexMapItemSchema
|
|
1420
1429
|
}));
|
|
1421
|
-
DataTypeHandlerFactory.register(`${
|
|
1430
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.IdMap}`, () => ({
|
|
1422
1431
|
type: JsonLdTypes.IdMap,
|
|
1423
1432
|
jsonSchema: async () => JsonLdIdMapSchema
|
|
1424
1433
|
}));
|
|
1425
|
-
DataTypeHandlerFactory.register(`${
|
|
1434
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.TypeMap}`, () => ({
|
|
1426
1435
|
type: JsonLdTypes.TypeMap,
|
|
1427
1436
|
jsonSchema: async () => JsonLdTypeMapSchema
|
|
1428
1437
|
}));
|
|
1429
|
-
DataTypeHandlerFactory.register(`${
|
|
1438
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.IncludedBlock}`, () => ({
|
|
1430
1439
|
type: JsonLdTypes.IncludedBlock,
|
|
1431
1440
|
jsonSchema: async () => JsonLdIncludedBlockSchema
|
|
1432
1441
|
}));
|
|
1433
|
-
DataTypeHandlerFactory.register(`${
|
|
1442
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContextDefinition}`, () => ({
|
|
1434
1443
|
type: JsonLdTypes.ContextDefinition,
|
|
1435
1444
|
jsonSchema: async () => JsonLdContextDefinitionSchema
|
|
1436
1445
|
}));
|
|
1437
|
-
DataTypeHandlerFactory.register(`${
|
|
1446
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ExpandedTermDefinition}`, () => ({
|
|
1438
1447
|
type: JsonLdTypes.ExpandedTermDefinition,
|
|
1439
1448
|
jsonSchema: async () => JsonLdExpandedTermDefinitionSchema
|
|
1440
1449
|
}));
|
|
1441
|
-
DataTypeHandlerFactory.register(`${
|
|
1450
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.Keyword}`, () => ({
|
|
1442
1451
|
type: JsonLdTypes.Keyword,
|
|
1443
1452
|
jsonSchema: async () => JsonLdKeywordSchema
|
|
1444
1453
|
}));
|
|
1445
|
-
DataTypeHandlerFactory.register(`${
|
|
1454
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ListOrSetItem}`, () => ({
|
|
1446
1455
|
type: JsonLdTypes.ListOrSetItem,
|
|
1447
1456
|
jsonSchema: async () => JsonLdListOrSetItemSchema
|
|
1448
1457
|
}));
|
|
1449
|
-
DataTypeHandlerFactory.register(`${
|
|
1458
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContainerType}`, () => ({
|
|
1450
1459
|
type: JsonLdTypes.ContainerType,
|
|
1451
1460
|
jsonSchema: async () => JsonLdContainerTypeSchema
|
|
1452
1461
|
}));
|
|
1453
|
-
DataTypeHandlerFactory.register(`${
|
|
1462
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContainerTypeArray}`, () => ({
|
|
1454
1463
|
type: JsonLdTypes.ContainerTypeArray,
|
|
1455
1464
|
jsonSchema: async () => JsonLdContainerTypeArraySchema
|
|
1456
1465
|
}));
|
|
1457
|
-
DataTypeHandlerFactory.register(`${
|
|
1466
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonPrimitive}`, () => ({
|
|
1458
1467
|
type: JsonLdTypes.JsonPrimitive,
|
|
1459
1468
|
jsonSchema: async () => JsonLdJsonPrimitiveSchema
|
|
1460
1469
|
}));
|
|
1461
|
-
DataTypeHandlerFactory.register(`${
|
|
1470
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonArray}`, () => ({
|
|
1462
1471
|
type: JsonLdTypes.JsonArray,
|
|
1463
1472
|
jsonSchema: async () => JsonLdJsonArraySchema
|
|
1464
1473
|
}));
|
|
1465
|
-
DataTypeHandlerFactory.register(`${
|
|
1474
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonObject}`, () => ({
|
|
1466
1475
|
type: JsonLdTypes.JsonObject,
|
|
1467
1476
|
jsonSchema: async () => JsonLdJsonObjectSchema
|
|
1468
1477
|
}));
|
|
1469
|
-
DataTypeHandlerFactory.register(`${
|
|
1478
|
+
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonValue}`, () => ({
|
|
1470
1479
|
type: JsonLdTypes.JsonValue,
|
|
1471
1480
|
jsonSchema: async () => JsonLdJsonValueSchema
|
|
1472
1481
|
}));
|
|
@@ -1780,4 +1789,4 @@ class JsonLdProcessor {
|
|
|
1780
1789
|
}
|
|
1781
1790
|
}
|
|
1782
1791
|
|
|
1783
|
-
export { JsonLdDataTypes, JsonLdHelper, JsonLdProcessor, JsonLdTypes };
|
|
1792
|
+
export { JsonLdContexts, JsonLdDataTypes, JsonLdHelper, JsonLdProcessor, JsonLdTypes };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export * from "./models/IJsonLdObject";
|
|
|
25
25
|
export * from "./models/IJsonLdSetObject";
|
|
26
26
|
export * from "./models/IJsonLdTypeMap";
|
|
27
27
|
export * from "./models/IJsonLdValueObject";
|
|
28
|
+
export * from "./models/jsonLdContexts";
|
|
28
29
|
export * from "./models/jsonLdTypes";
|
|
29
30
|
export * from "./utils/jsonLdHelper";
|
|
30
31
|
export * from "./utils/jsonLdProcessor";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The contexts of JSON-LD data.
|
|
3
|
+
*/
|
|
4
|
+
export declare const JsonLdContexts: {
|
|
5
|
+
/**
|
|
6
|
+
* Context Root.
|
|
7
|
+
*/
|
|
8
|
+
readonly ContextRoot: "https://schema.twindev.org/json-ld/";
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The contexts of JSON-LD data.
|
|
12
|
+
*/
|
|
13
|
+
export type JsonLdContexts = (typeof JsonLdContexts)[keyof typeof JsonLdContexts];
|
package/docs/changelog.md
CHANGED
package/docs/reference/index.md
CHANGED
|
@@ -37,8 +37,10 @@
|
|
|
37
37
|
- [IJsonLdListOrSetItem](type-aliases/IJsonLdListOrSetItem.md)
|
|
38
38
|
- [IJsonLdNodePrimitive](type-aliases/IJsonLdNodePrimitive.md)
|
|
39
39
|
- [IJsonLdValueObject](type-aliases/IJsonLdValueObject.md)
|
|
40
|
+
- [JsonLdContexts](type-aliases/JsonLdContexts.md)
|
|
40
41
|
- [JsonLdTypes](type-aliases/JsonLdTypes.md)
|
|
41
42
|
|
|
42
43
|
## Variables
|
|
43
44
|
|
|
45
|
+
- [JsonLdContexts](variables/JsonLdContexts.md)
|
|
44
46
|
- [JsonLdTypes](variables/JsonLdTypes.md)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Variable: JsonLdContexts
|
|
2
|
+
|
|
3
|
+
> `const` **JsonLdContexts**: `object`
|
|
4
|
+
|
|
5
|
+
The contexts of JSON-LD data.
|
|
6
|
+
|
|
7
|
+
## Type declaration
|
|
8
|
+
|
|
9
|
+
### ContextRoot
|
|
10
|
+
|
|
11
|
+
> `readonly` **ContextRoot**: `"https://schema.twindev.org/json-ld/"` = `"https://schema.twindev.org/json-ld/"`
|
|
12
|
+
|
|
13
|
+
Context Root.
|
|
@@ -6,12 +6,6 @@ The types of JSON-LD data.
|
|
|
6
6
|
|
|
7
7
|
## Type declaration
|
|
8
8
|
|
|
9
|
-
### ContextRoot
|
|
10
|
-
|
|
11
|
-
> `readonly` **ContextRoot**: `"https://schema.twindev.org/json-ld/"` = `"https://schema.twindev.org/json-ld/"`
|
|
12
|
-
|
|
13
|
-
Context Root.
|
|
14
|
-
|
|
15
9
|
### Document
|
|
16
10
|
|
|
17
11
|
> `readonly` **Document**: `"JsonLdDocument"` = `"JsonLdDocument"`
|
package/locales/en.json
CHANGED
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.27",
|
|
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.27",
|
|
19
19
|
"@twin.org/entity": "next",
|
|
20
20
|
"@twin.org/nameof": "next",
|
|
21
21
|
"@twin.org/web": "next",
|