@twin.org/document-management-service 0.0.1-next.10

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.
@@ -0,0 +1,53 @@
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
+ /**
4
+ * The tag to associate with the routes.
5
+ */
6
+ export declare const tagsDocumentManagement: ITag[];
7
+ /**
8
+ * The REST routes for document management.
9
+ * @param baseRouteName Prefix to prepend to the paths.
10
+ * @param componentName The name of the component to use in the routes stored in the ComponentFactory.
11
+ * @returns The generated routes.
12
+ */
13
+ export declare function generateRestRoutesDocumentManagement(baseRouteName: string, componentName: string): IRestRoute[];
14
+ /**
15
+ * Create a document as an auditable item graph vertex.
16
+ * @param httpRequestContext The request context for the API.
17
+ * @param componentName The name of the component to use in the routes.
18
+ * @param request The request.
19
+ * @returns The response object with additional http response properties.
20
+ */
21
+ export declare function documentManagementCreate(httpRequestContext: IHttpRequestContext, componentName: string, request: IDocumentManagementCreateRequest): Promise<ICreatedResponse>;
22
+ /**
23
+ * Get the document from the auditable item graph vertex.
24
+ * @param httpRequestContext The request context for the API.
25
+ * @param componentName The name of the component to use in the routes.
26
+ * @param request The request.
27
+ * @returns The response object with additional http response properties.
28
+ */
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>;
38
+ /**
39
+ * Remove the document from the auditable item graph vertex.
40
+ * @param httpRequestContext The request context for the API.
41
+ * @param componentName The name of the component to use in the routes.
42
+ * @param request The request.
43
+ * @returns The response object with additional http response properties.
44
+ */
45
+ export declare function documentManagementRemove(httpRequestContext: IHttpRequestContext, componentName: string, request: IDocumentManagementRemoveRequest): Promise<INoContentResponse>;
46
+ /**
47
+ * Query the documents from an auditable item graph vertex.
48
+ * @param httpRequestContext The request context for the API.
49
+ * @param componentName The name of the component to use in the routes.
50
+ * @param request The request.
51
+ * @returns The response object with additional http response properties.
52
+ */
53
+ export declare function documentManagementQuery(httpRequestContext: IHttpRequestContext, componentName: string, request: IDocumentManagementQueryRequest): Promise<IDocumentManagementQueryResponse>;
@@ -0,0 +1,115 @@
1
+ import { type IAuditableItemGraphVertexList } from "@twin.org/auditable-item-graph-models";
2
+ import { type IJsonLdNodeObject } from "@twin.org/data-json-ld";
3
+ import { type IDocumentList, type IDocumentManagementComponent } from "@twin.org/document-management-models";
4
+ import { UneceDocumentCodes } from "@twin.org/standards-unece";
5
+ import type { IDocumentManagementServiceConstructorOptions } from "./models/IDocumentManagementStorageServiceConstructorOptions";
6
+ /**
7
+ * Service for performing document management operations.
8
+ */
9
+ export declare class DocumentManagementService implements IDocumentManagementComponent {
10
+ /**
11
+ * The namespace supported by the document management service.
12
+ */
13
+ static readonly NAMESPACE: string;
14
+ /**
15
+ * Runtime name for the class.
16
+ */
17
+ readonly CLASS_NAME: string;
18
+ /**
19
+ * Create a new instance of DocumentManagementService.
20
+ * @param options The options for the service.
21
+ */
22
+ constructor(options?: IDocumentManagementServiceConstructorOptions);
23
+ /**
24
+ * Store a document as an auditable item graph vertex and add its content to blob storage.
25
+ * If the document id already exists and the blob data is different a new revision will be created.
26
+ * For any other changes the current revision will be updated.
27
+ * @param documentId The document id to create.
28
+ * @param documentIdFormat The format of the document identifier.
29
+ * @param documentCode The code for the document type.
30
+ * @param blob The data to create the document with.
31
+ * @param annotationObject Additional information to associate with the document.
32
+ * @param auditableItemGraphEdges The auditable item graph vertices to connect the document to.
33
+ * @param options Additional options for the set operation.
34
+ * @param options.createAttestation Flag to create an attestation for the document, defaults to false.
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.
37
+ * @param userIdentity The identity to perform the auditable item graph operation with.
38
+ * @param nodeIdentity The node identity to use for vault operations.
39
+ * @returns The auditable item graph vertex created for the document including its revision.
40
+ */
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?: {
46
+ createAttestation?: boolean;
47
+ addAlias?: boolean;
48
+ aliasAnnotationObject?: IJsonLdNodeObject;
49
+ }, userIdentity?: string, nodeIdentity?: string): Promise<string>;
50
+ /**
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.
70
+ * @param options Additional options for the get operation.
71
+ * @param options.includeBlobStorageMetadata Flag to include the blob storage metadata for the document, defaults to false.
72
+ * @param options.includeBlobStorageData Flag to include the blob storage data for the document, defaults to false.
73
+ * @param options.includeAttestation Flag to include the attestation information for the document, defaults to false.
74
+ * @param options.includeRemoved Flag to include deleted documents, defaults to false.
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.
77
+ * @param userIdentity The identity to perform the auditable item graph operation with.
78
+ * @param nodeIdentity The node identity to use for vault operations.
79
+ * @returns The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
80
+ */
81
+ get(auditableItemGraphDocumentId: string, options?: {
82
+ includeBlobStorageMetadata?: boolean;
83
+ includeBlobStorageData?: boolean;
84
+ includeAttestation?: boolean;
85
+ includeRemoved?: boolean;
86
+ }, cursor?: string, pageSize?: number, userIdentity?: string, nodeIdentity?: string): Promise<IDocumentList>;
87
+ /**
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.
92
+ * @param userIdentity The identity to perform the auditable item graph operation with.
93
+ * @param nodeIdentity The node identity to use for vault operations.
94
+ * @returns Nothing.
95
+ */
96
+ removeRevision(auditableItemGraphDocumentId: string, revision: number, userIdentity?: string, nodeIdentity?: string): Promise<void>;
97
+ /**
98
+ * Find all the document with a specific id.
99
+ * @param documentId The document id to find in the graph.
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.
102
+ * @param userIdentity The identity to perform the auditable item graph operation with.
103
+ * @param nodeIdentity The node identity to use for vault operations.
104
+ * @returns The graph vertices that contain documents referencing the specified document id.
105
+ */
106
+ query(documentId: string, cursor?: string, pageSize?: number, userIdentity?: string, nodeIdentity?: string): Promise<IAuditableItemGraphVertexList>;
107
+ /**
108
+ * Create an attestation for the document.
109
+ * @param document The document to create the attestation for.
110
+ * @param userIdentity The identity to perform the attestation operation with.
111
+ * @param nodeIdentity The node identity to perform attestation operation with.
112
+ * @returns The attestation identifier.
113
+ */
114
+ private createAttestation;
115
+ }
@@ -0,0 +1,5 @@
1
+ export * from "./documentManagementRoutes";
2
+ export * from "./documentManagementService";
3
+ export * from "./models/IDocumentManagementServiceConfig";
4
+ export * from "./models/IDocumentManagementStorageServiceConstructorOptions";
5
+ export * from "./restEntryPoints";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Configuration for the document management service.
3
+ */
4
+ export interface IDocumentManagementServiceConfig {
5
+ }
@@ -0,0 +1,25 @@
1
+ import type { IDocumentManagementServiceConfig } from "./IDocumentManagementServiceConfig";
2
+ /**
3
+ * Options for the document management Service constructor.
4
+ */
5
+ export interface IDocumentManagementServiceConstructorOptions {
6
+ /**
7
+ * The type of the auditable item graph component.
8
+ * @default auditable-item-graph
9
+ */
10
+ auditableItemGraphComponentType?: string;
11
+ /**
12
+ * The type of the blob storage component.
13
+ * @default blob-storage
14
+ */
15
+ blobStorageComponentType?: string;
16
+ /**
17
+ * The type of the attestation component.
18
+ * @default attestation
19
+ */
20
+ attestationComponentType?: string;
21
+ /**
22
+ * The configuration for the service.
23
+ */
24
+ config?: IDocumentManagementServiceConfig;
25
+ }
@@ -0,0 +1,2 @@
1
+ import type { IRestRouteEntryPoint } from "@twin.org/api-models";
2
+ export declare const restEntryPoints: IRestRouteEntryPoint[];
@@ -0,0 +1,47 @@
1
+ # @twin.org/document-management-service - Changelog
2
+
3
+ ## [0.0.1-next.10](https://github.com/twinfoundation/document-management/compare/document-management-service-v0.0.1-next.9...document-management-service-v0.0.1-next.10) (2025-04-25)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * adding missing route for the document management ([#4](https://github.com/twinfoundation/document-management/issues/4)) ([fd3292e](https://github.com/twinfoundation/document-management/commit/fd3292ede5014847ae2f2bcadb174b6552486154))
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.9 to 0.0.1-next.10
16
+
17
+ ## [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)
18
+
19
+
20
+ ### Features
21
+
22
+ * store document as a vertex ([#2](https://github.com/twinfoundation/document-management/issues/2)) ([7febedc](https://github.com/twinfoundation/document-management/commit/7febedc3fb31de9c19565d6326341046834f2c74))
23
+
24
+
25
+ ### Dependencies
26
+
27
+ * The following workspace dependencies were updated
28
+ * dependencies
29
+ * @twin.org/document-management-models bumped from 0.0.1-next.8 to 0.0.1-next.9
30
+
31
+ ## [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)
32
+
33
+
34
+ ### Miscellaneous Chores
35
+
36
+ * **document-management-service:** Synchronize repo versions
37
+
38
+
39
+ ### Dependencies
40
+
41
+ * The following workspace dependencies were updated
42
+ * dependencies
43
+ * @twin.org/document-management-models bumped from 0.0.1-next.7 to 0.0.1-next.8
44
+
45
+ ## v0.0.1-next.7
46
+
47
+ - Initial Release
@@ -0,0 +1 @@
1
+ # @twin.org/document-management-service - Examples