@twin.org/data-json-ld 0.0.3-next.2 → 0.0.3-next.20
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/README.md +1 -1
- package/dist/es/dataTypes/jsonLdDataTypes.js +104 -131
- package/dist/es/dataTypes/jsonLdDataTypes.js.map +1 -1
- package/dist/es/helpers/jsonLdHelperTypes.js +2 -0
- package/dist/es/helpers/jsonLdHelperTypes.js.map +1 -0
- package/dist/es/index.js +1 -0
- package/dist/es/index.js.map +1 -1
- package/dist/es/models/jsonLdContexts.js +10 -2
- package/dist/es/models/jsonLdContexts.js.map +1 -1
- package/dist/es/schemas/JsonLdContainerType.json +17 -7
- package/dist/es/schemas/JsonLdContainerTypeArray.json +129 -142
- package/dist/es/schemas/JsonLdContextDefinition.json +76 -18
- package/dist/es/schemas/JsonLdContextDefinitionElement.json +1 -0
- package/dist/es/schemas/JsonLdContextDefinitionRoot.json +1 -0
- package/dist/es/schemas/JsonLdDocument.json +3 -3
- package/dist/es/schemas/JsonLdExpandedTermDefinition.json +101 -89
- package/dist/es/schemas/JsonLdGraphObject.json +2 -2
- package/dist/es/schemas/JsonLdIdMap.json +1 -0
- package/dist/es/schemas/JsonLdIncludedBlock.json +1 -0
- package/dist/es/schemas/JsonLdIndexMap.json +2 -1
- package/dist/es/schemas/JsonLdIndexMapItem.json +1 -0
- package/dist/es/schemas/JsonLdJsonArray.json +1 -0
- package/dist/es/schemas/JsonLdJsonObject.json +2 -8
- package/dist/es/schemas/JsonLdJsonPrimitive.json +14 -5
- package/dist/es/schemas/JsonLdJsonValue.json +1 -0
- package/dist/es/schemas/JsonLdLanguageMap.json +1 -0
- package/dist/es/schemas/JsonLdListObject.json +2 -2
- package/dist/es/schemas/JsonLdListOrSetItem.json +1 -0
- package/dist/es/schemas/JsonLdNodeObject.json +12 -72
- package/dist/es/schemas/JsonLdNodePrimitive.json +1 -0
- package/dist/es/schemas/JsonLdObject.json +3 -3
- package/dist/es/schemas/JsonLdSetObject.json +2 -2
- package/dist/es/schemas/JsonLdTypeMap.json +1 -0
- package/dist/es/schemas/JsonLdValueObject.json +99 -87
- package/dist/es/utils/jsonLdHelper.js +181 -15
- package/dist/es/utils/jsonLdHelper.js.map +1 -1
- package/dist/es/utils/jsonLdProcessor.js +122 -33
- package/dist/es/utils/jsonLdProcessor.js.map +1 -1
- package/dist/types/helpers/jsonLdHelperTypes.d.ts +127 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/models/jsonLdContexts.d.ts +10 -2
- package/dist/types/utils/jsonLdHelper.d.ts +63 -6
- package/dist/types/utils/jsonLdProcessor.d.ts +10 -7
- package/docs/changelog.md +273 -1
- package/docs/examples.md +214 -1
- package/docs/reference/classes/JsonLdDataTypes.md +1 -1
- package/docs/reference/classes/JsonLdHelper.md +249 -13
- package/docs/reference/classes/JsonLdProcessor.md +51 -58
- package/docs/reference/index.md +23 -0
- package/docs/reference/interfaces/IJsonLdContextDefinition.md +20 -20
- package/docs/reference/interfaces/IJsonLdGraphObject.md +7 -7
- package/docs/reference/interfaces/IJsonLdIdMap.md +1 -1
- package/docs/reference/interfaces/IJsonLdIndexMap.md +1 -1
- package/docs/reference/interfaces/IJsonLdJsonObject.md +1 -1
- package/docs/reference/interfaces/IJsonLdLanguageMap.md +1 -1
- package/docs/reference/interfaces/IJsonLdListObject.md +3 -3
- package/docs/reference/interfaces/IJsonLdNodeObject.md +17 -17
- package/docs/reference/interfaces/IJsonLdObject.md +16 -16
- package/docs/reference/interfaces/IJsonLdSetObject.md +3 -3
- package/docs/reference/interfaces/IJsonLdTypeMap.md +1 -1
- package/docs/reference/type-aliases/IJsonLdExpandedTermDefinition.md +7 -7
- package/docs/reference/type-aliases/IJsonLdValueObject.md +2 -2
- package/docs/reference/type-aliases/JsonLdAliasKey.md +15 -0
- package/docs/reference/type-aliases/JsonLdExistingProperty.md +19 -0
- package/docs/reference/type-aliases/JsonLdExistingPropertyEither.md +24 -0
- package/docs/reference/type-aliases/JsonLdKeys.md +11 -0
- package/docs/reference/type-aliases/JsonLdObjectWithAliases.md +16 -0
- package/docs/reference/type-aliases/JsonLdObjectWithAtId.md +21 -0
- package/docs/reference/type-aliases/JsonLdObjectWithAtType.md +21 -0
- package/docs/reference/type-aliases/JsonLdObjectWithContext.md +21 -0
- package/docs/reference/type-aliases/JsonLdObjectWithId.md +21 -0
- package/docs/reference/type-aliases/JsonLdObjectWithNoAtId.md +11 -0
- package/docs/reference/type-aliases/JsonLdObjectWithNoAtType.md +11 -0
- package/docs/reference/type-aliases/JsonLdObjectWithNoContext.md +12 -0
- package/docs/reference/type-aliases/JsonLdObjectWithNoId.md +11 -0
- package/docs/reference/type-aliases/JsonLdObjectWithNoType.md +11 -0
- package/docs/reference/type-aliases/JsonLdObjectWithOptionalAtId.md +21 -0
- package/docs/reference/type-aliases/JsonLdObjectWithOptionalAtType.md +21 -0
- package/docs/reference/type-aliases/JsonLdObjectWithOptionalContext.md +22 -0
- package/docs/reference/type-aliases/JsonLdObjectWithOptionalId.md +21 -0
- package/docs/reference/type-aliases/JsonLdObjectWithOptionalType.md +21 -0
- package/docs/reference/type-aliases/JsonLdObjectWithType.md +21 -0
- package/docs/reference/type-aliases/JsonLdOptionalKeys.md +11 -0
- package/docs/reference/type-aliases/JsonLdRequiredKeys.md +11 -0
- package/docs/reference/type-aliases/JsonLdWithAliases.md +17 -0
- package/docs/reference/variables/JsonLdContexts.md +15 -3
- package/docs/reference/variables/JsonLdTypes.md +26 -26
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TWIN JSON LD Data
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This package provides JSON-LD data models and helper utilities for working with linked data documents in a predictable and reusable way. It aligns package-level data structures with the [JSON-LD](https://json-ld.org/) ecosystem, making it easier to represent interoperable semantic data across services.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright 2024 IOTA Stiftung.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
-
import {
|
|
3
|
+
import { DataTypeHelper } from "@twin.org/data-core";
|
|
4
4
|
import { JsonLdContexts } from "../models/jsonLdContexts.js";
|
|
5
5
|
import { JsonLdTypes } from "../models/jsonLdTypes.js";
|
|
6
6
|
import JsonLdContainerTypeSchema from "../schemas/JsonLdContainerType.json" with { type: "json" };
|
|
@@ -36,136 +36,109 @@ export class JsonLdDataTypes {
|
|
|
36
36
|
* Register all the data types.
|
|
37
37
|
*/
|
|
38
38
|
static registerTypes() {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
jsonSchema: async () => JsonLdContainerTypeSchema
|
|
143
|
-
}));
|
|
144
|
-
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContainerTypeArray}`, () => ({
|
|
145
|
-
context: JsonLdContexts.ContextRoot,
|
|
146
|
-
type: JsonLdTypes.ContainerTypeArray,
|
|
147
|
-
jsonSchema: async () => JsonLdContainerTypeArraySchema
|
|
148
|
-
}));
|
|
149
|
-
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonPrimitive}`, () => ({
|
|
150
|
-
context: JsonLdContexts.ContextRoot,
|
|
151
|
-
type: JsonLdTypes.JsonPrimitive,
|
|
152
|
-
jsonSchema: async () => JsonLdJsonPrimitiveSchema
|
|
153
|
-
}));
|
|
154
|
-
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonArray}`, () => ({
|
|
155
|
-
context: JsonLdContexts.ContextRoot,
|
|
156
|
-
type: JsonLdTypes.JsonArray,
|
|
157
|
-
jsonSchema: async () => JsonLdJsonArraySchema
|
|
158
|
-
}));
|
|
159
|
-
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonObject}`, () => ({
|
|
160
|
-
context: JsonLdContexts.ContextRoot,
|
|
161
|
-
type: JsonLdTypes.JsonObject,
|
|
162
|
-
jsonSchema: async () => JsonLdJsonObjectSchema
|
|
163
|
-
}));
|
|
164
|
-
DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonValue}`, () => ({
|
|
165
|
-
context: JsonLdContexts.ContextRoot,
|
|
166
|
-
type: JsonLdTypes.JsonValue,
|
|
167
|
-
jsonSchema: async () => JsonLdJsonValueSchema
|
|
168
|
-
}));
|
|
39
|
+
const types = [
|
|
40
|
+
{
|
|
41
|
+
type: JsonLdTypes.Document,
|
|
42
|
+
schema: JsonLdDocumentSchema
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
type: JsonLdTypes.Object,
|
|
46
|
+
schema: JsonLdObjectSchema
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
type: JsonLdTypes.NodeObject,
|
|
50
|
+
schema: JsonLdNodeObjectSchema
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
type: JsonLdTypes.NodePrimitive,
|
|
54
|
+
schema: JsonLdNodePrimitiveSchema
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: JsonLdTypes.GraphObject,
|
|
58
|
+
schema: JsonLdGraphObjectSchema
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
type: JsonLdTypes.ValueObject,
|
|
62
|
+
schema: JsonLdValueObjectSchema
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: JsonLdTypes.ListObject,
|
|
66
|
+
schema: JsonLdListObjectSchema
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
type: JsonLdTypes.SetObject,
|
|
70
|
+
schema: JsonLdSetObjectSchema
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
type: JsonLdTypes.LanguageMap,
|
|
74
|
+
schema: JsonLdLanguageMapSchema
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
type: JsonLdTypes.IndexMap,
|
|
78
|
+
schema: JsonLdIndexMapSchema
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
type: JsonLdTypes.IndexMapItem,
|
|
82
|
+
schema: JsonLdIndexMapItemSchema
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
type: JsonLdTypes.IdMap,
|
|
86
|
+
schema: JsonLdIdMapSchema
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
type: JsonLdTypes.TypeMap,
|
|
90
|
+
schema: JsonLdTypeMapSchema
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
type: JsonLdTypes.IncludedBlock,
|
|
94
|
+
schema: JsonLdIncludedBlockSchema
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
type: JsonLdTypes.ContextDefinition,
|
|
98
|
+
schema: JsonLdContextDefinitionSchema
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
type: JsonLdTypes.ContextDefinitionElement,
|
|
102
|
+
schema: JsonLdContextDefinitionElementSchema
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
type: JsonLdTypes.ContextDefinitionRoot,
|
|
106
|
+
schema: JsonLdContextDefinitionRootSchema
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
type: JsonLdTypes.ExpandedTermDefinition,
|
|
110
|
+
schema: JsonLdExpandedTermDefinitionSchema
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
type: JsonLdTypes.ListOrSetItem,
|
|
114
|
+
schema: JsonLdListOrSetItemSchema
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
type: JsonLdTypes.ContainerType,
|
|
118
|
+
schema: JsonLdContainerTypeSchema
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
type: JsonLdTypes.ContainerTypeArray,
|
|
122
|
+
schema: JsonLdContainerTypeArraySchema
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
type: JsonLdTypes.JsonPrimitive,
|
|
126
|
+
schema: JsonLdJsonPrimitiveSchema
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
type: JsonLdTypes.JsonArray,
|
|
130
|
+
schema: JsonLdJsonArraySchema
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
type: JsonLdTypes.JsonObject,
|
|
134
|
+
schema: JsonLdJsonObjectSchema
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
type: JsonLdTypes.JsonValue,
|
|
138
|
+
schema: JsonLdJsonValueSchema
|
|
139
|
+
}
|
|
140
|
+
];
|
|
141
|
+
DataTypeHelper.registerTypes(JsonLdContexts.Namespace, JsonLdContexts.JsonLdContext, types);
|
|
169
142
|
}
|
|
170
143
|
}
|
|
171
144
|
//# sourceMappingURL=jsonLdDataTypes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonLdDataTypes.js","sourceRoot":"","sources":["../../../src/dataTypes/jsonLdDataTypes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,sBAAsB,EAAoB,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,yBAAyB,MAAM,qCAAqC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAClG,OAAO,8BAA8B,MAAM,0CAA0C,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAC5G,OAAO,6BAA6B,MAAM,yCAAyC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAC1G,OAAO,oCAAoC,MAAM,gDAAgD,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACxH,OAAO,iCAAiC,MAAM,6CAA6C,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAClH,OAAO,oBAAoB,MAAM,gCAAgC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACxF,OAAO,kCAAkC,MAAM,8CAA8C,CAAC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CAC9B,GAAG,cAAc,CAAC,WAAW,GAAG,WAAW,CAAC,aAAa,EAAE,EAC3D,GAAG,EAAE,CAAC,CAAC;YACN,OAAO,EAAE,cAAc,CAAC,WAAW;YACnC,IAAI,EAAE,WAAW,CAAC,aAAa;YAC/B,UAAU,EAAE,KAAK,IAAI,EAAE,CAAC,yBAAwC;SAChE,CAAC,CACF,CAAC;QACF,sBAAsB,CAAC,QAAQ,CAC9B,GAAG,cAAc,CAAC,WAAW,GAAG,WAAW,CAAC,SAAS,EAAE,EACvD,GAAG,EAAE,CAAC,CAAC;YACN,OAAO,EAAE,cAAc,CAAC,WAAW;YACnC,IAAI,EAAE,WAAW,CAAC,SAAS;YAC3B,UAAU,EAAE,KAAK,IAAI,EAAE,CAAC,qBAAoC;SAC5D,CAAC,CACF,CAAC;QACF,sBAAsB,CAAC,QAAQ,CAC9B,GAAG,cAAc,CAAC,WAAW,GAAG,WAAW,CAAC,UAAU,EAAE,EACxD,GAAG,EAAE,CAAC,CAAC;YACN,OAAO,EAAE,cAAc,CAAC,WAAW;YACnC,IAAI,EAAE,WAAW,CAAC,UAAU;YAC5B,UAAU,EAAE,KAAK,IAAI,EAAE,CAAC,sBAAqC;SAC7D,CAAC,CACF,CAAC;QACF,sBAAsB,CAAC,QAAQ,CAC9B,GAAG,cAAc,CAAC,WAAW,GAAG,WAAW,CAAC,SAAS,EAAE,EACvD,GAAG,EAAE,CAAC,CAAC;YACN,OAAO,EAAE,cAAc,CAAC,WAAW;YACnC,IAAI,EAAE,WAAW,CAAC,SAAS;YAC3B,UAAU,EAAE,KAAK,IAAI,EAAE,CAAC,qBAAoC;SAC5D,CAAC,CACF,CAAC;IACH,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { DataTypeHandlerFactory, type IJsonSchema } from \"@twin.org/data-core\";\nimport { JsonLdContexts } from \"../models/jsonLdContexts.js\";\nimport { JsonLdTypes } from \"../models/jsonLdTypes.js\";\nimport JsonLdContainerTypeSchema from \"../schemas/JsonLdContainerType.json\" with { type: \"json\" };\nimport JsonLdContainerTypeArraySchema from \"../schemas/JsonLdContainerTypeArray.json\" with { type: \"json\" };\nimport JsonLdContextDefinitionSchema from \"../schemas/JsonLdContextDefinition.json\" with { type: \"json\" };\nimport JsonLdContextDefinitionElementSchema from \"../schemas/JsonLdContextDefinitionElement.json\" with { type: \"json\" };\nimport JsonLdContextDefinitionRootSchema from \"../schemas/JsonLdContextDefinitionRoot.json\" with { type: \"json\" };\nimport JsonLdDocumentSchema from \"../schemas/JsonLdDocument.json\" with { type: \"json\" };\nimport JsonLdExpandedTermDefinitionSchema from \"../schemas/JsonLdExpandedTermDefinition.json\" with { type: \"json\" };\nimport JsonLdGraphObjectSchema from \"../schemas/JsonLdGraphObject.json\" with { type: \"json\" };\nimport JsonLdIdMapSchema from \"../schemas/JsonLdIdMap.json\" with { type: \"json\" };\nimport JsonLdIncludedBlockSchema from \"../schemas/JsonLdIncludedBlock.json\" with { type: \"json\" };\nimport JsonLdIndexMapSchema from \"../schemas/JsonLdIndexMap.json\" with { type: \"json\" };\nimport JsonLdIndexMapItemSchema from \"../schemas/JsonLdIndexMapItem.json\" with { type: \"json\" };\nimport JsonLdJsonArraySchema from \"../schemas/JsonLdJsonArray.json\" with { type: \"json\" };\nimport JsonLdJsonObjectSchema from \"../schemas/JsonLdJsonObject.json\" with { type: \"json\" };\nimport JsonLdJsonPrimitiveSchema from \"../schemas/JsonLdJsonPrimitive.json\" with { type: \"json\" };\nimport JsonLdJsonValueSchema from \"../schemas/JsonLdJsonValue.json\" with { type: \"json\" };\nimport JsonLdLanguageMapSchema from \"../schemas/JsonLdLanguageMap.json\" with { type: \"json\" };\nimport JsonLdListObjectSchema from \"../schemas/JsonLdListObject.json\" with { type: \"json\" };\nimport JsonLdListOrSetItemSchema from \"../schemas/JsonLdListOrSetItem.json\" with { type: \"json\" };\nimport JsonLdNodeObjectSchema from \"../schemas/JsonLdNodeObject.json\" with { type: \"json\" };\nimport JsonLdNodePrimitiveSchema from \"../schemas/JsonLdNodePrimitive.json\" with { type: \"json\" };\nimport JsonLdObjectSchema from \"../schemas/JsonLdObject.json\" with { type: \"json\" };\nimport JsonLdSetObjectSchema from \"../schemas/JsonLdSetObject.json\" with { type: \"json\" };\nimport JsonLdTypeMapSchema from \"../schemas/JsonLdTypeMap.json\" with { type: \"json\" };\nimport JsonLdValueObjectSchema from \"../schemas/JsonLdValueObject.json\" with { type: \"json\" };\n\n/**\n * Handle all the data types for JSON-LD.\n */\nexport class JsonLdDataTypes {\n\t/**\n\t * Register all the data types.\n\t */\n\tpublic static registerTypes(): void {\n\t\tDataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.Document}`, () => ({\n\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\ttype: JsonLdTypes.Document,\n\t\t\tjsonSchema: async () => JsonLdDocumentSchema as IJsonSchema\n\t\t}));\n\t\tDataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.Object}`, () => ({\n\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\ttype: JsonLdTypes.Object,\n\t\t\tjsonSchema: async () => JsonLdObjectSchema as IJsonSchema\n\t\t}));\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${JsonLdContexts.ContextRoot}${JsonLdTypes.NodeObject}`,\n\t\t\t() => ({\n\t\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\t\ttype: JsonLdTypes.NodeObject,\n\t\t\t\tjsonSchema: async () => JsonLdNodeObjectSchema as IJsonSchema\n\t\t\t})\n\t\t);\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${JsonLdContexts.ContextRoot}${JsonLdTypes.NodePrimitive}`,\n\t\t\t() => ({\n\t\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\t\ttype: JsonLdTypes.NodePrimitive,\n\t\t\t\tjsonSchema: async () => JsonLdNodePrimitiveSchema as IJsonSchema\n\t\t\t})\n\t\t);\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${JsonLdContexts.ContextRoot}${JsonLdTypes.GraphObject}`,\n\t\t\t() => ({\n\t\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\t\ttype: JsonLdTypes.GraphObject,\n\t\t\t\tjsonSchema: async () => JsonLdGraphObjectSchema as IJsonSchema\n\t\t\t})\n\t\t);\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${JsonLdContexts.ContextRoot}${JsonLdTypes.ValueObject}`,\n\t\t\t() => ({\n\t\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\t\ttype: JsonLdTypes.ValueObject,\n\t\t\t\tjsonSchema: async () => JsonLdValueObjectSchema as unknown as IJsonSchema\n\t\t\t})\n\t\t);\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${JsonLdContexts.ContextRoot}${JsonLdTypes.ListObject}`,\n\t\t\t() => ({\n\t\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\t\ttype: JsonLdTypes.ListObject,\n\t\t\t\tjsonSchema: async () => JsonLdListObjectSchema as IJsonSchema\n\t\t\t})\n\t\t);\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${JsonLdContexts.ContextRoot}${JsonLdTypes.ListObject}`,\n\t\t\t() => ({\n\t\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\t\ttype: JsonLdTypes.ListObject,\n\t\t\t\tjsonSchema: async () => JsonLdListObjectSchema as IJsonSchema\n\t\t\t})\n\t\t);\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${JsonLdContexts.ContextRoot}${JsonLdTypes.SetObject}`,\n\t\t\t() => ({\n\t\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\t\ttype: JsonLdTypes.SetObject,\n\t\t\t\tjsonSchema: async () => JsonLdSetObjectSchema as IJsonSchema\n\t\t\t})\n\t\t);\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${JsonLdContexts.ContextRoot}${JsonLdTypes.LanguageMap}`,\n\t\t\t() => ({\n\t\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\t\ttype: JsonLdTypes.LanguageMap,\n\t\t\t\tjsonSchema: async () => JsonLdLanguageMapSchema as IJsonSchema\n\t\t\t})\n\t\t);\n\t\tDataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.IndexMap}`, () => ({\n\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\ttype: JsonLdTypes.IndexMap,\n\t\t\tjsonSchema: async () => JsonLdIndexMapSchema as IJsonSchema\n\t\t}));\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${JsonLdContexts.ContextRoot}${JsonLdTypes.IndexMapItem}`,\n\t\t\t() => ({\n\t\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\t\ttype: JsonLdTypes.IndexMapItem,\n\t\t\t\tjsonSchema: async () => JsonLdIndexMapItemSchema as IJsonSchema\n\t\t\t})\n\t\t);\n\t\tDataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.IdMap}`, () => ({\n\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\ttype: JsonLdTypes.IdMap,\n\t\t\tjsonSchema: async () => JsonLdIdMapSchema as IJsonSchema\n\t\t}));\n\t\tDataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.TypeMap}`, () => ({\n\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\ttype: JsonLdTypes.TypeMap,\n\t\t\tjsonSchema: async () => JsonLdTypeMapSchema as IJsonSchema\n\t\t}));\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${JsonLdContexts.ContextRoot}${JsonLdTypes.IncludedBlock}`,\n\t\t\t() => ({\n\t\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\t\ttype: JsonLdTypes.IncludedBlock,\n\t\t\t\tjsonSchema: async () => JsonLdIncludedBlockSchema as IJsonSchema\n\t\t\t})\n\t\t);\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContextDefinition}`,\n\t\t\t() => ({\n\t\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\t\ttype: JsonLdTypes.ContextDefinition,\n\t\t\t\tjsonSchema: async () => JsonLdContextDefinitionSchema as IJsonSchema\n\t\t\t})\n\t\t);\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContextDefinitionElement}`,\n\t\t\t() => ({\n\t\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\t\ttype: JsonLdTypes.ContextDefinitionElement,\n\t\t\t\tjsonSchema: async () => JsonLdContextDefinitionElementSchema as IJsonSchema\n\t\t\t})\n\t\t);\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContextDefinitionRoot}`,\n\t\t\t() => ({\n\t\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\t\ttype: JsonLdTypes.ContextDefinitionRoot,\n\t\t\t\tjsonSchema: async () => JsonLdContextDefinitionRootSchema as IJsonSchema\n\t\t\t})\n\t\t);\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${JsonLdContexts.ContextRoot}${JsonLdTypes.ExpandedTermDefinition}`,\n\t\t\t() => ({\n\t\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\t\ttype: JsonLdTypes.ExpandedTermDefinition,\n\t\t\t\tjsonSchema: async () => JsonLdExpandedTermDefinitionSchema as unknown as IJsonSchema\n\t\t\t})\n\t\t);\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${JsonLdContexts.ContextRoot}${JsonLdTypes.ListOrSetItem}`,\n\t\t\t() => ({\n\t\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\t\ttype: JsonLdTypes.ListOrSetItem,\n\t\t\t\tjsonSchema: async () => JsonLdListOrSetItemSchema as IJsonSchema\n\t\t\t})\n\t\t);\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContainerType}`,\n\t\t\t() => ({\n\t\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\t\ttype: JsonLdTypes.ContainerType,\n\t\t\t\tjsonSchema: async () => JsonLdContainerTypeSchema as IJsonSchema\n\t\t\t})\n\t\t);\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContainerTypeArray}`,\n\t\t\t() => ({\n\t\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\t\ttype: JsonLdTypes.ContainerTypeArray,\n\t\t\t\tjsonSchema: async () => JsonLdContainerTypeArraySchema as IJsonSchema\n\t\t\t})\n\t\t);\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonPrimitive}`,\n\t\t\t() => ({\n\t\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\t\ttype: JsonLdTypes.JsonPrimitive,\n\t\t\t\tjsonSchema: async () => JsonLdJsonPrimitiveSchema as IJsonSchema\n\t\t\t})\n\t\t);\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonArray}`,\n\t\t\t() => ({\n\t\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\t\ttype: JsonLdTypes.JsonArray,\n\t\t\t\tjsonSchema: async () => JsonLdJsonArraySchema as IJsonSchema\n\t\t\t})\n\t\t);\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonObject}`,\n\t\t\t() => ({\n\t\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\t\ttype: JsonLdTypes.JsonObject,\n\t\t\t\tjsonSchema: async () => JsonLdJsonObjectSchema as IJsonSchema\n\t\t\t})\n\t\t);\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonValue}`,\n\t\t\t() => ({\n\t\t\t\tcontext: JsonLdContexts.ContextRoot,\n\t\t\t\ttype: JsonLdTypes.JsonValue,\n\t\t\t\tjsonSchema: async () => JsonLdJsonValueSchema as IJsonSchema\n\t\t\t})\n\t\t);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"jsonLdDataTypes.js","sourceRoot":"","sources":["../../../src/dataTypes/jsonLdDataTypes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,yBAAyB,MAAM,qCAAqC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAClG,OAAO,8BAA8B,MAAM,0CAA0C,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAC5G,OAAO,6BAA6B,MAAM,yCAAyC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAC1G,OAAO,oCAAoC,MAAM,gDAAgD,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACxH,OAAO,iCAAiC,MAAM,6CAA6C,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAClH,OAAO,oBAAoB,MAAM,gCAAgC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACxF,OAAO,kCAAkC,MAAM,8CAA8C,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACpH,OAAO,uBAAuB,MAAM,mCAAmC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAC9F,OAAO,iBAAiB,MAAM,6BAA6B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAClF,OAAO,yBAAyB,MAAM,qCAAqC,CAAC,OAAO,IAAI,EAA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AC,wBAAwB;gBAC1C,MAAM,EAAE,oCAAoC;aAC5C;YACD;gBACC,IAAI,EAAE,WAAW,CAAC,qBAAqB;gBACvC,MAAM,EAAE,iCAAiC;aACzC;YACD;gBACC,IAAI,EAAE,WAAW,CAAC,sBAAsB;gBACxC,MAAM,EAAE,kCAAkC;aAC1C;YACD;gBACC,IAAI,EAAE,WAAW,CAAC,aAAa;gBAC/B,MAAM,EAAE,yBAAyB;aACjC;YACD;gBACC,IAAI,EAAE,WAAW,CAAC,aAAa;gBAC/B,MAAM,EAAE,yBAAyB;aACjC;YACD;gBACC,IAAI,EAAE,WAAW,CAAC,kBAAkB;gBACpC,MAAM,EAAE,8BAA8B;aACtC;YACD;gBACC,IAAI,EAAE,WAAW,CAAC,aAAa;gBAC/B,MAAM,EAAE,yBAAyB;aACjC;YACD;gBACC,IAAI,EAAE,WAAW,CAAC,SAAS;gBAC3B,MAAM,EAAE,qBAAqB;aAC7B;YACD;gBACC,IAAI,EAAE,WAAW,CAAC,UAAU;gBAC5B,MAAM,EAAE,sBAAsB;aAC9B;YACD;gBACC,IAAI,EAAE,WAAW,CAAC,SAAS;gBAC3B,MAAM,EAAE,qBAAqB;aAC7B;SACD,CAAC;QAEF,cAAc,CAAC,aAAa,CAAC,cAAc,CAAC,SAAS,EAAE,cAAc,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IAC7F,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { DataTypeHelper } from \"@twin.org/data-core\";\nimport { JsonLdContexts } from \"../models/jsonLdContexts.js\";\nimport { JsonLdTypes } from \"../models/jsonLdTypes.js\";\nimport JsonLdContainerTypeSchema from \"../schemas/JsonLdContainerType.json\" with { type: \"json\" };\nimport JsonLdContainerTypeArraySchema from \"../schemas/JsonLdContainerTypeArray.json\" with { type: \"json\" };\nimport JsonLdContextDefinitionSchema from \"../schemas/JsonLdContextDefinition.json\" with { type: \"json\" };\nimport JsonLdContextDefinitionElementSchema from \"../schemas/JsonLdContextDefinitionElement.json\" with { type: \"json\" };\nimport JsonLdContextDefinitionRootSchema from \"../schemas/JsonLdContextDefinitionRoot.json\" with { type: \"json\" };\nimport JsonLdDocumentSchema from \"../schemas/JsonLdDocument.json\" with { type: \"json\" };\nimport JsonLdExpandedTermDefinitionSchema from \"../schemas/JsonLdExpandedTermDefinition.json\" with { type: \"json\" };\nimport JsonLdGraphObjectSchema from \"../schemas/JsonLdGraphObject.json\" with { type: \"json\" };\nimport JsonLdIdMapSchema from \"../schemas/JsonLdIdMap.json\" with { type: \"json\" };\nimport JsonLdIncludedBlockSchema from \"../schemas/JsonLdIncludedBlock.json\" with { type: \"json\" };\nimport JsonLdIndexMapSchema from \"../schemas/JsonLdIndexMap.json\" with { type: \"json\" };\nimport JsonLdIndexMapItemSchema from \"../schemas/JsonLdIndexMapItem.json\" with { type: \"json\" };\nimport JsonLdJsonArraySchema from \"../schemas/JsonLdJsonArray.json\" with { type: \"json\" };\nimport JsonLdJsonObjectSchema from \"../schemas/JsonLdJsonObject.json\" with { type: \"json\" };\nimport JsonLdJsonPrimitiveSchema from \"../schemas/JsonLdJsonPrimitive.json\" with { type: \"json\" };\nimport JsonLdJsonValueSchema from \"../schemas/JsonLdJsonValue.json\" with { type: \"json\" };\nimport JsonLdLanguageMapSchema from \"../schemas/JsonLdLanguageMap.json\" with { type: \"json\" };\nimport JsonLdListObjectSchema from \"../schemas/JsonLdListObject.json\" with { type: \"json\" };\nimport JsonLdListOrSetItemSchema from \"../schemas/JsonLdListOrSetItem.json\" with { type: \"json\" };\nimport JsonLdNodeObjectSchema from \"../schemas/JsonLdNodeObject.json\" with { type: \"json\" };\nimport JsonLdNodePrimitiveSchema from \"../schemas/JsonLdNodePrimitive.json\" with { type: \"json\" };\nimport JsonLdObjectSchema from \"../schemas/JsonLdObject.json\" with { type: \"json\" };\nimport JsonLdSetObjectSchema from \"../schemas/JsonLdSetObject.json\" with { type: \"json\" };\nimport JsonLdTypeMapSchema from \"../schemas/JsonLdTypeMap.json\" with { type: \"json\" };\nimport JsonLdValueObjectSchema from \"../schemas/JsonLdValueObject.json\" with { type: \"json\" };\n\n/**\n * Handle all the data types for JSON-LD.\n */\nexport class JsonLdDataTypes {\n\t/**\n\t * Register all the data types.\n\t */\n\tpublic static registerTypes(): void {\n\t\tconst types = [\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.Document,\n\t\t\t\tschema: JsonLdDocumentSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.Object,\n\t\t\t\tschema: JsonLdObjectSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.NodeObject,\n\t\t\t\tschema: JsonLdNodeObjectSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.NodePrimitive,\n\t\t\t\tschema: JsonLdNodePrimitiveSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.GraphObject,\n\t\t\t\tschema: JsonLdGraphObjectSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.ValueObject,\n\t\t\t\tschema: JsonLdValueObjectSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.ListObject,\n\t\t\t\tschema: JsonLdListObjectSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.SetObject,\n\t\t\t\tschema: JsonLdSetObjectSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.LanguageMap,\n\t\t\t\tschema: JsonLdLanguageMapSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.IndexMap,\n\t\t\t\tschema: JsonLdIndexMapSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.IndexMapItem,\n\t\t\t\tschema: JsonLdIndexMapItemSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.IdMap,\n\t\t\t\tschema: JsonLdIdMapSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.TypeMap,\n\t\t\t\tschema: JsonLdTypeMapSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.IncludedBlock,\n\t\t\t\tschema: JsonLdIncludedBlockSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.ContextDefinition,\n\t\t\t\tschema: JsonLdContextDefinitionSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.ContextDefinitionElement,\n\t\t\t\tschema: JsonLdContextDefinitionElementSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.ContextDefinitionRoot,\n\t\t\t\tschema: JsonLdContextDefinitionRootSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.ExpandedTermDefinition,\n\t\t\t\tschema: JsonLdExpandedTermDefinitionSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.ListOrSetItem,\n\t\t\t\tschema: JsonLdListOrSetItemSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.ContainerType,\n\t\t\t\tschema: JsonLdContainerTypeSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.ContainerTypeArray,\n\t\t\t\tschema: JsonLdContainerTypeArraySchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.JsonPrimitive,\n\t\t\t\tschema: JsonLdJsonPrimitiveSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.JsonArray,\n\t\t\t\tschema: JsonLdJsonArraySchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.JsonObject,\n\t\t\t\tschema: JsonLdJsonObjectSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: JsonLdTypes.JsonValue,\n\t\t\t\tschema: JsonLdJsonValueSchema\n\t\t\t}\n\t\t];\n\n\t\tDataTypeHelper.registerTypes(JsonLdContexts.Namespace, JsonLdContexts.JsonLdContext, types);\n\t}\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLdHelperTypes.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdHelperTypes.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IJsonLdContextDefinitionRoot } from \"../models/IJsonLdContextDefinitionRoot.js\";\n\n/**\n * Extract the optional property names from a type.\n */\nexport type JsonLdOptionalKeys<T> = {\n\t[K in keyof T]-?: {} extends Pick<T, K> ? K : never;\n}[keyof T];\n\n/**\n * Extract the required property names from a type.\n */\nexport type JsonLdRequiredKeys<T> = Exclude<keyof T, JsonLdOptionalKeys<T>>;\n\n/**\n * Keep JSON-LD keys as-is and prefix non-JSON-LD keys.\n */\nexport type JsonLdAliasKey<K extends string, Prefix extends string> = K extends `@${string}`\n\t? K\n\t: `${Prefix}:${K}`;\n\n/**\n * Remap an object type so JSON-LD keys (\"@...\") are preserved and\n * non-JSON-LD keys are exposed as `Prefix:key` aliases, while preserving\n * each key's original required/optional status.\n */\nexport type JsonLdWithAliases<T extends object, Prefix extends string> = {\n\t[K in Extract<JsonLdRequiredKeys<T>, string> as JsonLdAliasKey<K, Prefix>]: T[K];\n} & {\n\t[K in Extract<JsonLdOptionalKeys<T>, string> as JsonLdAliasKey<K, Prefix>]?: T[K];\n};\n\n/**\n * Keep only JSON-LD keys (\"@...\") from a type.\n */\nexport type JsonLdKeys<T extends object> = Pick<T, Extract<keyof T, `@${string}`>>;\n\n/**\n * Create a JSON-LD object shape containing only JSON-LD keys plus aliased\n * non-JSON-LD keys.\n */\nexport type JsonLdObjectWithAliases<T extends object, Prefix extends string> = JsonLdKeys<T> &\n\tJsonLdWithAliases<T, Prefix>;\n\n/**\n * Add \"@context\" to a type.\n */\nexport type JsonLdObjectWithContext<T extends object, C = IJsonLdContextDefinitionRoot> = Omit<\n\tT,\n\t\"@context\"\n> & {\n\t\"@context\": C;\n};\n\n/**\n * Infer an existing property's type from a source type, or fall back to a default.\n */\nexport type JsonLdExistingProperty<T extends object, P extends PropertyKey, D> = T extends {\n\t[K in P]?: infer PropertyType;\n}\n\t? Exclude<PropertyType, undefined>\n\t: D;\n\n/**\n * Infer an existing property's type from either of two source properties,\n * or fall back to a default when neither exists.\n */\nexport type JsonLdExistingPropertyEither<\n\tT extends object,\n\tP1 extends PropertyKey,\n\tP2 extends PropertyKey,\n\tD\n> = [JsonLdExistingProperty<T, P1, never> | JsonLdExistingProperty<T, P2, never>] extends [never]\n\t? D\n\t: JsonLdExistingProperty<T, P1, never> | JsonLdExistingProperty<T, P2, never>;\n\n/**\n * Add optional \"@context\" to a type, inferring an existing context type from\n * the source type when available, otherwise using the provided default.\n */\nexport type JsonLdObjectWithOptionalContext<\n\tT extends object,\n\tC = JsonLdExistingProperty<T, \"@context\", IJsonLdContextDefinitionRoot>\n> = Omit<T, \"@context\"> & {\n\t\"@context\"?: C;\n};\n\n/**\n * Omit optional \"@context\" from a type, inferring an existing context type from\n * the source type when available, otherwise using the provided default.\n */\nexport type JsonLdObjectWithNoContext<T extends object> = Omit<T, \"@context\">;\n\n/**\n * Add \"type\" to a type.\n */\nexport type JsonLdObjectWithType<\n\tT extends object,\n\tTy = JsonLdExistingPropertyEither<T, \"type\", \"@type\", string | string[]>\n> = Omit<T, \"type\" | \"@type\"> & {\n\ttype: Ty;\n};\n\n/**\n * Add optional \"type\" to a type.\n */\nexport type JsonLdObjectWithOptionalType<\n\tT extends object,\n\tTy = JsonLdExistingPropertyEither<T, \"type\", \"@type\", string | string[]>\n> = Omit<T, \"type\" | \"@type\"> & {\n\ttype?: Ty;\n};\n\n/**\n * Omit \"type\" from a type.\n */\nexport type JsonLdObjectWithNoType<T extends object> = Omit<T, \"type\">;\n\n/**\n * Add \"@type\" to a type.\n */\nexport type JsonLdObjectWithAtType<\n\tT extends object,\n\tTy = JsonLdExistingPropertyEither<T, \"@type\", \"type\", string | string[]>\n> = Omit<T, \"@type\" | \"type\"> & {\n\t\"@type\": Ty;\n};\n\n/**\n * Add optional \"@type\" to a type.\n */\nexport type JsonLdObjectWithOptionalAtType<\n\tT extends object,\n\tTy = JsonLdExistingPropertyEither<T, \"@type\", \"type\", string | string[]>\n> = Omit<T, \"@type\" | \"type\"> & {\n\t\"@type\"?: Ty;\n};\n\n/**\n * Omit \"@type\" from a type.\n */\nexport type JsonLdObjectWithNoAtType<T extends object> = Omit<T, \"@type\">;\n\n/**\n * Add \"id\" to a type.\n */\nexport type JsonLdObjectWithId<\n\tT extends object,\n\tId = JsonLdExistingPropertyEither<T, \"id\", \"@id\", string>\n> = Omit<T, \"id\" | \"@id\"> & {\n\tid: Id;\n};\n\n/**\n * Add optional \"id\" to a type.\n */\nexport type JsonLdObjectWithOptionalId<\n\tT extends object,\n\tId = JsonLdExistingPropertyEither<T, \"id\", \"@id\", string>\n> = Omit<T, \"id\" | \"@id\"> & {\n\tid?: Id;\n};\n\n/**\n * Omit \"id\" from a type.\n */\nexport type JsonLdObjectWithNoId<T extends object> = Omit<T, \"id\">;\n\n/**\n * Add \"@id\" to a type.\n */\nexport type JsonLdObjectWithAtId<\n\tT extends object,\n\tId = JsonLdExistingPropertyEither<T, \"@id\", \"id\", string>\n> = Omit<T, \"@id\" | \"id\"> & {\n\t\"@id\": Id;\n};\n\n/**\n * Add optional \"@id\" to a type.\n */\nexport type JsonLdObjectWithOptionalAtId<\n\tT extends object,\n\tId = JsonLdExistingPropertyEither<T, \"@id\", \"id\", string>\n> = Omit<T, \"@id\" | \"id\"> & {\n\t\"@id\"?: Id;\n};\n\n/**\n * Omit \"@id\" from a type.\n */\nexport type JsonLdObjectWithNoAtId<T extends object> = Omit<T, \"@id\">;\n"]}
|
package/dist/es/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright 2024 IOTA Stiftung.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0.
|
|
3
3
|
export * from "./dataTypes/jsonLdDataTypes.js";
|
|
4
|
+
export * from "./helpers/jsonLdHelperTypes.js";
|
|
4
5
|
export * from "./models/IJsonLdContainerType.js";
|
|
5
6
|
export * from "./models/IJsonLdContainerTypeArray.js";
|
|
6
7
|
export * from "./models/IJsonLdContextDefinition.js";
|
package/dist/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,0CAA0C,CAAC;AACzD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2CAA2C,CAAC;AAC1D,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./dataTypes/jsonLdDataTypes.js\";\nexport * from \"./models/IJsonLdContainerType.js\";\nexport * from \"./models/IJsonLdContainerTypeArray.js\";\nexport * from \"./models/IJsonLdContextDefinition.js\";\nexport * from \"./models/IJsonLdContextDefinitionElement.js\";\nexport * from \"./models/IJsonLdContextDefinitionRoot.js\";\nexport * from \"./models/IJsonLdDocument.js\";\nexport * from \"./models/IJsonLdExpandedTermDefinition.js\";\nexport * from \"./models/IJsonLdGraphObject.js\";\nexport * from \"./models/IJsonLdIdMap.js\";\nexport * from \"./models/IJsonLdIncludedBlock.js\";\nexport * from \"./models/IJsonLdIndexMap.js\";\nexport * from \"./models/IJsonLdIndexMapItem.js\";\nexport * from \"./models/IJsonLdJsonArray.js\";\nexport * from \"./models/IJsonLdJsonObject.js\";\nexport * from \"./models/IJsonLdJsonPrimitive.js\";\nexport * from \"./models/IJsonLdJsonValue.js\";\nexport * from \"./models/IJsonLdLanguageMap.js\";\nexport * from \"./models/IJsonLdListObject.js\";\nexport * from \"./models/IJsonLdListOrSetItem.js\";\nexport * from \"./models/IJsonLdNodeObject.js\";\nexport * from \"./models/IJsonLdNodePrimitive.js\";\nexport * from \"./models/IJsonLdObject.js\";\nexport * from \"./models/IJsonLdSetObject.js\";\nexport * from \"./models/IJsonLdTypeMap.js\";\nexport * from \"./models/IJsonLdValueObject.js\";\nexport * from \"./models/jsonLdContexts.js\";\nexport * from \"./models/jsonLdTypes.js\";\nexport * from \"./utils/jsonLdHelper.js\";\nexport * from \"./utils/jsonLdProcessor.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,0CAA0C,CAAC;AACzD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2CAA2C,CAAC;AAC1D,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./dataTypes/jsonLdDataTypes.js\";\nexport * from \"./helpers/jsonLdHelperTypes.js\";\nexport * from \"./models/IJsonLdContainerType.js\";\nexport * from \"./models/IJsonLdContainerTypeArray.js\";\nexport * from \"./models/IJsonLdContextDefinition.js\";\nexport * from \"./models/IJsonLdContextDefinitionElement.js\";\nexport * from \"./models/IJsonLdContextDefinitionRoot.js\";\nexport * from \"./models/IJsonLdDocument.js\";\nexport * from \"./models/IJsonLdExpandedTermDefinition.js\";\nexport * from \"./models/IJsonLdGraphObject.js\";\nexport * from \"./models/IJsonLdIdMap.js\";\nexport * from \"./models/IJsonLdIncludedBlock.js\";\nexport * from \"./models/IJsonLdIndexMap.js\";\nexport * from \"./models/IJsonLdIndexMapItem.js\";\nexport * from \"./models/IJsonLdJsonArray.js\";\nexport * from \"./models/IJsonLdJsonObject.js\";\nexport * from \"./models/IJsonLdJsonPrimitive.js\";\nexport * from \"./models/IJsonLdJsonValue.js\";\nexport * from \"./models/IJsonLdLanguageMap.js\";\nexport * from \"./models/IJsonLdListObject.js\";\nexport * from \"./models/IJsonLdListOrSetItem.js\";\nexport * from \"./models/IJsonLdNodeObject.js\";\nexport * from \"./models/IJsonLdNodePrimitive.js\";\nexport * from \"./models/IJsonLdObject.js\";\nexport * from \"./models/IJsonLdSetObject.js\";\nexport * from \"./models/IJsonLdTypeMap.js\";\nexport * from \"./models/IJsonLdValueObject.js\";\nexport * from \"./models/jsonLdContexts.js\";\nexport * from \"./models/jsonLdTypes.js\";\nexport * from \"./utils/jsonLdHelper.js\";\nexport * from \"./utils/jsonLdProcessor.js\";\n"]}
|
|
@@ -6,8 +6,16 @@
|
|
|
6
6
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
7
|
export const JsonLdContexts = {
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* The canonical RDF namespace URI for JSON-LD.
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
Namespace: "https://schema.twindev.org/json-ld/",
|
|
12
|
+
/**
|
|
13
|
+
* The value to use in JSON-LD context for JSON-LD.
|
|
14
|
+
*/
|
|
15
|
+
Context: "https://schema.twindev.org/json-ld/",
|
|
16
|
+
/**
|
|
17
|
+
* The JSON-LD Context URL for JSON-LD.
|
|
18
|
+
*/
|
|
19
|
+
JsonLdContext: "https://schema.twindev.org/json-ld/types.jsonld"
|
|
12
20
|
};
|
|
13
21
|
//# sourceMappingURL=jsonLdContexts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonLdContexts.js","sourceRoot":"","sources":["../../../src/models/jsonLdContexts.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,cAAc,GAAG;IAC7B;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"jsonLdContexts.js","sourceRoot":"","sources":["../../../src/models/jsonLdContexts.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,cAAc,GAAG;IAC7B;;OAEG;IACH,SAAS,EAAE,qCAAqC;IAEhD;;OAEG;IACH,OAAO,EAAE,qCAAqC;IAE9C;;OAEG;IACH,aAAa,EAAE,iDAAiD;CACvD,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The contexts of JSON-LD data.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const JsonLdContexts = {\n\t/**\n\t * The canonical RDF namespace URI for JSON-LD.\n\t */\n\tNamespace: \"https://schema.twindev.org/json-ld/\",\n\n\t/**\n\t * The value to use in JSON-LD context for JSON-LD.\n\t */\n\tContext: \"https://schema.twindev.org/json-ld/\",\n\n\t/**\n\t * The JSON-LD Context URL for JSON-LD.\n\t */\n\tJsonLdContext: \"https://schema.twindev.org/json-ld/types.jsonld\"\n} as const;\n\n/**\n * The contexts of JSON-LD data.\n */\nexport type JsonLdContexts = (typeof JsonLdContexts)[keyof typeof JsonLdContexts];\n"]}
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "https://schema.twindev.org/json-ld/JsonLdContainerType",
|
|
4
|
+
"title": "JsonLdContainerType",
|
|
4
5
|
"description": "JSON-LD container types.",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
"anyOf": [
|
|
7
|
+
{
|
|
8
|
+
"const": "@language"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"const": "@index"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"const": "@id"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"const": "@graph"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"const": "@type"
|
|
21
|
+
}
|
|
12
22
|
]
|
|
13
23
|
}
|