@twin.org/auditable-item-graph-models 0.0.1-next.4 → 0.0.1-next.40

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 (60) hide show
  1. package/dist/cjs/index.cjs +344 -274
  2. package/dist/esm/index.mjs +343 -274
  3. package/dist/types/index.d.ts +5 -3
  4. package/dist/types/models/IAuditableItemGraphAlias.d.ts +21 -3
  5. package/dist/types/models/IAuditableItemGraphAuditedElement.d.ts +7 -7
  6. package/dist/types/models/IAuditableItemGraphChangeset.d.ts +27 -11
  7. package/dist/types/models/IAuditableItemGraphComponent.d.ts +59 -61
  8. package/dist/types/models/IAuditableItemGraphEdge.d.ts +22 -4
  9. package/dist/types/models/IAuditableItemGraphPatchOperation.d.ts +28 -2
  10. package/dist/types/models/IAuditableItemGraphResource.d.ts +16 -2
  11. package/dist/types/models/IAuditableItemGraphVertex.d.ts +28 -2
  12. package/dist/types/models/IAuditableItemGraphVertexList.d.ts +29 -0
  13. package/dist/types/models/api/IAuditableItemGraphCreateRequest.d.ts +9 -9
  14. package/dist/types/models/api/IAuditableItemGraphGetRequest.d.ts +2 -2
  15. package/dist/types/models/api/IAuditableItemGraphGetResponse.d.ts +2 -13
  16. package/dist/types/models/api/IAuditableItemGraphListRequest.d.ts +14 -5
  17. package/dist/types/models/api/IAuditableItemGraphListResponse.d.ts +2 -12
  18. package/dist/types/models/api/IAuditableItemGraphUpdateRequest.d.ts +9 -9
  19. package/dist/types/models/auditableItemGraphContexts.d.ts +17 -0
  20. package/dist/types/models/auditableItemGraphTopics.d.ts +17 -0
  21. package/dist/types/models/auditableItemGraphTypes.d.ts +6 -22
  22. package/dist/types/models/eventBus/IAuditableItemGraphEventBusVertexCreated.d.ts +9 -0
  23. package/dist/types/models/eventBus/IAuditableItemGraphEventBusVertexUpdated.d.ts +14 -0
  24. package/docs/changelog.md +55 -1
  25. package/docs/reference/classes/AuditableItemGraphDataTypes.md +3 -3
  26. package/docs/reference/index.md +7 -5
  27. package/docs/reference/interfaces/IAuditableItemGraphAlias.md +34 -22
  28. package/docs/reference/interfaces/IAuditableItemGraphAuditedElement.md +11 -11
  29. package/docs/reference/interfaces/IAuditableItemGraphChangeset.md +34 -18
  30. package/docs/reference/interfaces/IAuditableItemGraphComponent.md +113 -57
  31. package/docs/reference/interfaces/IAuditableItemGraphCreateRequest.md +5 -5
  32. package/docs/reference/interfaces/IAuditableItemGraphEdge.md +38 -26
  33. package/docs/reference/interfaces/IAuditableItemGraphEventBusVertexCreated.md +11 -0
  34. package/docs/reference/interfaces/IAuditableItemGraphEventBusVertexUpdated.md +19 -0
  35. package/docs/reference/interfaces/IAuditableItemGraphGetRequest.md +2 -2
  36. package/docs/reference/interfaces/IAuditableItemGraphGetResponse.md +4 -4
  37. package/docs/reference/interfaces/IAuditableItemGraphListRequest.md +17 -5
  38. package/docs/reference/interfaces/IAuditableItemGraphListResponse.md +3 -3
  39. package/docs/reference/interfaces/IAuditableItemGraphPatchOperation.md +46 -2
  40. package/docs/reference/interfaces/IAuditableItemGraphResource.md +32 -20
  41. package/docs/reference/interfaces/IAuditableItemGraphUpdateRequest.md +5 -5
  42. package/docs/reference/interfaces/IAuditableItemGraphVertex.md +50 -18
  43. package/docs/reference/interfaces/IAuditableItemGraphVertexList.md +35 -0
  44. package/docs/reference/type-aliases/AuditableItemGraphContexts.md +5 -0
  45. package/docs/reference/type-aliases/AuditableItemGraphTopics.md +5 -0
  46. package/docs/reference/type-aliases/AuditableItemGraphTypes.md +1 -1
  47. package/docs/reference/type-aliases/VerifyDepth.md +1 -1
  48. package/docs/reference/variables/AuditableItemGraphContexts.md +19 -0
  49. package/docs/reference/variables/AuditableItemGraphTopics.md +19 -0
  50. package/docs/reference/variables/AuditableItemGraphTypes.md +6 -30
  51. package/package.json +6 -4
  52. package/dist/types/models/IAuditableItemGraphCredential.d.ts +0 -25
  53. package/dist/types/models/IAuditableItemGraphMetadataElement.d.ts +0 -10
  54. package/dist/types/models/IAuditableItemGraphVerification.d.ts +0 -15
  55. package/dist/types/models/auditableItemGraphVerificationState.d.ts +0 -37
  56. package/docs/reference/interfaces/IAuditableItemGraphCredential.md +0 -43
  57. package/docs/reference/interfaces/IAuditableItemGraphVerification.md +0 -23
  58. package/docs/reference/type-aliases/AuditableItemGraphVerificationState.md +0 -5
  59. package/docs/reference/type-aliases/JsonReturnType.md +0 -13
  60. package/docs/reference/variables/AuditableItemGraphVerificationState.md +0 -49
@@ -3,225 +3,296 @@ import { DataTypeHandlerFactory } from '@twin.org/data-core';
3
3
  // Copyright 2024 IOTA Stiftung.
4
4
  // SPDX-License-Identifier: Apache-2.0.
5
5
  /**
6
- * The types of auditable item graph data.
6
+ * The contexts of auditable item graph data.
7
7
  */
8
8
  // eslint-disable-next-line @typescript-eslint/naming-convention
9
- const AuditableItemGraphTypes = {
9
+ const AuditableItemGraphContexts = {
10
10
  /**
11
11
  * The context root for the auditable item graph types.
12
12
  */
13
13
  ContextRoot: "https://schema.twindev.org/aig/",
14
+ /**
15
+ * The context root for the common types.
16
+ */
17
+ ContextRootCommon: "https://schema.twindev.org/common/"
18
+ };
19
+
20
+ // Copyright 2024 IOTA Stiftung.
21
+ // SPDX-License-Identifier: Apache-2.0.
22
+ /**
23
+ * The types of auditable item graph data.
24
+ */
25
+ // eslint-disable-next-line @typescript-eslint/naming-convention
26
+ const AuditableItemGraphTypes = {
14
27
  /**
15
28
  * Represents auditable item graph vertex.
16
29
  */
17
- Vertex: "https://schema.twindev.org/aig/AuditableItemGraphVertex",
30
+ Vertex: "AuditableItemGraphVertex",
18
31
  /**
19
32
  * Represents auditable item graph alias.
20
33
  */
21
- Alias: "https://schema.twindev.org/aig/AuditableItemGraphAlias",
34
+ Alias: "AuditableItemGraphAlias",
22
35
  /**
23
36
  * Represents auditable item graph resource.
24
37
  */
25
- Resource: "https://schema.twindev.org/aig/AuditableItemGraphResource",
38
+ Resource: "AuditableItemGraphResource",
26
39
  /**
27
40
  * Represents auditable item graph edge.
28
41
  */
29
- Edge: "https://schema.twindev.org/aig/AuditableItemGraphEdge",
42
+ Edge: "AuditableItemGraphEdge",
30
43
  /**
31
44
  * Represents auditable item graph changeset.
32
45
  */
33
- Changeset: "https://schema.twindev.org/aig/AuditableItemGraphChangeset",
46
+ Changeset: "AuditableItemGraphChangeset",
34
47
  /**
35
48
  * Represents patch operation.
36
49
  */
37
- PatchOperation: "https://schema.twindev.org/aig/AuditableItemGraphPatchOperation",
38
- /**
39
- * Represents the immutable credential payload.
40
- */
41
- Credential: "https://schema.twindev.org/aig/AuditableItemGraphPatchCredential",
42
- /**
43
- * Represents auditable item stream verification.
44
- */
45
- Verification: "https://schema.twindev.org/aig/AuditableItemGraphVerification",
46
- /**
47
- * Represents auditable item stream verification state.
48
- */
49
- VerificationState: "https://schema.twindev.org/aig/AuditableItemGraphVerificationState"
50
+ PatchOperation: "AuditableItemGraphPatchOperation"
50
51
  };
51
52
 
52
- var type$8 = "object";
53
- var properties$7 = {
54
- metadata: {
55
- $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
56
- description: "The metadata to associate with the element as JSON-LD."
57
- },
53
+ var type$5 = "object";
54
+ var properties$5 = {
58
55
  id: {
59
56
  type: "string",
60
57
  description: "The id of the element."
61
58
  },
62
- created: {
63
- type: "number",
64
- description: "The timestamp of when the element was created."
59
+ dateCreated: {
60
+ type: "string",
61
+ description: "The date/time of when the element was created."
62
+ },
63
+ dateModified: {
64
+ type: "string",
65
+ description: "The date/time of when the element was modified."
66
+ },
67
+ dateDeleted: {
68
+ type: "string",
69
+ description: "The date/time of when the element was deleted, as we never actually remove items."
70
+ },
71
+ "@context": {
72
+ anyOf: [
73
+ {
74
+ type: "string",
75
+ "const": "https://schema.twindev.org/aig/"
76
+ },
77
+ {
78
+ type: "array",
79
+ minItems: 1,
80
+ items: [
81
+ {
82
+ type: "string",
83
+ "const": "https://schema.twindev.org/aig/"
84
+ }
85
+ ],
86
+ additionalItems: {
87
+ $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
88
+ }
89
+ }
90
+ ],
91
+ description: "JSON-LD Context."
65
92
  },
66
- updated: {
67
- type: "number",
68
- description: "The timestamp of when the element was updated."
93
+ type: {
94
+ type: "string",
95
+ "const": "AuditableItemGraphAlias",
96
+ description: "JSON-LD Type."
69
97
  },
70
- deleted: {
71
- type: "number",
72
- description: "The timestamp of when the element was deleted, as we never actually remove items."
98
+ annotationObject: {
99
+ $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
100
+ description: "The JSON-LD annotation object for the alias."
73
101
  },
74
- format: {
102
+ aliasFormat: {
75
103
  type: "string",
76
104
  description: "The format of the id in the alias."
77
105
  }
78
106
  };
79
- var additionalProperties$7 = false;
80
- var required$6 = [
81
- "created",
82
- "id"
107
+ var required$5 = [
108
+ "@context",
109
+ "id",
110
+ "type"
83
111
  ];
84
- var description$7 = "Interface describing an alias for a vertex.";
112
+ var additionalProperties$5 = false;
113
+ var description$5 = "Interface describing an alias for a vertex.";
85
114
  var AuditableItemGraphAliasSchema = {
86
- type: type$8,
87
- properties: properties$7,
88
- additionalProperties: additionalProperties$7,
89
- required: required$6,
90
- description: description$7
115
+ type: type$5,
116
+ properties: properties$5,
117
+ required: required$5,
118
+ additionalProperties: additionalProperties$5,
119
+ description: description$5
91
120
  };
92
121
 
93
- var type$7 = "object";
94
- var properties$6 = {
95
- created: {
96
- type: "number",
97
- description: "The timestamp of when the changeset was created."
98
- },
99
- userIdentity: {
100
- type: "string",
101
- description: "The user identity that created the changes."
102
- },
103
- patches: {
122
+ var type$4 = "object";
123
+ var properties$4 = {
124
+ "@context": {
104
125
  type: "array",
105
- items: {
106
- $ref: "https://schema.twindev.org/aig/AuditableItemGraphPatchOperation"
126
+ minItems: 2,
127
+ items: [
128
+ {
129
+ type: "string",
130
+ "const": "https://schema.twindev.org/aig/"
131
+ },
132
+ {
133
+ type: "string",
134
+ "const": "https://schema.twindev.org/common/"
135
+ }
136
+ ],
137
+ additionalItems: {
138
+ $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
107
139
  },
108
- description: "The patches in the changeset."
140
+ description: "JSON-LD Context."
109
141
  },
110
- hash: {
142
+ type: {
111
143
  type: "string",
112
- description: "The hash for the changeset."
144
+ "const": "AuditableItemGraphChangeset",
145
+ description: "JSON-LD Type."
113
146
  },
114
- signature: {
147
+ id: {
115
148
  type: "string",
116
- description: "The signature for the changeset."
149
+ description: "The id of the changeset."
117
150
  },
118
- immutableStorageId: {
151
+ dateCreated: {
119
152
  type: "string",
120
- description: "The immutable storage id containing the signature for the changeset."
121
- }
122
- };
123
- var required$5 = [
124
- "created",
125
- "userIdentity",
126
- "patches",
127
- "hash",
128
- "signature"
129
- ];
130
- var additionalProperties$6 = false;
131
- var description$6 = "Interface describing a set of updates to the vertex.";
132
- var AuditableItemGraphChangesetSchema = {
133
- type: type$7,
134
- properties: properties$6,
135
- required: required$5,
136
- additionalProperties: additionalProperties$6,
137
- description: description$6
138
- };
139
-
140
- var type$6 = "object";
141
- var properties$5 = {
142
- created: {
143
- type: "number",
144
- description: "The timestamp of when the changeset was created."
153
+ description: "The date/time of when the changeset was created."
145
154
  },
146
155
  userIdentity: {
147
156
  type: "string",
148
157
  description: "The user identity that created the changes."
149
158
  },
150
- signature: {
151
- type: "string",
152
- description: "The signature for the changeset."
159
+ patches: {
160
+ type: "array",
161
+ items: {
162
+ $ref: "https://schema.twindev.org/aig/AuditableItemGraphPatchOperation"
163
+ },
164
+ description: "The patches in the changeset."
153
165
  },
154
- hash: {
166
+ proofId: {
155
167
  type: "string",
156
- description: "The signature for the changeset."
168
+ description: "The immutable proof id which contains the signature for this changeset."
157
169
  },
158
- integrity: {
159
- type: "string",
160
- description: "The integrity data for this changeset, encrypted."
170
+ verification: {
171
+ $ref: "https://schema.twindev.org/immutable-proof/ImmutableProofVerification",
172
+ description: "The verification for the changeset."
161
173
  }
162
174
  };
163
175
  var required$4 = [
164
- "created",
176
+ "@context",
177
+ "type",
178
+ "id",
179
+ "dateCreated",
165
180
  "userIdentity",
166
- "signature",
167
- "hash"
181
+ "patches"
168
182
  ];
169
- var additionalProperties$5 = false;
170
- var description$5 = "The data stored immutably for the graph in a verifiable credential.";
171
- var AuditableItemGraphCredentialSchema = {
172
- type: type$6,
173
- properties: properties$5,
183
+ var additionalProperties$4 = false;
184
+ var description$4 = "Interface describing a set of changes to the vertex.";
185
+ var AuditableItemGraphChangesetSchema = {
186
+ type: type$4,
187
+ properties: properties$4,
174
188
  required: required$4,
175
- additionalProperties: additionalProperties$5,
176
- description: description$5
189
+ additionalProperties: additionalProperties$4,
190
+ description: description$4
177
191
  };
178
192
 
179
- var type$5 = "object";
180
- var properties$4 = {
181
- metadata: {
182
- $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
183
- description: "The metadata to associate with the element as JSON-LD."
184
- },
193
+ var type$3 = "object";
194
+ var properties$3 = {
185
195
  id: {
186
196
  type: "string",
187
197
  description: "The id of the element."
188
198
  },
189
- created: {
190
- type: "number",
191
- description: "The timestamp of when the element was created."
199
+ dateCreated: {
200
+ type: "string",
201
+ description: "The date/time of when the element was created."
192
202
  },
193
- updated: {
194
- type: "number",
195
- description: "The timestamp of when the element was updated."
203
+ dateModified: {
204
+ type: "string",
205
+ description: "The date/time of when the element was modified."
196
206
  },
197
- deleted: {
198
- type: "number",
199
- description: "The timestamp of when the element was deleted, as we never actually remove items."
207
+ dateDeleted: {
208
+ type: "string",
209
+ description: "The date/time of when the element was deleted, as we never actually remove items."
210
+ },
211
+ "@context": {
212
+ anyOf: [
213
+ {
214
+ type: "string",
215
+ "const": "https://schema.twindev.org/aig/"
216
+ },
217
+ {
218
+ type: "array",
219
+ minItems: 1,
220
+ items: [
221
+ {
222
+ type: "string",
223
+ "const": "https://schema.twindev.org/aig/"
224
+ }
225
+ ],
226
+ additionalItems: {
227
+ $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
228
+ }
229
+ }
230
+ ],
231
+ description: "JSON-LD Context."
200
232
  },
201
- relationship: {
233
+ type: {
202
234
  type: "string",
203
- description: "The relationship between the two vertices."
235
+ "const": "AuditableItemGraphEdge",
236
+ description: "JSON-LD Type."
237
+ },
238
+ annotationObject: {
239
+ $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
240
+ description: "The JSON-LD annotation object for the edge."
241
+ },
242
+ edgeRelationships: {
243
+ type: "array",
244
+ items: {
245
+ type: "string"
246
+ },
247
+ description: "The relationships between the two vertices."
204
248
  }
205
249
  };
206
250
  var required$3 = [
207
- "created",
251
+ "@context",
208
252
  "id",
209
- "relationship"
253
+ "type",
254
+ "edgeRelationships"
210
255
  ];
211
- var additionalProperties$4 = false;
212
- var description$4 = "Interface describing an edge between two vertices in an auditable item graph.";
256
+ var additionalProperties$3 = false;
257
+ var description$3 = "Interface describing an edge between two vertices in an auditable item graph.";
213
258
  var AuditableItemGraphEdgeSchema = {
214
- type: type$5,
215
- properties: properties$4,
259
+ type: type$3,
260
+ properties: properties$3,
216
261
  required: required$3,
217
- additionalProperties: additionalProperties$4,
218
- description: description$4
262
+ additionalProperties: additionalProperties$3,
263
+ description: description$3
219
264
  };
220
265
 
221
- var type$4 = "object";
222
- var additionalProperties$3 = false;
223
- var properties$3 = {
224
- op: {
266
+ var type$2 = "object";
267
+ var properties$2 = {
268
+ "@context": {
269
+ anyOf: [
270
+ {
271
+ type: "string",
272
+ "const": "https://schema.twindev.org/aig/"
273
+ },
274
+ {
275
+ type: "array",
276
+ minItems: 1,
277
+ items: [
278
+ {
279
+ type: "string",
280
+ "const": "https://schema.twindev.org/aig/"
281
+ }
282
+ ],
283
+ additionalItems: {
284
+ $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
285
+ }
286
+ }
287
+ ],
288
+ description: "JSON-LD Context."
289
+ },
290
+ type: {
291
+ type: "string",
292
+ "const": "AuditableItemGraphPatchOperation",
293
+ description: "JSON-LD Type."
294
+ },
295
+ patchOperation: {
225
296
  type: "string",
226
297
  "enum": [
227
298
  "add",
@@ -233,116 +304,147 @@ var properties$3 = {
233
304
  ],
234
305
  description: "The operation that was performed on the item."
235
306
  },
236
- path: {
307
+ patchPath: {
237
308
  type: "string",
238
309
  description: "The path to the object that was changed."
239
310
  },
240
- from: {
311
+ patchFrom: {
241
312
  type: "string",
242
313
  description: "The path the value was copied or moved from."
243
314
  },
244
- value: {
315
+ patchValue: {
245
316
  description: "The value to add."
246
317
  }
247
318
  };
248
319
  var required$2 = [
249
- "op",
250
- "path"
320
+ "@context",
321
+ "type",
322
+ "patchOperation",
323
+ "patchPath"
251
324
  ];
252
- var description$3 = "The patch operation for JSON diffs.";
325
+ var additionalProperties$2 = false;
326
+ var description$2 = "The patch operation for JSON diffs.";
253
327
  var AuditableItemGraphPatchOperationSchema = {
254
- type: type$4,
255
- additionalProperties: additionalProperties$3,
256
- properties: properties$3,
328
+ type: type$2,
329
+ properties: properties$2,
257
330
  required: required$2,
258
- description: description$3
331
+ additionalProperties: additionalProperties$2,
332
+ description: description$2
259
333
  };
260
334
 
261
- var type$3 = "object";
262
- var additionalProperties$2 = false;
263
- var properties$2 = {
264
- metadata: {
265
- $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
266
- description: "The metadata to associate with the element as JSON-LD."
267
- },
335
+ var type$1 = "object";
336
+ var properties$1 = {
268
337
  id: {
269
338
  type: "string",
270
339
  description: "The id of the element."
271
340
  },
272
- created: {
273
- type: "number",
274
- description: "The timestamp of when the element was created."
341
+ dateCreated: {
342
+ type: "string",
343
+ description: "The date/time of when the element was created."
275
344
  },
276
- updated: {
277
- type: "number",
278
- description: "The timestamp of when the element was updated."
345
+ dateModified: {
346
+ type: "string",
347
+ description: "The date/time of when the element was modified."
279
348
  },
280
- deleted: {
281
- type: "number",
282
- description: "The timestamp of when the element was deleted, as we never actually remove items."
349
+ dateDeleted: {
350
+ type: "string",
351
+ description: "The date/time of when the element was deleted, as we never actually remove items."
352
+ },
353
+ "@context": {
354
+ anyOf: [
355
+ {
356
+ type: "string",
357
+ "const": "https://schema.twindev.org/aig/"
358
+ },
359
+ {
360
+ type: "array",
361
+ minItems: 1,
362
+ items: [
363
+ {
364
+ type: "string",
365
+ "const": "https://schema.twindev.org/aig/"
366
+ }
367
+ ],
368
+ additionalItems: {
369
+ $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
370
+ }
371
+ }
372
+ ],
373
+ description: "JSON-LD Context."
374
+ },
375
+ type: {
376
+ type: "string",
377
+ "const": "AuditableItemGraphResource",
378
+ description: "JSON-LD Type."
379
+ },
380
+ resourceObject: {
381
+ $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
382
+ description: "The JSON-LD object for the resource."
283
383
  }
284
384
  };
285
385
  var required$1 = [
286
- "created",
287
- "id"
386
+ "@context",
387
+ "type"
288
388
  ];
289
- var description$2 = "Interface describing an auditable item graph vertex resource.";
389
+ var additionalProperties$1 = false;
390
+ var description$1 = "Interface describing an auditable item graph vertex resource.";
290
391
  var AuditableItemGraphResourceSchema = {
291
- type: type$3,
292
- additionalProperties: additionalProperties$2,
293
- properties: properties$2,
294
- required: required$1,
295
- description: description$2
296
- };
297
-
298
- var type$2 = "object";
299
- var properties$1 = {
300
- epoch: {
301
- type: "number",
302
- description: "The epoch of the verification."
303
- },
304
- state: {
305
- $ref: "https://schema.twindev.org/aig/AuditableItemGraphVerificationState",
306
- description: "The state of the verification."
307
- }
308
- };
309
- var required = [
310
- "epoch",
311
- "state"
312
- ];
313
- var additionalProperties$1 = {
314
- };
315
- var description$1 = "Interface describing an auditable item graph verification.";
316
- var AuditableItemGraphVerificationSchema = {
317
- type: type$2,
392
+ type: type$1,
318
393
  properties: properties$1,
319
- required: required,
394
+ required: required$1,
320
395
  additionalProperties: additionalProperties$1,
321
396
  description: description$1
322
397
  };
323
398
 
324
- var type$1 = "string";
325
- var description = "The state of the verification.";
326
- var AuditableItemGraphVerificationStateSchema = {
327
- type: type$1,
328
- "enum": [
329
- "ok",
330
- "hashMismatch",
331
- "signatureNotVerified",
332
- "credentialRevoked",
333
- "immutableHashMismatch",
334
- "immutableSignatureMismatch",
335
- "integrityDataMismatch"
336
- ],
337
- description: description
338
- };
339
-
340
399
  var type = "object";
341
400
  var properties = {
401
+ id: {
402
+ type: "string",
403
+ description: "The id of the element."
404
+ },
405
+ dateCreated: {
406
+ type: "string",
407
+ description: "The date/time of when the element was created."
408
+ },
409
+ dateModified: {
410
+ type: "string",
411
+ description: "The date/time of when the element was modified."
412
+ },
413
+ dateDeleted: {
414
+ type: "string",
415
+ description: "The date/time of when the element was deleted, as we never actually remove items."
416
+ },
417
+ "@context": {
418
+ type: "array",
419
+ minItems: 2,
420
+ items: [
421
+ {
422
+ type: "string",
423
+ "const": "https://schema.twindev.org/aig/"
424
+ },
425
+ {
426
+ type: "string",
427
+ "const": "https://schema.twindev.org/common/"
428
+ }
429
+ ],
430
+ additionalItems: {
431
+ $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
432
+ },
433
+ description: "JSON-LD Context."
434
+ },
435
+ type: {
436
+ type: "string",
437
+ "const": "AuditableItemGraphVertex",
438
+ description: "JSON-LD Type."
439
+ },
342
440
  nodeIdentity: {
343
441
  type: "string",
344
442
  description: "The identity of the node which controls the vertex."
345
443
  },
444
+ annotationObject: {
445
+ $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
446
+ description: "The JSON-LD annotation object for the vertex."
447
+ },
346
448
  aliases: {
347
449
  type: "array",
348
450
  items: {
@@ -371,28 +473,24 @@ var properties = {
371
473
  },
372
474
  description: "Changesets for the vertex."
373
475
  },
374
- id: {
375
- type: "string",
376
- description: "The id of the element."
377
- },
378
- created: {
379
- type: "number",
380
- description: "The timestamp of when the element was created."
381
- },
382
- updated: {
383
- type: "number",
384
- description: "The timestamp of when the element was updated."
385
- },
386
- metadata: {
387
- $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
388
- description: "The metadata to associate with the element as JSON-LD."
476
+ verified: {
477
+ type: "boolean",
478
+ description: "Is the vertex verified, will only be populated when verification is requested."
389
479
  }
390
480
  };
481
+ var required = [
482
+ "@context",
483
+ "id",
484
+ "type"
485
+ ];
391
486
  var additionalProperties = false;
487
+ var description = "Interface describing an auditable item graph vertex.";
392
488
  var AuditableItemGraphVertexSchema = {
393
489
  type: type,
394
490
  properties: properties,
395
- additionalProperties: additionalProperties
491
+ required: required,
492
+ additionalProperties: additionalProperties,
493
+ description: description
396
494
  };
397
495
 
398
496
  // Copyright 2024 IOTA Stiftung.
@@ -405,89 +503,60 @@ class AuditableItemGraphDataTypes {
405
503
  * Register all the data types.
406
504
  */
407
505
  static registerTypes() {
408
- DataTypeHandlerFactory.register(AuditableItemGraphTypes.Vertex, () => ({
506
+ DataTypeHandlerFactory.register(`${AuditableItemGraphContexts.ContextRoot}${AuditableItemGraphTypes.Vertex}`, () => ({
507
+ context: AuditableItemGraphContexts.ContextRoot,
409
508
  type: AuditableItemGraphTypes.Vertex,
410
509
  defaultValue: {},
411
510
  jsonSchema: async () => AuditableItemGraphVertexSchema
412
511
  }));
413
- DataTypeHandlerFactory.register(AuditableItemGraphTypes.Alias, () => ({
512
+ DataTypeHandlerFactory.register(`${AuditableItemGraphContexts.ContextRoot}${AuditableItemGraphTypes.Alias}`, () => ({
513
+ context: AuditableItemGraphContexts.ContextRoot,
414
514
  type: AuditableItemGraphTypes.Alias,
415
515
  defaultValue: {},
416
516
  jsonSchema: async () => AuditableItemGraphAliasSchema
417
517
  }));
418
- DataTypeHandlerFactory.register(AuditableItemGraphTypes.Resource, () => ({
518
+ DataTypeHandlerFactory.register(`${AuditableItemGraphContexts.ContextRoot}${AuditableItemGraphTypes.Resource}`, () => ({
519
+ context: AuditableItemGraphContexts.ContextRoot,
419
520
  type: AuditableItemGraphTypes.Resource,
420
521
  defaultValue: {},
421
522
  jsonSchema: async () => AuditableItemGraphResourceSchema
422
523
  }));
423
- DataTypeHandlerFactory.register(AuditableItemGraphTypes.Edge, () => ({
524
+ DataTypeHandlerFactory.register(`${AuditableItemGraphContexts.ContextRoot}${AuditableItemGraphTypes.Edge}`, () => ({
525
+ context: AuditableItemGraphContexts.ContextRoot,
424
526
  type: AuditableItemGraphTypes.Edge,
425
527
  defaultValue: {},
426
528
  jsonSchema: async () => AuditableItemGraphEdgeSchema
427
529
  }));
428
- DataTypeHandlerFactory.register(AuditableItemGraphTypes.Changeset, () => ({
530
+ DataTypeHandlerFactory.register(`${AuditableItemGraphContexts.ContextRoot}${AuditableItemGraphTypes.Changeset}`, () => ({
531
+ context: AuditableItemGraphContexts.ContextRoot,
429
532
  type: AuditableItemGraphTypes.Changeset,
430
533
  defaultValue: {},
431
534
  jsonSchema: async () => AuditableItemGraphChangesetSchema
432
535
  }));
433
- DataTypeHandlerFactory.register(AuditableItemGraphTypes.PatchOperation, () => ({
536
+ DataTypeHandlerFactory.register(`${AuditableItemGraphContexts.ContextRoot}${AuditableItemGraphTypes.PatchOperation}`, () => ({
537
+ context: AuditableItemGraphContexts.ContextRoot,
434
538
  type: AuditableItemGraphTypes.PatchOperation,
435
539
  defaultValue: {},
436
540
  jsonSchema: async () => AuditableItemGraphPatchOperationSchema
437
541
  }));
438
- DataTypeHandlerFactory.register(AuditableItemGraphTypes.Credential, () => ({
439
- type: AuditableItemGraphTypes.Credential,
440
- defaultValue: {},
441
- jsonSchema: async () => AuditableItemGraphCredentialSchema
442
- }));
443
- DataTypeHandlerFactory.register(AuditableItemGraphTypes.Verification, () => ({
444
- type: AuditableItemGraphTypes.Verification,
445
- defaultValue: {},
446
- jsonSchema: async () => AuditableItemGraphVerificationSchema
447
- }));
448
- DataTypeHandlerFactory.register(AuditableItemGraphTypes.VerificationState, () => ({
449
- type: AuditableItemGraphTypes.VerificationState,
450
- defaultValue: {},
451
- jsonSchema: async () => AuditableItemGraphVerificationStateSchema
452
- }));
453
542
  }
454
543
  }
455
544
 
456
545
  // Copyright 2024 IOTA Stiftung.
457
546
  // SPDX-License-Identifier: Apache-2.0.
458
547
  /**
459
- * The state of the verification.
548
+ * The topics for auditable item graph event bus notifications.
460
549
  */
461
550
  // eslint-disable-next-line @typescript-eslint/naming-convention
462
- const AuditableItemGraphVerificationState = {
463
- /**
464
- * OK.
465
- */
466
- Ok: "ok",
467
- /**
468
- * The stored hash does not matched the calculated one.
469
- */
470
- HashMismatch: "hashMismatch",
471
- /**
472
- * The signature verification failed.
473
- */
474
- SignatureNotVerified: "signatureNotVerified",
475
- /**
476
- * The credential in the immutable storage was revoked.
477
- */
478
- CredentialRevoked: "credentialRevoked",
479
- /**
480
- * Immutable hash mismatch.
481
- */
482
- ImmutableHashMismatch: "immutableHashMismatch",
551
+ const AuditableItemGraphTopics = {
483
552
  /**
484
- * Immutable signature mismatch.
553
+ * A vertex was created.
485
554
  */
486
- ImmutableSignatureMismatch: "immutableSignatureMismatch",
555
+ VertexCreated: "auditable-item-graph:vertex-created",
487
556
  /**
488
- * Integrity data mismatch.
557
+ * A vertex was updated.
489
558
  */
490
- IntegrityDataMismatch: "integrityDataMismatch"
559
+ VertexUpdated: "auditable-item-graph:vertex-updated"
491
560
  };
492
561
 
493
562
  // Copyright 2024 IOTA Stiftung.
@@ -511,4 +580,4 @@ const VerifyDepth = {
511
580
  All: "all"
512
581
  };
513
582
 
514
- export { AuditableItemGraphDataTypes, AuditableItemGraphTypes, AuditableItemGraphVerificationState, VerifyDepth };
583
+ export { AuditableItemGraphContexts, AuditableItemGraphDataTypes, AuditableItemGraphTopics, AuditableItemGraphTypes, VerifyDepth };