@twin.org/data-json-ld 0.0.2-next.4 → 0.0.3-next.2

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 (122) hide show
  1. package/dist/es/dataTypes/jsonLdDataTypes.js +171 -0
  2. package/dist/es/dataTypes/jsonLdDataTypes.js.map +1 -0
  3. package/dist/es/index.js +33 -0
  4. package/dist/es/index.js.map +1 -0
  5. package/dist/es/models/IJsonLdContainerType.js +4 -0
  6. package/dist/es/models/IJsonLdContainerType.js.map +1 -0
  7. package/dist/es/models/IJsonLdContainerTypeArray.js +2 -0
  8. package/dist/es/models/IJsonLdContainerTypeArray.js.map +1 -0
  9. package/dist/es/models/IJsonLdContextDefinition.js +2 -0
  10. package/dist/es/models/IJsonLdContextDefinition.js.map +1 -0
  11. package/dist/es/models/IJsonLdContextDefinitionElement.js +2 -0
  12. package/dist/es/models/IJsonLdContextDefinitionElement.js.map +1 -0
  13. package/dist/es/models/IJsonLdContextDefinitionRoot.js +2 -0
  14. package/dist/es/models/IJsonLdContextDefinitionRoot.js.map +1 -0
  15. package/dist/es/models/IJsonLdDocument.js +2 -0
  16. package/dist/es/models/IJsonLdDocument.js.map +1 -0
  17. package/dist/es/models/IJsonLdExpandedTermDefinition.js +2 -0
  18. package/dist/es/models/IJsonLdExpandedTermDefinition.js.map +1 -0
  19. package/dist/es/models/IJsonLdGraphObject.js +2 -0
  20. package/dist/es/models/IJsonLdGraphObject.js.map +1 -0
  21. package/dist/es/models/IJsonLdIdMap.js +2 -0
  22. package/dist/es/models/IJsonLdIdMap.js.map +1 -0
  23. package/dist/es/models/IJsonLdIncludedBlock.js +2 -0
  24. package/dist/es/models/IJsonLdIncludedBlock.js.map +1 -0
  25. package/dist/es/models/IJsonLdIndexMap.js +2 -0
  26. package/dist/es/models/IJsonLdIndexMap.js.map +1 -0
  27. package/dist/es/models/IJsonLdIndexMapItem.js +2 -0
  28. package/dist/es/models/IJsonLdIndexMapItem.js.map +1 -0
  29. package/dist/es/models/IJsonLdJsonArray.js +2 -0
  30. package/dist/es/models/IJsonLdJsonArray.js.map +1 -0
  31. package/dist/es/models/IJsonLdJsonObject.js +2 -0
  32. package/dist/es/models/IJsonLdJsonObject.js.map +1 -0
  33. package/dist/es/models/IJsonLdJsonPrimitive.js +4 -0
  34. package/dist/es/models/IJsonLdJsonPrimitive.js.map +1 -0
  35. package/dist/es/models/IJsonLdJsonValue.js +2 -0
  36. package/dist/es/models/IJsonLdJsonValue.js.map +1 -0
  37. package/dist/es/models/IJsonLdLanguageMap.js +4 -0
  38. package/dist/es/models/IJsonLdLanguageMap.js.map +1 -0
  39. package/dist/es/models/IJsonLdListObject.js +2 -0
  40. package/dist/es/models/IJsonLdListObject.js.map +1 -0
  41. package/dist/es/models/IJsonLdListOrSetItem.js +2 -0
  42. package/dist/es/models/IJsonLdListOrSetItem.js.map +1 -0
  43. package/dist/es/models/IJsonLdNodeObject.js +2 -0
  44. package/dist/es/models/IJsonLdNodeObject.js.map +1 -0
  45. package/dist/es/models/IJsonLdNodePrimitive.js +2 -0
  46. package/dist/es/models/IJsonLdNodePrimitive.js.map +1 -0
  47. package/dist/es/models/IJsonLdObject.js +2 -0
  48. package/dist/es/models/IJsonLdObject.js.map +1 -0
  49. package/dist/es/models/IJsonLdSetObject.js +2 -0
  50. package/dist/es/models/IJsonLdSetObject.js.map +1 -0
  51. package/dist/es/models/IJsonLdTypeMap.js +2 -0
  52. package/dist/es/models/IJsonLdTypeMap.js.map +1 -0
  53. package/dist/es/models/IJsonLdValueObject.js +2 -0
  54. package/dist/es/models/IJsonLdValueObject.js.map +1 -0
  55. package/dist/es/models/jsonLdContexts.js +13 -0
  56. package/dist/es/models/jsonLdContexts.js.map +1 -0
  57. package/dist/es/models/jsonLdTypes.js +113 -0
  58. package/dist/es/models/jsonLdTypes.js.map +1 -0
  59. package/dist/es/schemas/JsonLdContainerType.json +13 -0
  60. package/dist/es/schemas/JsonLdContainerTypeArray.json +179 -0
  61. package/dist/es/schemas/JsonLdContextDefinition.json +76 -0
  62. package/dist/es/schemas/JsonLdContextDefinitionElement.json +16 -0
  63. package/dist/es/schemas/JsonLdContextDefinitionRoot.json +16 -0
  64. package/dist/es/schemas/JsonLdDocument.json +48 -0
  65. package/dist/es/schemas/JsonLdExpandedTermDefinition.json +136 -0
  66. package/dist/es/schemas/JsonLdGraphObject.json +44 -0
  67. package/dist/es/schemas/JsonLdIdMap.json +9 -0
  68. package/dist/es/schemas/JsonLdIncludedBlock.json +16 -0
  69. package/dist/es/schemas/JsonLdIndexMap.json +19 -0
  70. package/dist/es/schemas/JsonLdIndexMapItem.json +31 -0
  71. package/dist/es/schemas/JsonLdJsonArray.json +9 -0
  72. package/dist/es/schemas/JsonLdJsonObject.json +16 -0
  73. package/dist/es/schemas/JsonLdJsonPrimitive.json +11 -0
  74. package/dist/es/schemas/JsonLdJsonValue.json +16 -0
  75. package/dist/es/schemas/JsonLdLanguageMap.json +22 -0
  76. package/dist/es/schemas/JsonLdListObject.json +28 -0
  77. package/dist/es/schemas/JsonLdListOrSetItem.json +25 -0
  78. package/dist/es/schemas/JsonLdNodeObject.json +100 -0
  79. package/dist/es/schemas/JsonLdNodePrimitive.json +34 -0
  80. package/dist/es/schemas/JsonLdObject.json +76 -0
  81. package/dist/es/schemas/JsonLdSetObject.json +28 -0
  82. package/dist/es/schemas/JsonLdTypeMap.json +16 -0
  83. package/dist/es/schemas/JsonLdValueObject.json +113 -0
  84. package/dist/es/utils/jsonLdHelper.js +131 -0
  85. package/dist/es/utils/jsonLdHelper.js.map +1 -0
  86. package/dist/es/utils/jsonLdProcessor.js +375 -0
  87. package/dist/es/utils/jsonLdProcessor.js.map +1 -0
  88. package/dist/types/index.d.ts +30 -30
  89. package/dist/types/models/IJsonLdContainerTypeArray.d.ts +1 -1
  90. package/dist/types/models/IJsonLdContextDefinition.d.ts +1 -1
  91. package/dist/types/models/IJsonLdContextDefinitionElement.d.ts +1 -1
  92. package/dist/types/models/IJsonLdContextDefinitionRoot.d.ts +1 -1
  93. package/dist/types/models/IJsonLdDocument.d.ts +3 -3
  94. package/dist/types/models/IJsonLdExpandedTermDefinition.d.ts +3 -3
  95. package/dist/types/models/IJsonLdGraphObject.d.ts +2 -2
  96. package/dist/types/models/IJsonLdIdMap.d.ts +1 -1
  97. package/dist/types/models/IJsonLdIncludedBlock.d.ts +1 -1
  98. package/dist/types/models/IJsonLdIndexMap.d.ts +1 -1
  99. package/dist/types/models/IJsonLdIndexMapItem.d.ts +4 -4
  100. package/dist/types/models/IJsonLdJsonArray.d.ts +1 -1
  101. package/dist/types/models/IJsonLdJsonObject.d.ts +1 -1
  102. package/dist/types/models/IJsonLdJsonValue.d.ts +3 -3
  103. package/dist/types/models/IJsonLdListObject.d.ts +1 -1
  104. package/dist/types/models/IJsonLdListOrSetItem.d.ts +2 -2
  105. package/dist/types/models/IJsonLdNodeObject.d.ts +7 -7
  106. package/dist/types/models/IJsonLdNodePrimitive.d.ts +5 -5
  107. package/dist/types/models/IJsonLdObject.d.ts +4 -4
  108. package/dist/types/models/IJsonLdSetObject.d.ts +1 -1
  109. package/dist/types/models/IJsonLdTypeMap.d.ts +1 -1
  110. package/dist/types/models/IJsonLdValueObject.d.ts +3 -3
  111. package/dist/types/utils/jsonLdHelper.d.ts +20 -1
  112. package/dist/types/utils/jsonLdProcessor.d.ts +4 -4
  113. package/docs/changelog.md +50 -0
  114. package/docs/reference/classes/JsonLdHelper.md +72 -0
  115. package/docs/reference/classes/JsonLdProcessor.md +9 -9
  116. package/docs/reference/interfaces/IJsonLdContextDefinition.md +4 -4
  117. package/docs/reference/interfaces/IJsonLdJsonObject.md +1 -1
  118. package/docs/reference/interfaces/IJsonLdLanguageMap.md +1 -1
  119. package/docs/reference/interfaces/IJsonLdNodeObject.md +1 -1
  120. package/package.json +6 -8
  121. package/dist/cjs/index.cjs +0 -2018
  122. package/dist/esm/index.mjs +0 -2012
@@ -1,4 +1,4 @@
1
- import type { IJsonLdContextDefinition } from "./IJsonLdContextDefinition";
1
+ import type { IJsonLdContextDefinition } from "./IJsonLdContextDefinition.js";
2
2
  /**
3
3
  * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
4
4
  * that are used in other packages cannot understand some of the types e.g. OrArray
@@ -1,4 +1,4 @@
1
- import type { IJsonLdContextDefinitionElement } from "./IJsonLdContextDefinitionElement";
1
+ import type { IJsonLdContextDefinitionElement } from "./IJsonLdContextDefinitionElement.js";
2
2
  /**
3
3
  * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
4
4
  * that are used in other packages cannot understand some of the types e.g. OrArray
@@ -1,6 +1,6 @@
1
- import type { IJsonLdContextDefinitionRoot } from "./IJsonLdContextDefinitionRoot";
2
- import type { IJsonLdNodeObject } from "./IJsonLdNodeObject";
3
- import type { IJsonLdValueObject } from "./IJsonLdValueObject";
1
+ import type { IJsonLdContextDefinitionRoot } from "./IJsonLdContextDefinitionRoot.js";
2
+ import type { IJsonLdNodeObject } from "./IJsonLdNodeObject.js";
3
+ import type { IJsonLdValueObject } from "./IJsonLdValueObject.js";
4
4
  /**
5
5
  * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
6
6
  * that are used in other packages cannot understand some of the types e.g. OrArray
@@ -1,6 +1,6 @@
1
- import type { IJsonLdContainerType } from "./IJsonLdContainerType";
2
- import type { IJsonLdContainerTypeArray } from "./IJsonLdContainerTypeArray";
3
- import type { IJsonLdContextDefinition } from "./IJsonLdContextDefinition";
1
+ import type { IJsonLdContainerType } from "./IJsonLdContainerType.js";
2
+ import type { IJsonLdContainerTypeArray } from "./IJsonLdContainerTypeArray.js";
3
+ import type { IJsonLdContextDefinition } from "./IJsonLdContextDefinition.js";
4
4
  /**
5
5
  * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
6
6
  * that are used in other packages cannot understand some of the types e.g. OrArray
@@ -1,5 +1,5 @@
1
- import type { IJsonLdContextDefinitionRoot } from "./IJsonLdContextDefinitionRoot";
2
- import type { IJsonLdNodeObject } from "./IJsonLdNodeObject";
1
+ import type { IJsonLdContextDefinitionRoot } from "./IJsonLdContextDefinitionRoot.js";
2
+ import type { IJsonLdNodeObject } from "./IJsonLdNodeObject.js";
3
3
  /**
4
4
  * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
5
5
  * that are used in other packages cannot understand some of the types e.g. OrArray
@@ -1,4 +1,4 @@
1
- import type { IJsonLdNodeObject } from "./IJsonLdNodeObject";
1
+ import type { IJsonLdNodeObject } from "./IJsonLdNodeObject.js";
2
2
  /**
3
3
  * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
4
4
  * that are used in other packages cannot understand some of the types e.g. OrArray
@@ -1,4 +1,4 @@
1
- import type { IJsonLdNodeObject } from "./IJsonLdNodeObject";
1
+ import type { IJsonLdNodeObject } from "./IJsonLdNodeObject.js";
2
2
  /**
3
3
  * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
4
4
  * that are used in other packages cannot understand some of the types e.g. OrArray
@@ -1,4 +1,4 @@
1
- import type { IJsonLdIndexMapItem } from "./IJsonLdIndexMapItem";
1
+ import type { IJsonLdIndexMapItem } from "./IJsonLdIndexMapItem.js";
2
2
  /**
3
3
  * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
4
4
  * that are used in other packages cannot understand some of the types e.g. OrArray
@@ -1,7 +1,7 @@
1
- import type { IJsonLdListObject } from "./IJsonLdListObject";
2
- import type { IJsonLdNodeObject } from "./IJsonLdNodeObject";
3
- import type { IJsonLdSetObject } from "./IJsonLdSetObject";
4
- import type { IJsonLdValueObject } from "./IJsonLdValueObject";
1
+ import type { IJsonLdListObject } from "./IJsonLdListObject.js";
2
+ import type { IJsonLdNodeObject } from "./IJsonLdNodeObject.js";
3
+ import type { IJsonLdSetObject } from "./IJsonLdSetObject.js";
4
+ import type { IJsonLdValueObject } from "./IJsonLdValueObject.js";
5
5
  /**
6
6
  * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
7
7
  * that are used in other packages cannot understand some of the types e.g. OrArray
@@ -1,4 +1,4 @@
1
- import type { IJsonLdJsonValue } from "./IJsonLdJsonValue";
1
+ import type { IJsonLdJsonValue } from "./IJsonLdJsonValue.js";
2
2
  /**
3
3
  * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
4
4
  * that are used in other packages cannot understand some of the types e.g. OrArray
@@ -1,4 +1,4 @@
1
- import type { IJsonLdJsonValue } from "./IJsonLdJsonValue";
1
+ import type { IJsonLdJsonValue } from "./IJsonLdJsonValue.js";
2
2
  /**
3
3
  * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
4
4
  * that are used in other packages cannot understand some of the types e.g. OrArray
@@ -1,6 +1,6 @@
1
- import type { IJsonLdJsonArray } from "./IJsonLdJsonArray";
2
- import type { IJsonLdJsonObject } from "./IJsonLdJsonObject";
3
- import type { IJsonLdJsonPrimitive } from "./IJsonLdJsonPrimitive";
1
+ import type { IJsonLdJsonArray } from "./IJsonLdJsonArray.js";
2
+ import type { IJsonLdJsonObject } from "./IJsonLdJsonObject.js";
3
+ import type { IJsonLdJsonPrimitive } from "./IJsonLdJsonPrimitive.js";
4
4
  /**
5
5
  * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
6
6
  * that are used in other packages cannot understand some of the types e.g. OrArray
@@ -1,4 +1,4 @@
1
- import type { IJsonLdListOrSetItem } from "./IJsonLdListOrSetItem";
1
+ import type { IJsonLdListOrSetItem } from "./IJsonLdListOrSetItem.js";
2
2
  /**
3
3
  * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
4
4
  * that are used in other packages cannot understand some of the types e.g. OrArray
@@ -1,5 +1,5 @@
1
- import type { IJsonLdNodeObject } from "./IJsonLdNodeObject";
2
- import type { IJsonLdValueObject } from "./IJsonLdValueObject";
1
+ import type { IJsonLdNodeObject } from "./IJsonLdNodeObject.js";
2
+ import type { IJsonLdValueObject } from "./IJsonLdValueObject.js";
3
3
  /**
4
4
  * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
5
5
  * that are used in other packages cannot understand some of the types e.g. OrArray
@@ -1,10 +1,10 @@
1
- import type { IJsonLdIdMap } from "./IJsonLdIdMap";
2
- import type { IJsonLdIncludedBlock } from "./IJsonLdIncludedBlock";
3
- import type { IJsonLdIndexMap } from "./IJsonLdIndexMap";
4
- import type { IJsonLdLanguageMap } from "./IJsonLdLanguageMap";
5
- import type { IJsonLdNodePrimitive } from "./IJsonLdNodePrimitive";
6
- import type { IJsonLdObject } from "./IJsonLdObject";
7
- import type { IJsonLdTypeMap } from "./IJsonLdTypeMap";
1
+ import type { IJsonLdIdMap } from "./IJsonLdIdMap.js";
2
+ import type { IJsonLdIncludedBlock } from "./IJsonLdIncludedBlock.js";
3
+ import type { IJsonLdIndexMap } from "./IJsonLdIndexMap.js";
4
+ import type { IJsonLdLanguageMap } from "./IJsonLdLanguageMap.js";
5
+ import type { IJsonLdNodePrimitive } from "./IJsonLdNodePrimitive.js";
6
+ import type { IJsonLdObject } from "./IJsonLdObject.js";
7
+ import type { IJsonLdTypeMap } from "./IJsonLdTypeMap.js";
8
8
  /**
9
9
  * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
10
10
  * that are used in other packages cannot understand some of the types e.g. OrArray
@@ -1,8 +1,8 @@
1
- import type { IJsonLdGraphObject } from "./IJsonLdGraphObject";
2
- import type { IJsonLdListObject } from "./IJsonLdListObject";
3
- import type { IJsonLdNodeObject } from "./IJsonLdNodeObject";
4
- import type { IJsonLdSetObject } from "./IJsonLdSetObject";
5
- import type { IJsonLdValueObject } from "./IJsonLdValueObject";
1
+ import type { IJsonLdGraphObject } from "./IJsonLdGraphObject.js";
2
+ import type { IJsonLdListObject } from "./IJsonLdListObject.js";
3
+ import type { IJsonLdNodeObject } from "./IJsonLdNodeObject.js";
4
+ import type { IJsonLdSetObject } from "./IJsonLdSetObject.js";
5
+ import type { IJsonLdValueObject } from "./IJsonLdValueObject.js";
6
6
  /**
7
7
  * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
8
8
  * that are used in other packages cannot understand some of the types e.g. OrArray
@@ -1,7 +1,7 @@
1
- import type { IJsonLdContextDefinitionRoot } from "./IJsonLdContextDefinitionRoot";
2
- import type { IJsonLdIncludedBlock } from "./IJsonLdIncludedBlock";
3
- import type { IJsonLdJsonObject } from "./IJsonLdJsonObject";
4
- import type { IJsonLdNodeObject } from "./IJsonLdNodeObject";
1
+ import type { IJsonLdContextDefinitionRoot } from "./IJsonLdContextDefinitionRoot.js";
2
+ import type { IJsonLdIncludedBlock } from "./IJsonLdIncludedBlock.js";
3
+ import type { IJsonLdJsonObject } from "./IJsonLdJsonObject.js";
4
+ import type { IJsonLdNodeObject } from "./IJsonLdNodeObject.js";
5
5
  /**
6
6
  * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
7
7
  * that are used in other packages cannot understand some of the types e.g. OrArray
@@ -1,4 +1,4 @@
1
- import type { IJsonLdListOrSetItem } from "./IJsonLdListOrSetItem";
1
+ import type { IJsonLdListOrSetItem } from "./IJsonLdListOrSetItem.js";
2
2
  /**
3
3
  * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
4
4
  * that are used in other packages cannot understand some of the types e.g. OrArray
@@ -1,4 +1,4 @@
1
- import type { IJsonLdNodeObject } from "./IJsonLdNodeObject";
1
+ import type { IJsonLdNodeObject } from "./IJsonLdNodeObject.js";
2
2
  /**
3
3
  * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
4
4
  * that are used in other packages cannot understand some of the types e.g. OrArray
@@ -1,6 +1,6 @@
1
- import type { IJsonLdContextDefinitionRoot } from "./IJsonLdContextDefinitionRoot";
2
- import type { IJsonLdJsonArray } from "./IJsonLdJsonArray";
3
- import type { IJsonLdJsonObject } from "./IJsonLdJsonObject";
1
+ import type { IJsonLdContextDefinitionRoot } from "./IJsonLdContextDefinitionRoot.js";
2
+ import type { IJsonLdJsonArray } from "./IJsonLdJsonArray.js";
3
+ import type { IJsonLdJsonObject } from "./IJsonLdJsonObject.js";
4
4
  /**
5
5
  * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
6
6
  * that are used in other packages cannot understand some of the types e.g. OrArray
@@ -1,6 +1,6 @@
1
1
  import { type IValidationFailure } from "@twin.org/core";
2
2
  import { type ValidationMode } from "@twin.org/data-core";
3
- import type { IJsonLdDocument } from "../models/IJsonLdDocument";
3
+ import type { IJsonLdDocument } from "../models/IJsonLdDocument.js";
4
4
  /**
5
5
  * Class to help with JSON LD.
6
6
  */
@@ -18,4 +18,23 @@ export declare class JsonLdHelper {
18
18
  validationMode?: ValidationMode;
19
19
  failOnMissingType?: boolean;
20
20
  }): Promise<boolean>;
21
+ /**
22
+ * Expand the JSON-LD document and check if it is of a specific type.
23
+ * @param document The JSON-LD document to check.
24
+ * @param type The type to check for.
25
+ * @returns True if the document is of the specified type.
26
+ */
27
+ static isType(document: IJsonLdDocument, type: string[]): Promise<boolean>;
28
+ /**
29
+ * Get the types from the document.
30
+ * @param document The JSON-LD document to check.
31
+ * @returns The type(s) extracted from the document.
32
+ */
33
+ static getType(document: IJsonLdDocument): Promise<string[]>;
34
+ /**
35
+ * Get the id from the document.
36
+ * @param document The JSON-LD document to get the id from.
37
+ * @returns The id extracted from the document.
38
+ */
39
+ static getId(document: IJsonLdDocument): Promise<string | undefined>;
21
40
  }
@@ -1,7 +1,7 @@
1
- import type { RemoteDocument, Url } from "jsonld/jsonld-spec";
2
- import type { IJsonLdContextDefinitionElement } from "../models/IJsonLdContextDefinitionElement";
3
- import type { IJsonLdContextDefinitionRoot } from "../models/IJsonLdContextDefinitionRoot";
4
- import type { IJsonLdNodeObject } from "../models/IJsonLdNodeObject";
1
+ import type { RemoteDocument, Url } from "jsonld/jsonld-spec.js";
2
+ import type { IJsonLdContextDefinitionElement } from "../models/IJsonLdContextDefinitionElement.js";
3
+ import type { IJsonLdContextDefinitionRoot } from "../models/IJsonLdContextDefinitionRoot.js";
4
+ import type { IJsonLdNodeObject } from "../models/IJsonLdNodeObject.js";
5
5
  /**
6
6
  * JSON-LD Processor.
7
7
  */
package/docs/changelog.md CHANGED
@@ -1,5 +1,55 @@
1
1
  # @twin.org/data-json-ld - Changelog
2
2
 
3
+ ## [0.0.3-next.2](https://github.com/twinfoundation/data/compare/data-json-ld-v0.0.3-next.1...data-json-ld-v0.0.3-next.2) (2025-11-24)
4
+
5
+
6
+ ### Features
7
+
8
+ * add JsonLdHelper getId and getType ([4b43e41](https://github.com/twinfoundation/data/commit/4b43e41fa47a16a19d2c759f5e40a1fb51e0a128))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * add redirect remove duplicates ([49709e0](https://github.com/twinfoundation/data/commit/49709e04cf087e216f4c9e36a9f35daceeae98fd))
14
+
15
+
16
+ ### Dependencies
17
+
18
+ * The following workspace dependencies were updated
19
+ * dependencies
20
+ * @twin.org/data-core bumped from 0.0.3-next.1 to 0.0.3-next.2
21
+
22
+ ## [0.0.3-next.1](https://github.com/twinfoundation/data/compare/data-json-ld-v0.0.3-next.0...data-json-ld-v0.0.3-next.1) (2025-11-10)
23
+
24
+
25
+ ### Features
26
+
27
+ * add context id features ([#25](https://github.com/twinfoundation/data/issues/25)) ([6592f2e](https://github.com/twinfoundation/data/commit/6592f2e4e59021cc42a079a4f46242758a54313d))
28
+ * add document cache access methods ([dbf1e36](https://github.com/twinfoundation/data/commit/dbf1e36d176c5f428f8c52628fb5a1ff7a6a174a))
29
+ * add fail on missing type option and both mode ([e8b9702](https://github.com/twinfoundation/data/commit/e8b97029a04b646497ff0e55b9610291e58ae92a))
30
+ * add validate-locales ([cf9b761](https://github.com/twinfoundation/data/commit/cf9b76160820fe0b13b4fe56ed241c1d5511b7c1))
31
+ * eslint migration to flat config ([b0db6e6](https://github.com/twinfoundation/data/commit/b0db6e69a90046fc60d29e4273fcdfee13c16088))
32
+ * expand Json LD Keyword ([70632d1](https://github.com/twinfoundation/data/commit/70632d1e11ad85cf3c57e118476b125a673f1681))
33
+ * support multiple type JSON-LD ([8f0d530](https://github.com/twinfoundation/data/commit/8f0d530f66302ab19413ecf968f170f97456e31e))
34
+ * update framework core ([c077b8c](https://github.com/twinfoundation/data/commit/c077b8c07e7ee66b5482254eab6f2a52cd911270))
35
+ * update ts-to-schema ([8c3cd91](https://github.com/twinfoundation/data/commit/8c3cd9131113f2d609f6e709562402e5c7766c1a))
36
+ * use fully qualified names for data type lookups ([b7b5c74](https://github.com/twinfoundation/data/commit/b7b5c746b0180a87baa976f6a7a76cedd53d8ff7))
37
+ * use shared store mechanism ([#3](https://github.com/twinfoundation/data/issues/3)) ([33eb221](https://github.com/twinfoundation/data/commit/33eb221ccec2b4a79549c06e9a04225009b93a46))
38
+ * use updated Is.function ([46a4715](https://github.com/twinfoundation/data/commit/46a4715f995aea34f2011138662fe003c9727d07))
39
+ * use updated JSON schema specs ([465223a](https://github.com/twinfoundation/data/commit/465223a9e9c24af546480ef084327a78fa366eaa))
40
+
41
+
42
+ ### Bug Fixes
43
+
44
+ * itemListElement compaction override ([d908a10](https://github.com/twinfoundation/data/commit/d908a1043d7792e31b3101221d17850757b6c2a6))
45
+
46
+
47
+ ### Dependencies
48
+
49
+ * The following workspace dependencies were updated
50
+ * dependencies
51
+ * @twin.org/data-core bumped from 0.0.3-next.0 to 0.0.3-next.1
52
+
3
53
  ## [0.0.2-next.4](https://github.com/twinfoundation/data/compare/data-json-ld-v0.0.2-next.3...data-json-ld-v0.0.2-next.4) (2025-10-09)
4
54
 
5
55
 
@@ -61,3 +61,75 @@ If true, will fail validation if the data type is missing, defaults to false.
61
61
  `Promise`\<`boolean`\>
62
62
 
63
63
  True if the document was valid.
64
+
65
+ ***
66
+
67
+ ### isType()
68
+
69
+ > `static` **isType**(`document`, `type`): `Promise`\<`boolean`\>
70
+
71
+ Expand the JSON-LD document and check if it is of a specific type.
72
+
73
+ #### Parameters
74
+
75
+ ##### document
76
+
77
+ [`IJsonLdDocument`](../type-aliases/IJsonLdDocument.md)
78
+
79
+ The JSON-LD document to check.
80
+
81
+ ##### type
82
+
83
+ `string`[]
84
+
85
+ The type to check for.
86
+
87
+ #### Returns
88
+
89
+ `Promise`\<`boolean`\>
90
+
91
+ True if the document is of the specified type.
92
+
93
+ ***
94
+
95
+ ### getType()
96
+
97
+ > `static` **getType**(`document`): `Promise`\<`string`[]\>
98
+
99
+ Get the types from the document.
100
+
101
+ #### Parameters
102
+
103
+ ##### document
104
+
105
+ [`IJsonLdDocument`](../type-aliases/IJsonLdDocument.md)
106
+
107
+ The JSON-LD document to check.
108
+
109
+ #### Returns
110
+
111
+ `Promise`\<`string`[]\>
112
+
113
+ The type(s) extracted from the document.
114
+
115
+ ***
116
+
117
+ ### getId()
118
+
119
+ > `static` **getId**(`document`): `Promise`\<`string` \| `undefined`\>
120
+
121
+ Get the id from the document.
122
+
123
+ #### Parameters
124
+
125
+ ##### document
126
+
127
+ [`IJsonLdDocument`](../type-aliases/IJsonLdDocument.md)
128
+
129
+ The JSON-LD document to get the id from.
130
+
131
+ #### Returns
132
+
133
+ `Promise`\<`string` \| `undefined`\>
134
+
135
+ The id extracted from the document.
@@ -264,7 +264,7 @@ The URL to redirect to.
264
264
 
265
265
  ### combineContexts()
266
266
 
267
- > `static` **combineContexts**(`context1`, `context2`): `undefined` \| [`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md)
267
+ > `static` **combineContexts**(`context1`, `context2`): [`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md) \| `undefined`
268
268
 
269
269
  Combine contexts.
270
270
 
@@ -274,17 +274,17 @@ Combine contexts.
274
274
 
275
275
  The first JSON-LD context to combine.
276
276
 
277
- `undefined` | [`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md)
277
+ [`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md) | `undefined`
278
278
 
279
279
  ##### context2
280
280
 
281
281
  The second JSON-LD context to combine.
282
282
 
283
- `undefined` | [`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md)
283
+ [`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md) | `undefined`
284
284
 
285
285
  #### Returns
286
286
 
287
- `undefined` \| [`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md)
287
+ [`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md) \| `undefined`
288
288
 
289
289
  The combined context.
290
290
 
@@ -292,7 +292,7 @@ The combined context.
292
292
 
293
293
  ### gatherContexts()
294
294
 
295
- > `static` **gatherContexts**\<`T`\>(`element`, `initial?`): `undefined` \| [`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md)
295
+ > `static` **gatherContexts**\<`T`\>(`element`, `initial?`): [`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md) \| `undefined`
296
296
 
297
297
  Gather all the contexts from the element and it's children.
298
298
 
@@ -318,7 +318,7 @@ The initial context.
318
318
 
319
319
  #### Returns
320
320
 
321
- `undefined` \| [`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md)
321
+ [`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md) \| `undefined`
322
322
 
323
323
  The combined contexts.
324
324
 
@@ -326,7 +326,7 @@ The combined contexts.
326
326
 
327
327
  ### removeContexts()
328
328
 
329
- > `static` **removeContexts**(`context`, `match?`): `undefined` \| [`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md)
329
+ > `static` **removeContexts**(`context`, `match?`): [`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md) \| `undefined`
330
330
 
331
331
  Remove all the contexts that match the pattern.
332
332
 
@@ -336,7 +336,7 @@ Remove all the contexts that match the pattern.
336
336
 
337
337
  The context to remove the entries from.
338
338
 
339
- `undefined` | [`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md)
339
+ [`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md) | `undefined`
340
340
 
341
341
  ##### match?
342
342
 
@@ -346,7 +346,7 @@ The element to try and match.
346
346
 
347
347
  #### Returns
348
348
 
349
- `undefined` \| [`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md)
349
+ [`IJsonLdContextDefinitionRoot`](../type-aliases/IJsonLdContextDefinitionRoot.md) \| `undefined`
350
350
 
351
351
  The updated contexts.
352
352
 
@@ -8,19 +8,19 @@ https://www.w3.org/TR/json-ld11/#context-definitions
8
8
 
9
9
  ## Indexable
10
10
 
11
- \[`key`: `string`\]: `undefined` \| `null` \| `string` \| `boolean` \| [`IJsonLdExpandedTermDefinition`](../type-aliases/IJsonLdExpandedTermDefinition.md) \| \{ `@container`: `"@set"`; `@protected?`: `boolean`; \}
11
+ \[`key`: `string`\]: `string` \| `boolean` \| [`IJsonLdExpandedTermDefinition`](../type-aliases/IJsonLdExpandedTermDefinition.md) \| \{ `@container`: `"@set"`; `@protected?`: `boolean`; \} \| `null` \| `undefined`
12
12
 
13
13
  ## Properties
14
14
 
15
15
  ### @base?
16
16
 
17
- > `optional` **@base**: `null` \| `string`
17
+ > `optional` **@base**: `string` \| `null`
18
18
 
19
19
  ***
20
20
 
21
21
  ### @direction?
22
22
 
23
- > `optional` **@direction**: `null` \| `"ltr"` \| `"rtl"`
23
+ > `optional` **@direction**: `"ltr"` \| `"rtl"` \| `null`
24
24
 
25
25
  ***
26
26
 
@@ -70,4 +70,4 @@ https://www.w3.org/TR/json-ld11/#context-definitions
70
70
 
71
71
  ### @vocab?
72
72
 
73
- > `optional` **@vocab**: `null` \| `string`
73
+ > `optional` **@vocab**: `string` \| `null`
@@ -4,4 +4,4 @@ JSON Type for object.
4
4
 
5
5
  ## Indexable
6
6
 
7
- \[`key`: `string`\]: `undefined` \| [`IJsonLdJsonValue`](../type-aliases/IJsonLdJsonValue.md)
7
+ \[`key`: `string`\]: [`IJsonLdJsonValue`](../type-aliases/IJsonLdJsonValue.md) \| `undefined`
@@ -8,4 +8,4 @@ https://www.w3.org/TR/json-ld11/#language-maps
8
8
 
9
9
  ## Indexable
10
10
 
11
- \[`key`: `string`\]: `null` \| `string` \| `string`[]
11
+ \[`key`: `string`\]: `string` \| `string`[] \| `null`
@@ -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`[] \| [`IJsonLdContextDefinition`](IJsonLdContextDefinition.md) \| [`IJsonLdContextDefinitionElement`](../type-aliases/IJsonLdContextDefinitionElement.md)[] \| [`IJsonLdIdMap`](IJsonLdIdMap.md) \| `IJsonLdNodeObject` \| `IJsonLdNodeObject`[] \| [`IJsonLdJsonObject`](IJsonLdJsonObject.md) \| `object` & `object` \| `object` & `object` \| `object` & `object` \| [`IJsonLdListObject`](IJsonLdListObject.md) \| [`IJsonLdSetObject`](IJsonLdSetObject.md) \| [`IJsonLdIndexMap`](IJsonLdIndexMap.md) \| [`IJsonLdLanguageMap`](IJsonLdLanguageMap.md) \| [`IJsonLdGraphObject`](IJsonLdGraphObject.md) \| [`IJsonLdJsonObject`](IJsonLdJsonObject.md)[] \| \{\[`key`: `string`\]: `string`; \} \| [`IJsonLdTypeMap`](IJsonLdTypeMap.md) \| [`IJsonLdNodePrimitive`](../type-aliases/IJsonLdNodePrimitive.md)[]
16
+ \[`key`: `string`\]: `string` \| `number` \| `boolean` \| `string`[] \| [`IJsonLdContextDefinition`](IJsonLdContextDefinition.md) \| [`IJsonLdContextDefinitionElement`](../type-aliases/IJsonLdContextDefinitionElement.md)[] \| [`IJsonLdIdMap`](IJsonLdIdMap.md) \| `IJsonLdNodeObject` \| `IJsonLdNodeObject`[] \| [`IJsonLdJsonObject`](IJsonLdJsonObject.md) \| `object` & `object` \| `object` & `object` \| `object` & `object` \| [`IJsonLdListObject`](IJsonLdListObject.md) \| [`IJsonLdSetObject`](IJsonLdSetObject.md) \| [`IJsonLdIndexMap`](IJsonLdIndexMap.md) \| [`IJsonLdLanguageMap`](IJsonLdLanguageMap.md) \| [`IJsonLdGraphObject`](IJsonLdGraphObject.md) \| [`IJsonLdJsonObject`](IJsonLdJsonObject.md)[] \| \{\[`key`: `string`\]: `string`; \} \| [`IJsonLdTypeMap`](IJsonLdTypeMap.md) \| [`IJsonLdNodePrimitive`](../type-aliases/IJsonLdNodePrimitive.md)[] \| `null` \| `undefined`
17
17
 
18
18
  ## Properties
19
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/data-json-ld",
3
- "version": "0.0.2-next.4",
3
+ "version": "0.0.3-next.2",
4
4
  "description": "Models which define the structure of JSON LD",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,27 +15,25 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@twin.org/core": "next",
18
- "@twin.org/data-core": "0.0.2-next.4",
18
+ "@twin.org/data-core": "0.0.3-next.2",
19
19
  "@twin.org/entity": "next",
20
20
  "@twin.org/nameof": "next",
21
21
  "@twin.org/web": "next",
22
22
  "@types/jsonld": "1.5.15",
23
23
  "jsonld": "8.3.3"
24
24
  },
25
- "main": "./dist/cjs/index.cjs",
26
- "module": "./dist/esm/index.mjs",
25
+ "main": "./dist/es/index.js",
27
26
  "types": "./dist/types/index.d.ts",
28
27
  "exports": {
29
28
  ".": {
30
29
  "types": "./dist/types/index.d.ts",
31
- "require": "./dist/cjs/index.cjs",
32
- "import": "./dist/esm/index.mjs"
30
+ "import": "./dist/es/index.js",
31
+ "default": "./dist/es/index.js"
33
32
  },
34
33
  "./locales/*.json": "./locales/*.json"
35
34
  },
36
35
  "files": [
37
- "dist/cjs",
38
- "dist/esm",
36
+ "dist/es",
39
37
  "dist/types",
40
38
  "locales",
41
39
  "docs"