@twin.org/data-json-ld 0.0.1-next.14 → 0.0.1-next.16
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/docs/changelog.md +1 -1
- package/docs/reference/classes/JsonLdHelper.md +9 -3
- package/docs/reference/classes/JsonLdProcessor.md +34 -12
- package/docs/reference/interfaces/IJsonLdContextDefinition.md +1 -1
- 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/IJsonLdNodeObject.md +2 -2
- package/docs/reference/interfaces/IJsonLdObject.md +1 -1
- package/docs/reference/interfaces/IJsonLdTypeMap.md +1 -1
- package/docs/reference/type-aliases/IJsonLdContainerTypeArray.md +1 -1
- package/docs/reference/type-aliases/IJsonLdDocument.md +1 -1
- package/docs/reference/type-aliases/IJsonLdExpandedTermDefinition.md +1 -1
- package/docs/reference/type-aliases/IJsonLdValueObject.md +1 -1
- package/package.json +3 -3
package/docs/changelog.md
CHANGED
|
@@ -26,15 +26,21 @@ Validate a JSON-LD document.
|
|
|
26
26
|
|
|
27
27
|
#### Parameters
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
##### document
|
|
30
|
+
|
|
31
|
+
`T`
|
|
30
32
|
|
|
31
33
|
The JSON-LD document to validate.
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
##### validationFailures
|
|
36
|
+
|
|
37
|
+
`IValidationFailure`[]
|
|
34
38
|
|
|
35
39
|
The list of validation failures to add to.
|
|
36
40
|
|
|
37
|
-
|
|
41
|
+
##### validationMode?
|
|
42
|
+
|
|
43
|
+
`ValidationMode`
|
|
38
44
|
|
|
39
45
|
The validation mode to use, defaults to either.
|
|
40
46
|
|
|
@@ -22,7 +22,9 @@ The document loader to use.
|
|
|
22
22
|
|
|
23
23
|
#### Parameters
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
##### url
|
|
26
|
+
|
|
27
|
+
`string`
|
|
26
28
|
|
|
27
29
|
#### Returns
|
|
28
30
|
|
|
@@ -38,11 +40,15 @@ Compact a document according to a particular context.
|
|
|
38
40
|
|
|
39
41
|
#### Parameters
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
##### document
|
|
44
|
+
|
|
45
|
+
[`IJsonLdDocument`](../type-aliases/IJsonLdDocument.md)
|
|
42
46
|
|
|
43
47
|
The JSON-LD document to compact.
|
|
44
48
|
|
|
45
|
-
|
|
49
|
+
##### context?
|
|
50
|
+
|
|
51
|
+
[`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md)
|
|
46
52
|
|
|
47
53
|
The context to compact the document to, if not provided will try and gather from the object.
|
|
48
54
|
|
|
@@ -62,7 +68,9 @@ Expand a document, removing its context.
|
|
|
62
68
|
|
|
63
69
|
#### Parameters
|
|
64
70
|
|
|
65
|
-
|
|
71
|
+
##### compacted
|
|
72
|
+
|
|
73
|
+
[`IJsonLdDocument`](../type-aliases/IJsonLdDocument.md)
|
|
66
74
|
|
|
67
75
|
The compacted JSON-LD document to expand.
|
|
68
76
|
|
|
@@ -82,11 +90,15 @@ Add a redirect to use during document resolution.
|
|
|
82
90
|
|
|
83
91
|
#### Parameters
|
|
84
92
|
|
|
85
|
-
|
|
93
|
+
##### from
|
|
94
|
+
|
|
95
|
+
`RegExp`
|
|
86
96
|
|
|
87
97
|
The URL to redirect from.
|
|
88
98
|
|
|
89
|
-
|
|
99
|
+
##### to
|
|
100
|
+
|
|
101
|
+
`string`
|
|
90
102
|
|
|
91
103
|
The URL to redirect to.
|
|
92
104
|
|
|
@@ -104,14 +116,18 @@ Combine contexts.
|
|
|
104
116
|
|
|
105
117
|
#### Parameters
|
|
106
118
|
|
|
107
|
-
|
|
119
|
+
##### context1
|
|
108
120
|
|
|
109
121
|
The first JSON-LD context to combine.
|
|
110
122
|
|
|
111
|
-
|
|
123
|
+
`undefined` | [`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md)
|
|
124
|
+
|
|
125
|
+
##### context2
|
|
112
126
|
|
|
113
127
|
The second JSON-LD context to combine.
|
|
114
128
|
|
|
129
|
+
`undefined` | [`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md)
|
|
130
|
+
|
|
115
131
|
#### Returns
|
|
116
132
|
|
|
117
133
|
`undefined` \| [`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md)
|
|
@@ -128,11 +144,13 @@ Gather all the contexts from the element and it's children.
|
|
|
128
144
|
|
|
129
145
|
#### Parameters
|
|
130
146
|
|
|
131
|
-
|
|
147
|
+
##### element
|
|
132
148
|
|
|
133
149
|
The element to gather the contexts from.
|
|
134
150
|
|
|
135
|
-
|
|
151
|
+
##### initial?
|
|
152
|
+
|
|
153
|
+
[`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md)
|
|
136
154
|
|
|
137
155
|
The initial context.
|
|
138
156
|
|
|
@@ -152,11 +170,15 @@ Remove all the contexts that match the pattern.
|
|
|
152
170
|
|
|
153
171
|
#### Parameters
|
|
154
172
|
|
|
155
|
-
|
|
173
|
+
##### context
|
|
156
174
|
|
|
157
175
|
The context to remove the entries from.
|
|
158
176
|
|
|
159
|
-
|
|
177
|
+
`undefined` | [`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md)
|
|
178
|
+
|
|
179
|
+
##### match?
|
|
180
|
+
|
|
181
|
+
[`IJsonLdContextDefinitionElement`](../type-aliases/IJsonLdContextDefinitionElement.md)[]
|
|
160
182
|
|
|
161
183
|
The element to try and match.
|
|
162
184
|
|
|
@@ -8,7 +8,7 @@ https://www.w3.org/TR/json-ld11/#context-definitions
|
|
|
8
8
|
|
|
9
9
|
## Indexable
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
\[`key`: `string`\]: `undefined` \| `null` \| `string` \| `boolean` \| [`IJsonLdExpandedTermDefinition`](../type-aliases/IJsonLdExpandedTermDefinition.md) \| \{ `@container`: `"@set"`; `@protected`: `boolean`; \}
|
|
12
12
|
|
|
13
13
|
## Properties
|
|
14
14
|
|
|
@@ -9,4 +9,4 @@ https://www.w3.org/TR/json-ld11/#index-maps
|
|
|
9
9
|
|
|
10
10
|
## Indexable
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
\[`key`: `string`\]: [`IJsonLdIndexMapItem`](../type-aliases/IJsonLdIndexMapItem.md) \| [`IJsonLdIndexMapItem`](../type-aliases/IJsonLdIndexMapItem.md)[]
|
|
@@ -13,7 +13,7 @@ https://www.w3.org/TR/json-ld11/#node-objects
|
|
|
13
13
|
|
|
14
14
|
## Indexable
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
\[`key`: `string`\]: `undefined` \| `null` \| `string` \| `number` \| `boolean` \| `string`[] \| [`IJsonLdNodeObject`](IJsonLdNodeObject.md) \| [`IJsonLdContextDefinition`](IJsonLdContextDefinition.md) \| [`IJsonLdContextDefinitionElement`](../type-aliases/IJsonLdContextDefinitionElement.md)[] \| `object` & `object` \| `object` & `object` \| `object` & `object` \| [`IJsonLdNodeObject`](IJsonLdNodeObject.md)[] \| [`IJsonLdGraphObject`](IJsonLdGraphObject.md) \| [`IJsonLdListObject`](IJsonLdListObject.md) \| [`IJsonLdSetObject`](IJsonLdSetObject.md) \| [`IJsonLdNodePrimitive`](../type-aliases/IJsonLdNodePrimitive.md)[] \| [`IJsonLdLanguageMap`](IJsonLdLanguageMap.md) \| [`IJsonLdIndexMap`](IJsonLdIndexMap.md) \| [`IJsonLdIdMap`](IJsonLdIdMap.md) \| [`IJsonLdTypeMap`](IJsonLdTypeMap.md) \| \{\} \| [`IJsonLdJsonObject`](IJsonLdJsonObject.md) \| [`IJsonLdJsonObject`](IJsonLdJsonObject.md)[]
|
|
17
17
|
|
|
18
18
|
## Properties
|
|
19
19
|
|
|
@@ -83,7 +83,7 @@ https://www.w3.org/TR/json-ld11/#node-objects
|
|
|
83
83
|
|
|
84
84
|
#### Index Signature
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
\[`key`: `string`\]: `string`
|
|
87
87
|
|
|
88
88
|
#### Inherited from
|
|
89
89
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
# Type Alias: IJsonLdContainerTypeArray
|
|
2
2
|
|
|
3
|
-
> **IJsonLdContainerTypeArray**: [`"@graph"`, `"@id"
|
|
3
|
+
> **IJsonLdContainerTypeArray**: \[`"@graph"`, `"@id"`\] \| \[`"@id"`, `"@graph"`\] \| \[`"@set"`, `"@graph"`, `"@id"`\] \| \[`"@set"`, `"@id"`, `"@graph"`\] \| \[`"@graph"`, `"@set"`, `"@id"`\] \| \[`"@id"`, `"@set"`, `"@graph"`\] \| \[`"@graph"`, `"@id"`, `"@set"`\] \| \[`"@id"`, `"@graph"`, `"@set"`\] \| \[`"@set"`, [`IJsonLdContainerType`](IJsonLdContainerType.md)\] \| \[[`IJsonLdContainerType`](IJsonLdContainerType.md), `"@set"`\]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Type Alias: IJsonLdDocument
|
|
2
2
|
|
|
3
|
-
> **IJsonLdDocument**: [`IJsonLdNodeObject`](../interfaces/IJsonLdNodeObject.md) \| [`IJsonLdNodeObject`](../interfaces/IJsonLdNodeObject.md)[] \| `
|
|
3
|
+
> **IJsonLdDocument**: [`IJsonLdNodeObject`](../interfaces/IJsonLdNodeObject.md) \| [`IJsonLdNodeObject`](../interfaces/IJsonLdNodeObject.md)[] \| \{ `@context`: [`IJsonLdKeyword`](IJsonLdKeyword.md)\[`"@context"`\]; `@graph`: [`IJsonLdKeyword`](IJsonLdKeyword.md)\[`"@graph"`\]; \}
|
|
4
4
|
|
|
5
5
|
A JSON-LD document MUST be valid JSON text as described in [RFC8259],
|
|
6
6
|
or some format that can be represented in the JSON-LD internal representation
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Type Alias: IJsonLdExpandedTermDefinition
|
|
2
2
|
|
|
3
|
-
> **IJsonLdExpandedTermDefinition**: `object` & `
|
|
3
|
+
> **IJsonLdExpandedTermDefinition**: `object` & \{ `@id`: [`IJsonLdKeyword`](IJsonLdKeyword.md)\[`"@id"`\] \| `null`; `@nest`: `"@nest"` \| `string`; `@container`: [`IJsonLdKeyword`](IJsonLdKeyword.md)\[`"@container"`\]; \} \| \{ `@reverse`: [`IJsonLdKeyword`](IJsonLdKeyword.md)\[`"@reverse"`\]; `@container`: `"@set"` \| `"@index"` \| `null`; \}
|
|
4
4
|
|
|
5
5
|
An expanded term definition is used to describe the mapping between a term
|
|
6
6
|
and its expanded identifier, as well as other properties of the value
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Type Alias: IJsonLdValueObject
|
|
2
2
|
|
|
3
|
-
> **IJsonLdValueObject**: `object` & `
|
|
3
|
+
> **IJsonLdValueObject**: `object` & \{ `@value`: [`IJsonLdKeyword`](IJsonLdKeyword.md)\[`"@value"`\]; `@language`: [`IJsonLdKeyword`](IJsonLdKeyword.md)\[`"@language"`\]; `@direction`: [`IJsonLdKeyword`](IJsonLdKeyword.md)\[`"@direction"`\]; \} \| \{ `@value`: [`IJsonLdKeyword`](IJsonLdKeyword.md)\[`"@value"`\]; `@type`: [`IJsonLdKeyword`](IJsonLdKeyword.md)\[`"@type"`\]; \} \| \{ `@value`: [`IJsonLdKeyword`](IJsonLdKeyword.md)\[`"@value"`\] \| [`IJsonLdJsonObject`](../interfaces/IJsonLdJsonObject.md) \| [`IJsonLdJsonArray`](IJsonLdJsonArray.md); `@type`: `"@json"`; \}
|
|
4
4
|
|
|
5
5
|
A value object is used to explicitly associate a type or a language with a value
|
|
6
6
|
to create a typed value or a language-tagged string and possibly associate a base direction.
|
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.16",
|
|
4
4
|
"description": "Models which define the structure of JSON LD",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,13 +15,13 @@
|
|
|
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.16",
|
|
19
19
|
"@twin.org/entity": "next",
|
|
20
20
|
"@twin.org/nameof": "next",
|
|
21
21
|
"@twin.org/web": "next",
|
|
22
22
|
"@types/json-schema": "7.0.15",
|
|
23
23
|
"@types/jsonld": "1.5.15",
|
|
24
|
-
"jsonld": "8.3.
|
|
24
|
+
"jsonld": "8.3.3"
|
|
25
25
|
},
|
|
26
26
|
"main": "./dist/cjs/index.cjs",
|
|
27
27
|
"module": "./dist/esm/index.mjs",
|