@twin.org/document-management-service 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.
@@ -1,5 +1,5 @@
1
- import { type ICreatedResponse, type IHttpRequestContext, type INoContentResponse, type IRestRoute, type ITag } from "@twin.org/api-models";
2
- import { type IDocumentManagementGetRequest, type IDocumentManagementGetResponse, type IDocumentManagementQueryRequest, type IDocumentManagementQueryResponse, type IDocumentManagementRemoveRequest, type IDocumentManagementSetRequest } from "@twin.org/document-management-models";
1
+ import type { ICreatedResponse, IHttpRequestContext, INoContentResponse, IRestRoute, ITag } from "@twin.org/api-models";
2
+ import { type IDocumentManagementCreateRequest, type IDocumentManagementGetRequest, type IDocumentManagementGetResponse, type IDocumentManagementQueryRequest, type IDocumentManagementQueryResponse, type IDocumentManagementRemoveRequest, type IDocumentManagementUpdateRequest } from "@twin.org/document-management-models";
3
3
  /**
4
4
  * The tag to associate with the routes.
5
5
  */
@@ -12,13 +12,13 @@ export declare const tagsDocumentManagement: ITag[];
12
12
  */
13
13
  export declare function generateRestRoutesDocumentManagement(baseRouteName: string, componentName: string): IRestRoute[];
14
14
  /**
15
- * Set a document in to an auditable item graph vertex.
15
+ * Create a document as an auditable item graph vertex.
16
16
  * @param httpRequestContext The request context for the API.
17
17
  * @param componentName The name of the component to use in the routes.
18
18
  * @param request The request.
19
19
  * @returns The response object with additional http response properties.
20
20
  */
21
- export declare function documentManagementSet(httpRequestContext: IHttpRequestContext, componentName: string, request: IDocumentManagementSetRequest): Promise<ICreatedResponse>;
21
+ export declare function documentManagementCreate(httpRequestContext: IHttpRequestContext, componentName: string, request: IDocumentManagementCreateRequest): Promise<ICreatedResponse>;
22
22
  /**
23
23
  * Get the document from the auditable item graph vertex.
24
24
  * @param httpRequestContext The request context for the API.
@@ -27,6 +27,14 @@ export declare function documentManagementSet(httpRequestContext: IHttpRequestCo
27
27
  * @returns The response object with additional http response properties.
28
28
  */
29
29
  export declare function documentManagementGet(httpRequestContext: IHttpRequestContext, componentName: string, request: IDocumentManagementGetRequest): Promise<IDocumentManagementGetResponse>;
30
+ /**
31
+ * UPdate the document from the auditable item graph vertex.
32
+ * @param httpRequestContext The request context for the API.
33
+ * @param componentName The name of the component to use in the routes.
34
+ * @param request The request.
35
+ * @returns The response object with additional http response properties.
36
+ */
37
+ export declare function documentManagementUpdate(httpRequestContext: IHttpRequestContext, componentName: string, request: IDocumentManagementUpdateRequest): Promise<INoContentResponse>;
30
38
  /**
31
39
  * Remove the document from the auditable item graph vertex.
32
40
  * @param httpRequestContext The request context for the API.
@@ -1,5 +1,6 @@
1
+ import { type IAuditableItemGraphVertexList } from "@twin.org/auditable-item-graph-models";
1
2
  import { type IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
- import { type IDocument, type IDocumentList, type IDocumentManagementComponent } from "@twin.org/document-management-models";
3
+ import { type IDocumentList, type IDocumentManagementComponent } from "@twin.org/document-management-models";
3
4
  import { UneceDocumentCodes } from "@twin.org/standards-unece";
4
5
  import type { IDocumentManagementServiceConstructorOptions } from "./models/IDocumentManagementStorageServiceConstructorOptions";
5
6
  /**
@@ -20,80 +21,89 @@ export declare class DocumentManagementService implements IDocumentManagementCom
20
21
  */
21
22
  constructor(options?: IDocumentManagementServiceConstructorOptions);
22
23
  /**
23
- * Store a document in an auditable item graph vertex and add its content to blob storage.
24
+ * Store a document as an auditable item graph vertex and add its content to blob storage.
24
25
  * If the document id already exists and the blob data is different a new revision will be created.
25
26
  * For any other changes the current revision will be updated.
26
- * @param auditableItemGraphId The auditable item graph vertex id to create the document on.
27
27
  * @param documentId The document id to create.
28
28
  * @param documentIdFormat The format of the document identifier.
29
29
  * @param documentCode The code for the document type.
30
- * @param blob The data to create the document.
30
+ * @param blob The data to create the document with.
31
31
  * @param annotationObject Additional information to associate with the document.
32
+ * @param auditableItemGraphEdges The auditable item graph vertices to connect the document to.
32
33
  * @param options Additional options for the set operation.
33
34
  * @param options.createAttestation Flag to create an attestation for the document, defaults to false.
34
- * @param options.includeIdAsAlias Include the document id as an alias to the aig vertex, defaults to false.
35
- * @param options.aliasAnnotationObject Additional information to associate with the alias.
35
+ * @param options.addAlias Flag to add the document id as an alias to the aig vertex, defaults to true.
36
+ * @param options.aliasAnnotationObject Annotation object for the alias.
36
37
  * @param userIdentity The identity to perform the auditable item graph operation with.
37
38
  * @param nodeIdentity The node identity to use for vault operations.
38
- * @returns The identifier for the document which includes the auditable item graph identifier.
39
+ * @returns The auditable item graph vertex created for the document including its revision.
39
40
  */
40
- set(auditableItemGraphId: string, documentId: string, documentIdFormat: string | undefined, documentCode: UneceDocumentCodes, blob: Uint8Array, annotationObject?: IJsonLdNodeObject, options?: {
41
+ create(documentId: string, documentIdFormat: string | undefined, documentCode: UneceDocumentCodes, blob: Uint8Array, annotationObject?: IJsonLdNodeObject, auditableItemGraphEdges?: {
42
+ id: string;
43
+ addAlias?: boolean;
44
+ aliasAnnotationObject?: IJsonLdNodeObject;
45
+ }[], options?: {
41
46
  createAttestation?: boolean;
42
- includeIdAsAlias?: boolean;
47
+ addAlias?: boolean;
43
48
  aliasAnnotationObject?: IJsonLdNodeObject;
44
49
  }, userIdentity?: string, nodeIdentity?: string): Promise<string>;
45
50
  /**
46
- * Get a specific document from an auditable item graph vertex.
47
- * @param auditableItemGraphId The auditable item graph vertex id to get the document from.
48
- * @param identifier The identifier of the document to get.
51
+ * Update a document as an auditable item graph vertex and add its content to blob storage.
52
+ * If the blob data is different a new revision will be created.
53
+ * For any other changes the current revision will be updated.
54
+ * @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.
55
+ * @param blob The data to update the document with.
56
+ * @param annotationObject Additional information to associate with the document.
57
+ * @param auditableItemGraphEdges The auditable item graph vertices to connect the document to, if undefined retains current connections.
58
+ * @param userIdentity The identity to perform the auditable item graph operation with.
59
+ * @param nodeIdentity The node identity to use for vault operations.
60
+ * @returns Nothing.
61
+ */
62
+ update(auditableItemGraphDocumentId: string, blob?: Uint8Array, annotationObject?: IJsonLdNodeObject, auditableItemGraphEdges?: {
63
+ id: string;
64
+ addAlias?: boolean;
65
+ aliasAnnotationObject?: IJsonLdNodeObject;
66
+ }[], userIdentity?: string, nodeIdentity?: string): Promise<void>;
67
+ /**
68
+ * Get a document using it's auditable item graph vertex id and optional revision.
69
+ * @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.
49
70
  * @param options Additional options for the get operation.
50
71
  * @param options.includeBlobStorageMetadata Flag to include the blob storage metadata for the document, defaults to false.
51
72
  * @param options.includeBlobStorageData Flag to include the blob storage data for the document, defaults to false.
52
73
  * @param options.includeAttestation Flag to include the attestation information for the document, defaults to false.
53
74
  * @param options.includeRemoved Flag to include deleted documents, defaults to false.
54
- * @param options.maxRevisionCount Max number of revisions to return, defaults to 0.
55
- * @param revisionCursor The cursor to get the next chunk of revisions.
75
+ * @param cursor The cursor to get the next chunk of revisions.
76
+ * @param pageSize Page size of items to return, defaults to 1 so only most recent is returned.
56
77
  * @param userIdentity The identity to perform the auditable item graph operation with.
57
78
  * @param nodeIdentity The node identity to use for vault operations.
58
79
  * @returns The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
59
80
  */
60
- get(auditableItemGraphId: string, identifier: string, options?: {
81
+ get(auditableItemGraphDocumentId: string, options?: {
61
82
  includeBlobStorageMetadata?: boolean;
62
83
  includeBlobStorageData?: boolean;
63
84
  includeAttestation?: boolean;
64
85
  includeRemoved?: boolean;
65
- maxRevisionCount?: number;
66
- }, revisionCursor?: string, userIdentity?: string, nodeIdentity?: string): Promise<IDocument>;
86
+ }, cursor?: string, pageSize?: number, userIdentity?: string, nodeIdentity?: string): Promise<IDocumentList>;
67
87
  /**
68
- * Remove a specific document from an auditable item graph vertex.
69
- * The documents dateDeleted will be set, but can still be queried with the includeRemoved flag.
70
- * @param auditableItemGraphId The auditable item graph vertex id to remove the document from.
71
- * @param identifier The identifier of the document to remove.
72
- * @param options Additional options for the remove operation.
73
- * @param options.removeAllRevisions Flag to remove all revisions of the document, defaults to false.
88
+ * Remove an auditable item graph vertex using it's id.
89
+ * The document dateDeleted will be set, but can still be queried with the includeRemoved flag.
90
+ * @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.
91
+ * @param revision The revision of the document to remove.
74
92
  * @param userIdentity The identity to perform the auditable item graph operation with.
75
93
  * @param nodeIdentity The node identity to use for vault operations.
76
94
  * @returns Nothing.
77
95
  */
78
- remove(auditableItemGraphId: string, identifier: string, options?: {
79
- removeAllRevisions?: boolean;
80
- }, userIdentity?: string, nodeIdentity?: string): Promise<void>;
96
+ removeRevision(auditableItemGraphDocumentId: string, revision: number, userIdentity?: string, nodeIdentity?: string): Promise<void>;
81
97
  /**
82
- * Query an auditable item graph vertex for documents.
83
- * @param auditableItemGraphId The auditable item graph vertex to get the documents from.
84
- * @param documentCodes The document codes to query for, if undefined gets all document codes.
85
- * @param options Additional options for the query operation.
86
- * @param options.includeMostRecentRevisions Include the most recent 5 revisions, use the individual get to retrieve more.
87
- * @param options.includeRemoved Flag to include deleted documents, defaults to false.
98
+ * Find all the document with a specific id.
99
+ * @param documentId The document id to find in the graph.
88
100
  * @param cursor The cursor to get the next chunk of documents.
101
+ * @param pageSize The page size to get the next chunk of documents.
89
102
  * @param userIdentity The identity to perform the auditable item graph operation with.
90
103
  * @param nodeIdentity The node identity to use for vault operations.
91
- * @returns The most recent revisions of each document, cursor is set if there are more documents.
104
+ * @returns The graph vertices that contain documents referencing the specified document id.
92
105
  */
93
- query(auditableItemGraphId: string, documentCodes?: UneceDocumentCodes[], options?: {
94
- includeMostRecentRevisions?: boolean;
95
- includeRemoved?: boolean;
96
- }, cursor?: string, userIdentity?: string, nodeIdentity?: string): Promise<IDocumentList>;
106
+ query(documentId: string, cursor?: string, pageSize?: number, userIdentity?: string, nodeIdentity?: string): Promise<IAuditableItemGraphVertexList>;
97
107
  /**
98
108
  * Create an attestation for the document.
99
109
  * @param document The document to create the attestation for.
package/docs/changelog.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @twin.org/document-management-service - Changelog
2
2
 
3
+ ## [0.0.1-next.9](https://github.com/twinfoundation/document-management/compare/document-management-service-v0.0.1-next.8...document-management-service-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
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/document-management-models bumped from 0.0.1-next.8 to 0.0.1-next.9
16
+
3
17
  ## [0.0.1-next.8](https://github.com/twinfoundation/document-management/compare/document-management-service-v0.0.1-next.7...document-management-service-v0.0.1-next.8) (2025-03-28)
4
18
 
5
19