@twin.org/data-json-ld 0.0.1-next.10

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 (46) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +21 -0
  3. package/dist/cjs/index.cjs +1750 -0
  4. package/dist/esm/index.mjs +1745 -0
  5. package/dist/types/dataTypes/jsonLdDataTypes.d.ts +9 -0
  6. package/dist/types/index.d.ts +5 -0
  7. package/dist/types/models/IJsonLdDocument.d.ts +222 -0
  8. package/dist/types/models/jsonLdTypes.d.ts +109 -0
  9. package/dist/types/utils/jsonLdHelper.d.ts +16 -0
  10. package/dist/types/utils/jsonLdProcessor.d.ts +65 -0
  11. package/docs/changelog.md +5 -0
  12. package/docs/examples.md +1 -0
  13. package/docs/reference/classes/JsonLdDataTypes.md +25 -0
  14. package/docs/reference/classes/JsonLdHelper.md +45 -0
  15. package/docs/reference/classes/JsonLdProcessor.md +199 -0
  16. package/docs/reference/index.md +44 -0
  17. package/docs/reference/interfaces/IJsonLdContextDefinition.md +73 -0
  18. package/docs/reference/interfaces/IJsonLdGraphObject.md +31 -0
  19. package/docs/reference/interfaces/IJsonLdIdMap.md +11 -0
  20. package/docs/reference/interfaces/IJsonLdIndexMap.md +12 -0
  21. package/docs/reference/interfaces/IJsonLdJsonObject.md +5 -0
  22. package/docs/reference/interfaces/IJsonLdLanguageMap.md +11 -0
  23. package/docs/reference/interfaces/IJsonLdListObject.md +19 -0
  24. package/docs/reference/interfaces/IJsonLdNodeObject.md +100 -0
  25. package/docs/reference/interfaces/IJsonLdObject.md +64 -0
  26. package/docs/reference/interfaces/IJsonLdSetObject.md +19 -0
  27. package/docs/reference/interfaces/IJsonLdTypeMap.md +11 -0
  28. package/docs/reference/type-aliases/IJsonLdContainerType.md +3 -0
  29. package/docs/reference/type-aliases/IJsonLdContainerTypeArray.md +3 -0
  30. package/docs/reference/type-aliases/IJsonLdContextDefinitionElement.md +5 -0
  31. package/docs/reference/type-aliases/IJsonLdContextDefinitionRoot.md +5 -0
  32. package/docs/reference/type-aliases/IJsonLdDocument.md +11 -0
  33. package/docs/reference/type-aliases/IJsonLdExpandedTermDefinition.md +41 -0
  34. package/docs/reference/type-aliases/IJsonLdIncludedBlock.md +9 -0
  35. package/docs/reference/type-aliases/IJsonLdIndexMapItem.md +5 -0
  36. package/docs/reference/type-aliases/IJsonLdJsonArray.md +3 -0
  37. package/docs/reference/type-aliases/IJsonLdJsonPrimitive.md +3 -0
  38. package/docs/reference/type-aliases/IJsonLdJsonValue.md +3 -0
  39. package/docs/reference/type-aliases/IJsonLdKeyword.md +105 -0
  40. package/docs/reference/type-aliases/IJsonLdListOrSetItem.md +5 -0
  41. package/docs/reference/type-aliases/IJsonLdNodePrimitive.md +5 -0
  42. package/docs/reference/type-aliases/IJsonLdValueObject.md +20 -0
  43. package/docs/reference/type-aliases/JsonLdTypes.md +5 -0
  44. package/docs/reference/variables/JsonLdTypes.md +157 -0
  45. package/locales/en.json +7 -0
  46. package/package.json +44 -0
@@ -0,0 +1,9 @@
1
+ # Type Alias: IJsonLdIncludedBlock
2
+
3
+ > **IJsonLdIncludedBlock**: [`IJsonLdNodeObject`](../interfaces/IJsonLdNodeObject.md) \| [`IJsonLdNodeObject`](../interfaces/IJsonLdNodeObject.md)[]
4
+
5
+ An included block is used to provide a set of node objects.
6
+
7
+ ## See
8
+
9
+ https://www.w3.org/TR/json-ld11/#included-blocks
@@ -0,0 +1,5 @@
1
+ # Type Alias: IJsonLdIndexMapItem
2
+
3
+ > **IJsonLdIndexMapItem**: `null` \| `boolean` \| `number` \| `string` \| [`IJsonLdNodeObject`](../interfaces/IJsonLdNodeObject.md) \| [`IJsonLdValueObject`](IJsonLdValueObject.md) \| [`IJsonLdListObject`](../interfaces/IJsonLdListObject.md) \| [`IJsonLdSetObject`](../interfaces/IJsonLdSetObject.md)
4
+
5
+ The items that can be stored in an index map.
@@ -0,0 +1,3 @@
1
+ # Type Alias: IJsonLdJsonArray
2
+
3
+ > **IJsonLdJsonArray**: [`IJsonLdJsonValue`](IJsonLdJsonValue.md)[]
@@ -0,0 +1,3 @@
1
+ # Type Alias: IJsonLdJsonPrimitive
2
+
3
+ > **IJsonLdJsonPrimitive**: `string` \| `number` \| `boolean` \| `null`
@@ -0,0 +1,3 @@
1
+ # Type Alias: IJsonLdJsonValue
2
+
3
+ > **IJsonLdJsonValue**: [`IJsonLdJsonPrimitive`](IJsonLdJsonPrimitive.md) \| [`IJsonLdJsonArray`](IJsonLdJsonArray.md) \| [`IJsonLdJsonObject`](../interfaces/IJsonLdJsonObject.md)
@@ -0,0 +1,105 @@
1
+ # Type Alias: IJsonLdKeyword
2
+
3
+ > **IJsonLdKeyword**: `object`
4
+
5
+ A list of keywords and their types.
6
+ Only used for internal reference; not an actual interface.
7
+ Not for export.
8
+
9
+ ## Type declaration
10
+
11
+ ### @base
12
+
13
+ > **@base**: `string` \| `null`
14
+
15
+ ### @container
16
+
17
+ > **@container**: `"@list"` \| `"@set"` \| [`IJsonLdContainerType`](IJsonLdContainerType.md) \| (`"@list"` \| `"@set"` \| [`IJsonLdContainerType`](IJsonLdContainerType.md))[] \| [`IJsonLdContainerTypeArray`](IJsonLdContainerTypeArray.md) \| `null`
18
+
19
+ ### @context
20
+
21
+ > **@context**: [`IJsonLdContextDefinitionRoot`](IJsonLdContextDefinitionRoot.md)
22
+
23
+ ### @direction
24
+
25
+ > **@direction**: `"ltr"` \| `"rtl"` \| `null`
26
+
27
+ ### @graph
28
+
29
+ > **@graph**: [`IJsonLdValueObject`](IJsonLdValueObject.md) \| [`IJsonLdNodeObject`](../interfaces/IJsonLdNodeObject.md) \| ([`IJsonLdValueObject`](IJsonLdValueObject.md) \| [`IJsonLdNodeObject`](../interfaces/IJsonLdNodeObject.md))[]
30
+
31
+ ### @id
32
+
33
+ > **@id**: `string` \| `string`[]
34
+
35
+ ### @import
36
+
37
+ > **@import**: `string`
38
+
39
+ ### @included
40
+
41
+ > **@included**: [`IJsonLdIncludedBlock`](IJsonLdIncludedBlock.md)
42
+
43
+ ### @index
44
+
45
+ > **@index**: `string`
46
+
47
+ ### @json
48
+
49
+ > **@json**: `"@json"`
50
+
51
+ ### @language
52
+
53
+ > **@language**: `string`
54
+
55
+ ### @list
56
+
57
+ > **@list**: [`IJsonLdListOrSetItem`](IJsonLdListOrSetItem.md) \| [`IJsonLdListOrSetItem`](IJsonLdListOrSetItem.md)[]
58
+
59
+ ### @nest
60
+
61
+ > **@nest**: `object`
62
+
63
+ ### @none
64
+
65
+ > **@none**: `"@none"`
66
+
67
+ ### @prefix
68
+
69
+ > **@prefix**: `boolean`
70
+
71
+ ### @propagate
72
+
73
+ > **@propagate**: `boolean`
74
+
75
+ ### @protected
76
+
77
+ > **@protected**: `boolean`
78
+
79
+ ### @reverse
80
+
81
+ > **@reverse**: `string`
82
+
83
+ ### @set
84
+
85
+ > **@set**: [`IJsonLdListOrSetItem`](IJsonLdListOrSetItem.md) \| [`IJsonLdListOrSetItem`](IJsonLdListOrSetItem.md)[]
86
+
87
+ ### @type
88
+
89
+ > **@type**: `string`
90
+
91
+ ### @value
92
+
93
+ > **@value**: `null` \| `boolean` \| `number` \| `string`
94
+
95
+ ### @version
96
+
97
+ > **@version**: `"1.1"`
98
+
99
+ ### @vocab
100
+
101
+ > **@vocab**: `string` \| `null`
102
+
103
+ ## See
104
+
105
+ https://www.w3.org/TR/json-ld/#keywords
@@ -0,0 +1,5 @@
1
+ # Type Alias: IJsonLdListOrSetItem
2
+
3
+ > **IJsonLdListOrSetItem**: `null` \| `boolean` \| `number` \| `string` \| [`IJsonLdNodeObject`](../interfaces/IJsonLdNodeObject.md) \| [`IJsonLdValueObject`](IJsonLdValueObject.md)
4
+
5
+ A list or set item can be a null, boolean, number, string, node object, or value object.
@@ -0,0 +1,5 @@
1
+ # Type Alias: IJsonLdNodePrimitive
2
+
3
+ > **IJsonLdNodePrimitive**: `null` \| `boolean` \| `number` \| `string` \| [`IJsonLdNodeObject`](../interfaces/IJsonLdNodeObject.md) \| [`IJsonLdGraphObject`](../interfaces/IJsonLdGraphObject.md) \| [`IJsonLdValueObject`](IJsonLdValueObject.md) \| [`IJsonLdListObject`](../interfaces/IJsonLdListObject.md) \| [`IJsonLdSetObject`](../interfaces/IJsonLdSetObject.md)
4
+
5
+ A node primitive is a JSON-LD value which is not one of the defined NodeObject properties.
@@ -0,0 +1,20 @@
1
+ # Type Alias: IJsonLdValueObject
2
+
3
+ > **IJsonLdValueObject**: `object` & `object` \| `object` \| `object`
4
+
5
+ A value object is used to explicitly associate a type or a language with a value
6
+ to create a typed value or a language-tagged string and possibly associate a base direction.
7
+
8
+ ## Type declaration
9
+
10
+ ### @index?
11
+
12
+ > `optional` **@index**: [`IJsonLdKeyword`](IJsonLdKeyword.md)\[`"@index"`\]
13
+
14
+ ### @context?
15
+
16
+ > `optional` **@context**: [`IJsonLdKeyword`](IJsonLdKeyword.md)\[`"@context"`\]
17
+
18
+ ## See
19
+
20
+ https://www.w3.org/TR/json-ld11/#value-objects
@@ -0,0 +1,5 @@
1
+ # Type Alias: JsonLdTypes
2
+
3
+ > **JsonLdTypes**: *typeof* [`JsonLdTypes`](../variables/JsonLdTypes.md)\[keyof *typeof* [`JsonLdTypes`](../variables/JsonLdTypes.md)\]
4
+
5
+ The types of JSON-LD data.
@@ -0,0 +1,157 @@
1
+ # Variable: JsonLdTypes
2
+
3
+ > `const` **JsonLdTypes**: `object`
4
+
5
+ The types 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.
14
+
15
+ ### Document
16
+
17
+ > `readonly` **Document**: `"https://schema.twindev.org/json-ld/JsonLdDocument"` = `"https://schema.twindev.org/json-ld/JsonLdDocument"`
18
+
19
+ Represents JSON-LD Document.
20
+
21
+ ### Object
22
+
23
+ > `readonly` **Object**: `"https://schema.twindev.org/json-ld/JsonLdObject"` = `"https://schema.twindev.org/json-ld/JsonLdObject"`
24
+
25
+ Represents JSON-LD Object.
26
+
27
+ ### NodeObject
28
+
29
+ > `readonly` **NodeObject**: `"https://schema.twindev.org/json-ld/JsonLdNodeObject"` = `"https://schema.twindev.org/json-ld/JsonLdNodeObject"`
30
+
31
+ Represents JSON-LD Node Object.
32
+
33
+ ### NodePrimitive
34
+
35
+ > `readonly` **NodePrimitive**: `"https://schema.twindev.org/json-ld/JsonLdNodePrimitive"` = `"https://schema.twindev.org/json-ld/JsonLdNodePrimitive"`
36
+
37
+ Represents JSON-LD Node Primitive.
38
+
39
+ ### GraphObject
40
+
41
+ > `readonly` **GraphObject**: `"https://schema.twindev.org/json-ld/JsonLdGraphObject"` = `"https://schema.twindev.org/json-ld/JsonLdGraphObject"`
42
+
43
+ Represents JSON-LD Graph Object.
44
+
45
+ ### ValueObject
46
+
47
+ > `readonly` **ValueObject**: `"https://schema.twindev.org/json-ld/JsonLdValueObject"` = `"https://schema.twindev.org/json-ld/JsonLdValueObject"`
48
+
49
+ Represents JSON-LD Value Object.
50
+
51
+ ### ListObject
52
+
53
+ > `readonly` **ListObject**: `"https://schema.twindev.org/json-ld/JsonLdListObject"` = `"https://schema.twindev.org/json-ld/JsonLdListObject"`
54
+
55
+ Represents JSON-LD List Object.
56
+
57
+ ### SetObject
58
+
59
+ > `readonly` **SetObject**: `"https://schema.twindev.org/json-ld/JsonLdSetObject"` = `"https://schema.twindev.org/json-ld/JsonLdSetObject"`
60
+
61
+ Represents JSON-LD Set Object.
62
+
63
+ ### LanguageMap
64
+
65
+ > `readonly` **LanguageMap**: `"https://schema.twindev.org/json-ld/JsonLdLanguageMap"` = `"https://schema.twindev.org/json-ld/JsonLdLanguageMap"`
66
+
67
+ Represents JSON-LD Language Map.
68
+
69
+ ### IndexMap
70
+
71
+ > `readonly` **IndexMap**: `"https://schema.twindev.org/json-ld/JsonLdIndexMap"` = `"https://schema.twindev.org/json-ld/JsonLdIndexMap"`
72
+
73
+ Represents JSON-LD Index Map.
74
+
75
+ ### IndexMapItem
76
+
77
+ > `readonly` **IndexMapItem**: `"https://schema.twindev.org/json-ld/JsonLdIndexMapItem"` = `"https://schema.twindev.org/json-ld/JsonLdIndexMapItem"`
78
+
79
+ Represents JSON-LD Index Map Item.
80
+
81
+ ### IdMap
82
+
83
+ > `readonly` **IdMap**: `"https://schema.twindev.org/json-ld/JsonLdIdMap"` = `"https://schema.twindev.org/json-ld/JsonLdIdMap"`
84
+
85
+ Represents JSON-LD Id Map.
86
+
87
+ ### TypeMap
88
+
89
+ > `readonly` **TypeMap**: `"https://schema.twindev.org/json-ld/JsonLdTypeMap"` = `"https://schema.twindev.org/json-ld/JsonLdTypeMap"`
90
+
91
+ Represents JSON-LD Type Map.
92
+
93
+ ### IncludedBlock
94
+
95
+ > `readonly` **IncludedBlock**: `"https://schema.twindev.org/json-ld/JsonLdIncludedBlock"` = `"https://schema.twindev.org/json-ld/JsonLdIncludedBlock"`
96
+
97
+ Represents JSON-LD Included block.
98
+
99
+ ### ContextDefinition
100
+
101
+ > `readonly` **ContextDefinition**: `"https://schema.twindev.org/json-ld/JsonLdContextDefinition"` = `"https://schema.twindev.org/json-ld/JsonLdContextDefinition"`
102
+
103
+ Represents JSON-LD Context Definition.
104
+
105
+ ### ExpandedTermDefinition
106
+
107
+ > `readonly` **ExpandedTermDefinition**: `"https://schema.twindev.org/json-ld/JsonLdExpandedTermDefinition"` = `"https://schema.twindev.org/json-ld/JsonLdExpandedTermDefinition"`
108
+
109
+ Represents JSON-LD Expanded Term Definition.
110
+
111
+ ### Keyword
112
+
113
+ > `readonly` **Keyword**: `"https://schema.twindev.org/json-ld/JsonLdKeyword"` = `"https://schema.twindev.org/json-ld/JsonLdKeyword"`
114
+
115
+ Represents JSON-LD Keyword.
116
+
117
+ ### ListOrSetItem
118
+
119
+ > `readonly` **ListOrSetItem**: `"https://schema.twindev.org/json-ld/JsonLdListOrSetItem"` = `"https://schema.twindev.org/json-ld/JsonLdListOrSetItem"`
120
+
121
+ Represents JSON-LD List or Set Item.
122
+
123
+ ### ContainerType
124
+
125
+ > `readonly` **ContainerType**: `"https://schema.twindev.org/json-ld/JsonLdContainerType"` = `"https://schema.twindev.org/json-ld/JsonLdContainerType"`
126
+
127
+ Represents JSON-LD Container Type.
128
+
129
+ ### ContainerTypeArray
130
+
131
+ > `readonly` **ContainerTypeArray**: `"https://schema.twindev.org/json-ld/JsonLdContainerTypeArray"` = `"https://schema.twindev.org/json-ld/JsonLdContainerTypeArray"`
132
+
133
+ Represents JSON-LD Container Type Array.
134
+
135
+ ### JsonPrimitive
136
+
137
+ > `readonly` **JsonPrimitive**: `"https://schema.twindev.org/json-ld/JsonLdJsonPrimitive"` = `"https://schema.twindev.org/json-ld/JsonLdJsonPrimitive"`
138
+
139
+ Represents JSON-LD JSON Primitive.
140
+
141
+ ### JsonArray
142
+
143
+ > `readonly` **JsonArray**: `"https://schema.twindev.org/json-ld/JsonLdJsonArray"` = `"https://schema.twindev.org/json-ld/JsonLdJsonArray"`
144
+
145
+ Represents JSON-LD JSON Array.
146
+
147
+ ### JsonObject
148
+
149
+ > `readonly` **JsonObject**: `"https://schema.twindev.org/json-ld/JsonLdJsonObject"` = `"https://schema.twindev.org/json-ld/JsonLdJsonObject"`
150
+
151
+ Represents JSON-LD JSON Object.
152
+
153
+ ### JsonValue
154
+
155
+ > `readonly` **JsonValue**: `"https://schema.twindev.org/json-ld/JsonLdJsonValue"` = `"https://schema.twindev.org/json-ld/JsonLdJsonValue"`
156
+
157
+ Represents JSON-LD JSON Value.
@@ -0,0 +1,7 @@
1
+ {
2
+ "jsonLdProcessor": {
3
+ "compact": "The JSON-LD compaction failed",
4
+ "expand": "The JSON-LD expansion failed",
5
+ "invalidUrl": "The JSON-LD processing failed to retrieve from the following url \"{url}\""
6
+ }
7
+ }
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@twin.org/data-json-ld",
3
+ "version": "0.0.1-next.10",
4
+ "description": "Models which define the structure of JSON LD",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/twinfoundation/data.git",
8
+ "directory": "packages/data-json-ld"
9
+ },
10
+ "author": "martyn.janes@iota.org",
11
+ "license": "Apache-2.0",
12
+ "type": "module",
13
+ "engines": {
14
+ "node": ">=20.0.0"
15
+ },
16
+ "dependencies": {
17
+ "@twin.org/core": "next",
18
+ "@twin.org/data-core": "0.0.1-next.10",
19
+ "@twin.org/entity": "next",
20
+ "@twin.org/nameof": "next",
21
+ "@twin.org/web": "next",
22
+ "@types/json-schema": "7.0.15",
23
+ "@types/jsonld": "1.5.15",
24
+ "jsonld": "8.3.2"
25
+ },
26
+ "main": "./dist/cjs/index.cjs",
27
+ "module": "./dist/esm/index.mjs",
28
+ "types": "./dist/types/index.d.ts",
29
+ "exports": {
30
+ ".": {
31
+ "require": "./dist/cjs/index.cjs",
32
+ "import": "./dist/esm/index.mjs",
33
+ "types": "./dist/types/index.d.ts"
34
+ },
35
+ "./locales": "./locales"
36
+ },
37
+ "files": [
38
+ "dist/cjs",
39
+ "dist/esm",
40
+ "dist/types",
41
+ "locales",
42
+ "docs"
43
+ ]
44
+ }