@twin.org/auditable-item-graph-models 0.0.3-next.8 → 0.9.0-next.1

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 (119) hide show
  1. package/README.md +3 -1
  2. package/dist/es/dataTypes/auditableItemGraphDataTypes.js +47 -43
  3. package/dist/es/dataTypes/auditableItemGraphDataTypes.js.map +1 -1
  4. package/dist/es/index.js +11 -0
  5. package/dist/es/index.js.map +1 -1
  6. package/dist/es/models/IAuditableItemGraphAlias.js.map +1 -1
  7. package/dist/es/models/IAuditableItemGraphAuditedElement.js.map +1 -1
  8. package/dist/es/models/IAuditableItemGraphChangeset.js.map +1 -1
  9. package/dist/es/models/IAuditableItemGraphChangesetList.js.map +1 -1
  10. package/dist/es/models/IAuditableItemGraphComponent.js.map +1 -1
  11. package/dist/es/models/IAuditableItemGraphEdge.js.map +1 -1
  12. package/dist/es/models/IAuditableItemGraphListPatch.js +2 -0
  13. package/dist/es/models/IAuditableItemGraphListPatch.js.map +1 -0
  14. package/dist/es/models/IAuditableItemGraphPartialVertex.js +2 -0
  15. package/dist/es/models/IAuditableItemGraphPartialVertex.js.map +1 -0
  16. package/dist/es/models/IAuditableItemGraphPatchOperation.js.map +1 -1
  17. package/dist/es/models/IAuditableItemGraphResource.js.map +1 -1
  18. package/dist/es/models/IAuditableItemGraphVertex.js.map +1 -1
  19. package/dist/es/models/IAuditableItemGraphVertexList.js.map +1 -1
  20. package/dist/es/models/IAuditableItemGraphVertexVersionList.js +2 -0
  21. package/dist/es/models/IAuditableItemGraphVertexVersionList.js.map +1 -0
  22. package/dist/es/models/api/IAuditableItemGraphCreateRequest.js.map +1 -1
  23. package/dist/es/models/api/IAuditableItemGraphRemoveProofRequest.js +4 -0
  24. package/dist/es/models/api/IAuditableItemGraphRemoveProofRequest.js.map +1 -0
  25. package/dist/es/models/api/IAuditableItemGraphUpdatePartialRequest.js +2 -0
  26. package/dist/es/models/api/IAuditableItemGraphUpdatePartialRequest.js.map +1 -0
  27. package/dist/es/models/api/IAuditableItemGraphUpdateRequest.js.map +1 -1
  28. package/dist/es/models/api/IAuditableItemGraphVersionGetRequest.js +2 -0
  29. package/dist/es/models/api/IAuditableItemGraphVersionGetRequest.js.map +1 -0
  30. package/dist/es/models/api/IAuditableItemGraphVersionGetResponse.js +2 -0
  31. package/dist/es/models/api/IAuditableItemGraphVersionGetResponse.js.map +1 -0
  32. package/dist/es/models/api/IAuditableItemGraphVersionListRequest.js +2 -0
  33. package/dist/es/models/api/IAuditableItemGraphVersionListRequest.js.map +1 -0
  34. package/dist/es/models/api/IAuditableItemGraphVersionListResponse.js +2 -0
  35. package/dist/es/models/api/IAuditableItemGraphVersionListResponse.js.map +1 -0
  36. package/dist/es/models/auditableItemGraphMetricIds.js +69 -0
  37. package/dist/es/models/auditableItemGraphMetricIds.js.map +1 -0
  38. package/dist/es/models/auditableItemGraphMetrics.js +82 -0
  39. package/dist/es/models/auditableItemGraphMetrics.js.map +1 -0
  40. package/dist/es/models/auditableItemGraphTypes.js +13 -1
  41. package/dist/es/models/auditableItemGraphTypes.js.map +1 -1
  42. package/dist/es/schemas/AuditableItemGraphAlias.json +18 -25
  43. package/dist/es/schemas/AuditableItemGraphAuditedElement.json +25 -0
  44. package/dist/es/schemas/AuditableItemGraphChangeset.json +14 -13
  45. package/dist/es/schemas/AuditableItemGraphEdge.json +15 -26
  46. package/dist/es/schemas/AuditableItemGraphListPatch.json +33 -0
  47. package/dist/es/schemas/AuditableItemGraphPartialVertex.json +110 -0
  48. package/dist/es/schemas/AuditableItemGraphPatchOperation.json +27 -19
  49. package/dist/es/schemas/AuditableItemGraphResource.json +9 -24
  50. package/dist/es/schemas/AuditableItemGraphVertex.json +39 -29
  51. package/dist/es/schemas/AuditableItemGraphVertexList.json +17 -20
  52. package/dist/types/index.d.ts +11 -0
  53. package/dist/types/models/IAuditableItemGraphAlias.d.ts +8 -3
  54. package/dist/types/models/IAuditableItemGraphAuditedElement.d.ts +3 -3
  55. package/dist/types/models/IAuditableItemGraphChangeset.d.ts +11 -5
  56. package/dist/types/models/IAuditableItemGraphChangesetList.d.ts +1 -1
  57. package/dist/types/models/IAuditableItemGraphComponent.d.ts +41 -45
  58. package/dist/types/models/IAuditableItemGraphEdge.d.ts +4 -4
  59. package/dist/types/models/IAuditableItemGraphListPatch.d.ts +18 -0
  60. package/dist/types/models/IAuditableItemGraphPartialVertex.d.ts +45 -0
  61. package/dist/types/models/IAuditableItemGraphPatchOperation.d.ts +4 -4
  62. package/dist/types/models/IAuditableItemGraphResource.d.ts +2 -2
  63. package/dist/types/models/IAuditableItemGraphVertex.d.ts +12 -6
  64. package/dist/types/models/IAuditableItemGraphVertexList.d.ts +1 -1
  65. package/dist/types/models/IAuditableItemGraphVertexVersionList.d.ts +29 -0
  66. package/dist/types/models/api/IAuditableItemGraphCreateRequest.d.ts +2 -31
  67. package/dist/types/models/api/IAuditableItemGraphRemoveProofRequest.d.ts +14 -0
  68. package/dist/types/models/api/IAuditableItemGraphUpdatePartialRequest.d.ts +20 -0
  69. package/dist/types/models/api/IAuditableItemGraphUpdateRequest.d.ts +4 -34
  70. package/dist/types/models/api/IAuditableItemGraphVersionGetRequest.d.ts +25 -0
  71. package/dist/types/models/api/IAuditableItemGraphVersionGetResponse.d.ts +17 -0
  72. package/dist/types/models/api/IAuditableItemGraphVersionListRequest.d.ts +34 -0
  73. package/dist/types/models/api/IAuditableItemGraphVersionListResponse.d.ts +17 -0
  74. package/dist/types/models/auditableItemGraphMetricIds.d.ts +69 -0
  75. package/dist/types/models/auditableItemGraphMetrics.d.ts +5 -0
  76. package/dist/types/models/auditableItemGraphTypes.d.ts +12 -0
  77. package/docs/changelog.md +269 -80
  78. package/docs/examples.md +22 -1
  79. package/docs/reference/classes/AuditableItemGraphDataTypes.md +1 -1
  80. package/docs/reference/index.md +12 -0
  81. package/docs/reference/interfaces/IAuditableItemGraphAlias.md +22 -19
  82. package/docs/reference/interfaces/IAuditableItemGraphAuditedElement.md +8 -11
  83. package/docs/reference/interfaces/IAuditableItemGraphChangeset.md +21 -17
  84. package/docs/reference/interfaces/IAuditableItemGraphChangesetGetRequest.md +6 -6
  85. package/docs/reference/interfaces/IAuditableItemGraphChangesetGetResponse.md +3 -3
  86. package/docs/reference/interfaces/IAuditableItemGraphChangesetList.md +3 -4
  87. package/docs/reference/interfaces/IAuditableItemGraphChangesetListRequest.md +8 -8
  88. package/docs/reference/interfaces/IAuditableItemGraphChangesetListResponse.md +4 -4
  89. package/docs/reference/interfaces/IAuditableItemGraphComponent.md +108 -58
  90. package/docs/reference/interfaces/IAuditableItemGraphCreateRequest.md +2 -26
  91. package/docs/reference/interfaces/IAuditableItemGraphEdge.md +15 -21
  92. package/docs/reference/interfaces/IAuditableItemGraphEventBusVertexCreated.md +1 -1
  93. package/docs/reference/interfaces/IAuditableItemGraphEventBusVertexUpdated.md +2 -2
  94. package/docs/reference/interfaces/IAuditableItemGraphGetRequest.md +7 -7
  95. package/docs/reference/interfaces/IAuditableItemGraphGetResponse.md +3 -3
  96. package/docs/reference/interfaces/IAuditableItemGraphListPatch.md +25 -0
  97. package/docs/reference/interfaces/IAuditableItemGraphListRequest.md +14 -14
  98. package/docs/reference/interfaces/IAuditableItemGraphListResponse.md +4 -4
  99. package/docs/reference/interfaces/IAuditableItemGraphPartialVertex.md +149 -0
  100. package/docs/reference/interfaces/IAuditableItemGraphPatchOperation.md +9 -13
  101. package/docs/reference/interfaces/IAuditableItemGraphRemoveProofRequest.md +17 -0
  102. package/docs/reference/interfaces/IAuditableItemGraphResource.md +13 -17
  103. package/docs/reference/interfaces/IAuditableItemGraphUpdatePartialRequest.md +26 -0
  104. package/docs/reference/interfaces/IAuditableItemGraphUpdateRequest.md +5 -29
  105. package/docs/reference/interfaces/IAuditableItemGraphVersionGetRequest.md +35 -0
  106. package/docs/reference/interfaces/IAuditableItemGraphVersionGetResponse.md +23 -0
  107. package/docs/reference/interfaces/IAuditableItemGraphVersionListRequest.md +49 -0
  108. package/docs/reference/interfaces/IAuditableItemGraphVersionListResponse.md +23 -0
  109. package/docs/reference/interfaces/IAuditableItemGraphVertex.md +30 -30
  110. package/docs/reference/interfaces/IAuditableItemGraphVertexList.md +3 -4
  111. package/docs/reference/interfaces/IAuditableItemGraphVertexVersionList.md +35 -0
  112. package/docs/reference/type-aliases/AuditableItemGraphMetricIds.md +5 -0
  113. package/docs/reference/variables/AuditableItemGraphContexts.md +6 -6
  114. package/docs/reference/variables/AuditableItemGraphMetricIds.md +97 -0
  115. package/docs/reference/variables/AuditableItemGraphMetrics.md +5 -0
  116. package/docs/reference/variables/AuditableItemGraphTopics.md +2 -2
  117. package/docs/reference/variables/AuditableItemGraphTypes.md +26 -8
  118. package/docs/reference/variables/VerifyDepth.md +3 -3
  119. package/package.json +13 -12
@@ -1,60 +1,45 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://schema.twindev.org/aig/AuditableItemGraphResource",
4
+ "title": "AuditableItemGraphResource",
4
5
  "description": "Interface describing an auditable item graph vertex resource.",
5
6
  "type": "object",
6
7
  "properties": {
7
- "id": {
8
- "type": "string",
9
- "description": "The id of the element."
10
- },
11
- "dateCreated": {
12
- "type": "string",
13
- "description": "The date/time of when the element was created. json-ld namespace:schema"
14
- },
15
- "dateModified": {
16
- "type": "string",
17
- "description": "The date/time of when the element was modified. json-ld namespace:schema"
18
- },
19
- "dateDeleted": {
20
- "type": "string",
21
- "description": "The date/time of when the element was deleted, as we never actually remove items. json-ld namespace:schema"
22
- },
23
8
  "@context": {
24
9
  "anyOf": [
25
10
  {
26
- "type": "string",
27
11
  "const": "https://schema.twindev.org/aig/"
28
12
  },
29
13
  {
30
14
  "type": "array",
31
- "minItems": 1,
32
15
  "prefixItems": [
33
16
  {
34
- "type": "string",
35
17
  "const": "https://schema.twindev.org/aig/"
36
18
  }
37
19
  ],
38
20
  "items": {
39
21
  "$ref": "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
40
- }
22
+ },
23
+ "minItems": 1
41
24
  }
42
25
  ],
43
26
  "description": "JSON-LD Context."
44
27
  },
45
28
  "type": {
46
- "type": "string",
47
29
  "const": "AuditableItemGraphResource",
48
30
  "description": "JSON-LD Type."
49
31
  },
50
32
  "resourceObject": {
51
33
  "$ref": "https://schema.twindev.org/json-ld/JsonLdNodeObject",
52
- "description": "The JSON-LD object for the resource. json-ld type:json"
34
+ "description": "The JSON-LD object for the resource."
53
35
  }
54
36
  },
55
37
  "required": [
56
- "@context",
57
38
  "type"
58
39
  ],
59
- "additionalProperties": false
40
+ "allOf": [
41
+ {
42
+ "$ref": "https://schema.twindev.org/aig/AuditableItemGraphAuditedElement"
43
+ }
44
+ ]
60
45
  }
@@ -1,80 +1,70 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://schema.twindev.org/aig/AuditableItemGraphVertex",
4
+ "title": "AuditableItemGraphVertex",
4
5
  "description": "Interface describing an auditable item graph vertex.",
5
6
  "type": "object",
6
7
  "properties": {
7
- "id": {
8
- "type": "string",
9
- "description": "The id of the element."
10
- },
11
- "dateCreated": {
12
- "type": "string",
13
- "description": "The date/time of when the element was created. json-ld namespace:schema"
14
- },
15
- "dateModified": {
16
- "type": "string",
17
- "description": "The date/time of when the element was modified. json-ld namespace:schema"
18
- },
19
- "dateDeleted": {
20
- "type": "string",
21
- "description": "The date/time of when the element was deleted, as we never actually remove items. json-ld namespace:schema"
22
- },
23
8
  "@context": {
24
9
  "type": "array",
25
- "minItems": 2,
26
- "description": "JSON-LD Context.",
27
10
  "prefixItems": [
28
11
  {
29
- "type": "string",
30
12
  "const": "https://schema.twindev.org/aig/"
31
13
  },
32
14
  {
33
- "type": "string",
34
15
  "const": "https://schema.twindev.org/common/"
35
16
  }
36
17
  ],
37
18
  "items": {
38
19
  "$ref": "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
39
- }
20
+ },
21
+ "minItems": 2,
22
+ "description": "JSON-LD Context."
40
23
  },
41
- "type": {
24
+ "id": {
42
25
  "type": "string",
26
+ "description": "The id of the element."
27
+ },
28
+ "type": {
43
29
  "const": "AuditableItemGraphVertex",
44
30
  "description": "JSON-LD Type."
45
31
  },
46
32
  "organizationIdentity": {
47
33
  "type": "string",
48
- "description": "The identity of the organization which controls the vertex. json-ld namespace:twin-common"
34
+ "description": "The identity of the organization which controls the vertex."
49
35
  },
50
36
  "annotationObject": {
51
37
  "$ref": "https://schema.twindev.org/json-ld/JsonLdNodeObject",
52
- "description": "The JSON-LD annotation object for the vertex. json-ld namespace:twin-common"
38
+ "description": "The JSON-LD annotation object for the vertex."
53
39
  },
54
40
  "aliases": {
55
41
  "type": "array",
56
42
  "items": {
57
43
  "$ref": "https://schema.twindev.org/aig/AuditableItemGraphAlias"
58
44
  },
59
- "description": "Alternative aliases that can be used to identify the vertex. json-ld container:set"
45
+ "description": "Alternative aliases that can be used to identify the vertex."
60
46
  },
61
47
  "resources": {
62
48
  "type": "array",
63
49
  "items": {
64
50
  "$ref": "https://schema.twindev.org/aig/AuditableItemGraphResource"
65
51
  },
66
- "description": "The resources attached to the vertex. json-ld container:set"
52
+ "description": "The resources attached to the vertex."
67
53
  },
68
54
  "edges": {
69
55
  "type": "array",
70
56
  "items": {
71
57
  "$ref": "https://schema.twindev.org/aig/AuditableItemGraphEdge"
72
58
  },
73
- "description": "Edges connected to the vertex. json-ld container:set"
59
+ "description": "Edges connected to the vertex."
74
60
  },
75
61
  "verified": {
76
62
  "type": "boolean",
77
- "description": "Is the vertex verified, will only be populated when verification is requested. json-ld namespace:twin-common"
63
+ "description": "Is the vertex verified, will only be populated when verification is requested."
64
+ },
65
+ "version": {
66
+ "type": "number",
67
+ "description": "The version of the vertex, populated only when getting a specific version.\nMaps to https://schema.org/version."
78
68
  }
79
69
  },
80
70
  "required": [
@@ -82,5 +72,25 @@
82
72
  "id",
83
73
  "type"
84
74
  ],
85
- "additionalProperties": false
75
+ "allOf": [
76
+ {
77
+ "description": "Interface describing the base properties for auditable elements.",
78
+ "type": "object",
79
+ "properties": {
80
+ "dateCreated": {
81
+ "type": "string",
82
+ "description": "The date/time of when the element was created."
83
+ },
84
+ "dateModified": {
85
+ "type": "string",
86
+ "description": "The date/time of when the element was modified."
87
+ },
88
+ "dateDeleted": {
89
+ "type": "string",
90
+ "description": "The date/time of when the element was deleted, as we never actually remove items."
91
+ }
92
+ },
93
+ "$comment": "Inlined utility base type AuditableItemGraphAuditedElement so utility transformations can operate on concrete properties instead of a $ref."
94
+ }
95
+ ]
86
96
  }
@@ -1,41 +1,39 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://schema.twindev.org/aig/AuditableItemGraphVertexList",
4
+ "title": "AuditableItemGraphVertexList",
4
5
  "description": "Interface describing an auditable item graph vertex list.",
5
6
  "type": "object",
6
7
  "properties": {
7
8
  "@context": {
8
9
  "type": "array",
9
- "minItems": 2,
10
- "description": "JSON-LD Context.",
11
10
  "prefixItems": [
12
11
  {
13
- "type": "string",
14
12
  "const": "https://schema.org"
15
13
  },
16
14
  {
17
- "type": "string",
18
15
  "const": "https://schema.twindev.org/aig/"
19
16
  }
20
17
  ],
21
18
  "items": {
22
19
  "$ref": "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
23
- }
20
+ },
21
+ "minItems": 2,
22
+ "description": "JSON-LD Context."
24
23
  },
25
24
  "type": {
26
25
  "type": "array",
27
- "items": {
28
- "allOf": [
29
- {
30
- "type": "string",
31
- "const": "ItemList"
32
- },
33
- {
34
- "type": "string",
35
- "const": "AuditableItemGraphVertexList"
36
- }
37
- ]
38
- },
26
+ "prefixItems": [
27
+ {
28
+ "const": "ItemList"
29
+ },
30
+ {
31
+ "const": "AuditableItemGraphVertexList"
32
+ }
33
+ ],
34
+ "items": false,
35
+ "minItems": 2,
36
+ "maxItems": 2,
39
37
  "description": "JSON-LD Type."
40
38
  },
41
39
  "itemListElement": {
@@ -43,13 +41,12 @@
43
41
  "items": {
44
42
  "$ref": "https://schema.twindev.org/aig/AuditableItemGraphVertex"
45
43
  },
46
- "description": "The list of vertices. json-ld namespace:schema"
44
+ "description": "The list of vertices."
47
45
  }
48
46
  },
49
47
  "required": [
50
48
  "@context",
51
49
  "type",
52
50
  "itemListElement"
53
- ],
54
- "additionalProperties": false
51
+ ]
55
52
  }
@@ -8,8 +8,16 @@ export * from "./models/api/IAuditableItemGraphGetRequest.js";
8
8
  export * from "./models/api/IAuditableItemGraphGetResponse.js";
9
9
  export * from "./models/api/IAuditableItemGraphListRequest.js";
10
10
  export * from "./models/api/IAuditableItemGraphListResponse.js";
11
+ export * from "./models/api/IAuditableItemGraphRemoveProofRequest.js";
11
12
  export * from "./models/api/IAuditableItemGraphUpdateRequest.js";
13
+ export * from "./models/api/IAuditableItemGraphUpdatePartialRequest.js";
14
+ export * from "./models/api/IAuditableItemGraphVersionGetRequest.js";
15
+ export * from "./models/api/IAuditableItemGraphVersionGetResponse.js";
16
+ export * from "./models/api/IAuditableItemGraphVersionListRequest.js";
17
+ export * from "./models/api/IAuditableItemGraphVersionListResponse.js";
12
18
  export * from "./models/auditableItemGraphContexts.js";
19
+ export * from "./models/auditableItemGraphMetricIds.js";
20
+ export * from "./models/auditableItemGraphMetrics.js";
13
21
  export * from "./models/auditableItemGraphTopics.js";
14
22
  export * from "./models/auditableItemGraphTypes.js";
15
23
  export * from "./models/eventBus/IAuditableItemGraphEventBusVertexCreated.js";
@@ -21,7 +29,10 @@ export * from "./models/IAuditableItemGraphChangesetList.js";
21
29
  export * from "./models/IAuditableItemGraphComponent.js";
22
30
  export * from "./models/IAuditableItemGraphEdge.js";
23
31
  export * from "./models/IAuditableItemGraphPatchOperation.js";
32
+ export * from "./models/IAuditableItemGraphListPatch.js";
33
+ export * from "./models/IAuditableItemGraphPartialVertex.js";
24
34
  export * from "./models/IAuditableItemGraphResource.js";
25
35
  export * from "./models/IAuditableItemGraphVertex.js";
26
36
  export * from "./models/IAuditableItemGraphVertexList.js";
37
+ export * from "./models/IAuditableItemGraphVertexVersionList.js";
27
38
  export * from "./models/verifyDepth.js";
@@ -9,7 +9,7 @@ export interface IAuditableItemGraphAlias extends IAuditableItemGraphAuditedElem
9
9
  /**
10
10
  * JSON-LD Context.
11
11
  */
12
- "@context": typeof AuditableItemGraphContexts.Context | [typeof AuditableItemGraphContexts.Context, ...IJsonLdContextDefinitionElement[]];
12
+ "@context"?: typeof AuditableItemGraphContexts.Context | [typeof AuditableItemGraphContexts.Context, ...IJsonLdContextDefinitionElement[]];
13
13
  /**
14
14
  * The id of the element.
15
15
  */
@@ -20,12 +20,17 @@ export interface IAuditableItemGraphAlias extends IAuditableItemGraphAuditedElem
20
20
  type: typeof AuditableItemGraphTypes.Alias;
21
21
  /**
22
22
  * The JSON-LD annotation object for the alias.
23
- * json-ld namespace:twin-common
23
+ * @json-ld namespace:twin-common
24
24
  */
25
25
  annotationObject?: IJsonLdNodeObject;
26
26
  /**
27
27
  * The format of the id in the alias.
28
- * json-ld type:schema:Text
28
+ * @json-ld type:sch:Text
29
29
  */
30
30
  aliasFormat?: string;
31
+ /**
32
+ * Whether the alias should be unique across the graph, meaning that no other vertex can have the same alias. Defaults to false.
33
+ * @json-ld type:sch:Boolean
34
+ */
35
+ unique?: boolean;
31
36
  }
@@ -8,17 +8,17 @@ export interface IAuditableItemGraphAuditedElement {
8
8
  id?: string;
9
9
  /**
10
10
  * The date/time of when the element was created.
11
- * json-ld namespace:schema
11
+ * @json-ld namespace:sch
12
12
  */
13
13
  dateCreated?: string;
14
14
  /**
15
15
  * The date/time of when the element was modified.
16
- * json-ld namespace:schema
16
+ * @json-ld namespace:sch
17
17
  */
18
18
  dateModified?: string;
19
19
  /**
20
20
  * The date/time of when the element was deleted, as we never actually remove items.
21
- * json-ld namespace:schema
21
+ * @json-ld namespace:sch
22
22
  */
23
23
  dateDeleted?: string;
24
24
  }
@@ -25,27 +25,33 @@ export interface IAuditableItemGraphChangeset {
25
25
  id: string;
26
26
  /**
27
27
  * The date/time of when the changeset was created.
28
- * json-ld namespace:schema
28
+ * @json-ld namespace:sch
29
29
  */
30
30
  dateCreated: string;
31
31
  /**
32
32
  * The user identity that created the changes.
33
- * json-ld namespace:twin-common
33
+ * @json-ld namespace:twin-common
34
34
  */
35
35
  userIdentity?: string;
36
36
  /**
37
37
  * The patches in the changeset.
38
- * json-ld container:set
38
+ * @json-ld container:set
39
39
  */
40
40
  patches: IAuditableItemGraphPatchOperation[];
41
41
  /**
42
42
  * The immutable proof id which contains the signature for this changeset.
43
- * json-ld type:schema:identifier
43
+ * @json-ld type:sch:identifier
44
44
  */
45
45
  proofId?: string;
46
46
  /**
47
47
  * The verification for the changeset.
48
- * json-ld id
48
+ * @json-ld id
49
49
  */
50
50
  verification?: IImmutableProofVerification;
51
+ /**
52
+ * The version number of the vertex after this changeset was applied.
53
+ * Maps to https://schema.org/version.
54
+ * @json-ld namespace:sch
55
+ */
56
+ version?: number;
51
57
  }
@@ -21,7 +21,7 @@ export interface IAuditableItemGraphChangesetList {
21
21
  type: [typeof SchemaOrgTypes.ItemList, typeof AuditableItemGraphTypes.ChangesetList];
22
22
  /**
23
23
  * The list of changesets.
24
- * json-ld namespace:schema
24
+ * @json-ld namespace:sch
25
25
  */
26
26
  [SchemaOrgTypes.ItemListElement]: IAuditableItemGraphChangeset[];
27
27
  }
@@ -1,10 +1,11 @@
1
1
  import type { IComponent } from "@twin.org/core";
2
- import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
3
2
  import type { IComparator, SortDirection } from "@twin.org/entity";
4
3
  import type { IAuditableItemGraphChangeset } from "./IAuditableItemGraphChangeset.js";
5
4
  import type { IAuditableItemGraphChangesetList } from "./IAuditableItemGraphChangesetList.js";
5
+ import type { IAuditableItemGraphPartialVertex } from "./IAuditableItemGraphPartialVertex.js";
6
6
  import type { IAuditableItemGraphVertex } from "./IAuditableItemGraphVertex.js";
7
7
  import type { IAuditableItemGraphVertexList } from "./IAuditableItemGraphVertexList.js";
8
+ import type { IAuditableItemGraphVertexVersionList } from "./IAuditableItemGraphVertexVersionList.js";
8
9
  import type { VerifyDepth } from "./verifyDepth.js";
9
10
  /**
10
11
  * Interface describing an auditable item graph contract.
@@ -19,54 +20,28 @@ export interface IAuditableItemGraphComponent extends IComponent {
19
20
  * @param vertex.edges The edges connected to the vertex.
20
21
  * @returns The id of the new graph item.
21
22
  */
22
- create(vertex: {
23
- annotationObject?: IJsonLdNodeObject;
24
- aliases?: {
25
- id: string;
26
- aliasFormat?: string;
27
- unique?: boolean;
28
- annotationObject?: IJsonLdNodeObject;
29
- }[];
30
- resources?: {
31
- id?: string;
32
- resourceObject?: IJsonLdNodeObject;
33
- }[];
34
- edges?: {
35
- targetId: string;
36
- edgeRelationships: string[];
37
- annotationObject?: IJsonLdNodeObject;
38
- }[];
39
- }): Promise<string>;
23
+ create(vertex: Omit<IAuditableItemGraphVertex, "id">): Promise<string>;
40
24
  /**
41
- * Update a graph vertex.
25
+ * Update a graph vertex (PUT — full replacement of vertex state).
26
+ * Concurrent updates for the same vertex are serialized via `Mutex` on the vertex id.
27
+ * Multi-replica deployments are not coordinated.
42
28
  * @param vertex The vertex to update.
43
29
  * @param vertex.id The id of the vertex to update.
44
30
  * @param vertex.annotationObject The annotation object for the vertex as JSON-LD.
45
31
  * @param vertex.aliases Alternative aliases that can be used to identify the vertex.
46
32
  * @param vertex.resources The resources attached to the vertex.
47
33
  * @param vertex.edges The edges connected to the vertex.
48
- * @returns Nothing.
34
+ * @returns A promise that resolves when the vertex has been updated.
49
35
  */
50
- update(vertex: {
51
- id: string;
52
- annotationObject?: IJsonLdNodeObject;
53
- aliases?: {
54
- id: string;
55
- aliasFormat?: string;
56
- unique?: boolean;
57
- annotationObject?: IJsonLdNodeObject;
58
- }[];
59
- resources?: {
60
- id?: string;
61
- resourceObject?: IJsonLdNodeObject;
62
- }[];
63
- edges?: {
64
- id?: string;
65
- targetId: string;
66
- edgeRelationships: string[];
67
- annotationObject?: IJsonLdNodeObject;
68
- }[];
69
- }): Promise<void>;
36
+ update(vertex: IAuditableItemGraphVertex): Promise<void>;
37
+ /**
38
+ * Partially update a graph vertex (PATCH); only properties that are not undefined are applied.
39
+ * Sub-lists use explicit `{ add, remove }` patch objects. Serialized with `update()` via `Mutex`
40
+ * on the same vertex id.
41
+ * @param partial The partial vertex update (must include `id`).
42
+ * @returns A promise that resolves when the partial update has been applied.
43
+ */
44
+ updatePartial(partial: IAuditableItemGraphPartialVertex): Promise<void>;
70
45
  /**
71
46
  * Get a graph vertex.
72
47
  * @param id The id of the vertex to get.
@@ -108,12 +83,33 @@ export interface IAuditableItemGraphComponent extends IComponent {
108
83
  verifySignatureDepth?: VerifyDepth;
109
84
  }): Promise<IAuditableItemGraphChangeset>;
110
85
  /**
111
- * Remove the verifiable storage for an item.
112
- * @param id The id of the vertex to remove the storage from.
113
- * @returns Nothing.
86
+ * Get a graph vertex at a specific version.
87
+ * @param id The id of the vertex.
88
+ * @param version The version number to retrieve.
89
+ * @returns The vertex reconstructed at that version.
90
+ * @throws NotFoundError if the vertex or version is not found.
91
+ */
92
+ getVersion(id: string, version: number): Promise<IAuditableItemGraphVertex>;
93
+ /**
94
+ * Get all versions of a graph vertex.
95
+ * @param id The id of the vertex.
96
+ * @param options Additional options for the operation.
97
+ * @param options.after Only return versions created after this ISO 8601 timestamp (exclusive).
98
+ * @param options.before Only return versions created before this ISO 8601 timestamp (exclusive).
99
+ * @returns The list of vertex versions.
100
+ * @throws NotFoundError if the vertex is not found.
101
+ */
102
+ getVersions(id: string, options?: {
103
+ after?: string;
104
+ before?: string;
105
+ }): Promise<IAuditableItemGraphVertexVersionList>;
106
+ /**
107
+ * Remove the proof for an item.
108
+ * @param id The id of the vertex to remove the proof from.
109
+ * @returns A promise that resolves when the proof has been removed from all changesets.
114
110
  * @throws NotFoundError if the vertex is not found.
115
111
  */
116
- removeVerifiable(id: string): Promise<void>;
112
+ removeProof(id: string): Promise<void>;
117
113
  /**
118
114
  * Query the graph for vertices.
119
115
  * @param options The query options.
@@ -9,14 +9,14 @@ export interface IAuditableItemGraphEdge extends IAuditableItemGraphAuditedEleme
9
9
  /**
10
10
  * JSON-LD Context.
11
11
  */
12
- "@context": typeof AuditableItemGraphContexts.Context | [typeof AuditableItemGraphContexts.Context, ...IJsonLdContextDefinitionElement[]];
12
+ "@context"?: typeof AuditableItemGraphContexts.Context | [typeof AuditableItemGraphContexts.Context, ...IJsonLdContextDefinitionElement[]];
13
13
  /**
14
14
  * The id of the element.
15
15
  */
16
16
  id?: string;
17
17
  /**
18
18
  * The target vertex id the edge connects to.
19
- * json-ld type:@id
19
+ * @json-ld type:@id
20
20
  */
21
21
  targetId: string;
22
22
  /**
@@ -25,12 +25,12 @@ export interface IAuditableItemGraphEdge extends IAuditableItemGraphAuditedEleme
25
25
  type: typeof AuditableItemGraphTypes.Edge;
26
26
  /**
27
27
  * The JSON-LD annotation object for the edge.
28
- * json-ld namespace:twin-common
28
+ * @json-ld namespace:twin-common
29
29
  */
30
30
  annotationObject?: IJsonLdNodeObject;
31
31
  /**
32
32
  * The relationships between the two vertices.
33
- * json-ld container:set
33
+ * @json-ld container:set
34
34
  */
35
35
  edgeRelationships: string[];
36
36
  }
@@ -0,0 +1,18 @@
1
+ import type { IAuditableItemGraphAlias } from "./IAuditableItemGraphAlias.js";
2
+ import type { IAuditableItemGraphEdge } from "./IAuditableItemGraphEdge.js";
3
+ import type { IAuditableItemGraphResource } from "./IAuditableItemGraphResource.js";
4
+ /**
5
+ * PATCH operations for a sub-list on a vertex.
6
+ */
7
+ export interface IAuditableItemGraphListPatch<TItem = IAuditableItemGraphEdge | IAuditableItemGraphAlias | IAuditableItemGraphResource> {
8
+ /**
9
+ * Items to add or update in the active set.
10
+ * @json-ld container:set
11
+ */
12
+ add?: TItem[];
13
+ /**
14
+ * Identifiers of items to remove from the active set (soft-delete).
15
+ * @json-ld container:set
16
+ */
17
+ remove?: string[];
18
+ }
@@ -0,0 +1,45 @@
1
+ import type { IJsonLdContextDefinitionElement } from "@twin.org/data-json-ld";
2
+ import type { AuditableItemGraphContexts } from "./auditableItemGraphContexts.js";
3
+ import type { AuditableItemGraphTypes } from "./auditableItemGraphTypes.js";
4
+ import type { IAuditableItemGraphAlias } from "./IAuditableItemGraphAlias.js";
5
+ import type { IAuditableItemGraphEdge } from "./IAuditableItemGraphEdge.js";
6
+ import type { IAuditableItemGraphListPatch } from "./IAuditableItemGraphListPatch.js";
7
+ import type { IAuditableItemGraphResource } from "./IAuditableItemGraphResource.js";
8
+ import type { IAuditableItemGraphVertex } from "./IAuditableItemGraphVertex.js";
9
+ /**
10
+ * Partial vertex payload for updatePartial (PATCH — requires id).
11
+ * Sub-lists use explicit `{ add, remove }` patches; bare arrays are not supported.
12
+ */
13
+ export interface IAuditableItemGraphPartialVertex extends Omit<IAuditableItemGraphVertex, "type" | "aliases" | "edges" | "resources"> {
14
+ /**
15
+ * The id of the vertex to update.
16
+ */
17
+ id: string;
18
+ /**
19
+ * JSON-LD Context.
20
+ */
21
+ "@context": [
22
+ typeof AuditableItemGraphContexts.Context,
23
+ typeof AuditableItemGraphContexts.ContextCommon,
24
+ ...IJsonLdContextDefinitionElement[]
25
+ ];
26
+ /**
27
+ * JSON-LD Type.
28
+ */
29
+ type?: typeof AuditableItemGraphTypes.Vertex;
30
+ /**
31
+ * Patch operations for aliases.
32
+ * @json-ld id
33
+ */
34
+ aliasPatches?: IAuditableItemGraphListPatch<IAuditableItemGraphAlias>;
35
+ /**
36
+ * Patch operations for resources.
37
+ * @json-ld id
38
+ */
39
+ resourcePatches?: IAuditableItemGraphListPatch<IAuditableItemGraphResource>;
40
+ /**
41
+ * Patch operations for edges.
42
+ * @json-ld id
43
+ */
44
+ edgePatches?: IAuditableItemGraphListPatch<IAuditableItemGraphEdge>;
45
+ }
@@ -15,22 +15,22 @@ export interface IAuditableItemGraphPatchOperation {
15
15
  type: typeof AuditableItemGraphTypes.PatchOperation;
16
16
  /**
17
17
  * The operation that was performed on the item.
18
- * json-ld type:schema:Text
18
+ * @json-ld type:sch:Text
19
19
  */
20
20
  patchOperation: "add" | "remove" | "replace" | "move" | "copy" | "test";
21
21
  /**
22
22
  * The path to the object that was changed.
23
- * json-ld type:schema:Text
23
+ * @json-ld type:sch:Text
24
24
  */
25
25
  patchPath: string;
26
26
  /**
27
27
  * The path the value was copied or moved from.
28
- * json-ld type:schema:Text
28
+ * @json-ld type:sch:Text
29
29
  */
30
30
  patchFrom?: string;
31
31
  /**
32
32
  * The value to add.
33
- * json-ld type:json
33
+ * @json-ld type:json
34
34
  */
35
35
  patchValue?: unknown;
36
36
  }
@@ -9,14 +9,14 @@ export interface IAuditableItemGraphResource extends IAuditableItemGraphAuditedE
9
9
  /**
10
10
  * JSON-LD Context.
11
11
  */
12
- "@context": typeof AuditableItemGraphContexts.Context | [typeof AuditableItemGraphContexts.Context, ...IJsonLdContextDefinitionElement[]];
12
+ "@context"?: typeof AuditableItemGraphContexts.Context | [typeof AuditableItemGraphContexts.Context, ...IJsonLdContextDefinitionElement[]];
13
13
  /**
14
14
  * JSON-LD Type.
15
15
  */
16
16
  type: typeof AuditableItemGraphTypes.Resource;
17
17
  /**
18
18
  * The JSON-LD object for the resource.
19
- * json-ld type:json
19
+ * @json-ld type:json
20
20
  */
21
21
  resourceObject?: IJsonLdNodeObject;
22
22
  }