@twin.org/auditable-item-graph-models 0.0.1-next.3 → 0.0.1-next.30

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 (57) hide show
  1. package/dist/cjs/index.cjs +375 -253
  2. package/dist/esm/index.mjs +374 -253
  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 +26 -10
  7. package/dist/types/models/IAuditableItemGraphComponent.d.ts +55 -59
  8. package/dist/types/models/IAuditableItemGraphEdge.d.ts +21 -3
  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 +25 -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 +10 -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 +8 -24
  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 +1 -1
  25. package/docs/reference/index.md +7 -5
  26. package/docs/reference/interfaces/IAuditableItemGraphAlias.md +34 -22
  27. package/docs/reference/interfaces/IAuditableItemGraphAuditedElement.md +11 -11
  28. package/docs/reference/interfaces/IAuditableItemGraphChangeset.md +33 -17
  29. package/docs/reference/interfaces/IAuditableItemGraphComponent.md +104 -54
  30. package/docs/reference/interfaces/IAuditableItemGraphCreateRequest.md +5 -5
  31. package/docs/reference/interfaces/IAuditableItemGraphEdge.md +38 -26
  32. package/docs/reference/interfaces/IAuditableItemGraphEventBusVertexCreated.md +11 -0
  33. package/docs/reference/interfaces/IAuditableItemGraphEventBusVertexUpdated.md +19 -0
  34. package/docs/reference/interfaces/IAuditableItemGraphGetRequest.md +2 -2
  35. package/docs/reference/interfaces/IAuditableItemGraphGetResponse.md +4 -4
  36. package/docs/reference/interfaces/IAuditableItemGraphListRequest.md +11 -5
  37. package/docs/reference/interfaces/IAuditableItemGraphListResponse.md +3 -3
  38. package/docs/reference/interfaces/IAuditableItemGraphPatchOperation.md +46 -2
  39. package/docs/reference/interfaces/IAuditableItemGraphResource.md +32 -20
  40. package/docs/reference/interfaces/IAuditableItemGraphUpdateRequest.md +5 -5
  41. package/docs/reference/interfaces/IAuditableItemGraphVertex.md +50 -18
  42. package/docs/reference/interfaces/IAuditableItemGraphVertexList.md +35 -0
  43. package/docs/reference/type-aliases/AuditableItemGraphContexts.md +5 -0
  44. package/docs/reference/type-aliases/AuditableItemGraphTopics.md +5 -0
  45. package/docs/reference/variables/AuditableItemGraphContexts.md +19 -0
  46. package/docs/reference/variables/AuditableItemGraphTopics.md +19 -0
  47. package/docs/reference/variables/AuditableItemGraphTypes.md +9 -33
  48. package/package.json +5 -34
  49. package/dist/types/models/IAuditableItemGraphCredential.d.ts +0 -25
  50. package/dist/types/models/IAuditableItemGraphMetadataElement.d.ts +0 -10
  51. package/dist/types/models/IAuditableItemGraphVerification.d.ts +0 -15
  52. package/dist/types/models/auditableItemGraphVerificationState.d.ts +0 -37
  53. package/docs/reference/interfaces/IAuditableItemGraphCredential.md +0 -43
  54. package/docs/reference/interfaces/IAuditableItemGraphVerification.md +0 -23
  55. package/docs/reference/type-aliases/AuditableItemGraphVerificationState.md +0 -5
  56. package/docs/reference/type-aliases/JsonReturnType.md +0 -13
  57. package/docs/reference/variables/AuditableItemGraphVerificationState.md +0 -49
@@ -5,16 +5,18 @@ export * from "./models/api/IAuditableItemGraphGetResponse";
5
5
  export * from "./models/api/IAuditableItemGraphListRequest";
6
6
  export * from "./models/api/IAuditableItemGraphListResponse";
7
7
  export * from "./models/api/IAuditableItemGraphUpdateRequest";
8
+ export * from "./models/auditableItemGraphContexts";
9
+ export * from "./models/auditableItemGraphTopics";
8
10
  export * from "./models/auditableItemGraphTypes";
9
- export * from "./models/auditableItemGraphVerificationState";
11
+ export * from "./models/eventBus/IAuditableItemGraphEventBusVertexCreated";
12
+ export * from "./models/eventBus/IAuditableItemGraphEventBusVertexUpdated";
10
13
  export * from "./models/IAuditableItemGraphAlias";
11
14
  export * from "./models/IAuditableItemGraphAuditedElement";
12
15
  export * from "./models/IAuditableItemGraphChangeset";
13
16
  export * from "./models/IAuditableItemGraphComponent";
14
- export * from "./models/IAuditableItemGraphCredential";
15
17
  export * from "./models/IAuditableItemGraphEdge";
16
18
  export * from "./models/IAuditableItemGraphPatchOperation";
17
19
  export * from "./models/IAuditableItemGraphResource";
18
- export * from "./models/IAuditableItemGraphVerification";
19
20
  export * from "./models/IAuditableItemGraphVertex";
21
+ export * from "./models/IAuditableItemGraphVertexList";
20
22
  export * from "./models/verifyDepth";
@@ -1,11 +1,29 @@
1
+ import type { IJsonLdContextDefinitionElement, IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
+ import type { AuditableItemGraphContexts } from "./auditableItemGraphContexts";
3
+ import type { AuditableItemGraphTypes } from "./auditableItemGraphTypes";
1
4
  import type { IAuditableItemGraphAuditedElement } from "./IAuditableItemGraphAuditedElement";
2
- import type { IAuditableItemGraphMetadataElement } from "./IAuditableItemGraphMetadataElement";
3
5
  /**
4
6
  * Interface describing an alias for a vertex.
5
7
  */
6
- export interface IAuditableItemGraphAlias extends IAuditableItemGraphAuditedElement, IAuditableItemGraphMetadataElement {
8
+ export interface IAuditableItemGraphAlias extends IAuditableItemGraphAuditedElement {
9
+ /**
10
+ * JSON-LD Context.
11
+ */
12
+ "@context": typeof AuditableItemGraphContexts.ContextRoot | [typeof AuditableItemGraphContexts.ContextRoot, ...IJsonLdContextDefinitionElement[]];
13
+ /**
14
+ * The id of the element.
15
+ */
16
+ id: string;
17
+ /**
18
+ * JSON-LD Type.
19
+ */
20
+ type: typeof AuditableItemGraphTypes.Alias;
21
+ /**
22
+ * The JSON-LD annotation object for the alias.
23
+ */
24
+ annotationObject?: IJsonLdNodeObject;
7
25
  /**
8
26
  * The format of the id in the alias.
9
27
  */
10
- format?: string;
28
+ aliasFormat?: string;
11
29
  }
@@ -5,17 +5,17 @@ export interface IAuditableItemGraphAuditedElement {
5
5
  /**
6
6
  * The id of the element.
7
7
  */
8
- id: string;
8
+ id?: string;
9
9
  /**
10
- * The timestamp of when the element was created.
10
+ * The date/time of when the element was created.
11
11
  */
12
- created: number;
12
+ dateCreated?: string;
13
13
  /**
14
- * The timestamp of when the element was updated.
14
+ * The date/time of when the element was modified.
15
15
  */
16
- updated?: number;
16
+ dateModified?: string;
17
17
  /**
18
- * The timestamp of when the element was deleted, as we never actually remove items.
18
+ * The date/time of when the element was deleted, as we never actually remove items.
19
19
  */
20
- deleted?: number;
20
+ dateDeleted?: string;
21
21
  }
@@ -1,12 +1,32 @@
1
+ import type { IJsonLdContextDefinitionElement } from "@twin.org/data-json-ld";
2
+ import type { IImmutableProofVerification } from "@twin.org/immutable-proof-models";
3
+ import type { AuditableItemGraphContexts } from "./auditableItemGraphContexts";
4
+ import type { AuditableItemGraphTypes } from "./auditableItemGraphTypes";
1
5
  import type { IAuditableItemGraphPatchOperation } from "./IAuditableItemGraphPatchOperation";
2
6
  /**
3
7
  * Interface describing a set of updates to the vertex.
4
8
  */
5
9
  export interface IAuditableItemGraphChangeset {
6
10
  /**
7
- * The timestamp of when the changeset was created.
11
+ * JSON-LD Context.
8
12
  */
9
- created: number;
13
+ "@context": [
14
+ typeof AuditableItemGraphContexts.ContextRoot,
15
+ typeof AuditableItemGraphContexts.ContextRootCommon,
16
+ ...IJsonLdContextDefinitionElement[]
17
+ ];
18
+ /**
19
+ * JSON-LD Type.
20
+ */
21
+ type: typeof AuditableItemGraphTypes.Changeset;
22
+ /**
23
+ * The id of the changeset.
24
+ */
25
+ id: string;
26
+ /**
27
+ * The date/time of when the changeset was created.
28
+ */
29
+ dateCreated: string;
10
30
  /**
11
31
  * The user identity that created the changes.
12
32
  */
@@ -16,15 +36,11 @@ export interface IAuditableItemGraphChangeset {
16
36
  */
17
37
  patches: IAuditableItemGraphPatchOperation[];
18
38
  /**
19
- * The hash for the changeset.
20
- */
21
- hash: string;
22
- /**
23
- * The signature for the changeset.
39
+ * The immutable proof id which contains the signature for this changeset.
24
40
  */
25
- signature: string;
41
+ proofId?: string;
26
42
  /**
27
- * The immutable storage id containing the signature for the changeset.
43
+ * The verification for the changeset.
28
44
  */
29
- immutableStorageId?: string;
45
+ verification?: IImmutableProofVerification;
30
46
  }
@@ -1,62 +1,71 @@
1
1
  import type { IComponent } from "@twin.org/core";
2
- import type { IJsonLdDocument, IJsonLdNodeObject } from "@twin.org/data-json-ld";
3
- import type { SortDirection } from "@twin.org/entity";
4
- import type { IAuditableItemGraphVerification } from "./IAuditableItemGraphVerification";
2
+ import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
3
+ import type { IComparator, SortDirection } from "@twin.org/entity";
5
4
  import type { IAuditableItemGraphVertex } from "./IAuditableItemGraphVertex";
5
+ import type { IAuditableItemGraphVertexList } from "./IAuditableItemGraphVertexList";
6
6
  import type { VerifyDepth } from "./verifyDepth";
7
- /**
8
- * The return type based on the response type.
9
- */
10
- export type JsonReturnType<T, U, V> = T extends "json" ? U : V;
11
7
  /**
12
8
  * Interface describing an auditable item graph contract.
13
9
  */
14
10
  export interface IAuditableItemGraphComponent extends IComponent {
15
11
  /**
16
12
  * Create a new graph vertex.
17
- * @param metadata The metadata for the vertex as JSON-LD.
18
- * @param aliases Alternative aliases that can be used to identify the vertex.
19
- * @param resources The resources attached to the vertex.
20
- * @param edges The edges connected to the vertex.
13
+ * @param vertex The vertex to create.
14
+ * @param vertex.annotationObject The annotation object for the vertex as JSON-LD.
15
+ * @param vertex.aliases Alternative aliases that can be used to identify the vertex.
16
+ * @param vertex.resources The resources attached to the vertex.
17
+ * @param vertex.edges The edges connected to the vertex.
21
18
  * @param userIdentity The identity to create the auditable item graph operation with.
22
19
  * @param nodeIdentity The node identity to use for vault operations.
23
20
  * @returns The id of the new graph item.
24
21
  */
25
- create(metadata?: IJsonLdNodeObject, aliases?: {
26
- id: string;
27
- format?: string;
28
- metadata?: IJsonLdNodeObject;
29
- }[], resources?: {
30
- id: string;
31
- metadata?: IJsonLdNodeObject;
32
- }[], edges?: {
33
- id: string;
34
- relationship: string;
35
- metadata?: IJsonLdNodeObject;
36
- }[], userIdentity?: string, nodeIdentity?: string): Promise<string>;
22
+ create(vertex: {
23
+ annotationObject?: IJsonLdNodeObject;
24
+ aliases?: {
25
+ id: string;
26
+ aliasFormat?: string;
27
+ annotationObject?: IJsonLdNodeObject;
28
+ }[];
29
+ resources?: {
30
+ id?: string;
31
+ resourceObject?: IJsonLdNodeObject;
32
+ }[];
33
+ edges?: {
34
+ id: string;
35
+ edgeRelationship: string;
36
+ annotationObject?: IJsonLdNodeObject;
37
+ }[];
38
+ }, userIdentity?: string, nodeIdentity?: string): Promise<string>;
37
39
  /**
38
40
  * Update a graph vertex.
39
- * @param id The id of the vertex to update.
40
- * @param metadata The metadata for the vertex as JSON-LD.
41
- * @param aliases Alternative aliases that can be used to identify the vertex.
42
- * @param resources The resources attached to the vertex.
43
- * @param edges The edges connected to the vertex.
41
+ * @param vertex The vertex to update.
42
+ * @param vertex.id The id of the vertex to update.
43
+ * @param vertex.annotationObject The annotation object for the vertex as JSON-LD.
44
+ * @param vertex.aliases Alternative aliases that can be used to identify the vertex.
45
+ * @param vertex.resources The resources attached to the vertex.
46
+ * @param vertex.edges The edges connected to the vertex.
44
47
  * @param userIdentity The identity to create the auditable item graph operation with.
45
48
  * @param nodeIdentity The node identity to use for vault operations.
46
49
  * @returns Nothing.
47
50
  */
48
- update(id: string, metadata?: IJsonLdNodeObject, aliases?: {
49
- id: string;
50
- format?: string;
51
- metadata?: IJsonLdNodeObject;
52
- }[], resources?: {
53
- id: string;
54
- metadata?: IJsonLdNodeObject;
55
- }[], edges?: {
51
+ update(vertex: {
56
52
  id: string;
57
- relationship: string;
58
- metadata?: IJsonLdNodeObject;
59
- }[], userIdentity?: string, nodeIdentity?: string): Promise<void>;
53
+ annotationObject?: IJsonLdNodeObject;
54
+ aliases?: {
55
+ id: string;
56
+ aliasFormat?: string;
57
+ annotationObject?: IJsonLdNodeObject;
58
+ }[];
59
+ resources?: {
60
+ id?: string;
61
+ resourceObject?: IJsonLdNodeObject;
62
+ }[];
63
+ edges?: {
64
+ id: string;
65
+ edgeRelationship: string;
66
+ annotationObject?: IJsonLdNodeObject;
67
+ }[];
68
+ }, userIdentity?: string, nodeIdentity?: string): Promise<void>;
60
69
  /**
61
70
  * Get a graph vertex.
62
71
  * @param id The id of the vertex to get.
@@ -64,18 +73,14 @@ export interface IAuditableItemGraphComponent extends IComponent {
64
73
  * @param options.includeDeleted Whether to include deleted aliases, resource, edges, defaults to false.
65
74
  * @param options.includeChangesets Whether to include the changesets of the vertex, defaults to false.
66
75
  * @param options.verifySignatureDepth How many signatures to verify, defaults to "none".
67
- * @param responseType The response type to return, defaults to application/json.
68
76
  * @returns The vertex if found.
69
77
  * @throws NotFoundError if the vertex is not found.
70
78
  */
71
- get<T extends "json" | "jsonld" = "json">(id: string, options?: {
79
+ get(id: string, options?: {
72
80
  includeDeleted?: boolean;
73
81
  includeChangesets?: boolean;
74
82
  verifySignatureDepth?: VerifyDepth;
75
- }, responseType?: T): Promise<JsonReturnType<T, IAuditableItemGraphVertex & {
76
- verified?: boolean;
77
- changesetsVerification?: IAuditableItemGraphVerification[];
78
- }, IJsonLdDocument>>;
83
+ }): Promise<IAuditableItemGraphVertex>;
79
84
  /**
80
85
  * Remove the immutable storage for an item.
81
86
  * @param id The id of the vertex to remove the storage from.
@@ -89,25 +94,16 @@ export interface IAuditableItemGraphComponent extends IComponent {
89
94
  * @param options The query options.
90
95
  * @param options.id The optional id to look for.
91
96
  * @param options.idMode Look in id, alias or both, defaults to both.
92
- * @param orderBy The order for the results, defaults to created.
97
+ * @param conditions Conditions to use in the query.
98
+ * @param orderBy The order for the results, defaults to dateCreated.
93
99
  * @param orderByDirection The direction for the order, defaults to descending.
94
- * @param properties The properties to return, if not provided defaults to id, created, aliases and metadata.
100
+ * @param properties The properties to return, if not provided defaults to id, dateCreated, aliases and object.
95
101
  * @param cursor The cursor to request the next page of entities.
96
102
  * @param pageSize The maximum number of entities in a page.
97
- * @param responseType The response type to return, defaults to application/json.
98
103
  * @returns The entities, which can be partial if a limited keys list was provided.
99
104
  */
100
- query<T extends "json" | "jsonld" = "json">(options?: {
105
+ query(options?: {
101
106
  id?: string;
102
107
  idMode?: "id" | "alias" | "both";
103
- }, orderBy?: "created" | "updated", orderByDirection?: SortDirection, properties?: (keyof IAuditableItemGraphVertex)[], cursor?: string, pageSize?: number, responseType?: T): Promise<JsonReturnType<T, {
104
- /**
105
- * The entities, which can be partial if a limited keys list was provided.
106
- */
107
- entities: Partial<IAuditableItemGraphVertex>[];
108
- /**
109
- * An optional cursor, when defined can be used to call find to get more entities.
110
- */
111
- cursor?: string;
112
- }, IJsonLdDocument>>;
108
+ }, conditions?: IComparator[], orderBy?: keyof Pick<IAuditableItemGraphVertex, "dateCreated" | "dateModified">, orderByDirection?: SortDirection, properties?: (keyof IAuditableItemGraphVertex)[], cursor?: string, pageSize?: number): Promise<IAuditableItemGraphVertexList>;
113
109
  }
@@ -1,11 +1,29 @@
1
+ import type { IJsonLdContextDefinitionElement, IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
+ import type { AuditableItemGraphContexts } from "./auditableItemGraphContexts";
3
+ import type { AuditableItemGraphTypes } from "./auditableItemGraphTypes";
1
4
  import type { IAuditableItemGraphAuditedElement } from "./IAuditableItemGraphAuditedElement";
2
- import type { IAuditableItemGraphMetadataElement } from "./IAuditableItemGraphMetadataElement";
3
5
  /**
4
6
  * Interface describing an edge between two vertices in an auditable item graph.
5
7
  */
6
- export interface IAuditableItemGraphEdge extends IAuditableItemGraphAuditedElement, IAuditableItemGraphMetadataElement {
8
+ export interface IAuditableItemGraphEdge extends IAuditableItemGraphAuditedElement {
9
+ /**
10
+ * JSON-LD Context.
11
+ */
12
+ "@context": typeof AuditableItemGraphContexts.ContextRoot | [typeof AuditableItemGraphContexts.ContextRoot, ...IJsonLdContextDefinitionElement[]];
13
+ /**
14
+ * The id of the element.
15
+ */
16
+ id: string;
17
+ /**
18
+ * JSON-LD Type.
19
+ */
20
+ type: typeof AuditableItemGraphTypes.Edge;
21
+ /**
22
+ * The JSON-LD annotation object for the edge.
23
+ */
24
+ annotationObject?: IJsonLdNodeObject;
7
25
  /**
8
26
  * The relationship between the two vertices.
9
27
  */
10
- relationship: string;
28
+ edgeRelationship: string;
11
29
  }
@@ -1,6 +1,32 @@
1
- import type { IPatchOperation } from "@twin.org/core";
1
+ import type { IJsonLdContextDefinitionElement } from "@twin.org/data-json-ld";
2
+ import type { AuditableItemGraphContexts } from "./auditableItemGraphContexts";
3
+ import type { AuditableItemGraphTypes } from "./auditableItemGraphTypes";
2
4
  /**
3
5
  * The patch operation for JSON diffs.
4
6
  */
5
- export interface IAuditableItemGraphPatchOperation extends IPatchOperation {
7
+ export interface IAuditableItemGraphPatchOperation {
8
+ /**
9
+ * JSON-LD Context.
10
+ */
11
+ "@context": typeof AuditableItemGraphContexts.ContextRoot | [typeof AuditableItemGraphContexts.ContextRoot, ...IJsonLdContextDefinitionElement[]];
12
+ /**
13
+ * JSON-LD Type.
14
+ */
15
+ type: typeof AuditableItemGraphTypes.PatchOperation;
16
+ /**
17
+ * The operation that was performed on the item.
18
+ */
19
+ patchOperation: "add" | "remove" | "replace" | "move" | "copy" | "test";
20
+ /**
21
+ * The path to the object that was changed.
22
+ */
23
+ patchPath: string;
24
+ /**
25
+ * The path the value was copied or moved from.
26
+ */
27
+ patchFrom?: string;
28
+ /**
29
+ * The value to add.
30
+ */
31
+ patchValue?: unknown;
6
32
  }
@@ -1,7 +1,21 @@
1
+ import type { IJsonLdContextDefinitionElement, IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
+ import type { AuditableItemGraphContexts } from "./auditableItemGraphContexts";
3
+ import type { AuditableItemGraphTypes } from "./auditableItemGraphTypes";
1
4
  import type { IAuditableItemGraphAuditedElement } from "./IAuditableItemGraphAuditedElement";
2
- import type { IAuditableItemGraphMetadataElement } from "./IAuditableItemGraphMetadataElement";
3
5
  /**
4
6
  * Interface describing an auditable item graph vertex resource.
5
7
  */
6
- export interface IAuditableItemGraphResource extends IAuditableItemGraphAuditedElement, IAuditableItemGraphMetadataElement {
8
+ export interface IAuditableItemGraphResource extends IAuditableItemGraphAuditedElement {
9
+ /**
10
+ * JSON-LD Context.
11
+ */
12
+ "@context": typeof AuditableItemGraphContexts.ContextRoot | [typeof AuditableItemGraphContexts.ContextRoot, ...IJsonLdContextDefinitionElement[]];
13
+ /**
14
+ * JSON-LD Type.
15
+ */
16
+ type: typeof AuditableItemGraphTypes.Resource;
17
+ /**
18
+ * The JSON-LD object for the resource.
19
+ */
20
+ resourceObject?: IJsonLdNodeObject;
7
21
  }
@@ -1,17 +1,39 @@
1
+ import type { IJsonLdContextDefinitionElement, IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
+ import type { AuditableItemGraphContexts } from "./auditableItemGraphContexts";
3
+ import type { AuditableItemGraphTypes } from "./auditableItemGraphTypes";
1
4
  import type { IAuditableItemGraphAlias } from "./IAuditableItemGraphAlias";
2
5
  import type { IAuditableItemGraphAuditedElement } from "./IAuditableItemGraphAuditedElement";
3
6
  import type { IAuditableItemGraphChangeset } from "./IAuditableItemGraphChangeset";
4
7
  import type { IAuditableItemGraphEdge } from "./IAuditableItemGraphEdge";
5
- import type { IAuditableItemGraphMetadataElement } from "./IAuditableItemGraphMetadataElement";
6
8
  import type { IAuditableItemGraphResource } from "./IAuditableItemGraphResource";
7
9
  /**
8
10
  * Interface describing an auditable item graph vertex.
9
11
  */
10
- export interface IAuditableItemGraphVertex extends Omit<IAuditableItemGraphAuditedElement, "deleted">, IAuditableItemGraphMetadataElement {
12
+ export interface IAuditableItemGraphVertex extends Omit<IAuditableItemGraphAuditedElement, "deleted"> {
13
+ /**
14
+ * JSON-LD Context.
15
+ */
16
+ "@context": [
17
+ typeof AuditableItemGraphContexts.ContextRoot,
18
+ typeof AuditableItemGraphContexts.ContextRootCommon,
19
+ ...IJsonLdContextDefinitionElement[]
20
+ ];
21
+ /**
22
+ * The id of the element.
23
+ */
24
+ id: string;
25
+ /**
26
+ * JSON-LD Type.
27
+ */
28
+ type: typeof AuditableItemGraphTypes.Vertex;
11
29
  /**
12
30
  * The identity of the node which controls the vertex.
13
31
  */
14
32
  nodeIdentity?: string;
33
+ /**
34
+ * The JSON-LD annotation object for the vertex.
35
+ */
36
+ annotationObject?: IJsonLdNodeObject;
15
37
  /**
16
38
  * Alternative aliases that can be used to identify the vertex.
17
39
  */
@@ -28,4 +50,8 @@ export interface IAuditableItemGraphVertex extends Omit<IAuditableItemGraphAudit
28
50
  * Changesets for the vertex.
29
51
  */
30
52
  changesets?: IAuditableItemGraphChangeset[];
53
+ /**
54
+ * Is the vertex verified, will only be populated when verification is requested.
55
+ */
56
+ verified?: boolean;
31
57
  }
@@ -0,0 +1,25 @@
1
+ import type { IJsonLdContextDefinitionElement } from "@twin.org/data-json-ld";
2
+ import type { AuditableItemGraphContexts } from "./auditableItemGraphContexts";
3
+ import type { AuditableItemGraphTypes } from "./auditableItemGraphTypes";
4
+ import type { IAuditableItemGraphVertex } from "./IAuditableItemGraphVertex";
5
+ /**
6
+ * Interface describing an auditable item graph vertex list.
7
+ */
8
+ export interface IAuditableItemGraphVertexList {
9
+ /**
10
+ * JSON-LD Context.
11
+ */
12
+ "@context": typeof AuditableItemGraphContexts.ContextRoot | [typeof AuditableItemGraphContexts.ContextRoot, ...IJsonLdContextDefinitionElement[]];
13
+ /**
14
+ * JSON-LD Type.
15
+ */
16
+ type: typeof AuditableItemGraphTypes.VertexList;
17
+ /**
18
+ * The list of vertices.
19
+ */
20
+ vertices: IAuditableItemGraphVertex[];
21
+ /**
22
+ * The cursor to get the next chunk of vertices.
23
+ */
24
+ cursor?: string;
25
+ }
@@ -6,33 +6,33 @@ export interface IAuditableItemGraphCreateRequest {
6
6
  /**
7
7
  * The data to be used in the vertex.
8
8
  */
9
- body?: {
9
+ body: {
10
10
  /**
11
- * The metadata to be used in the vertex as JSON-LD.
11
+ * The object to be used in the vertex as JSON-LD.
12
12
  */
13
- metadata?: IJsonLdNodeObject;
13
+ annotationObject?: IJsonLdNodeObject;
14
14
  /**
15
15
  * Alternative aliases that can be used to identify the vertex.
16
16
  */
17
17
  aliases?: {
18
18
  id: string;
19
- format?: string;
20
- metadata?: IJsonLdNodeObject;
19
+ aliasFormat?: string;
20
+ annotationObject?: IJsonLdNodeObject;
21
21
  }[];
22
22
  /**
23
23
  * The resources attached to the vertex.
24
24
  */
25
25
  resources?: {
26
- id: string;
27
- metadata?: IJsonLdNodeObject;
26
+ id?: string;
27
+ resourceObject?: IJsonLdNodeObject;
28
28
  }[];
29
29
  /**
30
30
  * The edges connected to the vertex.
31
31
  */
32
32
  edges?: {
33
33
  id: string;
34
- relationship: string;
35
- metadata?: IJsonLdNodeObject;
34
+ edgeRelationship: string;
35
+ annotationObject?: IJsonLdNodeObject;
36
36
  }[];
37
37
  };
38
38
  }
@@ -1,4 +1,4 @@
1
- import type { MimeTypes } from "@twin.org/web";
1
+ import type { HeaderTypes, MimeTypes } from "@twin.org/web";
2
2
  import type { VerifyDepth } from "../verifyDepth";
3
3
  /**
4
4
  * Get an auditable item graph vertex.
@@ -8,7 +8,7 @@ export interface IAuditableItemGraphGetRequest {
8
8
  * The headers which can be used to determine the response data type.
9
9
  */
10
10
  headers?: {
11
- Accept: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;
11
+ [HeaderTypes.Accept]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;
12
12
  };
13
13
  /**
14
14
  * The parameters from the path.
@@ -1,6 +1,4 @@
1
- import type { IJsonLdDocument } from "@twin.org/data-json-ld";
2
1
  import type { HeaderTypes, MimeTypes } from "@twin.org/web";
3
- import type { IAuditableItemGraphVerification } from "../IAuditableItemGraphVerification";
4
2
  import type { IAuditableItemGraphVertex } from "../IAuditableItemGraphVertex";
5
3
  /**
6
4
  * Response to getting an auditable item graph vertex.
@@ -13,16 +11,7 @@ export interface IAuditableItemGraphGetResponse {
13
11
  [HeaderTypes.ContentType]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;
14
12
  };
15
13
  /**
16
- * The response body, if accept header is set to application/ld+json the return object is JSON-LD document.
14
+ * The response body.
17
15
  */
18
- body: IJsonLdDocument | (IAuditableItemGraphVertex & {
19
- /**
20
- * Whether the vertex and its elements have been verified.
21
- */
22
- verified?: boolean;
23
- /**
24
- * The verification for the changesets including any failure information.
25
- */
26
- changesetsVerification?: IAuditableItemGraphVerification[];
27
- });
16
+ body: IAuditableItemGraphVertex;
28
17
  }
@@ -1,5 +1,6 @@
1
1
  import type { SortDirection } from "@twin.org/entity";
2
- import type { MimeTypes } from "@twin.org/web";
2
+ import type { HeaderTypes, MimeTypes } from "@twin.org/web";
3
+ import type { IAuditableItemGraphVertex } from "../IAuditableItemGraphVertex";
3
4
  /**
4
5
  * Get the a list of the vertices with matching ids or aliases.
5
6
  */
@@ -8,7 +9,7 @@ export interface IAuditableItemGraphListRequest {
8
9
  * The headers which can be used to determine the response data type.
9
10
  */
10
11
  headers?: {
11
- Accept: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;
12
+ [HeaderTypes.Accept]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;
12
13
  };
13
14
  /**
14
15
  * The query parameters.
@@ -23,15 +24,19 @@ export interface IAuditableItemGraphListRequest {
23
24
  */
24
25
  idMode?: "id" | "alias" | "both";
25
26
  /**
26
- * The order for the results, default to created.
27
+ * The conditions to filter the streams, JSON stringified IComparator[].
27
28
  */
28
- orderBy?: "created" | "updated";
29
+ conditions?: string;
30
+ /**
31
+ * The order for the results, default to dateCreated.
32
+ */
33
+ orderBy?: keyof Pick<IAuditableItemGraphVertex, "dateCreated" | "dateModified">;
29
34
  /**
30
35
  * The direction for the order, defaults to desc.
31
36
  */
32
37
  orderByDirection?: SortDirection;
33
38
  /**
34
- * The properties to return as a comma separated list, defaults to "id,created,aliases,metadata".
39
+ * The properties to return as a comma separated list, defaults to "id,dateCreated,aliases,annotationObject".
35
40
  */
36
41
  properties?: string;
37
42
  /**
@@ -1,6 +1,5 @@
1
- import type { IJsonLdDocument } from "@twin.org/data-json-ld";
2
1
  import type { HeaderTypes, MimeTypes } from "@twin.org/web";
3
- import type { IAuditableItemGraphVertex } from "../IAuditableItemGraphVertex";
2
+ import type { IAuditableItemGraphVertexList } from "../IAuditableItemGraphVertexList";
4
3
  /**
5
4
  * The response to getting the a list of the vertices with matching ids or aliases.
6
5
  */
@@ -14,14 +13,5 @@ export interface IAuditableItemGraphListResponse {
14
13
  /**
15
14
  * The response payload.
16
15
  */
17
- body: IJsonLdDocument | {
18
- /**
19
- * The entities, which can be partial if a limited keys list was provided.
20
- */
21
- entities?: Partial<IAuditableItemGraphVertex>[];
22
- /**
23
- * An optional cursor, when defined can be used to call find to get more entities.
24
- */
25
- cursor?: string;
26
- };
16
+ body: IAuditableItemGraphVertexList;
27
17
  }