@twin.org/data-json-ld 0.0.1-next.19 → 0.0.1-next.21

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.
Files changed (41) hide show
  1. package/dist/cjs/index.cjs +136 -117
  2. package/dist/esm/index.mjs +137 -118
  3. package/dist/types/index.d.ts +25 -0
  4. package/dist/types/models/IJsonLdContainerType.d.ts +8 -0
  5. package/dist/types/models/IJsonLdContainerTypeArray.d.ts +9 -0
  6. package/dist/types/models/IJsonLdContextDefinition.d.ts +25 -0
  7. package/dist/types/models/IJsonLdContextDefinitionElement.d.ts +9 -0
  8. package/dist/types/models/IJsonLdContextDefinitionRoot.d.ts +9 -0
  9. package/dist/types/models/IJsonLdDocument.d.ts +2 -204
  10. package/dist/types/models/IJsonLdExpandedTermDefinition.d.ts +28 -0
  11. package/dist/types/models/IJsonLdGraphObject.d.ts +16 -0
  12. package/dist/types/models/IJsonLdIdMap.d.ts +12 -0
  13. package/dist/types/models/IJsonLdIncludedBlock.d.ts +10 -0
  14. package/dist/types/models/IJsonLdIndexMap.d.ts +13 -0
  15. package/dist/types/models/IJsonLdIndexMapItem.d.ts +12 -0
  16. package/dist/types/models/IJsonLdJsonArray.d.ts +9 -0
  17. package/dist/types/models/IJsonLdJsonObject.d.ts +11 -0
  18. package/dist/types/models/IJsonLdJsonPrimitive.d.ts +8 -0
  19. package/dist/types/models/IJsonLdJsonValue.d.ts +11 -0
  20. package/dist/types/models/IJsonLdKeyword.d.ts +42 -0
  21. package/dist/types/models/IJsonLdLanguageMap.d.ts +11 -0
  22. package/dist/types/models/IJsonLdListObject.d.ts +13 -0
  23. package/dist/types/models/IJsonLdListOrSetItem.d.ts +10 -0
  24. package/dist/types/models/IJsonLdNodeObject.d.ts +19 -0
  25. package/dist/types/models/IJsonLdNodePrimitive.d.ts +13 -0
  26. package/dist/types/models/IJsonLdObject.d.ts +24 -0
  27. package/dist/types/models/IJsonLdSetObject.d.ts +13 -0
  28. package/dist/types/models/IJsonLdTypeMap.d.ts +12 -0
  29. package/dist/types/models/IJsonLdValueObject.d.ts +26 -0
  30. package/dist/types/utils/jsonLdProcessor.d.ts +6 -6
  31. package/docs/changelog.md +1 -1
  32. package/docs/reference/classes/JsonLdProcessor.md +21 -7
  33. package/docs/reference/index.md +17 -17
  34. package/docs/reference/interfaces/IJsonLdJsonObject.md +2 -0
  35. package/docs/reference/interfaces/IJsonLdNodeObject.md +1 -1
  36. package/docs/reference/type-aliases/IJsonLdContainerType.md +2 -0
  37. package/docs/reference/type-aliases/IJsonLdContainerTypeArray.md +2 -0
  38. package/docs/reference/type-aliases/IJsonLdJsonArray.md +2 -0
  39. package/docs/reference/type-aliases/IJsonLdJsonPrimitive.md +2 -0
  40. package/docs/reference/type-aliases/IJsonLdJsonValue.md +2 -0
  41. package/package.json +2 -2
@@ -34,15 +34,19 @@ The document loader to use.
34
34
 
35
35
  ### compact()
36
36
 
37
- > `static` **compact**(`document`, `context`?): `Promise`\<[`IJsonLdDocument`](../type-aliases/IJsonLdDocument.md)\>
37
+ > `static` **compact**\<`T`\>(`document`, `context`?): `Promise`\<`T`\>
38
38
 
39
39
  Compact a document according to a particular context.
40
40
 
41
+ #### Type Parameters
42
+
43
+ • **T** *extends* [`IJsonLdNodeObject`](../interfaces/IJsonLdNodeObject.md)
44
+
41
45
  #### Parameters
42
46
 
43
47
  ##### document
44
48
 
45
- [`IJsonLdDocument`](../type-aliases/IJsonLdDocument.md)
49
+ `T`
46
50
 
47
51
  The JSON-LD document to compact.
48
52
 
@@ -54,7 +58,7 @@ The context to compact the document to, if not provided will try and gather from
54
58
 
55
59
  #### Returns
56
60
 
57
- `Promise`\<[`IJsonLdDocument`](../type-aliases/IJsonLdDocument.md)\>
61
+ `Promise`\<`T`\>
58
62
 
59
63
  The compacted JSON-LD document.
60
64
 
@@ -62,21 +66,25 @@ The compacted JSON-LD document.
62
66
 
63
67
  ### expand()
64
68
 
65
- > `static` **expand**(`compacted`): `Promise`\<[`IJsonLdDocument`](../type-aliases/IJsonLdDocument.md)\>
69
+ > `static` **expand**\<`T`\>(`compacted`): `Promise`\<[`IJsonLdNodeObject`](../interfaces/IJsonLdNodeObject.md)[]\>
66
70
 
67
71
  Expand a document, removing its context.
68
72
 
73
+ #### Type Parameters
74
+
75
+ • **T** *extends* [`IJsonLdNodeObject`](../interfaces/IJsonLdNodeObject.md)
76
+
69
77
  #### Parameters
70
78
 
71
79
  ##### compacted
72
80
 
73
- [`IJsonLdDocument`](../type-aliases/IJsonLdDocument.md)
81
+ `T`
74
82
 
75
83
  The compacted JSON-LD document to expand.
76
84
 
77
85
  #### Returns
78
86
 
79
- `Promise`\<[`IJsonLdDocument`](../type-aliases/IJsonLdDocument.md)\>
87
+ `Promise`\<[`IJsonLdNodeObject`](../interfaces/IJsonLdNodeObject.md)[]\>
80
88
 
81
89
  The expanded JSON-LD document.
82
90
 
@@ -138,14 +146,20 @@ The combined context.
138
146
 
139
147
  ### gatherContexts()
140
148
 
141
- > `static` **gatherContexts**(`element`, `initial`?): `undefined` \| [`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md)
149
+ > `static` **gatherContexts**\<`T`\>(`element`, `initial`?): `undefined` \| [`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md)
142
150
 
143
151
  Gather all the contexts from the element and it's children.
144
152
 
153
+ #### Type Parameters
154
+
155
+ • **T** *extends* [`IJsonLdNodeObject`](../interfaces/IJsonLdNodeObject.md)
156
+
145
157
  #### Parameters
146
158
 
147
159
  ##### element
148
160
 
161
+ `T`
162
+
149
163
  The element to gather the contexts from.
150
164
 
151
165
  ##### initial?
@@ -8,35 +8,35 @@
8
8
 
9
9
  ## Interfaces
10
10
 
11
- - [IJsonLdNodeObject](interfaces/IJsonLdNodeObject.md)
12
- - [IJsonLdObject](interfaces/IJsonLdObject.md)
11
+ - [IJsonLdContextDefinition](interfaces/IJsonLdContextDefinition.md)
13
12
  - [IJsonLdGraphObject](interfaces/IJsonLdGraphObject.md)
13
+ - [IJsonLdIdMap](interfaces/IJsonLdIdMap.md)
14
+ - [IJsonLdIndexMap](interfaces/IJsonLdIndexMap.md)
15
+ - [IJsonLdJsonObject](interfaces/IJsonLdJsonObject.md)
16
+ - [IJsonLdLanguageMap](interfaces/IJsonLdLanguageMap.md)
14
17
  - [IJsonLdListObject](interfaces/IJsonLdListObject.md)
18
+ - [IJsonLdNodeObject](interfaces/IJsonLdNodeObject.md)
19
+ - [IJsonLdObject](interfaces/IJsonLdObject.md)
15
20
  - [IJsonLdSetObject](interfaces/IJsonLdSetObject.md)
16
- - [IJsonLdLanguageMap](interfaces/IJsonLdLanguageMap.md)
17
- - [IJsonLdIndexMap](interfaces/IJsonLdIndexMap.md)
18
- - [IJsonLdIdMap](interfaces/IJsonLdIdMap.md)
19
21
  - [IJsonLdTypeMap](interfaces/IJsonLdTypeMap.md)
20
- - [IJsonLdContextDefinition](interfaces/IJsonLdContextDefinition.md)
21
- - [IJsonLdJsonObject](interfaces/IJsonLdJsonObject.md)
22
22
 
23
23
  ## Type Aliases
24
24
 
25
- - [IJsonLdDocument](type-aliases/IJsonLdDocument.md)
26
- - [IJsonLdNodePrimitive](type-aliases/IJsonLdNodePrimitive.md)
27
- - [IJsonLdValueObject](type-aliases/IJsonLdValueObject.md)
28
- - [IJsonLdIndexMapItem](type-aliases/IJsonLdIndexMapItem.md)
29
- - [IJsonLdIncludedBlock](type-aliases/IJsonLdIncludedBlock.md)
25
+ - [IJsonLdContainerType](type-aliases/IJsonLdContainerType.md)
26
+ - [IJsonLdContainerTypeArray](type-aliases/IJsonLdContainerTypeArray.md)
30
27
  - [IJsonLdContextDefinitionElement](type-aliases/IJsonLdContextDefinitionElement.md)
31
28
  - [IJsonLdContextDefinitionRoot](type-aliases/IJsonLdContextDefinitionRoot.md)
29
+ - [IJsonLdDocument](type-aliases/IJsonLdDocument.md)
32
30
  - [IJsonLdExpandedTermDefinition](type-aliases/IJsonLdExpandedTermDefinition.md)
33
- - [IJsonLdKeyword](type-aliases/IJsonLdKeyword.md)
34
- - [IJsonLdListOrSetItem](type-aliases/IJsonLdListOrSetItem.md)
35
- - [IJsonLdContainerType](type-aliases/IJsonLdContainerType.md)
36
- - [IJsonLdContainerTypeArray](type-aliases/IJsonLdContainerTypeArray.md)
37
- - [IJsonLdJsonPrimitive](type-aliases/IJsonLdJsonPrimitive.md)
31
+ - [IJsonLdIncludedBlock](type-aliases/IJsonLdIncludedBlock.md)
32
+ - [IJsonLdIndexMapItem](type-aliases/IJsonLdIndexMapItem.md)
38
33
  - [IJsonLdJsonArray](type-aliases/IJsonLdJsonArray.md)
34
+ - [IJsonLdJsonPrimitive](type-aliases/IJsonLdJsonPrimitive.md)
39
35
  - [IJsonLdJsonValue](type-aliases/IJsonLdJsonValue.md)
36
+ - [IJsonLdKeyword](type-aliases/IJsonLdKeyword.md)
37
+ - [IJsonLdListOrSetItem](type-aliases/IJsonLdListOrSetItem.md)
38
+ - [IJsonLdNodePrimitive](type-aliases/IJsonLdNodePrimitive.md)
39
+ - [IJsonLdValueObject](type-aliases/IJsonLdValueObject.md)
40
40
  - [JsonLdTypes](type-aliases/JsonLdTypes.md)
41
41
 
42
42
  ## Variables
@@ -1,5 +1,7 @@
1
1
  # Interface: IJsonLdJsonObject
2
2
 
3
+ JSON Type for object.
4
+
3
5
  ## Indexable
4
6
 
5
7
  \[`key`: `string`\]: `undefined` \| [`IJsonLdJsonValue`](../type-aliases/IJsonLdJsonValue.md)
@@ -13,7 +13,7 @@ https://www.w3.org/TR/json-ld11/#node-objects
13
13
 
14
14
  ## Indexable
15
15
 
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)[]
16
+ \[`key`: `string`\]: `undefined` \| `null` \| `string` \| `number` \| `boolean` \| `string`[] \| [`IJsonLdContextDefinition`](IJsonLdContextDefinition.md) \| [`IJsonLdContextDefinitionElement`](../type-aliases/IJsonLdContextDefinitionElement.md)[] \| [`IJsonLdIdMap`](IJsonLdIdMap.md) \| [`IJsonLdNodeObject`](IJsonLdNodeObject.md) \| [`IJsonLdListObject`](IJsonLdListObject.md) \| `object` & `object` \| `object` & `object` \| `object` & `object` \| [`IJsonLdSetObject`](IJsonLdSetObject.md) \| [`IJsonLdJsonObject`](IJsonLdJsonObject.md) \| [`IJsonLdIndexMap`](IJsonLdIndexMap.md) \| [`IJsonLdLanguageMap`](IJsonLdLanguageMap.md) \| [`IJsonLdGraphObject`](IJsonLdGraphObject.md) \| [`IJsonLdNodeObject`](IJsonLdNodeObject.md)[] \| [`IJsonLdJsonObject`](IJsonLdJsonObject.md)[] \| \{\} \| [`IJsonLdTypeMap`](IJsonLdTypeMap.md) \| [`IJsonLdNodePrimitive`](../type-aliases/IJsonLdNodePrimitive.md)[]
17
17
 
18
18
  ## Properties
19
19
 
@@ -1,3 +1,5 @@
1
1
  # Type Alias: IJsonLdContainerType
2
2
 
3
3
  > **IJsonLdContainerType**: `"@language"` \| `"@index"` \| `"@id"` \| `"@graph"` \| `"@type"`
4
+
5
+ Helper Types
@@ -1,3 +1,5 @@
1
1
  # Type Alias: IJsonLdContainerTypeArray
2
2
 
3
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"`\]
4
+
5
+ Helper Types.
@@ -1,3 +1,5 @@
1
1
  # Type Alias: IJsonLdJsonArray
2
2
 
3
3
  > **IJsonLdJsonArray**: [`IJsonLdJsonValue`](IJsonLdJsonValue.md)[]
4
+
5
+ JSON Type for array.
@@ -1,3 +1,5 @@
1
1
  # Type Alias: IJsonLdJsonPrimitive
2
2
 
3
3
  > **IJsonLdJsonPrimitive**: `string` \| `number` \| `boolean` \| `null`
4
+
5
+ JSON Primitive.
@@ -1,3 +1,5 @@
1
1
  # Type Alias: IJsonLdJsonValue
2
2
 
3
3
  > **IJsonLdJsonValue**: [`IJsonLdJsonPrimitive`](IJsonLdJsonPrimitive.md) \| [`IJsonLdJsonArray`](IJsonLdJsonArray.md) \| [`IJsonLdJsonObject`](../interfaces/IJsonLdJsonObject.md)
4
+
5
+ JSON Value.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/data-json-ld",
3
- "version": "0.0.1-next.19",
3
+ "version": "0.0.1-next.21",
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.19",
18
+ "@twin.org/data-core": "0.0.1-next.21",
19
19
  "@twin.org/entity": "next",
20
20
  "@twin.org/nameof": "next",
21
21
  "@twin.org/web": "next",