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

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