@twin.org/document-management-models 0.0.1-next.1 → 0.0.1-next.11

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 (34) hide show
  1. package/dist/cjs/index.cjs +17 -3
  2. package/dist/esm/index.mjs +17 -4
  3. package/dist/types/index.d.ts +5 -2
  4. package/dist/types/models/IDocument.d.ts +14 -9
  5. package/dist/types/models/IDocumentAttestation.d.ts +41 -0
  6. package/dist/types/models/IDocumentList.d.ts +9 -4
  7. package/dist/types/models/IDocumentManagementComponent.d.ts +54 -34
  8. package/dist/types/models/api/{IDocumentManagementSetRequest.d.ts → IDocumentManagementCreateRequest.d.ts} +19 -12
  9. package/dist/types/models/api/IDocumentManagementGetRequest.d.ts +13 -9
  10. package/dist/types/models/api/IDocumentManagementGetResponse.d.ts +2 -2
  11. package/dist/types/models/api/IDocumentManagementQueryRequest.d.ts +7 -22
  12. package/dist/types/models/api/IDocumentManagementQueryResponse.d.ts +2 -2
  13. package/dist/types/models/api/IDocumentManagementRemoveRequest.d.ts +5 -15
  14. package/dist/types/models/api/IDocumentManagementUpdateRequest.d.ts +36 -0
  15. package/dist/types/models/documentContexts.d.ts +17 -0
  16. package/dist/types/models/{documentDataTypes.d.ts → documentTypes.d.ts} +4 -8
  17. package/docs/changelog.md +29 -1
  18. package/docs/reference/index.md +5 -1
  19. package/docs/reference/interfaces/IDocument.md +14 -6
  20. package/docs/reference/interfaces/IDocumentAttestation.md +59 -0
  21. package/docs/reference/interfaces/IDocumentList.md +9 -1
  22. package/docs/reference/interfaces/IDocumentManagementComponent.md +120 -70
  23. package/docs/reference/interfaces/{IDocumentManagementSetRequest.md → IDocumentManagementCreateRequest.md} +21 -17
  24. package/docs/reference/interfaces/IDocumentManagementGetRequest.md +20 -14
  25. package/docs/reference/interfaces/IDocumentManagementGetResponse.md +1 -1
  26. package/docs/reference/interfaces/IDocumentManagementQueryRequest.md +11 -43
  27. package/docs/reference/interfaces/IDocumentManagementQueryResponse.md +1 -1
  28. package/docs/reference/interfaces/IDocumentManagementRemoveRequest.md +7 -27
  29. package/docs/reference/interfaces/IDocumentManagementUpdateRequest.md +43 -0
  30. package/docs/reference/type-aliases/DocumentContexts.md +5 -0
  31. package/docs/reference/type-aliases/DocumentTypes.md +1 -1
  32. package/docs/reference/variables/DocumentContexts.md +19 -0
  33. package/docs/reference/variables/DocumentTypes.md +6 -12
  34. package/package.json +2 -1
@@ -3,10 +3,10 @@
3
3
  // Copyright 2024 IOTA Stiftung.
4
4
  // SPDX-License-Identifier: Apache-2.0.
5
5
  /**
6
- * The types of document management objects.
6
+ * The contexts of document management objects.
7
7
  */
8
8
  // eslint-disable-next-line @typescript-eslint/naming-convention
9
- const DocumentTypes = {
9
+ const DocumentContexts = {
10
10
  /**
11
11
  * The context root for the document types.
12
12
  */
@@ -14,15 +14,29 @@ const DocumentTypes = {
14
14
  /**
15
15
  * The context root for the common types.
16
16
  */
17
- ContextRootCommon: "https://schema.twindev.org/common/",
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 document management objects.
24
+ */
25
+ // eslint-disable-next-line @typescript-eslint/naming-convention
26
+ const DocumentTypes = {
18
27
  /**
19
28
  * Represents a document.
20
29
  */
21
30
  Document: "Document",
31
+ /**
32
+ * Represents a document attestation.
33
+ */
34
+ DocumentAttestation: "DocumentAttestation",
22
35
  /**
23
36
  * Represents a document list.
24
37
  */
25
38
  DocumentList: "DocumentList"
26
39
  };
27
40
 
41
+ exports.DocumentContexts = DocumentContexts;
28
42
  exports.DocumentTypes = DocumentTypes;
@@ -1,10 +1,10 @@
1
1
  // Copyright 2024 IOTA Stiftung.
2
2
  // SPDX-License-Identifier: Apache-2.0.
3
3
  /**
4
- * The types of document management objects.
4
+ * The contexts of document management objects.
5
5
  */
6
6
  // eslint-disable-next-line @typescript-eslint/naming-convention
7
- const DocumentTypes = {
7
+ const DocumentContexts = {
8
8
  /**
9
9
  * The context root for the document types.
10
10
  */
@@ -12,15 +12,28 @@ const DocumentTypes = {
12
12
  /**
13
13
  * The context root for the common types.
14
14
  */
15
- ContextRootCommon: "https://schema.twindev.org/common/",
15
+ ContextRootCommon: "https://schema.twindev.org/common/"
16
+ };
17
+
18
+ // Copyright 2024 IOTA Stiftung.
19
+ // SPDX-License-Identifier: Apache-2.0.
20
+ /**
21
+ * The types of document management objects.
22
+ */
23
+ // eslint-disable-next-line @typescript-eslint/naming-convention
24
+ const DocumentTypes = {
16
25
  /**
17
26
  * Represents a document.
18
27
  */
19
28
  Document: "Document",
29
+ /**
30
+ * Represents a document attestation.
31
+ */
32
+ DocumentAttestation: "DocumentAttestation",
20
33
  /**
21
34
  * Represents a document list.
22
35
  */
23
36
  DocumentList: "DocumentList"
24
37
  };
25
38
 
26
- export { DocumentTypes };
39
+ export { DocumentContexts, DocumentTypes };
@@ -1,10 +1,13 @@
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/documentDataTypes";
7
+ export * from "./models/api/IDocumentManagementUpdateRequest";
8
+ export * from "./models/documentContexts";
9
+ export * from "./models/documentTypes";
8
10
  export * from "./models/IDocument";
11
+ export * from "./models/IDocumentAttestation";
9
12
  export * from "./models/IDocumentList";
10
13
  export * from "./models/IDocumentManagementComponent";
@@ -1,9 +1,10 @@
1
1
  import type { IAttestationInformation } from "@twin.org/attestation-models";
2
2
  import type { IBlobStorageEntry } from "@twin.org/blob-storage-models";
3
3
  import type { IJsonLdContextDefinitionElement, IJsonLdNodeObject } from "@twin.org/data-json-ld";
4
- import type { SchemaOrgTypes } from "@twin.org/standards-schema-org";
4
+ import type { SchemaOrgContexts } from "@twin.org/standards-schema-org";
5
5
  import type { UneceDocumentCodes } from "@twin.org/standards-unece";
6
- import type { DocumentTypes } from "./documentDataTypes";
6
+ import type { DocumentContexts } from "./documentContexts";
7
+ import type { DocumentTypes } from "./documentTypes";
7
8
  /**
8
9
  * Interface describing a document.
9
10
  */
@@ -12,9 +13,9 @@ export interface IDocument {
12
13
  * JSON-LD Context.
13
14
  */
14
15
  "@context": [
15
- typeof DocumentTypes.ContextRoot,
16
- typeof DocumentTypes.ContextRootCommon,
17
- typeof SchemaOrgTypes.ContextRoot,
16
+ typeof DocumentContexts.ContextRoot,
17
+ typeof DocumentContexts.ContextRootCommon,
18
+ typeof SchemaOrgContexts.ContextRoot,
18
19
  ...IJsonLdContextDefinitionElement[]
19
20
  ];
20
21
  /**
@@ -57,6 +58,10 @@ export interface IDocument {
57
58
  * The additional JSON-LD for blob storage if it was requested.
58
59
  */
59
60
  blobStorageEntry?: IBlobStorageEntry;
61
+ /**
62
+ * The data extracted from the document using data extraction services.
63
+ */
64
+ extractedData?: unknown;
60
65
  /**
61
66
  * The attestation for the document if one was created.
62
67
  */
@@ -78,11 +83,11 @@ export interface IDocument {
78
83
  */
79
84
  dateDeleted?: string;
80
85
  /**
81
- * The previous revisions of the document.
86
+ * The node which added the document to the graph.
82
87
  */
83
- revisions?: IDocument[];
88
+ nodeIdentity: string;
84
89
  /**
85
- * The cursor to get the next chunk of revisions.
90
+ * The user who added the document to the graph.
86
91
  */
87
- revisionCursor?: string;
92
+ userIdentity: string;
88
93
  }
@@ -0,0 +1,41 @@
1
+ import type { SchemaOrgContexts } from "@twin.org/standards-schema-org";
2
+ import type { UneceDocumentCodes } from "@twin.org/standards-unece";
3
+ import type { DocumentContexts } from "./documentContexts";
4
+ import type { DocumentTypes } from "./documentTypes";
5
+ /**
6
+ * Interface describing a document attestation.
7
+ */
8
+ export interface IDocumentAttestation {
9
+ /**
10
+ * JSON-LD Context.
11
+ */
12
+ "@context": [
13
+ typeof DocumentContexts.ContextRoot,
14
+ typeof DocumentContexts.ContextRootCommon,
15
+ typeof SchemaOrgContexts.ContextRoot
16
+ ];
17
+ /**
18
+ * JSON-LD Type.
19
+ */
20
+ type: typeof DocumentTypes.DocumentAttestation;
21
+ /**
22
+ * The id of the document.
23
+ */
24
+ documentId: string;
25
+ /**
26
+ * The code for the document type.
27
+ */
28
+ documentCode: UneceDocumentCodes;
29
+ /**
30
+ * The revision of the document as a 0 based index.
31
+ */
32
+ documentRevision: number;
33
+ /**
34
+ * The date/time of when the document was created.
35
+ */
36
+ dateCreated: string;
37
+ /**
38
+ * The hash of the document being attested.
39
+ */
40
+ blobHash: string;
41
+ }
@@ -1,16 +1,17 @@
1
1
  import type { IJsonLdContextDefinitionElement } from "@twin.org/data-json-ld";
2
- import type { DocumentTypes } from "./documentDataTypes";
2
+ import type { DocumentContexts } from "./documentContexts";
3
+ import type { DocumentTypes } from "./documentTypes";
3
4
  import type { IDocument } from "./IDocument";
4
5
  /**
5
- * Interface describing a document entry list.
6
+ * Interface describing a list of document entries.
6
7
  */
7
8
  export interface IDocumentList {
8
9
  /**
9
10
  * JSON-LD Context.
10
11
  */
11
12
  "@context": [
12
- typeof DocumentTypes.ContextRoot,
13
- typeof DocumentTypes.ContextRootCommon,
13
+ typeof DocumentContexts.ContextRoot,
14
+ typeof DocumentContexts.ContextRootCommon,
14
15
  ...IJsonLdContextDefinitionElement[]
15
16
  ];
16
17
  /**
@@ -21,6 +22,10 @@ export interface IDocumentList {
21
22
  * The list of documents.
22
23
  */
23
24
  documents: IDocument[];
25
+ /**
26
+ * The ids of the other vertices which are connected to the document.
27
+ */
28
+ edges?: string[];
24
29
  /**
25
30
  * The cursor to get the next chunk of documents.
26
31
  */
@@ -1,78 +1,98 @@
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.
20
- * @param createAttestation Flag to create an attestation for the document, defaults to false.
19
+ * @param auditableItemGraphEdges The auditable item graph vertices to connect the document to.
20
+ * @param options Additional options for the set operation.
21
+ * @param options.createAttestation Flag to create an attestation for the document, defaults to false.
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.
21
24
  * @param userIdentity The identity to perform the auditable item graph operation with.
22
25
  * @param nodeIdentity The node identity to use for vault operations.
23
- * @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.
24
27
  */
25
- set(auditableItemGraphId: string, documentId: string, documentIdFormat: string | undefined, documentCode: UneceDocumentCodes, blob: Uint8Array, annotationObject?: IJsonLdNodeObject, createAttestation?: boolean, userIdentity?: string, nodeIdentity?: string): Promise<string>;
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?: {
33
+ createAttestation?: boolean;
34
+ addAlias?: boolean;
35
+ aliasAnnotationObject?: IJsonLdNodeObject;
36
+ }, userIdentity?: string, nodeIdentity?: string): Promise<string>;
26
37
  /**
27
- * Get a specific document from an auditable item graph vertex.
28
- * @param auditableItemGraphId The auditable item graph vertex id to get the document from.
29
- * @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.
30
57
  * @param options Additional options for the get operation.
31
58
  * @param options.includeBlobStorageMetadata Flag to include the blob storage metadata for the document, defaults to false.
32
59
  * @param options.includeBlobStorageData Flag to include the blob storage data for the document, defaults to false.
33
60
  * @param options.includeAttestation Flag to include the attestation information for the document, defaults to false.
34
61
  * @param options.includeRemoved Flag to include deleted documents, defaults to false.
35
- * @param options.maxRevisionCount Max number of revisions to return, defaults to 0.
36
- * @param revisionCursor The cursor to get the next chunk of revisions.
62
+ * @param options.extractRuleGroupId If provided will extract data from the document using the specified rule group id.
63
+ * @param options.extractMimeType By default extraction will auto detect the mime type of the document, this can be used to override the detection.
64
+ * @param cursor The cursor to get the next chunk of revisions.
65
+ * @param pageSize Page size of items to return, defaults to 1 so only most recent is returned.
37
66
  * @param userIdentity The identity to perform the auditable item graph operation with.
38
67
  * @param nodeIdentity The node identity to use for vault operations.
39
68
  * @returns The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
40
69
  */
41
- get(auditableItemGraphId: string, identifier: string, options?: {
70
+ get(auditableItemGraphDocumentId: string, options?: {
42
71
  includeBlobStorageMetadata?: boolean;
43
72
  includeBlobStorageData?: boolean;
44
73
  includeAttestation?: boolean;
45
74
  includeRemoved?: boolean;
46
- maxRevisionCount?: number;
47
- }, revisionCursor?: string, userIdentity?: string, nodeIdentity?: string): Promise<IDocument>;
75
+ extractRuleGroupId?: string;
76
+ extractMimeType?: string;
77
+ }, cursor?: string, pageSize?: number, userIdentity?: string, nodeIdentity?: string): Promise<IDocumentList>;
48
78
  /**
49
- * Remove a specific document from an auditable item graph vertex.
50
- * The documents dateDeleted will be set, but can still be queried with the includeRemoved flag.
51
- * @param auditableItemGraphId The auditable item graph vertex id to remove the document from.
52
- * @param identifier The identifier of the document to remove.
53
- * @param options Additional options for the remove operation.
54
- * @param options.removeAllRevisions Flag to remove all revisions of the document, defaults to false.
79
+ * Remove an auditable item graph vertex using it's id.
80
+ * The document dateDeleted will be set, but can still be queried with the includeRemoved flag.
81
+ * @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.
82
+ * @param revision The revision of the document to remove.
55
83
  * @param userIdentity The identity to perform the auditable item graph operation with.
56
84
  * @param nodeIdentity The node identity to use for vault operations.
57
85
  * @returns Nothing.
58
86
  */
59
- remove(auditableItemGraphId: string, identifier: string, options?: {
60
- removeAllRevisions?: boolean;
61
- }, userIdentity?: string, nodeIdentity?: string): Promise<void>;
87
+ removeRevision(auditableItemGraphDocumentId: string, revision: number, userIdentity?: string, nodeIdentity?: string): Promise<void>;
62
88
  /**
63
- * Query an auditable item graph vertex for documents.
64
- * @param auditableItemGraphId The auditable item graph vertex to get the documents from.
65
- * @param documentCodes The document codes to query for, if undefined gets all document codes.
66
- * @param options Additional options for the query operation.
67
- * @param options.includeMostRecentRevisions Include the most recent 5 revisions, use the individual get to retrieve more.
68
- * @param options.includeRemoved Flag to include deleted documents, defaults to false.
89
+ * Find all the document with a specific id.
90
+ * @param documentId The document id to find in the graph.
69
91
  * @param cursor The cursor to get the next chunk of documents.
92
+ * @param pageSize The page size to get the next chunk of documents.
70
93
  * @param userIdentity The identity to perform the auditable item graph operation with.
71
94
  * @param nodeIdentity The node identity to use for vault operations.
72
- * @returns The most recent revisions of each document, cursor is set if there are more documents.
95
+ * @returns The graph vertices that contain documents referencing the specified document id.
73
96
  */
74
- query(auditableItemGraphId: string, documentCodes?: UneceDocumentCodes[], options?: {
75
- includeMostRecentRevisions?: boolean;
76
- includeRemoved?: boolean;
77
- }, cursor?: string, userIdentity?: string, nodeIdentity?: string): Promise<IDocumentList>;
97
+ query(documentId: string, cursor?: string, pageSize?: number, userIdentity?: string, nodeIdentity?: string): Promise<IAuditableItemGraphVertexList>;
78
98
  }
@@ -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,8 +29,24 @@ 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;
43
+ /**
44
+ * Flag to add the document id as an alias to the aig vertex, defaults to true.
45
+ */
46
+ addAlias?: boolean;
47
+ /**
48
+ * Annotation object for the alias.
49
+ */
50
+ aliasAnnotationObject?: IJsonLdNodeObject;
44
51
  };
45
52
  }
@@ -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,21 @@ export interface IDocumentManagementGetRequest {
47
43
  */
48
44
  includeRemoved?: boolean;
49
45
  /**
50
- * Max number of revisions to return.
51
- * @default 0
46
+ * If provided will extract data from the document using the specified rule group id.
47
+ */
48
+ extractRuleGroupId?: string;
49
+ /**
50
+ * By default extraction will auto detect the mime type of the document, this can be used to override the detection.
51
+ */
52
+ extractMimeType?: string;
53
+ /**
54
+ * Page size of items to return, defaults to 1 so only most recent is returned.
55
+ * @default 1
52
56
  */
53
- maxRevisionCount?: number;
57
+ pageSize?: string;
54
58
  /**
55
59
  * The cursor to get the next chunk of revisions.
56
60
  */
57
- revisionCursor?: string;
61
+ cursor?: string;
58
62
  };
59
63
  }
@@ -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
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The contexts of document management objects.
3
+ */
4
+ export declare const DocumentContexts: {
5
+ /**
6
+ * The context root for the document types.
7
+ */
8
+ readonly ContextRoot: "https://schema.twindev.org/documents/";
9
+ /**
10
+ * The context root for the common types.
11
+ */
12
+ readonly ContextRootCommon: "https://schema.twindev.org/common/";
13
+ };
14
+ /**
15
+ * The contexts of document management objects.
16
+ */
17
+ export type DocumentContexts = (typeof DocumentContexts)[keyof typeof DocumentContexts];
@@ -2,18 +2,14 @@
2
2
  * The types of document management objects.
3
3
  */
4
4
  export declare const DocumentTypes: {
5
- /**
6
- * The context root for the document types.
7
- */
8
- readonly ContextRoot: "https://schema.twindev.org/documents/";
9
- /**
10
- * The context root for the common types.
11
- */
12
- readonly ContextRootCommon: "https://schema.twindev.org/common/";
13
5
  /**
14
6
  * Represents a document.
15
7
  */
16
8
  readonly Document: "Document";
9
+ /**
10
+ * Represents a document attestation.
11
+ */
12
+ readonly DocumentAttestation: "DocumentAttestation";
17
13
  /**
18
14
  * Represents a document list.
19
15
  */