@twin.org/document-management-service 0.0.1-next.2
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.
- package/LICENSE +201 -0
- package/README.md +21 -0
- package/dist/cjs/index.cjs +866 -0
- package/dist/esm/index.mjs +857 -0
- package/dist/types/documentManagementRoutes.d.ts +45 -0
- package/dist/types/documentManagementService.d.ts +90 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/models/IDocumentManagementServiceConfig.d.ts +5 -0
- package/dist/types/models/IDocumentManagementStorageServiceConstructorOptions.d.ts +25 -0
- package/dist/types/restEntryPoints.d.ts +2 -0
- package/docs/changelog.md +5 -0
- package/docs/examples.md +1 -0
- package/docs/open-api/spec.json +5443 -0
- package/docs/reference/classes/DocumentManagementService.md +328 -0
- package/docs/reference/functions/documentManagementGet.md +31 -0
- package/docs/reference/functions/documentManagementQuery.md +31 -0
- package/docs/reference/functions/documentManagementRemove.md +31 -0
- package/docs/reference/functions/documentManagementSet.md +31 -0
- package/docs/reference/functions/generateRestRoutesDocumentManagement.md +25 -0
- package/docs/reference/index.md +23 -0
- package/docs/reference/interfaces/IDocumentManagementServiceConfig.md +3 -0
- package/docs/reference/interfaces/IDocumentManagementServiceConstructorOptions.md +53 -0
- package/docs/reference/variables/restEntryPoints.md +3 -0
- package/docs/reference/variables/tagsDocumentManagement.md +5 -0
- package/locales/en.json +14 -0
- package/package.json +50 -0
|
@@ -0,0 +1,45 @@
|
|
|
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";
|
|
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
|
+
* Set a document in to 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 documentManagementSet(httpRequestContext: IHttpRequestContext, componentName: string, request: IDocumentManagementSetRequest): 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
|
+
* Remove 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 documentManagementRemove(httpRequestContext: IHttpRequestContext, componentName: string, request: IDocumentManagementRemoveRequest): Promise<INoContentResponse>;
|
|
38
|
+
/**
|
|
39
|
+
* Query the documents from an 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 documentManagementQuery(httpRequestContext: IHttpRequestContext, componentName: string, request: IDocumentManagementQueryRequest): Promise<IDocumentManagementQueryResponse>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
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 { UneceDocumentCodes } from "@twin.org/standards-unece";
|
|
4
|
+
import type { IDocumentManagementServiceConstructorOptions } from "./models/IDocumentManagementStorageServiceConstructorOptions";
|
|
5
|
+
/**
|
|
6
|
+
* Service for performing document management operations.
|
|
7
|
+
*/
|
|
8
|
+
export declare class DocumentManagementService implements IDocumentManagementComponent {
|
|
9
|
+
/**
|
|
10
|
+
* The namespace supported by the document management service.
|
|
11
|
+
*/
|
|
12
|
+
static readonly NAMESPACE: string;
|
|
13
|
+
/**
|
|
14
|
+
* Runtime name for the class.
|
|
15
|
+
*/
|
|
16
|
+
readonly CLASS_NAME: string;
|
|
17
|
+
/**
|
|
18
|
+
* Create a new instance of DocumentManagementService.
|
|
19
|
+
* @param options The options for the service.
|
|
20
|
+
*/
|
|
21
|
+
constructor(options?: IDocumentManagementServiceConstructorOptions);
|
|
22
|
+
/**
|
|
23
|
+
* Store a document in an auditable item graph vertex and add its content to blob storage.
|
|
24
|
+
* If the document id already exists and the blob data is different a new revision will be created.
|
|
25
|
+
* 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
|
+
* @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.
|
|
31
|
+
* @param annotationObject Additional information to associate with the document.
|
|
32
|
+
* @param createAttestation Flag to create an attestation for the document, defaults to false.
|
|
33
|
+
* @param userIdentity The identity to perform the auditable item graph operation with.
|
|
34
|
+
* @param nodeIdentity The node identity to use for vault operations.
|
|
35
|
+
* @returns The identifier for the document which includes the auditable item graph identifier.
|
|
36
|
+
*/
|
|
37
|
+
set(auditableItemGraphId: string, documentId: string, documentIdFormat: string | undefined, documentCode: UneceDocumentCodes, blob: Uint8Array, annotationObject?: IJsonLdNodeObject, createAttestation?: boolean, userIdentity?: string, nodeIdentity?: string): Promise<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Get a specific document from an auditable item graph vertex.
|
|
40
|
+
* @param auditableItemGraphId The auditable item graph vertex id to get the document from.
|
|
41
|
+
* @param identifier The identifier of the document to get.
|
|
42
|
+
* @param options Additional options for the get operation.
|
|
43
|
+
* @param options.includeBlobStorageMetadata Flag to include the blob storage metadata for the document, defaults to false.
|
|
44
|
+
* @param options.includeBlobStorageData Flag to include the blob storage data for the document, defaults to false.
|
|
45
|
+
* @param options.includeAttestation Flag to include the attestation information for the document, defaults to false.
|
|
46
|
+
* @param options.includeRemoved Flag to include deleted documents, defaults to false.
|
|
47
|
+
* @param options.maxRevisionCount Max number of revisions to return, defaults to 0.
|
|
48
|
+
* @param revisionCursor The cursor to get the next chunk of revisions.
|
|
49
|
+
* @param userIdentity The identity to perform the auditable item graph operation with.
|
|
50
|
+
* @param nodeIdentity The node identity to use for vault operations.
|
|
51
|
+
* @returns The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
|
|
52
|
+
*/
|
|
53
|
+
get(auditableItemGraphId: string, identifier: string, options?: {
|
|
54
|
+
includeBlobStorageMetadata?: boolean;
|
|
55
|
+
includeBlobStorageData?: boolean;
|
|
56
|
+
includeAttestation?: boolean;
|
|
57
|
+
includeRemoved?: boolean;
|
|
58
|
+
maxRevisionCount?: number;
|
|
59
|
+
}, revisionCursor?: string, userIdentity?: string, nodeIdentity?: string): Promise<IDocument>;
|
|
60
|
+
/**
|
|
61
|
+
* Remove a specific document from an auditable item graph vertex.
|
|
62
|
+
* The documents dateDeleted will be set, but can still be queried with the includeRemoved flag.
|
|
63
|
+
* @param auditableItemGraphId The auditable item graph vertex id to remove the document from.
|
|
64
|
+
* @param identifier The identifier of the document to remove.
|
|
65
|
+
* @param options Additional options for the remove operation.
|
|
66
|
+
* @param options.removeAllRevisions Flag to remove all revisions of the document, defaults to false.
|
|
67
|
+
* @param userIdentity The identity to perform the auditable item graph operation with.
|
|
68
|
+
* @param nodeIdentity The node identity to use for vault operations.
|
|
69
|
+
* @returns Nothing.
|
|
70
|
+
*/
|
|
71
|
+
remove(auditableItemGraphId: string, identifier: string, options?: {
|
|
72
|
+
removeAllRevisions?: boolean;
|
|
73
|
+
}, userIdentity?: string, nodeIdentity?: string): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Query an auditable item graph vertex for documents.
|
|
76
|
+
* @param auditableItemGraphId The auditable item graph vertex to get the documents from.
|
|
77
|
+
* @param documentCodes The document codes to query for, if undefined gets all document codes.
|
|
78
|
+
* @param options Additional options for the query operation.
|
|
79
|
+
* @param options.includeMostRecentRevisions Include the most recent 5 revisions, use the individual get to retrieve more.
|
|
80
|
+
* @param options.includeRemoved Flag to include deleted documents, defaults to false.
|
|
81
|
+
* @param cursor The cursor to get the next chunk of documents.
|
|
82
|
+
* @param userIdentity The identity to perform the auditable item graph operation with.
|
|
83
|
+
* @param nodeIdentity The node identity to use for vault operations.
|
|
84
|
+
* @returns The most recent revisions of each document, cursor is set if there are more documents.
|
|
85
|
+
*/
|
|
86
|
+
query(auditableItemGraphId: string, documentCodes?: UneceDocumentCodes[], options?: {
|
|
87
|
+
includeMostRecentRevisions?: boolean;
|
|
88
|
+
includeRemoved?: boolean;
|
|
89
|
+
}, cursor?: string, userIdentity?: string, nodeIdentity?: string): Promise<IDocumentList>;
|
|
90
|
+
}
|
|
@@ -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
|
+
}
|
package/docs/examples.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @twin.org/document-management-service - Examples
|