@twin.org/auditable-item-graph-service 0.0.3-next.13 → 0.0.3-next.15

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 (25) hide show
  1. package/dist/es/auditableItemGraphRoutes.js +162 -1
  2. package/dist/es/auditableItemGraphRoutes.js.map +1 -1
  3. package/dist/es/auditableItemGraphService.js +208 -11
  4. package/dist/es/auditableItemGraphService.js.map +1 -1
  5. package/dist/es/entities/auditableItemGraphChangeset.js +8 -0
  6. package/dist/es/entities/auditableItemGraphChangeset.js.map +1 -1
  7. package/dist/es/entities/auditableItemGraphVertex.js +8 -0
  8. package/dist/es/entities/auditableItemGraphVertex.js.map +1 -1
  9. package/dist/es/models/IAuditableItemGraphServiceConstructorOptions.js.map +1 -1
  10. package/dist/types/auditableItemGraphRoutes.d.ts +17 -1
  11. package/dist/types/auditableItemGraphService.d.ts +26 -1
  12. package/dist/types/entities/auditableItemGraphChangeset.d.ts +4 -0
  13. package/dist/types/entities/auditableItemGraphVertex.d.ts +4 -0
  14. package/dist/types/models/IAuditableItemGraphServiceConstructorOptions.d.ts +4 -0
  15. package/docs/changelog.md +29 -0
  16. package/docs/open-api/spec.json +284 -0
  17. package/docs/reference/classes/AuditableItemGraphChangeset.md +8 -0
  18. package/docs/reference/classes/AuditableItemGraphService.md +98 -0
  19. package/docs/reference/classes/AuditableItemGraphVertex.md +8 -0
  20. package/docs/reference/functions/auditableItemGraphVersionGet.md +31 -0
  21. package/docs/reference/functions/auditableItemGraphVersionList.md +31 -0
  22. package/docs/reference/index.md +2 -0
  23. package/docs/reference/interfaces/IAuditableItemGraphServiceConstructorOptions.md +8 -0
  24. package/locales/en.json +3 -0
  25. package/package.json +3 -2
@@ -27,4 +27,8 @@ export declare class AuditableItemGraphChangeset {
27
27
  * The immutable proof id which contains the signature for this changeset.
28
28
  */
29
29
  proofId?: string;
30
+ /**
31
+ * The version number of the vertex after this changeset was applied.
32
+ */
33
+ version?: number;
30
34
  }
@@ -46,4 +46,8 @@ export declare class AuditableItemGraphVertex {
46
46
  * Edges connected to the vertex.
47
47
  */
48
48
  edges?: AuditableItemGraphEdge[];
49
+ /**
50
+ * The current version of the vertex, incremented on each changeset.
51
+ */
52
+ version?: number;
49
53
  }
@@ -22,6 +22,10 @@ export interface IAuditableItemGraphServiceConstructorOptions {
22
22
  * The event bus component type, defaults to no event bus.
23
23
  */
24
24
  eventBusComponentType?: string;
25
+ /**
26
+ * The component type for the optional telemetry component used for event metrics, defaults to no telemetry.
27
+ */
28
+ telemetryComponentType?: string;
25
29
  /**
26
30
  * The configuration for the service.
27
31
  */
package/docs/changelog.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.3-next.15](https://github.com/iotaledger/twin-auditable-item-graph/compare/auditable-item-graph-service-v0.0.3-next.14...auditable-item-graph-service-v0.0.3-next.15) (2026-05-20)
4
+
5
+
6
+ ### Features
7
+
8
+ * add event-driven telemetry metrics ([#63](https://github.com/iotaledger/twin-auditable-item-graph/issues/63)) ([8fe6cdd](https://github.com/iotaledger/twin-auditable-item-graph/commit/8fe6cdd0d56496402b766c151f002f475ddb8c0e))
9
+ * update dependencies ([482c97e](https://github.com/iotaledger/twin-auditable-item-graph/commit/482c97e16109e504cb495084ef51e860a7f86669))
10
+
11
+
12
+ ### Dependencies
13
+
14
+ * The following workspace dependencies were updated
15
+ * dependencies
16
+ * @twin.org/auditable-item-graph-models bumped from 0.0.3-next.14 to 0.0.3-next.15
17
+
18
+ ## [0.0.3-next.14](https://github.com/iotaledger/twin-auditable-item-graph/compare/auditable-item-graph-service-v0.0.3-next.13...auditable-item-graph-service-v0.0.3-next.14) (2026-05-18)
19
+
20
+
21
+ ### Features
22
+
23
+ * add versions ([#60](https://github.com/iotaledger/twin-auditable-item-graph/issues/60)) ([5c36f94](https://github.com/iotaledger/twin-auditable-item-graph/commit/5c36f94b1155c01dddbc8d62f3f65d599916c521))
24
+
25
+
26
+ ### Dependencies
27
+
28
+ * The following workspace dependencies were updated
29
+ * dependencies
30
+ * @twin.org/auditable-item-graph-models bumped from 0.0.3-next.13 to 0.0.3-next.14
31
+
3
32
  ## [0.0.3-next.13](https://github.com/iotaledger/twin-auditable-item-graph/compare/auditable-item-graph-service-v0.0.3-next.12...auditable-item-graph-service-v0.0.3-next.13) (2026-05-12)
4
33
 
5
34
 
@@ -867,6 +867,282 @@
867
867
  }
868
868
  }
869
869
  },
870
+ "/auditable-item-graph/{id}/versions/{versionId}": {
871
+ "get": {
872
+ "operationId": "auditableItemGraphVersionGet",
873
+ "summary": "Get a graph vertex at a specific version",
874
+ "tags": [
875
+ "Auditable Item Graph"
876
+ ],
877
+ "parameters": [
878
+ {
879
+ "name": "id",
880
+ "description": "The id of the vertex.",
881
+ "in": "path",
882
+ "required": true,
883
+ "schema": {
884
+ "type": "string"
885
+ },
886
+ "style": "simple",
887
+ "example": "aig:1234567890"
888
+ },
889
+ {
890
+ "name": "versionId",
891
+ "description": "The id of the version (changeset id) to get.",
892
+ "in": "path",
893
+ "required": true,
894
+ "schema": {
895
+ "type": "string"
896
+ },
897
+ "style": "simple",
898
+ "example": "changeset:1234567890"
899
+ },
900
+ {
901
+ "name": "accept",
902
+ "in": "header",
903
+ "required": true,
904
+ "schema": {
905
+ "type": "string"
906
+ },
907
+ "style": "simple",
908
+ "example": "application/json"
909
+ }
910
+ ],
911
+ "security": [
912
+ {
913
+ "jwtBearerAuthScheme": []
914
+ }
915
+ ],
916
+ "responses": {
917
+ "200": {
918
+ "description": "Response to getting an auditable item graph vertex at a specific version.",
919
+ "content": {
920
+ "application/json": {
921
+ "schema": {
922
+ "$ref": "https://schema.twindev.org/aig/AuditableItemGraphVertex"
923
+ },
924
+ "examples": {
925
+ "auditableItemGraphVersionGetResponseExample": {
926
+ "value": {
927
+ "@context": [
928
+ "https://schema.twindev.org/aig/",
929
+ "https://schema.twindev.org/common/",
930
+ "https://schema.org"
931
+ ],
932
+ "type": "AuditableItemGraphVertex",
933
+ "id": "aig:1234567890",
934
+ "dateCreated": "2024-08-22T11:55:16.271Z",
935
+ "version": 1
936
+ }
937
+ }
938
+ }
939
+ }
940
+ }
941
+ },
942
+ "400": {
943
+ "description": "The server cannot process the request, see the content for more details.",
944
+ "content": {
945
+ "application/json": {
946
+ "schema": {
947
+ "$ref": "#/components/schemas/Error"
948
+ },
949
+ "examples": {
950
+ "exampleResponse": {
951
+ "value": {
952
+ "name": "GeneralError",
953
+ "message": "errorMessage",
954
+ "properties": {
955
+ "foo": "bar"
956
+ }
957
+ }
958
+ }
959
+ }
960
+ }
961
+ }
962
+ },
963
+ "401": {
964
+ "description": "You are not authorized to use the API or no credentials were supplied, see the content for more details.",
965
+ "content": {
966
+ "application/json": {
967
+ "schema": {
968
+ "$ref": "#/components/schemas/Error"
969
+ },
970
+ "examples": {
971
+ "exampleResponse": {
972
+ "value": {
973
+ "name": "UnauthorizedError",
974
+ "message": "errorMessage"
975
+ }
976
+ }
977
+ }
978
+ }
979
+ }
980
+ },
981
+ "500": {
982
+ "description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
983
+ "content": {
984
+ "application/json": {
985
+ "schema": {
986
+ "$ref": "#/components/schemas/Error"
987
+ },
988
+ "examples": {
989
+ "exampleResponse": {
990
+ "value": {
991
+ "name": "InternalServerError",
992
+ "message": "errorMessage"
993
+ }
994
+ }
995
+ }
996
+ }
997
+ }
998
+ }
999
+ }
1000
+ }
1001
+ },
1002
+ "/auditable-item-graph/{id}/versions": {
1003
+ "get": {
1004
+ "operationId": "auditableItemGraphVersionList",
1005
+ "summary": "Get all versions of a graph vertex",
1006
+ "tags": [
1007
+ "Auditable Item Graph"
1008
+ ],
1009
+ "parameters": [
1010
+ {
1011
+ "name": "id",
1012
+ "description": "The id of the vertex.",
1013
+ "in": "path",
1014
+ "required": true,
1015
+ "schema": {
1016
+ "type": "string"
1017
+ },
1018
+ "style": "simple",
1019
+ "example": "aig:1234567890"
1020
+ },
1021
+ {
1022
+ "name": "after",
1023
+ "description": "Only return versions created after this ISO 8601 timestamp (exclusive).",
1024
+ "in": "query",
1025
+ "required": false,
1026
+ "schema": {
1027
+ "type": "string"
1028
+ }
1029
+ },
1030
+ {
1031
+ "name": "before",
1032
+ "description": "Only return versions created before this ISO 8601 timestamp (exclusive).",
1033
+ "in": "query",
1034
+ "required": false,
1035
+ "schema": {
1036
+ "type": "string"
1037
+ }
1038
+ },
1039
+ {
1040
+ "name": "accept",
1041
+ "in": "header",
1042
+ "required": true,
1043
+ "schema": {
1044
+ "type": "string"
1045
+ },
1046
+ "style": "simple",
1047
+ "example": "application/json"
1048
+ }
1049
+ ],
1050
+ "security": [
1051
+ {
1052
+ "jwtBearerAuthScheme": []
1053
+ }
1054
+ ],
1055
+ "responses": {
1056
+ "200": {
1057
+ "description": "Response to getting all versions of an auditable item graph vertex.",
1058
+ "content": {
1059
+ "application/json": {
1060
+ "schema": {
1061
+ "$ref": "https://schema.twindev.org/aig/AuditableItemGraphVertexVersionList"
1062
+ },
1063
+ "examples": {
1064
+ "auditableItemGraphVersionListResponseExample": {
1065
+ "value": {
1066
+ "@context": [
1067
+ "https://schema.org",
1068
+ "https://schema.twindev.org/aig/",
1069
+ "https://schema.twindev.org/common/"
1070
+ ],
1071
+ "type": [
1072
+ "ItemList",
1073
+ "AuditableItemGraphVertexVersionList"
1074
+ ],
1075
+ "itemListElement": [
1076
+ 0,
1077
+ 1,
1078
+ 2
1079
+ ]
1080
+ }
1081
+ }
1082
+ }
1083
+ }
1084
+ }
1085
+ },
1086
+ "400": {
1087
+ "description": "The server cannot process the request, see the content for more details.",
1088
+ "content": {
1089
+ "application/json": {
1090
+ "schema": {
1091
+ "$ref": "#/components/schemas/Error"
1092
+ },
1093
+ "examples": {
1094
+ "exampleResponse": {
1095
+ "value": {
1096
+ "name": "GeneralError",
1097
+ "message": "errorMessage",
1098
+ "properties": {
1099
+ "foo": "bar"
1100
+ }
1101
+ }
1102
+ }
1103
+ }
1104
+ }
1105
+ }
1106
+ },
1107
+ "401": {
1108
+ "description": "You are not authorized to use the API or no credentials were supplied, see the content for more details.",
1109
+ "content": {
1110
+ "application/json": {
1111
+ "schema": {
1112
+ "$ref": "#/components/schemas/Error"
1113
+ },
1114
+ "examples": {
1115
+ "exampleResponse": {
1116
+ "value": {
1117
+ "name": "UnauthorizedError",
1118
+ "message": "errorMessage"
1119
+ }
1120
+ }
1121
+ }
1122
+ }
1123
+ }
1124
+ },
1125
+ "500": {
1126
+ "description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
1127
+ "content": {
1128
+ "application/json": {
1129
+ "schema": {
1130
+ "$ref": "#/components/schemas/Error"
1131
+ },
1132
+ "examples": {
1133
+ "exampleResponse": {
1134
+ "value": {
1135
+ "name": "InternalServerError",
1136
+ "message": "errorMessage"
1137
+ }
1138
+ }
1139
+ }
1140
+ }
1141
+ }
1142
+ }
1143
+ }
1144
+ }
1145
+ },
870
1146
  "/auditable-item-graph/{id}/changesets/{changesetId}": {
871
1147
  "get": {
872
1148
  "operationId": "auditableItemGraphChangesetGet",
@@ -1458,6 +1734,10 @@
1458
1734
  "verified": {
1459
1735
  "type": "boolean",
1460
1736
  "description": "Is the vertex verified, will only be populated when verification is requested."
1737
+ },
1738
+ "version": {
1739
+ "type": "number",
1740
+ "description": "The version of the vertex, populated only when getting a specific version.\nMaps to https://schema.org/version."
1461
1741
  }
1462
1742
  },
1463
1743
  "required": [
@@ -1532,6 +1812,10 @@
1532
1812
  "verified": {
1533
1813
  "type": "boolean",
1534
1814
  "description": "Is the vertex verified, will only be populated when verification is requested."
1815
+ },
1816
+ "version": {
1817
+ "type": "number",
1818
+ "description": "The version of the vertex, populated only when getting a specific version.\nMaps to https://schema.org/version."
1535
1819
  }
1536
1820
  },
1537
1821
  "required": [
@@ -59,3 +59,11 @@ The patches in the changeset.
59
59
  > `optional` **proofId?**: `string`
60
60
 
61
61
  The immutable proof id which contains the signature for this changeset.
62
+
63
+ ***
64
+
65
+ ### version? {#version}
66
+
67
+ > `optional` **version?**: `number`
68
+
69
+ The version number of the vertex after this changeset was applied.
@@ -70,6 +70,22 @@ The class name of the component.
70
70
 
71
71
  ***
72
72
 
73
+ ### start() {#start}
74
+
75
+ > **start**(): `Promise`\<`void`\>
76
+
77
+ Register all AIG metrics with the telemetry component.
78
+
79
+ #### Returns
80
+
81
+ `Promise`\<`void`\>
82
+
83
+ #### Implementation of
84
+
85
+ `IAuditableItemGraphComponent.start`
86
+
87
+ ***
88
+
73
89
  ### create() {#create}
74
90
 
75
91
  > **create**(`vertex`): `Promise`\<`string`\>
@@ -260,6 +276,88 @@ NotFoundError if the vertex is not found.
260
276
 
261
277
  ***
262
278
 
279
+ ### getVersion() {#getversion}
280
+
281
+ > **getVersion**(`id`, `versionId`): `Promise`\<`IAuditableItemGraphVertex`\>
282
+
283
+ Get a graph vertex at a specific version.
284
+
285
+ #### Parameters
286
+
287
+ ##### id
288
+
289
+ `string`
290
+
291
+ The id of the vertex.
292
+
293
+ ##### versionId
294
+
295
+ `string`
296
+
297
+ The id of the version (changeset id) to retrieve.
298
+
299
+ #### Returns
300
+
301
+ `Promise`\<`IAuditableItemGraphVertex`\>
302
+
303
+ The vertex reconstructed at that version.
304
+
305
+ #### Throws
306
+
307
+ NotFoundError if the vertex or version is not found.
308
+
309
+ #### Implementation of
310
+
311
+ `IAuditableItemGraphComponent.getVersion`
312
+
313
+ ***
314
+
315
+ ### getVersions() {#getversions}
316
+
317
+ > **getVersions**(`id`, `options?`): `Promise`\<`IAuditableItemGraphVertexVersionList`\>
318
+
319
+ Get all versions of a graph vertex.
320
+
321
+ #### Parameters
322
+
323
+ ##### id
324
+
325
+ `string`
326
+
327
+ The id of the vertex.
328
+
329
+ ##### options?
330
+
331
+ Additional options for the operation.
332
+
333
+ ###### after?
334
+
335
+ `string`
336
+
337
+ Only return versions created after this ISO 8601 timestamp (exclusive).
338
+
339
+ ###### before?
340
+
341
+ `string`
342
+
343
+ Only return versions created before this ISO 8601 timestamp (exclusive).
344
+
345
+ #### Returns
346
+
347
+ `Promise`\<`IAuditableItemGraphVertexVersionList`\>
348
+
349
+ The list of vertex versions.
350
+
351
+ #### Throws
352
+
353
+ NotFoundError if the vertex is not found.
354
+
355
+ #### Implementation of
356
+
357
+ `IAuditableItemGraphComponent.getVersions`
358
+
359
+ ***
360
+
263
361
  ### removeVerifiable() {#removeverifiable}
264
362
 
265
363
  > **removeVerifiable**(`id`): `Promise`\<`void`\>
@@ -91,3 +91,11 @@ The resources attached to the vertex.
91
91
  > `optional` **edges?**: [`AuditableItemGraphEdge`](AuditableItemGraphEdge.md)[]
92
92
 
93
93
  Edges connected to the vertex.
94
+
95
+ ***
96
+
97
+ ### version? {#version}
98
+
99
+ > `optional` **version?**: `number`
100
+
101
+ The current version of the vertex, incremented on each changeset.
@@ -0,0 +1,31 @@
1
+ # Function: auditableItemGraphVersionGet()
2
+
3
+ > **auditableItemGraphVersionGet**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IAuditableItemGraphVersionGetResponse`\>
4
+
5
+ Get the graph vertex at a specific version.
6
+
7
+ ## Parameters
8
+
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
12
+
13
+ The request context for the API.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes.
20
+
21
+ ### request
22
+
23
+ `IAuditableItemGraphVersionGetRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`IAuditableItemGraphVersionGetResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: auditableItemGraphVersionList()
2
+
3
+ > **auditableItemGraphVersionList**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IAuditableItemGraphVersionListResponse`\>
4
+
5
+ Get all versions of a graph vertex.
6
+
7
+ ## Parameters
8
+
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
12
+
13
+ The request context for the API.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes.
20
+
21
+ ### request
22
+
23
+ `IAuditableItemGraphVersionListRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`IAuditableItemGraphVersionListResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -29,4 +29,6 @@
29
29
  - [auditableItemGraphChangesetGet](functions/auditableItemGraphChangesetGet.md)
30
30
  - [auditableItemGraphUpdate](functions/auditableItemGraphUpdate.md)
31
31
  - [auditableItemGraphList](functions/auditableItemGraphList.md)
32
+ - [auditableItemGraphVersionGet](functions/auditableItemGraphVersionGet.md)
33
+ - [auditableItemGraphVersionList](functions/auditableItemGraphVersionList.md)
32
34
  - [initSchema](functions/initSchema.md)
@@ -54,6 +54,14 @@ The event bus component type, defaults to no event bus.
54
54
 
55
55
  ***
56
56
 
57
+ ### telemetryComponentType? {#telemetrycomponenttype}
58
+
59
+ > `optional` **telemetryComponentType?**: `string`
60
+
61
+ The component type for the optional telemetry component used for event metrics, defaults to no telemetry.
62
+
63
+ ***
64
+
57
65
  ### config? {#config}
58
66
 
59
67
  > `optional` **config?**: [`IAuditableItemGraphServiceConfig`](IAuditableItemGraphServiceConfig.md)
package/locales/en.json CHANGED
@@ -4,6 +4,9 @@
4
4
  "namespaceMismatch": "The namespace in the urn \"{id}\" does not match the namespace of the Auditable Item Graph service \"{namespace}\"",
5
5
  "createFailed": "Creating the Auditable Item Graph vertex failed",
6
6
  "getFailed": "Getting the Auditable Item Graph vertex failed",
7
+ "getVersionFailed": "Getting the Auditable Item Graph vertex version failed",
8
+ "getVersionsFailed": "Getting the Auditable Item Graph vertex versions failed",
9
+ "versionNotFound": "The version with the Id \"{notFoundId}\" was not found",
7
10
  "updatingFailed": "Updating the Auditable Item Graph vertex failed",
8
11
  "queryingFailed": "Querying the Auditable Item Graph failed",
9
12
  "removeVerifiableFailed": "Removing the verifiable data the Auditable Item Graph vertex failed",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/auditable-item-graph-service",
3
- "version": "0.0.3-next.13",
3
+ "version": "0.0.3-next.15",
4
4
  "description": "Implements graph lifecycle operations and audited change tracking with API route definitions.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@twin.org/api-models": "next",
18
- "@twin.org/auditable-item-graph-models": "0.0.3-next.13",
18
+ "@twin.org/auditable-item-graph-models": "0.0.3-next.15",
19
19
  "@twin.org/context": "next",
20
20
  "@twin.org/core": "next",
21
21
  "@twin.org/crypto": "next",
@@ -27,6 +27,7 @@
27
27
  "@twin.org/nameof": "next",
28
28
  "@twin.org/standards-schema-org": "next",
29
29
  "@twin.org/standards-w3c-did": "next",
30
+ "@twin.org/telemetry-models": "next",
30
31
  "@twin.org/verifiable-storage-models": "next",
31
32
  "@twin.org/web": "next"
32
33
  },