@twin.org/auditable-item-graph-models 0.0.1-next.8 → 0.0.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 (54) hide show
  1. package/dist/cjs/index.cjs +265 -393
  2. package/dist/esm/index.mjs +264 -393
  3. package/dist/types/index.d.ts +4 -3
  4. package/dist/types/models/IAuditableItemGraphAlias.d.ts +9 -4
  5. package/dist/types/models/IAuditableItemGraphAuditedElement.d.ts +2 -2
  6. package/dist/types/models/IAuditableItemGraphChangeset.d.ts +16 -14
  7. package/dist/types/models/IAuditableItemGraphComponent.d.ts +52 -36
  8. package/dist/types/models/IAuditableItemGraphEdge.d.ts +11 -6
  9. package/dist/types/models/IAuditableItemGraphPatchOperation.d.ts +3 -1
  10. package/dist/types/models/IAuditableItemGraphResource.d.ts +3 -2
  11. package/dist/types/models/IAuditableItemGraphVertex.d.ts +13 -4
  12. package/dist/types/models/IAuditableItemGraphVertexList.d.ts +11 -4
  13. package/dist/types/models/api/IAuditableItemGraphCreateRequest.d.ts +6 -6
  14. package/dist/types/models/api/IAuditableItemGraphGetRequest.d.ts +2 -2
  15. package/dist/types/models/api/IAuditableItemGraphListRequest.d.ts +10 -2
  16. package/dist/types/models/api/IAuditableItemGraphUpdateRequest.d.ts +6 -6
  17. package/dist/types/models/auditableItemGraphContexts.d.ts +17 -0
  18. package/dist/types/models/auditableItemGraphTopics.d.ts +17 -0
  19. package/dist/types/models/auditableItemGraphTypes.d.ts +4 -20
  20. package/dist/types/models/eventBus/IAuditableItemGraphEventBusVertexCreated.d.ts +9 -0
  21. package/dist/types/models/eventBus/IAuditableItemGraphEventBusVertexUpdated.d.ts +14 -0
  22. package/docs/changelog.md +90 -1
  23. package/docs/reference/classes/AuditableItemGraphDataTypes.md +3 -3
  24. package/docs/reference/index.md +6 -4
  25. package/docs/reference/interfaces/IAuditableItemGraphAlias.md +18 -18
  26. package/docs/reference/interfaces/IAuditableItemGraphAuditedElement.md +4 -4
  27. package/docs/reference/interfaces/IAuditableItemGraphChangeset.md +14 -22
  28. package/docs/reference/interfaces/IAuditableItemGraphComponent.md +109 -37
  29. package/docs/reference/interfaces/IAuditableItemGraphCreateRequest.md +4 -4
  30. package/docs/reference/interfaces/IAuditableItemGraphEdge.md +21 -21
  31. package/docs/reference/interfaces/IAuditableItemGraphEventBusVertexCreated.md +11 -0
  32. package/docs/reference/interfaces/IAuditableItemGraphEventBusVertexUpdated.md +19 -0
  33. package/docs/reference/interfaces/IAuditableItemGraphGetRequest.md +2 -2
  34. package/docs/reference/interfaces/IAuditableItemGraphListRequest.md +15 -3
  35. package/docs/reference/interfaces/IAuditableItemGraphPatchOperation.md +2 -2
  36. package/docs/reference/interfaces/IAuditableItemGraphResource.md +5 -5
  37. package/docs/reference/interfaces/IAuditableItemGraphUpdateRequest.md +4 -4
  38. package/docs/reference/interfaces/IAuditableItemGraphVertex.md +18 -18
  39. package/docs/reference/interfaces/IAuditableItemGraphVertexList.md +6 -6
  40. package/docs/reference/type-aliases/AuditableItemGraphContexts.md +5 -0
  41. package/docs/reference/type-aliases/AuditableItemGraphTopics.md +5 -0
  42. package/docs/reference/type-aliases/AuditableItemGraphTypes.md +1 -1
  43. package/docs/reference/type-aliases/VerifyDepth.md +1 -1
  44. package/docs/reference/variables/AuditableItemGraphContexts.md +19 -0
  45. package/docs/reference/variables/AuditableItemGraphTopics.md +19 -0
  46. package/docs/reference/variables/AuditableItemGraphTypes.md +6 -30
  47. package/package.json +12 -10
  48. package/dist/types/models/IAuditableItemGraphCredential.d.ts +0 -34
  49. package/dist/types/models/IAuditableItemGraphVerification.d.ts +0 -29
  50. package/dist/types/models/auditableItemGraphVerificationState.d.ts +0 -37
  51. package/docs/reference/interfaces/IAuditableItemGraphCredential.md +0 -59
  52. package/docs/reference/interfaces/IAuditableItemGraphVerification.md +0 -47
  53. package/docs/reference/type-aliases/AuditableItemGraphVerificationState.md +0 -5
  54. package/docs/reference/variables/AuditableItemGraphVerificationState.md +0 -49
@@ -3,18 +3,35 @@ 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
30
  Vertex: "AuditableItemGraphVertex",
31
+ /**
32
+ * Represents auditable item graph vertex list.
33
+ */
34
+ VertexList: "AuditableItemGraphVertexList",
18
35
  /**
19
36
  * Represents auditable item graph alias.
20
37
  */
@@ -34,27 +51,14 @@ const AuditableItemGraphTypes = {
34
51
  /**
35
52
  * Represents patch operation.
36
53
  */
37
- PatchOperation: "AuditableItemGraphPatchOperation",
38
- /**
39
- * Represents the immutable credential payload.
40
- */
41
- Credential: "AuditableItemGraphPatchCredential",
42
- /**
43
- * Represents auditable item stream verification.
44
- */
45
- Verification: "AuditableItemGraphVerification",
46
- /**
47
- * Represents auditable item stream verification state.
48
- */
49
- VerificationState: "AuditableItemGraphVerificationState",
50
- /**
51
- * Represents auditable item stream vertex list.
52
- */
53
- VertexList: "AuditableItemGraphVertexList"
54
+ PatchOperation: "AuditableItemGraphPatchOperation"
54
55
  };
55
56
 
56
- var type$9 = "object";
57
- var properties$8 = {
57
+ var $schema$6 = "https://json-schema.org/draft/2020-12/schema";
58
+ var $id$6 = "https://schema.twindev.org/aig/AuditableItemGraphAlias";
59
+ var description$6 = "Interface describing an alias for a vertex.";
60
+ var type$6 = "object";
61
+ var properties$6 = {
58
62
  id: {
59
63
  type: "string",
60
64
  description: "The id of the element."
@@ -80,15 +84,15 @@ var properties$8 = {
80
84
  {
81
85
  type: "array",
82
86
  minItems: 1,
83
- items: [
87
+ items: {
88
+ $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
89
+ },
90
+ prefixItems: [
84
91
  {
85
92
  type: "string",
86
93
  "const": "https://schema.twindev.org/aig/"
87
94
  }
88
- ],
89
- additionalItems: {
90
- type: "string"
91
- }
95
+ ]
92
96
  }
93
97
  ],
94
98
  description: "JSON-LD Context."
@@ -98,60 +102,63 @@ var properties$8 = {
98
102
  "const": "AuditableItemGraphAlias",
99
103
  description: "JSON-LD Type."
100
104
  },
101
- aliasObject: {
105
+ annotationObject: {
102
106
  $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
103
- description: "The JSON-LD object for the alias."
107
+ description: "The JSON-LD annotation object for the alias."
104
108
  },
105
109
  aliasFormat: {
106
110
  type: "string",
107
111
  description: "The format of the id in the alias."
108
112
  }
109
113
  };
110
- var required$8 = [
114
+ var required$6 = [
111
115
  "@context",
112
- "dateCreated",
113
116
  "id",
114
117
  "type"
115
118
  ];
116
- var additionalProperties$8 = false;
117
- var description$9 = "Interface describing an alias for a vertex.";
119
+ var additionalProperties$6 = false;
118
120
  var AuditableItemGraphAliasSchema = {
119
- type: type$9,
120
- properties: properties$8,
121
- required: required$8,
122
- additionalProperties: additionalProperties$8,
123
- description: description$9
121
+ $schema: $schema$6,
122
+ $id: $id$6,
123
+ description: description$6,
124
+ type: type$6,
125
+ properties: properties$6,
126
+ required: required$6,
127
+ additionalProperties: additionalProperties$6
124
128
  };
125
129
 
126
- var type$8 = "object";
127
- var properties$7 = {
130
+ var $schema$5 = "https://json-schema.org/draft/2020-12/schema";
131
+ var $id$5 = "https://schema.twindev.org/aig/AuditableItemGraphChangeset";
132
+ var description$5 = "Interface describing a set of changes to the vertex.";
133
+ var type$5 = "object";
134
+ var properties$5 = {
128
135
  "@context": {
129
- anyOf: [
136
+ type: "array",
137
+ minItems: 2,
138
+ items: {
139
+ $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
140
+ },
141
+ description: "JSON-LD Context.",
142
+ prefixItems: [
130
143
  {
131
144
  type: "string",
132
145
  "const": "https://schema.twindev.org/aig/"
133
146
  },
134
147
  {
135
- type: "array",
136
- minItems: 1,
137
- items: [
138
- {
139
- type: "string",
140
- "const": "https://schema.twindev.org/aig/"
141
- }
142
- ],
143
- additionalItems: {
144
- type: "string"
145
- }
148
+ type: "string",
149
+ "const": "https://schema.twindev.org/common/"
146
150
  }
147
- ],
148
- description: "JSON-LD Context."
151
+ ]
149
152
  },
150
153
  type: {
151
154
  type: "string",
152
155
  "const": "AuditableItemGraphChangeset",
153
156
  description: "JSON-LD Type."
154
157
  },
158
+ id: {
159
+ type: "string",
160
+ description: "The id of the changeset."
161
+ },
155
162
  dateCreated: {
156
163
  type: "string",
157
164
  description: "The date/time of when the changeset was created."
@@ -162,117 +169,47 @@ var properties$7 = {
162
169
  },
163
170
  patches: {
164
171
  type: "array",
165
- items: {
166
- $ref: "https://schema.twindev.org/aig/AuditableItemGraphPatchOperation"
167
- },
168
- description: "The patches in the changeset."
169
- },
170
- hash: {
171
- type: "string",
172
- description: "The hash for the changeset."
173
- },
174
- signature: {
175
- type: "string",
176
- description: "The signature for the changeset."
172
+ items: false,
173
+ description: "The patches in the changeset.",
174
+ prefixItems: [
175
+ {
176
+ $ref: "https://schema.twindev.org/aig/AuditableItemGraphPatchOperation"
177
+ }
178
+ ]
177
179
  },
178
- immutableStorageId: {
180
+ proofId: {
179
181
  type: "string",
180
- description: "The immutable storage id containing the signature for the changeset."
182
+ description: "The immutable proof id which contains the signature for this changeset."
181
183
  },
182
184
  verification: {
183
- $ref: "https://schema.twindev.org/aig/AuditableItemGraphVerification",
185
+ $ref: "https://schema.twindev.org/immutable-proof/ImmutableProofVerification",
184
186
  description: "The verification for the changeset."
185
187
  }
186
188
  };
187
- var required$7 = [
189
+ var required$5 = [
188
190
  "@context",
189
191
  "type",
192
+ "id",
190
193
  "dateCreated",
191
194
  "userIdentity",
192
- "patches",
193
- "hash",
194
- "signature"
195
+ "patches"
195
196
  ];
196
- var additionalProperties$7 = false;
197
- var description$8 = "Interface describing a set of updates to the vertex.";
197
+ var additionalProperties$5 = false;
198
198
  var AuditableItemGraphChangesetSchema = {
199
- type: type$8,
200
- properties: properties$7,
201
- required: required$7,
202
- additionalProperties: additionalProperties$7,
203
- description: description$8
204
- };
205
-
206
- var type$7 = "object";
207
- var properties$6 = {
208
- "@context": {
209
- anyOf: [
210
- {
211
- type: "string",
212
- "const": "https://schema.twindev.org/aig/"
213
- },
214
- {
215
- type: "array",
216
- minItems: 1,
217
- items: [
218
- {
219
- type: "string",
220
- "const": "https://schema.twindev.org/aig/"
221
- }
222
- ],
223
- additionalItems: {
224
- type: "string"
225
- }
226
- }
227
- ],
228
- description: "JSON-LD Context."
229
- },
230
- type: {
231
- type: "string",
232
- "const": "AuditableItemGraphPatchCredential",
233
- description: "JSON-LD Type."
234
- },
235
- dateCreated: {
236
- type: "string",
237
- description: "The date/time of when the changeset was created."
238
- },
239
- userIdentity: {
240
- type: "string",
241
- description: "The user identity that created the changes."
242
- },
243
- signature: {
244
- type: "string",
245
- description: "The signature for the changeset."
246
- },
247
- hash: {
248
- type: "string",
249
- description: "The signature for the changeset."
250
- },
251
- integrity: {
252
- type: "string",
253
- description: "The integrity data for this changeset, encrypted."
254
- }
255
- };
256
- var required$6 = [
257
- "@context",
258
- "type",
259
- "dateCreated",
260
- "userIdentity",
261
- "signature",
262
- "hash"
263
- ];
264
- var additionalProperties$6 = false;
265
- var description$7 = "The data stored immutably for the graph in a verifiable credential.";
266
- var AuditableItemGraphCredentialSchema = {
267
- type: type$7,
268
- properties: properties$6,
269
- required: required$6,
270
- additionalProperties: additionalProperties$6,
271
- description: description$7
199
+ $schema: $schema$5,
200
+ $id: $id$5,
201
+ description: description$5,
202
+ type: type$5,
203
+ properties: properties$5,
204
+ required: required$5,
205
+ additionalProperties: additionalProperties$5
272
206
  };
273
207
 
274
- var type$6 = "object";
275
- var properties$5 = {
208
+ var $schema$4 = "https://json-schema.org/draft/2020-12/schema";
209
+ var $id$4 = "https://schema.twindev.org/aig/AuditableItemGraphEdge";
210
+ var description$4 = "Interface describing an edge between two vertices in an auditable item graph.";
211
+ var type$4 = "object";
212
+ var properties$4 = {
276
213
  id: {
277
214
  type: "string",
278
215
  description: "The id of the element."
@@ -298,15 +235,15 @@ var properties$5 = {
298
235
  {
299
236
  type: "array",
300
237
  minItems: 1,
301
- items: [
238
+ items: {
239
+ $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
240
+ },
241
+ prefixItems: [
302
242
  {
303
243
  type: "string",
304
244
  "const": "https://schema.twindev.org/aig/"
305
245
  }
306
- ],
307
- additionalItems: {
308
- type: "string"
309
- }
246
+ ]
310
247
  }
311
248
  ],
312
249
  description: "JSON-LD Context."
@@ -316,34 +253,43 @@ var properties$5 = {
316
253
  "const": "AuditableItemGraphEdge",
317
254
  description: "JSON-LD Type."
318
255
  },
319
- edgeObject: {
256
+ annotationObject: {
320
257
  $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
321
- description: "The JSON-LD object for the edge."
258
+ description: "The JSON-LD annotation object for the edge."
322
259
  },
323
- edgeRelationship: {
324
- type: "string",
325
- description: "The relationship between the two vertices."
260
+ edgeRelationships: {
261
+ type: "array",
262
+ items: false,
263
+ description: "The relationships between the two vertices.",
264
+ prefixItems: [
265
+ {
266
+ type: "string"
267
+ }
268
+ ]
326
269
  }
327
270
  };
328
- var required$5 = [
271
+ var required$4 = [
329
272
  "@context",
330
- "dateCreated",
331
- "edgeRelationship",
332
273
  "id",
333
- "type"
274
+ "type",
275
+ "edgeRelationships"
334
276
  ];
335
- var additionalProperties$5 = false;
336
- var description$6 = "Interface describing an edge between two vertices in an auditable item graph.";
277
+ var additionalProperties$4 = false;
337
278
  var AuditableItemGraphEdgeSchema = {
338
- type: type$6,
339
- properties: properties$5,
340
- required: required$5,
341
- additionalProperties: additionalProperties$5,
342
- description: description$6
279
+ $schema: $schema$4,
280
+ $id: $id$4,
281
+ description: description$4,
282
+ type: type$4,
283
+ properties: properties$4,
284
+ required: required$4,
285
+ additionalProperties: additionalProperties$4
343
286
  };
344
287
 
345
- var type$5 = "object";
346
- var properties$4 = {
288
+ var $schema$3 = "https://json-schema.org/draft/2020-12/schema";
289
+ var $id$3 = "https://schema.twindev.org/aig/AuditableItemGraphPatchOperation";
290
+ var description$3 = "The patch operation for JSON diffs.";
291
+ var type$3 = "object";
292
+ var properties$3 = {
347
293
  "@context": {
348
294
  anyOf: [
349
295
  {
@@ -353,15 +299,15 @@ var properties$4 = {
353
299
  {
354
300
  type: "array",
355
301
  minItems: 1,
356
- items: [
302
+ items: {
303
+ $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
304
+ },
305
+ prefixItems: [
357
306
  {
358
307
  type: "string",
359
308
  "const": "https://schema.twindev.org/aig/"
360
309
  }
361
- ],
362
- additionalItems: {
363
- type: "string"
364
- }
310
+ ]
365
311
  }
366
312
  ],
367
313
  description: "JSON-LD Context."
@@ -395,24 +341,28 @@ var properties$4 = {
395
341
  description: "The value to add."
396
342
  }
397
343
  };
398
- var required$4 = [
344
+ var required$3 = [
399
345
  "@context",
400
346
  "type",
401
347
  "patchOperation",
402
348
  "patchPath"
403
349
  ];
404
- var additionalProperties$4 = false;
405
- var description$5 = "The patch operation for JSON diffs.";
350
+ var additionalProperties$3 = false;
406
351
  var AuditableItemGraphPatchOperationSchema = {
407
- type: type$5,
408
- properties: properties$4,
409
- required: required$4,
410
- additionalProperties: additionalProperties$4,
411
- description: description$5
352
+ $schema: $schema$3,
353
+ $id: $id$3,
354
+ description: description$3,
355
+ type: type$3,
356
+ properties: properties$3,
357
+ required: required$3,
358
+ additionalProperties: additionalProperties$3
412
359
  };
413
360
 
414
- var type$4 = "object";
415
- var properties$3 = {
361
+ var $schema$2 = "https://json-schema.org/draft/2020-12/schema";
362
+ var $id$2 = "https://schema.twindev.org/aig/AuditableItemGraphResource";
363
+ var description$2 = "Interface describing an auditable item graph vertex resource.";
364
+ var type$2 = "object";
365
+ var properties$2 = {
416
366
  id: {
417
367
  type: "string",
418
368
  description: "The id of the element."
@@ -438,15 +388,15 @@ var properties$3 = {
438
388
  {
439
389
  type: "array",
440
390
  minItems: 1,
441
- items: [
391
+ items: {
392
+ $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
393
+ },
394
+ prefixItems: [
442
395
  {
443
396
  type: "string",
444
397
  "const": "https://schema.twindev.org/aig/"
445
398
  }
446
- ],
447
- additionalItems: {
448
- type: "string"
449
- }
399
+ ]
450
400
  }
451
401
  ],
452
402
  description: "JSON-LD Context."
@@ -461,98 +411,24 @@ var properties$3 = {
461
411
  description: "The JSON-LD object for the resource."
462
412
  }
463
413
  };
464
- var required$3 = [
465
- "@context",
466
- "dateCreated",
467
- "id",
468
- "type"
469
- ];
470
- var additionalProperties$3 = false;
471
- var description$4 = "Interface describing an auditable item graph vertex resource.";
472
- var AuditableItemGraphResourceSchema = {
473
- type: type$4,
474
- properties: properties$3,
475
- required: required$3,
476
- additionalProperties: additionalProperties$3,
477
- description: description$4
478
- };
479
-
480
- var type$3 = "object";
481
- var properties$2 = {
482
- "@context": {
483
- anyOf: [
484
- {
485
- type: "string",
486
- "const": "https://schema.twindev.org/aig/"
487
- },
488
- {
489
- type: "array",
490
- minItems: 1,
491
- items: [
492
- {
493
- type: "string",
494
- "const": "https://schema.twindev.org/aig/"
495
- }
496
- ],
497
- additionalItems: {
498
- type: "string"
499
- }
500
- }
501
- ],
502
- description: "JSON-LD Context."
503
- },
504
- type: {
505
- type: "string",
506
- "const": "AuditableItemGraphVerification",
507
- description: "JSON-LD Type."
508
- },
509
- dateCreated: {
510
- type: "string",
511
- description: "The date/time of the verification."
512
- },
513
- state: {
514
- $ref: "https://schema.twindev.org/aig/AuditableItemGraphVerificationState",
515
- description: "The state of the verification."
516
- },
517
- stateProperties: {
518
- type: "object",
519
- additionalProperties: {
520
- },
521
- description: "The state properties."
522
- }
523
- };
524
414
  var required$2 = [
525
415
  "@context",
526
- "type",
527
- "dateCreated",
528
- "state"
416
+ "type"
529
417
  ];
530
418
  var additionalProperties$2 = false;
531
- var description$3 = "Interface describing an auditable item graph verification.";
532
- var AuditableItemGraphVerificationSchema = {
533
- type: type$3,
419
+ var AuditableItemGraphResourceSchema = {
420
+ $schema: $schema$2,
421
+ $id: $id$2,
422
+ description: description$2,
423
+ type: type$2,
534
424
  properties: properties$2,
535
425
  required: required$2,
536
- additionalProperties: additionalProperties$2,
537
- description: description$3
538
- };
539
-
540
- var type$2 = "string";
541
- var description$2 = "The state of the verification.";
542
- var AuditableItemGraphVerificationStateSchema = {
543
- type: type$2,
544
- "enum": [
545
- "ok",
546
- "hashMismatch",
547
- "signatureNotVerified",
548
- "credentialRevoked",
549
- "immutableHashMismatch",
550
- "immutableSignatureMismatch",
551
- "integrityDataMismatch"
552
- ],
553
- description: description$2
426
+ additionalProperties: additionalProperties$2
554
427
  };
555
428
 
429
+ var $schema$1 = "https://json-schema.org/draft/2020-12/schema";
430
+ var $id$1 = "https://schema.twindev.org/aig/AuditableItemGraphVertex";
431
+ var description$1 = "Interface describing an auditable item graph vertex.";
556
432
  var type$1 = "object";
557
433
  var properties$1 = {
558
434
  id: {
@@ -572,26 +448,22 @@ var properties$1 = {
572
448
  description: "The date/time of when the element was deleted, as we never actually remove items."
573
449
  },
574
450
  "@context": {
575
- anyOf: [
451
+ type: "array",
452
+ minItems: 2,
453
+ items: {
454
+ $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
455
+ },
456
+ description: "JSON-LD Context.",
457
+ prefixItems: [
576
458
  {
577
459
  type: "string",
578
460
  "const": "https://schema.twindev.org/aig/"
579
461
  },
580
462
  {
581
- type: "array",
582
- minItems: 1,
583
- items: [
584
- {
585
- type: "string",
586
- "const": "https://schema.twindev.org/aig/"
587
- }
588
- ],
589
- additionalItems: {
590
- type: "string"
591
- }
463
+ type: "string",
464
+ "const": "https://schema.twindev.org/common/"
592
465
  }
593
- ],
594
- description: "JSON-LD Context."
466
+ ]
595
467
  },
596
468
  type: {
597
469
  type: "string",
@@ -602,37 +474,49 @@ var properties$1 = {
602
474
  type: "string",
603
475
  description: "The identity of the node which controls the vertex."
604
476
  },
605
- vertexObject: {
477
+ annotationObject: {
606
478
  $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
607
- description: "The JSON-LD object for the vertex."
479
+ description: "The JSON-LD annotation object for the vertex."
608
480
  },
609
481
  aliases: {
610
482
  type: "array",
611
- items: {
612
- $ref: "https://schema.twindev.org/aig/AuditableItemGraphAlias"
613
- },
614
- description: "Alternative aliases that can be used to identify the vertex."
483
+ items: false,
484
+ description: "Alternative aliases that can be used to identify the vertex.",
485
+ prefixItems: [
486
+ {
487
+ $ref: "https://schema.twindev.org/aig/AuditableItemGraphAlias"
488
+ }
489
+ ]
615
490
  },
616
491
  resources: {
617
492
  type: "array",
618
- items: {
619
- $ref: "https://schema.twindev.org/aig/AuditableItemGraphResource"
620
- },
621
- description: "The resources attached to the vertex."
493
+ items: false,
494
+ description: "The resources attached to the vertex.",
495
+ prefixItems: [
496
+ {
497
+ $ref: "https://schema.twindev.org/aig/AuditableItemGraphResource"
498
+ }
499
+ ]
622
500
  },
623
501
  edges: {
624
502
  type: "array",
625
- items: {
626
- $ref: "https://schema.twindev.org/aig/AuditableItemGraphEdge"
627
- },
628
- description: "Edges connected to the vertex."
503
+ items: false,
504
+ description: "Edges connected to the vertex.",
505
+ prefixItems: [
506
+ {
507
+ $ref: "https://schema.twindev.org/aig/AuditableItemGraphEdge"
508
+ }
509
+ ]
629
510
  },
630
511
  changesets: {
631
512
  type: "array",
632
- items: {
633
- $ref: "https://schema.twindev.org/aig/AuditableItemGraphChangeset"
634
- },
635
- description: "Changesets for the vertex."
513
+ items: false,
514
+ description: "Changesets for the vertex.",
515
+ prefixItems: [
516
+ {
517
+ $ref: "https://schema.twindev.org/aig/AuditableItemGraphChangeset"
518
+ }
519
+ ]
636
520
  },
637
521
  verified: {
638
522
  type: "boolean",
@@ -641,57 +525,71 @@ var properties$1 = {
641
525
  };
642
526
  var required$1 = [
643
527
  "@context",
644
- "dateCreated",
645
528
  "id",
646
529
  "type"
647
530
  ];
648
531
  var additionalProperties$1 = false;
649
- var description$1 = "Interface describing an auditable item graph vertex.";
650
532
  var AuditableItemGraphVertexSchema = {
533
+ $schema: $schema$1,
534
+ $id: $id$1,
535
+ description: description$1,
651
536
  type: type$1,
652
537
  properties: properties$1,
653
538
  required: required$1,
654
- additionalProperties: additionalProperties$1,
655
- description: description$1
539
+ additionalProperties: additionalProperties$1
656
540
  };
657
541
 
542
+ var $schema = "https://json-schema.org/draft/2020-12/schema";
543
+ var $id = "https://schema.twindev.org/aig/AuditableItemGraphVertexList";
544
+ var description = "Interface describing an auditable item graph vertex list.";
658
545
  var type = "object";
659
546
  var properties = {
660
547
  "@context": {
661
- anyOf: [
548
+ type: "array",
549
+ minItems: 2,
550
+ items: {
551
+ $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
552
+ },
553
+ description: "JSON-LD Context.",
554
+ prefixItems: [
662
555
  {
663
556
  type: "string",
664
- "const": "https://schema.twindev.org/aig/"
557
+ "const": "https://schema.org"
665
558
  },
666
559
  {
667
- type: "array",
668
- minItems: 1,
669
- items: [
670
- {
671
- type: "string",
672
- "const": "https://schema.twindev.org/aig/"
673
- }
674
- ],
675
- additionalItems: {
676
- type: "string"
677
- }
560
+ type: "string",
561
+ "const": "https://schema.twindev.org/aig/"
678
562
  }
679
- ],
680
- description: "JSON-LD Context."
563
+ ]
681
564
  },
682
565
  type: {
683
- type: "string",
684
- "const": "AuditableItemGraphVertexList",
685
- description: "JSON-LD Type."
566
+ type: "array",
567
+ minItems: 2,
568
+ items: false,
569
+ maxItems: 2,
570
+ description: "JSON-LD Type.",
571
+ prefixItems: [
572
+ {
573
+ type: "string",
574
+ "const": "ItemList"
575
+ },
576
+ {
577
+ type: "string",
578
+ "const": "AuditableItemGraphVertexList"
579
+ }
580
+ ]
686
581
  },
687
- vertices: {
582
+ itemListElement: {
688
583
  type: "array",
689
- items: {
690
- $ref: "https://schema.twindev.org/aig/AuditableItemGraphVertex"
691
- },
692
- description: "The list of vertices."
584
+ items: false,
585
+ description: "The list of vertices.",
586
+ prefixItems: [
587
+ {
588
+ $ref: "https://schema.twindev.org/aig/AuditableItemGraphVertex"
589
+ }
590
+ ]
693
591
  },
694
- cursor: {
592
+ nextItem: {
695
593
  type: "string",
696
594
  description: "The cursor to get the next chunk of vertices."
697
595
  }
@@ -699,16 +597,17 @@ var properties = {
699
597
  var required = [
700
598
  "@context",
701
599
  "type",
702
- "vertices"
600
+ "itemListElement"
703
601
  ];
704
602
  var additionalProperties = false;
705
- var description = "Interface describing an auditable item graph vertex list.";
706
603
  var AuditableItemGraphVertexListSchema = {
604
+ $schema: $schema,
605
+ $id: $id,
606
+ description: description,
707
607
  type: type,
708
608
  properties: properties,
709
609
  required: required,
710
- additionalProperties: additionalProperties,
711
- description: description
610
+ additionalProperties: additionalProperties
712
611
  };
713
612
 
714
613
  // Copyright 2024 IOTA Stiftung.
@@ -721,94 +620,66 @@ class AuditableItemGraphDataTypes {
721
620
  * Register all the data types.
722
621
  */
723
622
  static registerTypes() {
724
- DataTypeHandlerFactory.register(AuditableItemGraphTypes.Vertex, () => ({
623
+ DataTypeHandlerFactory.register(`${AuditableItemGraphContexts.ContextRoot}${AuditableItemGraphTypes.Vertex}`, () => ({
624
+ context: AuditableItemGraphContexts.ContextRoot,
725
625
  type: AuditableItemGraphTypes.Vertex,
726
626
  defaultValue: {},
727
627
  jsonSchema: async () => AuditableItemGraphVertexSchema
728
628
  }));
729
- DataTypeHandlerFactory.register(AuditableItemGraphTypes.Alias, () => ({
629
+ DataTypeHandlerFactory.register(`${AuditableItemGraphContexts.ContextRoot}${AuditableItemGraphTypes.VertexList}`, () => ({
630
+ context: AuditableItemGraphContexts.ContextRoot,
631
+ type: AuditableItemGraphTypes.VertexList,
632
+ defaultValue: {},
633
+ jsonSchema: async () => AuditableItemGraphVertexListSchema
634
+ }));
635
+ DataTypeHandlerFactory.register(`${AuditableItemGraphContexts.ContextRoot}${AuditableItemGraphTypes.Alias}`, () => ({
636
+ context: AuditableItemGraphContexts.ContextRoot,
730
637
  type: AuditableItemGraphTypes.Alias,
731
638
  defaultValue: {},
732
639
  jsonSchema: async () => AuditableItemGraphAliasSchema
733
640
  }));
734
- DataTypeHandlerFactory.register(AuditableItemGraphTypes.Resource, () => ({
641
+ DataTypeHandlerFactory.register(`${AuditableItemGraphContexts.ContextRoot}${AuditableItemGraphTypes.Resource}`, () => ({
642
+ context: AuditableItemGraphContexts.ContextRoot,
735
643
  type: AuditableItemGraphTypes.Resource,
736
644
  defaultValue: {},
737
645
  jsonSchema: async () => AuditableItemGraphResourceSchema
738
646
  }));
739
- DataTypeHandlerFactory.register(AuditableItemGraphTypes.Edge, () => ({
647
+ DataTypeHandlerFactory.register(`${AuditableItemGraphContexts.ContextRoot}${AuditableItemGraphTypes.Edge}`, () => ({
648
+ context: AuditableItemGraphContexts.ContextRoot,
740
649
  type: AuditableItemGraphTypes.Edge,
741
650
  defaultValue: {},
742
651
  jsonSchema: async () => AuditableItemGraphEdgeSchema
743
652
  }));
744
- DataTypeHandlerFactory.register(AuditableItemGraphTypes.Changeset, () => ({
653
+ DataTypeHandlerFactory.register(`${AuditableItemGraphContexts.ContextRoot}${AuditableItemGraphTypes.Changeset}`, () => ({
654
+ context: AuditableItemGraphContexts.ContextRoot,
745
655
  type: AuditableItemGraphTypes.Changeset,
746
656
  defaultValue: {},
747
657
  jsonSchema: async () => AuditableItemGraphChangesetSchema
748
658
  }));
749
- DataTypeHandlerFactory.register(AuditableItemGraphTypes.PatchOperation, () => ({
659
+ DataTypeHandlerFactory.register(`${AuditableItemGraphContexts.ContextRoot}${AuditableItemGraphTypes.PatchOperation}`, () => ({
660
+ context: AuditableItemGraphContexts.ContextRoot,
750
661
  type: AuditableItemGraphTypes.PatchOperation,
751
662
  defaultValue: {},
752
663
  jsonSchema: async () => AuditableItemGraphPatchOperationSchema
753
664
  }));
754
- DataTypeHandlerFactory.register(AuditableItemGraphTypes.Credential, () => ({
755
- type: AuditableItemGraphTypes.Credential,
756
- defaultValue: {},
757
- jsonSchema: async () => AuditableItemGraphCredentialSchema
758
- }));
759
- DataTypeHandlerFactory.register(AuditableItemGraphTypes.Verification, () => ({
760
- type: AuditableItemGraphTypes.Verification,
761
- defaultValue: {},
762
- jsonSchema: async () => AuditableItemGraphVerificationSchema
763
- }));
764
- DataTypeHandlerFactory.register(AuditableItemGraphTypes.VertexList, () => ({
765
- type: AuditableItemGraphTypes.VertexList,
766
- defaultValue: {},
767
- jsonSchema: async () => AuditableItemGraphVertexListSchema
768
- }));
769
- DataTypeHandlerFactory.register(AuditableItemGraphTypes.VerificationState, () => ({
770
- type: AuditableItemGraphTypes.VerificationState,
771
- defaultValue: {},
772
- jsonSchema: async () => AuditableItemGraphVerificationStateSchema
773
- }));
774
665
  }
775
666
  }
776
667
 
777
668
  // Copyright 2024 IOTA Stiftung.
778
669
  // SPDX-License-Identifier: Apache-2.0.
779
670
  /**
780
- * The state of the verification.
671
+ * The topics for auditable item graph event bus notifications.
781
672
  */
782
673
  // eslint-disable-next-line @typescript-eslint/naming-convention
783
- const AuditableItemGraphVerificationState = {
784
- /**
785
- * OK.
786
- */
787
- Ok: "ok",
788
- /**
789
- * The stored hash does not matched the calculated one.
790
- */
791
- HashMismatch: "hashMismatch",
792
- /**
793
- * The signature verification failed.
794
- */
795
- SignatureNotVerified: "signatureNotVerified",
796
- /**
797
- * The credential in the immutable storage was revoked.
798
- */
799
- CredentialRevoked: "credentialRevoked",
800
- /**
801
- * Immutable hash mismatch.
802
- */
803
- ImmutableHashMismatch: "immutableHashMismatch",
674
+ const AuditableItemGraphTopics = {
804
675
  /**
805
- * Immutable signature mismatch.
676
+ * A vertex was created.
806
677
  */
807
- ImmutableSignatureMismatch: "immutableSignatureMismatch",
678
+ VertexCreated: "auditable-item-graph:vertex-created",
808
679
  /**
809
- * Integrity data mismatch.
680
+ * A vertex was updated.
810
681
  */
811
- IntegrityDataMismatch: "integrityDataMismatch"
682
+ VertexUpdated: "auditable-item-graph:vertex-updated"
812
683
  };
813
684
 
814
685
  // Copyright 2024 IOTA Stiftung.
@@ -832,4 +703,4 @@ const VerifyDepth = {
832
703
  All: "all"
833
704
  };
834
705
 
835
- export { AuditableItemGraphDataTypes, AuditableItemGraphTypes, AuditableItemGraphVerificationState, VerifyDepth };
706
+ export { AuditableItemGraphContexts, AuditableItemGraphDataTypes, AuditableItemGraphTopics, AuditableItemGraphTypes, VerifyDepth };