@twin.org/document-management-models 0.0.1-next.8 → 0.0.1-next.9

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 (26) hide show
  1. package/dist/types/index.d.ts +2 -1
  2. package/dist/types/models/IDocument.d.ts +0 -8
  3. package/dist/types/models/IDocumentList.d.ts +4 -0
  4. package/dist/types/models/IDocumentManagementComponent.d.ts +45 -36
  5. package/dist/types/models/api/{IDocumentManagementSetRequest.d.ts → IDocumentManagementCreateRequest.d.ts} +14 -15
  6. package/dist/types/models/api/IDocumentManagementGetRequest.d.ts +5 -9
  7. package/dist/types/models/api/IDocumentManagementGetResponse.d.ts +2 -2
  8. package/dist/types/models/api/IDocumentManagementQueryRequest.d.ts +7 -22
  9. package/dist/types/models/api/IDocumentManagementQueryResponse.d.ts +2 -2
  10. package/dist/types/models/api/IDocumentManagementRemoveRequest.d.ts +5 -15
  11. package/dist/types/models/api/IDocumentManagementUpdateRequest.d.ts +36 -0
  12. package/docs/changelog.md +7 -0
  13. package/docs/reference/index.md +2 -1
  14. package/docs/reference/interfaces/IDocument.md +0 -16
  15. package/docs/reference/interfaces/IDocumentList.md +8 -0
  16. package/docs/reference/interfaces/IDocumentManagementComponent.md +96 -74
  17. package/docs/reference/interfaces/{IDocumentManagementSetRequest.md → IDocumentManagementCreateRequest.md} +13 -21
  18. package/docs/reference/interfaces/IDocumentManagementGetRequest.md +8 -14
  19. package/docs/reference/interfaces/IDocumentManagementGetResponse.md +1 -1
  20. package/docs/reference/interfaces/IDocumentManagementQueryRequest.md +11 -43
  21. package/docs/reference/interfaces/IDocumentManagementQueryResponse.md +1 -1
  22. package/docs/reference/interfaces/IDocumentManagementRemoveRequest.md +7 -27
  23. package/docs/reference/interfaces/IDocumentManagementUpdateRequest.md +43 -0
  24. package/docs/reference/type-aliases/DocumentContexts.md +1 -1
  25. package/docs/reference/type-aliases/DocumentTypes.md +1 -1
  26. package/package.json +2 -1
@@ -1,9 +1,10 @@
1
+ export * from "./models/api/IDocumentManagementCreateRequest";
1
2
  export * from "./models/api/IDocumentManagementGetRequest";
2
3
  export * from "./models/api/IDocumentManagementGetResponse";
3
4
  export * from "./models/api/IDocumentManagementQueryRequest";
4
5
  export * from "./models/api/IDocumentManagementQueryResponse";
5
6
  export * from "./models/api/IDocumentManagementRemoveRequest";
6
- export * from "./models/api/IDocumentManagementSetRequest";
7
+ export * from "./models/api/IDocumentManagementUpdateRequest";
7
8
  export * from "./models/documentContexts";
8
9
  export * from "./models/documentTypes";
9
10
  export * from "./models/IDocument";
@@ -86,12 +86,4 @@ export interface IDocument {
86
86
  * The user who added the document to the graph.
87
87
  */
88
88
  userIdentity: string;
89
- /**
90
- * The previous revisions of the document.
91
- */
92
- revisions?: IDocument[];
93
- /**
94
- * The cursor to get the next chunk of revisions.
95
- */
96
- revisionCursor?: string;
97
89
  }
@@ -22,6 +22,10 @@ export interface IDocumentList {
22
22
  * The list of documents.
23
23
  */
24
24
  documents: IDocument[];
25
+ /**
26
+ * The ids of the other vertices which are connected to the document.
27
+ */
28
+ edges?: string[];
25
29
  /**
26
30
  * The cursor to get the next chunk of documents.
27
31
  */
@@ -1,85 +1,94 @@
1
+ import type { IAuditableItemGraphVertexList } from "@twin.org/auditable-item-graph-models";
1
2
  import type { IComponent } from "@twin.org/core";
2
3
  import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
3
4
  import type { UneceDocumentCodes } from "@twin.org/standards-unece";
4
- import type { IDocument } from "./IDocument";
5
5
  import type { IDocumentList } from "./IDocumentList";
6
6
  /**
7
7
  * Interface describing an document management contract.
8
8
  */
9
9
  export interface IDocumentManagementComponent extends IComponent {
10
10
  /**
11
- * Store a document in an auditable item graph vertex and add its content to blob storage.
11
+ * Create a document as an auditable item graph vertex and add its content to blob storage.
12
12
  * If the document id already exists and the blob data is different a new revision will be created.
13
13
  * For any other changes the current revision will be updated.
14
- * @param auditableItemGraphId The auditable item graph vertex id to create the document on.
15
14
  * @param documentId The document id to create.
16
15
  * @param documentIdFormat The format of the document identifier.
17
16
  * @param documentCode The code for the document type.
18
17
  * @param blob The data to create the document with.
19
18
  * @param annotationObject Additional information to associate with the document.
19
+ * @param auditableItemGraphEdges The auditable item graph vertices to connect the document to.
20
20
  * @param options Additional options for the set operation.
21
21
  * @param options.createAttestation Flag to create an attestation for the document, defaults to false.
22
- * @param options.includeIdAsAlias Include the document id as an alias to the aig vertex, defaults to false.
23
- * @param options.aliasAnnotationObject Additional information to associate with the alias.
22
+ * @param options.addAlias Flag to add the document id as an alias to the aig vertex, defaults to true.
23
+ * @param options.aliasAnnotationObject Annotation object for the alias.
24
24
  * @param userIdentity The identity to perform the auditable item graph operation with.
25
25
  * @param nodeIdentity The node identity to use for vault operations.
26
- * @returns The identifier for the document which includes the auditable item graph identifier.
26
+ * @returns The auditable item graph vertex created for the document including its revision.
27
27
  */
28
- set(auditableItemGraphId: string, documentId: string, documentIdFormat: string | undefined, documentCode: UneceDocumentCodes, blob: Uint8Array, annotationObject?: IJsonLdNodeObject, options?: {
28
+ create(documentId: string, documentIdFormat: string | undefined, documentCode: UneceDocumentCodes, blob: Uint8Array, annotationObject?: IJsonLdNodeObject, auditableItemGraphEdges?: {
29
+ id: string;
30
+ addAlias?: boolean;
31
+ aliasAnnotationObject?: IJsonLdNodeObject;
32
+ }[], options?: {
29
33
  createAttestation?: boolean;
30
- includeIdAsAlias?: boolean;
34
+ addAlias?: boolean;
31
35
  aliasAnnotationObject?: IJsonLdNodeObject;
32
36
  }, userIdentity?: string, nodeIdentity?: string): Promise<string>;
33
37
  /**
34
- * Get a specific document from an auditable item graph vertex.
35
- * @param auditableItemGraphId The auditable item graph vertex id to get the document from.
36
- * @param identifier The identifier of the document to get.
38
+ * Update a document as an auditable item graph vertex and add its content to blob storage.
39
+ * If the blob data is different a new revision will be created.
40
+ * For any other changes the current revision will be updated.
41
+ * @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.
42
+ * @param blob The data to update the document with.
43
+ * @param annotationObject Additional information to associate with the document.
44
+ * @param auditableItemGraphEdges The auditable item graph vertices to connect the document to, if undefined retains current connections.
45
+ * @param userIdentity The identity to perform the auditable item graph operation with.
46
+ * @param nodeIdentity The node identity to use for vault operations.
47
+ * @returns Nothing.
48
+ */
49
+ update(auditableItemGraphDocumentId: string, blob?: Uint8Array, annotationObject?: IJsonLdNodeObject, auditableItemGraphEdges?: {
50
+ id: string;
51
+ addAlias?: boolean;
52
+ aliasAnnotationObject?: IJsonLdNodeObject;
53
+ }[], userIdentity?: string, nodeIdentity?: string): Promise<void>;
54
+ /**
55
+ * Get a document using it's auditable item graph vertex id and optional revision.
56
+ * @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.
37
57
  * @param options Additional options for the get operation.
38
58
  * @param options.includeBlobStorageMetadata Flag to include the blob storage metadata for the document, defaults to false.
39
59
  * @param options.includeBlobStorageData Flag to include the blob storage data for the document, defaults to false.
40
60
  * @param options.includeAttestation Flag to include the attestation information for the document, defaults to false.
41
61
  * @param options.includeRemoved Flag to include deleted documents, defaults to false.
42
- * @param options.maxRevisionCount Max number of revisions to return, defaults to 0.
43
- * @param revisionCursor The cursor to get the next chunk of revisions.
62
+ * @param cursor The cursor to get the next chunk of revisions.
63
+ * @param pageSize Page size of items to return, defaults to 1 so only most recent is returned.
44
64
  * @param userIdentity The identity to perform the auditable item graph operation with.
45
65
  * @param nodeIdentity The node identity to use for vault operations.
46
66
  * @returns The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
47
67
  */
48
- get(auditableItemGraphId: string, identifier: string, options?: {
68
+ get(auditableItemGraphDocumentId: string, options?: {
49
69
  includeBlobStorageMetadata?: boolean;
50
70
  includeBlobStorageData?: boolean;
51
71
  includeAttestation?: boolean;
52
72
  includeRemoved?: boolean;
53
- maxRevisionCount?: number;
54
- }, revisionCursor?: string, userIdentity?: string, nodeIdentity?: string): Promise<IDocument>;
73
+ }, cursor?: string, pageSize?: number, userIdentity?: string, nodeIdentity?: string): Promise<IDocumentList>;
55
74
  /**
56
- * Remove a specific document from an auditable item graph vertex.
57
- * The documents dateDeleted will be set, but can still be queried with the includeRemoved flag.
58
- * @param auditableItemGraphId The auditable item graph vertex id to remove the document from.
59
- * @param identifier The identifier of the document to remove.
60
- * @param options Additional options for the remove operation.
61
- * @param options.removeAllRevisions Flag to remove all revisions of the document, defaults to false.
75
+ * Remove an auditable item graph vertex using it's id.
76
+ * The document dateDeleted will be set, but can still be queried with the includeRemoved flag.
77
+ * @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.
78
+ * @param revision The revision of the document to remove.
62
79
  * @param userIdentity The identity to perform the auditable item graph operation with.
63
80
  * @param nodeIdentity The node identity to use for vault operations.
64
81
  * @returns Nothing.
65
82
  */
66
- remove(auditableItemGraphId: string, identifier: string, options?: {
67
- removeAllRevisions?: boolean;
68
- }, userIdentity?: string, nodeIdentity?: string): Promise<void>;
83
+ removeRevision(auditableItemGraphDocumentId: string, revision: number, userIdentity?: string, nodeIdentity?: string): Promise<void>;
69
84
  /**
70
- * Query an auditable item graph vertex for documents.
71
- * @param auditableItemGraphId The auditable item graph vertex to get the documents from.
72
- * @param documentCodes The document codes to query for, if undefined gets all document codes.
73
- * @param options Additional options for the query operation.
74
- * @param options.includeMostRecentRevisions Include the most recent 5 revisions, use the individual get to retrieve more.
75
- * @param options.includeRemoved Flag to include deleted documents, defaults to false.
85
+ * Find all the document with a specific id.
86
+ * @param documentId The document id to find in the graph.
76
87
  * @param cursor The cursor to get the next chunk of documents.
88
+ * @param pageSize The page size to get the next chunk of documents.
77
89
  * @param userIdentity The identity to perform the auditable item graph operation with.
78
90
  * @param nodeIdentity The node identity to use for vault operations.
79
- * @returns The most recent revisions of each document, cursor is set if there are more documents.
91
+ * @returns The graph vertices that contain documents referencing the specified document id.
80
92
  */
81
- query(auditableItemGraphId: string, documentCodes?: UneceDocumentCodes[], options?: {
82
- includeMostRecentRevisions?: boolean;
83
- includeRemoved?: boolean;
84
- }, cursor?: string, userIdentity?: string, nodeIdentity?: string): Promise<IDocumentList>;
93
+ query(documentId: string, cursor?: string, pageSize?: number, userIdentity?: string, nodeIdentity?: string): Promise<IAuditableItemGraphVertexList>;
85
94
  }
@@ -1,18 +1,9 @@
1
1
  import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
2
  import type { UneceDocumentCodes } from "@twin.org/standards-unece";
3
3
  /**
4
- * Request to set a document in an auditable item graph vertex.
4
+ * Request to create a document as an auditable item graph vertex.
5
5
  */
6
- export interface IDocumentManagementSetRequest {
7
- /**
8
- * The path parameters.
9
- */
10
- pathParams: {
11
- /**
12
- * The id of the auditable item graph vertex to store the document on.
13
- */
14
- auditableItemGraphId: string;
15
- };
6
+ export interface IDocumentManagementCreateRequest {
16
7
  /**
17
8
  * The body parameters.
18
9
  */
@@ -38,15 +29,23 @@ export interface IDocumentManagementSetRequest {
38
29
  */
39
30
  annotationObject?: IJsonLdNodeObject;
40
31
  /**
41
- * Flag to create an attestation for the document, defaults to false
32
+ * The auditable item graph vertices to connect the document to.
33
+ */
34
+ auditableItemGraphEdges?: {
35
+ id: string;
36
+ addAlias?: boolean;
37
+ aliasAnnotationObject?: IJsonLdNodeObject;
38
+ }[];
39
+ /**
40
+ * Flag to create an attestation for the document, defaults to false.
42
41
  */
43
42
  createAttestation?: boolean;
44
43
  /**
45
- * Include the document id as an alias to the aig vertex, defaults to false.
44
+ * Flag to add the document id as an alias to the aig vertex, defaults to true.
46
45
  */
47
- includeIdAsAlias?: boolean;
46
+ addAlias?: boolean;
48
47
  /**
49
- * Additional information to associate with the alias.
48
+ * Annotation object for the alias.
50
49
  */
51
50
  aliasAnnotationObject?: IJsonLdNodeObject;
52
51
  };
@@ -13,14 +13,10 @@ export interface IDocumentManagementGetRequest {
13
13
  * The path parameters.
14
14
  */
15
15
  pathParams: {
16
- /**
17
- * The id of the auditable item graph vertex to store the document on.
18
- */
19
- auditableItemGraphId: string;
20
16
  /**
21
17
  * The full id of the document to get.
22
18
  */
23
- documentId: string;
19
+ auditableItemGraphDocumentId: string;
24
20
  };
25
21
  /**
26
22
  * The query parameters.
@@ -47,13 +43,13 @@ export interface IDocumentManagementGetRequest {
47
43
  */
48
44
  includeRemoved?: boolean;
49
45
  /**
50
- * Max number of revisions to return.
51
- * @default 0
46
+ * Page size of items to return, defaults to 1 so only most recent is returned.
47
+ * @default 1
52
48
  */
53
- maxRevisionCount?: number;
49
+ pageSize?: string;
54
50
  /**
55
51
  * The cursor to get the next chunk of revisions.
56
52
  */
57
- revisionCursor?: string;
53
+ cursor?: string;
58
54
  };
59
55
  }
@@ -1,5 +1,5 @@
1
1
  import type { HeaderTypes, MimeTypes } from "@twin.org/web";
2
- import type { IDocument } from "../IDocument";
2
+ import type { IDocumentList } from "../IDocumentList";
3
3
  /**
4
4
  * Response to get a document and optionally revisions from an auditable item graph vertex.
5
5
  */
@@ -13,5 +13,5 @@ export interface IDocumentManagementGetResponse {
13
13
  /**
14
14
  * The body parameters.
15
15
  */
16
- body: IDocument;
16
+ body: IDocumentList;
17
17
  }
@@ -9,36 +9,21 @@ export interface IDocumentManagementQueryRequest {
9
9
  headers?: {
10
10
  [HeaderTypes.Accept]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;
11
11
  };
12
- /**
13
- * The path parameters.
14
- */
15
- pathParams: {
16
- /**
17
- * The id of the auditable item graph vertex which contains the documents.
18
- */
19
- auditableItemGraphId: string;
20
- };
21
12
  /**
22
13
  * The query parameters.
23
14
  */
24
- query?: {
15
+ query: {
25
16
  /**
26
- * List of comma separated document codes to filter the query.
17
+ * The id of the document id we are trying to find.
27
18
  */
28
- documentCodes?: string;
29
- /**
30
- * Include deleted documents in the response.
31
- * @default false
32
- */
33
- includeRemoved?: boolean;
34
- /**
35
- * Include the most recent 5 revisions, use the individual get to retrieve more.
36
- * @default false
37
- */
38
- includeMostRecentRevisions?: boolean;
19
+ documentId: string;
39
20
  /**
40
21
  * The cursor to get the next chunk of documents.
41
22
  */
42
23
  cursor?: string;
24
+ /**
25
+ * The number of documents to return.
26
+ */
27
+ pageSize?: string;
43
28
  };
44
29
  }
@@ -1,5 +1,5 @@
1
+ import type { IAuditableItemGraphVertexList } from "@twin.org/auditable-item-graph-models";
1
2
  import type { HeaderTypes, MimeTypes } from "@twin.org/web";
2
- import type { IDocumentList } from "../IDocumentList";
3
3
  /**
4
4
  * Response to query the documents from an auditable item graph vertex.
5
5
  */
@@ -13,5 +13,5 @@ export interface IDocumentManagementQueryResponse {
13
13
  /**
14
14
  * The body parameters.
15
15
  */
16
- body: IDocumentList;
16
+ body: IAuditableItemGraphVertexList;
17
17
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Request to remove a document from an auditable item graph.
2
+ * Request to remove a document revision from an auditable item graph.
3
3
  */
4
4
  export interface IDocumentManagementRemoveRequest {
5
5
  /**
@@ -7,22 +7,12 @@ export interface IDocumentManagementRemoveRequest {
7
7
  */
8
8
  pathParams: {
9
9
  /**
10
- * The id of the auditable item graph vertex to remove the document from.
10
+ * The id of the auditable item graph vertex to remove the revision from.
11
11
  */
12
- auditableItemGraphId: string;
12
+ auditableItemGraphDocumentId: string;
13
13
  /**
14
- * The full id of the document to remove.
14
+ * The revision of the document to remove.
15
15
  */
16
- documentId: string;
17
- };
18
- /**
19
- * The query parameters.
20
- */
21
- query?: {
22
- /**
23
- * Flag to remove all revisions of the document.
24
- * @default false
25
- */
26
- removeAllRevisions?: boolean;
16
+ revision: string;
27
17
  };
28
18
  }
@@ -0,0 +1,36 @@
1
+ import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
+ /**
3
+ * Request to update a document as an auditable item graph vertex.
4
+ */
5
+ export interface IDocumentManagementUpdateRequest {
6
+ /**
7
+ * The path parameters.
8
+ */
9
+ pathParams: {
10
+ /**
11
+ * The full id of the document to get.
12
+ */
13
+ auditableItemGraphDocumentId: string;
14
+ };
15
+ /**
16
+ * The body parameters.
17
+ */
18
+ body: {
19
+ /**
20
+ * The data to create the document with, in base64.
21
+ */
22
+ blob?: string;
23
+ /**
24
+ * Additional information to associate with the document.
25
+ */
26
+ annotationObject?: IJsonLdNodeObject;
27
+ /**
28
+ * The auditable item graph vertices to connect the document to.
29
+ */
30
+ auditableItemGraphEdges?: {
31
+ id: string;
32
+ addAlias?: boolean;
33
+ aliasAnnotationObject?: IJsonLdNodeObject;
34
+ }[];
35
+ };
36
+ }
package/docs/changelog.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @twin.org/document-management-models - Changelog
2
2
 
3
+ ## [0.0.1-next.9](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.8...document-management-models-v0.0.1-next.9) (2025-04-17)
4
+
5
+
6
+ ### Features
7
+
8
+ * store document as a vertex ([#2](https://github.com/twinfoundation/document-management/issues/2)) ([7febedc](https://github.com/twinfoundation/document-management/commit/7febedc3fb31de9c19565d6326341046834f2c74))
9
+
3
10
  ## [0.0.1-next.8](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.7...document-management-models-v0.0.1-next.8) (2025-03-28)
4
11
 
5
12
 
@@ -6,12 +6,13 @@
6
6
  - [IDocumentAttestation](interfaces/IDocumentAttestation.md)
7
7
  - [IDocumentList](interfaces/IDocumentList.md)
8
8
  - [IDocumentManagementComponent](interfaces/IDocumentManagementComponent.md)
9
+ - [IDocumentManagementCreateRequest](interfaces/IDocumentManagementCreateRequest.md)
9
10
  - [IDocumentManagementGetRequest](interfaces/IDocumentManagementGetRequest.md)
10
11
  - [IDocumentManagementGetResponse](interfaces/IDocumentManagementGetResponse.md)
11
12
  - [IDocumentManagementQueryRequest](interfaces/IDocumentManagementQueryRequest.md)
12
13
  - [IDocumentManagementQueryResponse](interfaces/IDocumentManagementQueryResponse.md)
13
14
  - [IDocumentManagementRemoveRequest](interfaces/IDocumentManagementRemoveRequest.md)
14
- - [IDocumentManagementSetRequest](interfaces/IDocumentManagementSetRequest.md)
15
+ - [IDocumentManagementUpdateRequest](interfaces/IDocumentManagementUpdateRequest.md)
15
16
 
16
17
  ## Type Aliases
17
18
 
@@ -145,19 +145,3 @@ The node which added the document to the graph.
145
145
  > **userIdentity**: `string`
146
146
 
147
147
  The user who added the document to the graph.
148
-
149
- ***
150
-
151
- ### revisions?
152
-
153
- > `optional` **revisions**: [`IDocument`](IDocument.md)[]
154
-
155
- The previous revisions of the document.
156
-
157
- ***
158
-
159
- ### revisionCursor?
160
-
161
- > `optional` **revisionCursor**: `string`
162
-
163
- The cursor to get the next chunk of revisions.
@@ -28,6 +28,14 @@ The list of documents.
28
28
 
29
29
  ***
30
30
 
31
+ ### edges?
32
+
33
+ > `optional` **edges**: `string`[]
34
+
35
+ The ids of the other vertices which are connected to the document.
36
+
37
+ ***
38
+
31
39
  ### cursor?
32
40
 
33
41
  > `optional` **cursor**: `string`
@@ -8,22 +8,16 @@ Interface describing an document management contract.
8
8
 
9
9
  ## Methods
10
10
 
11
- ### set()
11
+ ### create()
12
12
 
13
- > **set**(`auditableItemGraphId`, `documentId`, `documentIdFormat`, `documentCode`, `blob`, `annotationObject`?, `options`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`string`\>
13
+ > **create**(`documentId`, `documentIdFormat`, `documentCode`, `blob`, `annotationObject?`, `auditableItemGraphEdges?`, `options?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`string`\>
14
14
 
15
- Store a document in an auditable item graph vertex and add its content to blob storage.
15
+ Create a document as an auditable item graph vertex and add its content to blob storage.
16
16
  If the document id already exists and the blob data is different a new revision will be created.
17
17
  For any other changes the current revision will be updated.
18
18
 
19
19
  #### Parameters
20
20
 
21
- ##### auditableItemGraphId
22
-
23
- `string`
24
-
25
- The auditable item graph vertex id to create the document on.
26
-
27
21
  ##### documentId
28
22
 
29
23
  `string`
@@ -54,6 +48,12 @@ The data to create the document with.
54
48
 
55
49
  Additional information to associate with the document.
56
50
 
51
+ ##### auditableItemGraphEdges?
52
+
53
+ `object`[]
54
+
55
+ The auditable item graph vertices to connect the document to.
56
+
57
57
  ##### options?
58
58
 
59
59
  Additional options for the set operation.
@@ -64,17 +64,17 @@ Additional options for the set operation.
64
64
 
65
65
  Flag to create an attestation for the document, defaults to false.
66
66
 
67
- ###### includeIdAsAlias?
67
+ ###### addAlias?
68
68
 
69
69
  `boolean`
70
70
 
71
- Include the document id as an alias to the aig vertex, defaults to false.
71
+ Flag to add the document id as an alias to the aig vertex, defaults to true.
72
72
 
73
73
  ###### aliasAnnotationObject?
74
74
 
75
75
  `IJsonLdNodeObject`
76
76
 
77
- Additional information to associate with the alias.
77
+ Annotation object for the alias.
78
78
 
79
79
  ##### userIdentity?
80
80
 
@@ -92,29 +92,77 @@ The node identity to use for vault operations.
92
92
 
93
93
  `Promise`\<`string`\>
94
94
 
95
- The identifier for the document which includes the auditable item graph identifier.
95
+ The auditable item graph vertex created for the document including its revision.
96
96
 
97
97
  ***
98
98
 
99
- ### get()
99
+ ### update()
100
100
 
101
- > **get**(`auditableItemGraphId`, `identifier`, `options`?, `revisionCursor`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<[`IDocument`](IDocument.md)\>
101
+ > **update**(`auditableItemGraphDocumentId`, `blob?`, `annotationObject?`, `auditableItemGraphEdges?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`void`\>
102
102
 
103
- Get a specific document from an auditable item graph vertex.
103
+ Update a document as an auditable item graph vertex and add its content to blob storage.
104
+ If the blob data is different a new revision will be created.
105
+ For any other changes the current revision will be updated.
104
106
 
105
107
  #### Parameters
106
108
 
107
- ##### auditableItemGraphId
109
+ ##### auditableItemGraphDocumentId
108
110
 
109
111
  `string`
110
112
 
111
- The auditable item graph vertex id to get the document from.
113
+ The auditable item graph vertex id which contains the document.
114
+
115
+ ##### blob?
116
+
117
+ `Uint8Array`\<`ArrayBufferLike`\>
118
+
119
+ The data to update the document with.
120
+
121
+ ##### annotationObject?
122
+
123
+ `IJsonLdNodeObject`
124
+
125
+ Additional information to associate with the document.
126
+
127
+ ##### auditableItemGraphEdges?
128
+
129
+ `object`[]
130
+
131
+ The auditable item graph vertices to connect the document to, if undefined retains current connections.
132
+
133
+ ##### userIdentity?
134
+
135
+ `string`
136
+
137
+ The identity to perform the auditable item graph operation with.
138
+
139
+ ##### nodeIdentity?
140
+
141
+ `string`
142
+
143
+ The node identity to use for vault operations.
144
+
145
+ #### Returns
146
+
147
+ `Promise`\<`void`\>
148
+
149
+ Nothing.
150
+
151
+ ***
152
+
153
+ ### get()
154
+
155
+ > **get**(`auditableItemGraphDocumentId`, `options?`, `cursor?`, `pageSize?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<[`IDocumentList`](IDocumentList.md)\>
156
+
157
+ Get a document using it's auditable item graph vertex id and optional revision.
158
+
159
+ #### Parameters
112
160
 
113
- ##### identifier
161
+ ##### auditableItemGraphDocumentId
114
162
 
115
163
  `string`
116
164
 
117
- The identifier of the document to get.
165
+ The auditable item graph vertex id which contains the document.
118
166
 
119
167
  ##### options?
120
168
 
@@ -144,17 +192,17 @@ Flag to include the attestation information for the document, defaults to false.
144
192
 
145
193
  Flag to include deleted documents, defaults to false.
146
194
 
147
- ###### maxRevisionCount?
195
+ ##### cursor?
148
196
 
149
- `number`
197
+ `string`
150
198
 
151
- Max number of revisions to return, defaults to 0.
199
+ The cursor to get the next chunk of revisions.
152
200
 
153
- ##### revisionCursor?
201
+ ##### pageSize?
154
202
 
155
- `string`
203
+ `number`
156
204
 
157
- The cursor to get the next chunk of revisions.
205
+ Page size of items to return, defaults to 1 so only most recent is returned.
158
206
 
159
207
  ##### userIdentity?
160
208
 
@@ -170,42 +218,32 @@ The node identity to use for vault operations.
170
218
 
171
219
  #### Returns
172
220
 
173
- `Promise`\<[`IDocument`](IDocument.md)\>
221
+ `Promise`\<[`IDocumentList`](IDocumentList.md)\>
174
222
 
175
223
  The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
176
224
 
177
225
  ***
178
226
 
179
- ### remove()
227
+ ### removeRevision()
180
228
 
181
- > **remove**(`auditableItemGraphId`, `identifier`, `options`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`void`\>
229
+ > **removeRevision**(`auditableItemGraphDocumentId`, `revision`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`void`\>
182
230
 
183
- Remove a specific document from an auditable item graph vertex.
184
- The documents dateDeleted will be set, but can still be queried with the includeRemoved flag.
231
+ Remove an auditable item graph vertex using it's id.
232
+ The document dateDeleted will be set, but can still be queried with the includeRemoved flag.
185
233
 
186
234
  #### Parameters
187
235
 
188
- ##### auditableItemGraphId
189
-
190
- `string`
191
-
192
- The auditable item graph vertex id to remove the document from.
193
-
194
- ##### identifier
236
+ ##### auditableItemGraphDocumentId
195
237
 
196
238
  `string`
197
239
 
198
- The identifier of the document to remove.
240
+ The auditable item graph vertex id which contains the document.
199
241
 
200
- ##### options?
242
+ ##### revision
201
243
 
202
- Additional options for the remove operation.
203
-
204
- ###### removeAllRevisions?
205
-
206
- `boolean`
244
+ `number`
207
245
 
208
- Flag to remove all revisions of the document, defaults to false.
246
+ The revision of the document to remove.
209
247
 
210
248
  ##### userIdentity?
211
249
 
@@ -229,39 +267,17 @@ Nothing.
229
267
 
230
268
  ### query()
231
269
 
232
- > **query**(`auditableItemGraphId`, `documentCodes`?, `options`?, `cursor`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<[`IDocumentList`](IDocumentList.md)\>
270
+ > **query**(`documentId`, `cursor?`, `pageSize?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`IAuditableItemGraphVertexList`\>
233
271
 
234
- Query an auditable item graph vertex for documents.
272
+ Find all the document with a specific id.
235
273
 
236
274
  #### Parameters
237
275
 
238
- ##### auditableItemGraphId
276
+ ##### documentId
239
277
 
240
278
  `string`
241
279
 
242
- The auditable item graph vertex to get the documents from.
243
-
244
- ##### documentCodes?
245
-
246
- `string`[]
247
-
248
- The document codes to query for, if undefined gets all document codes.
249
-
250
- ##### options?
251
-
252
- Additional options for the query operation.
253
-
254
- ###### includeMostRecentRevisions?
255
-
256
- `boolean`
257
-
258
- Include the most recent 5 revisions, use the individual get to retrieve more.
259
-
260
- ###### includeRemoved?
261
-
262
- `boolean`
263
-
264
- Flag to include deleted documents, defaults to false.
280
+ The document id to find in the graph.
265
281
 
266
282
  ##### cursor?
267
283
 
@@ -269,6 +285,12 @@ Flag to include deleted documents, defaults to false.
269
285
 
270
286
  The cursor to get the next chunk of documents.
271
287
 
288
+ ##### pageSize?
289
+
290
+ `number`
291
+
292
+ The page size to get the next chunk of documents.
293
+
272
294
  ##### userIdentity?
273
295
 
274
296
  `string`
@@ -283,6 +305,6 @@ The node identity to use for vault operations.
283
305
 
284
306
  #### Returns
285
307
 
286
- `Promise`\<[`IDocumentList`](IDocumentList.md)\>
308
+ `Promise`\<`IAuditableItemGraphVertexList`\>
287
309
 
288
- The most recent revisions of each document, cursor is set if there are more documents.
310
+ The graph vertices that contain documents referencing the specified document id.
@@ -1,23 +1,9 @@
1
- # Interface: IDocumentManagementSetRequest
1
+ # Interface: IDocumentManagementCreateRequest
2
2
 
3
- Request to set a document in an auditable item graph vertex.
3
+ Request to create a document as an auditable item graph vertex.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### pathParams
8
-
9
- > **pathParams**: `object`
10
-
11
- The path parameters.
12
-
13
- #### auditableItemGraphId
14
-
15
- > **auditableItemGraphId**: `string`
16
-
17
- The id of the auditable item graph vertex to store the document on.
18
-
19
- ***
20
-
21
7
  ### body
22
8
 
23
9
  > **body**: `object`
@@ -54,20 +40,26 @@ The data to create the document with, in base64.
54
40
 
55
41
  Additional information to associate with the document.
56
42
 
43
+ #### auditableItemGraphEdges?
44
+
45
+ > `optional` **auditableItemGraphEdges**: `object`[]
46
+
47
+ The auditable item graph vertices to connect the document to.
48
+
57
49
  #### createAttestation?
58
50
 
59
51
  > `optional` **createAttestation**: `boolean`
60
52
 
61
- Flag to create an attestation for the document, defaults to false
53
+ Flag to create an attestation for the document, defaults to false.
62
54
 
63
- #### includeIdAsAlias?
55
+ #### addAlias?
64
56
 
65
- > `optional` **includeIdAsAlias**: `boolean`
57
+ > `optional` **addAlias**: `boolean`
66
58
 
67
- Include the document id as an alias to the aig vertex, defaults to false.
59
+ Flag to add the document id as an alias to the aig vertex, defaults to true.
68
60
 
69
61
  #### aliasAnnotationObject?
70
62
 
71
63
  > `optional` **aliasAnnotationObject**: `IJsonLdNodeObject`
72
64
 
73
- Additional information to associate with the alias.
65
+ Annotation object for the alias.
@@ -22,15 +22,9 @@ The headers which can be used to determine the response data type.
22
22
 
23
23
  The path parameters.
24
24
 
25
- #### auditableItemGraphId
25
+ #### auditableItemGraphDocumentId
26
26
 
27
- > **auditableItemGraphId**: `string`
28
-
29
- The id of the auditable item graph vertex to store the document on.
30
-
31
- #### documentId
32
-
33
- > **documentId**: `string`
27
+ > **auditableItemGraphDocumentId**: `string`
34
28
 
35
29
  The full id of the document to get.
36
30
 
@@ -90,20 +84,20 @@ Include deleted documents in the response.
90
84
  false
91
85
  ```
92
86
 
93
- #### maxRevisionCount?
87
+ #### pageSize?
94
88
 
95
- > `optional` **maxRevisionCount**: `number`
89
+ > `optional` **pageSize**: `string`
96
90
 
97
- Max number of revisions to return.
91
+ Page size of items to return, defaults to 1 so only most recent is returned.
98
92
 
99
93
  ##### Default
100
94
 
101
95
  ```ts
102
- 0
96
+ 1
103
97
  ```
104
98
 
105
- #### revisionCursor?
99
+ #### cursor?
106
100
 
107
- > `optional` **revisionCursor**: `string`
101
+ > `optional` **cursor**: `string`
108
102
 
109
103
  The cursor to get the next chunk of revisions.
@@ -18,6 +18,6 @@ The headers which can be used to determine the response data type.
18
18
 
19
19
  ### body
20
20
 
21
- > **body**: [`IDocument`](IDocument.md)
21
+ > **body**: [`IDocumentList`](IDocumentList.md)
22
22
 
23
23
  The body parameters.
@@ -16,58 +16,26 @@ The headers which can be used to determine the response data type.
16
16
 
17
17
  ***
18
18
 
19
- ### pathParams
19
+ ### query
20
20
 
21
- > **pathParams**: `object`
22
-
23
- The path parameters.
24
-
25
- #### auditableItemGraphId
26
-
27
- > **auditableItemGraphId**: `string`
28
-
29
- The id of the auditable item graph vertex which contains the documents.
30
-
31
- ***
32
-
33
- ### query?
34
-
35
- > `optional` **query**: `object`
21
+ > **query**: `object`
36
22
 
37
23
  The query parameters.
38
24
 
39
- #### documentCodes?
40
-
41
- > `optional` **documentCodes**: `string`
42
-
43
- List of comma separated document codes to filter the query.
44
-
45
- #### includeRemoved?
25
+ #### documentId
46
26
 
47
- > `optional` **includeRemoved**: `boolean`
27
+ > **documentId**: `string`
48
28
 
49
- Include deleted documents in the response.
50
-
51
- ##### Default
52
-
53
- ```ts
54
- false
55
- ```
56
-
57
- #### includeMostRecentRevisions?
58
-
59
- > `optional` **includeMostRecentRevisions**: `boolean`
60
-
61
- Include the most recent 5 revisions, use the individual get to retrieve more.
62
-
63
- ##### Default
64
-
65
- ```ts
66
- false
67
- ```
29
+ The id of the document id we are trying to find.
68
30
 
69
31
  #### cursor?
70
32
 
71
33
  > `optional` **cursor**: `string`
72
34
 
73
35
  The cursor to get the next chunk of documents.
36
+
37
+ #### pageSize?
38
+
39
+ > `optional` **pageSize**: `string`
40
+
41
+ The number of documents to return.
@@ -18,6 +18,6 @@ The headers which can be used to determine the response data type.
18
18
 
19
19
  ### body
20
20
 
21
- > **body**: [`IDocumentList`](IDocumentList.md)
21
+ > **body**: `IAuditableItemGraphVertexList`
22
22
 
23
23
  The body parameters.
@@ -1,6 +1,6 @@
1
1
  # Interface: IDocumentManagementRemoveRequest
2
2
 
3
- Request to remove a document from an auditable item graph.
3
+ Request to remove a document revision from an auditable item graph.
4
4
 
5
5
  ## Properties
6
6
 
@@ -10,34 +10,14 @@ Request to remove a document from an auditable item graph.
10
10
 
11
11
  The path parameters.
12
12
 
13
- #### auditableItemGraphId
13
+ #### auditableItemGraphDocumentId
14
14
 
15
- > **auditableItemGraphId**: `string`
15
+ > **auditableItemGraphDocumentId**: `string`
16
16
 
17
- The id of the auditable item graph vertex to remove the document from.
17
+ The id of the auditable item graph vertex to remove the revision from.
18
18
 
19
- #### documentId
19
+ #### revision
20
20
 
21
- > **documentId**: `string`
21
+ > **revision**: `string`
22
22
 
23
- The full id of the document to remove.
24
-
25
- ***
26
-
27
- ### query?
28
-
29
- > `optional` **query**: `object`
30
-
31
- The query parameters.
32
-
33
- #### removeAllRevisions?
34
-
35
- > `optional` **removeAllRevisions**: `boolean`
36
-
37
- Flag to remove all revisions of the document.
38
-
39
- ##### Default
40
-
41
- ```ts
42
- false
43
- ```
23
+ The revision of the document to remove.
@@ -0,0 +1,43 @@
1
+ # Interface: IDocumentManagementUpdateRequest
2
+
3
+ Request to update a document as an auditable item graph vertex.
4
+
5
+ ## Properties
6
+
7
+ ### pathParams
8
+
9
+ > **pathParams**: `object`
10
+
11
+ The path parameters.
12
+
13
+ #### auditableItemGraphDocumentId
14
+
15
+ > **auditableItemGraphDocumentId**: `string`
16
+
17
+ The full id of the document to get.
18
+
19
+ ***
20
+
21
+ ### body
22
+
23
+ > **body**: `object`
24
+
25
+ The body parameters.
26
+
27
+ #### blob?
28
+
29
+ > `optional` **blob**: `string`
30
+
31
+ The data to create the document with, in base64.
32
+
33
+ #### annotationObject?
34
+
35
+ > `optional` **annotationObject**: `IJsonLdNodeObject`
36
+
37
+ Additional information to associate with the document.
38
+
39
+ #### auditableItemGraphEdges?
40
+
41
+ > `optional` **auditableItemGraphEdges**: `object`[]
42
+
43
+ The auditable item graph vertices to connect the document to.
@@ -1,5 +1,5 @@
1
1
  # Type Alias: DocumentContexts
2
2
 
3
- > **DocumentContexts**: *typeof* [`DocumentContexts`](../variables/DocumentContexts.md)\[keyof *typeof* [`DocumentContexts`](../variables/DocumentContexts.md)\]
3
+ > **DocumentContexts** = *typeof* [`DocumentContexts`](../variables/DocumentContexts.md)\[keyof *typeof* [`DocumentContexts`](../variables/DocumentContexts.md)\]
4
4
 
5
5
  The contexts of document management objects.
@@ -1,5 +1,5 @@
1
1
  # Type Alias: DocumentTypes
2
2
 
3
- > **DocumentTypes**: *typeof* [`DocumentTypes`](../variables/DocumentTypes.md)\[keyof *typeof* [`DocumentTypes`](../variables/DocumentTypes.md)\]
3
+ > **DocumentTypes** = *typeof* [`DocumentTypes`](../variables/DocumentTypes.md)\[keyof *typeof* [`DocumentTypes`](../variables/DocumentTypes.md)\]
4
4
 
5
5
  The types of document management objects.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/document-management-models",
3
- "version": "0.0.1-next.8",
3
+ "version": "0.0.1-next.9",
4
4
  "description": "Models which define the structure of the document management connectors and services",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,6 +15,7 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@twin.org/attestation-models": "next",
18
+ "@twin.org/auditable-item-graph-models": "next",
18
19
  "@twin.org/blob-storage-models": "next",
19
20
  "@twin.org/core": "next",
20
21
  "@twin.org/data-json-ld": "next",