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

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 (36) hide show
  1. package/dist/cjs/index.cjs +152 -4
  2. package/dist/esm/index.mjs +152 -5
  3. package/dist/types/dataTypes/documentManagementDataTypes.d.ts +9 -0
  4. package/dist/types/index.d.ts +5 -1
  5. package/dist/types/models/IDocument.d.ts +4 -8
  6. package/dist/types/models/IDocumentList.d.ts +9 -4
  7. package/dist/types/models/IDocumentManagementComponent.d.ts +70 -35
  8. package/dist/types/models/api/{IDocumentManagementSetRequest.d.ts → IDocumentManagementCreateRequest.d.ts} +14 -15
  9. package/dist/types/models/api/IDocumentManagementGetRequest.d.ts +17 -13
  10. package/dist/types/models/api/IDocumentManagementGetResponse.d.ts +2 -2
  11. package/dist/types/models/api/IDocumentManagementGetRevisionRequest.d.ts +53 -0
  12. package/dist/types/models/api/IDocumentManagementGetRevisionResponse.d.ts +17 -0
  13. package/dist/types/models/api/IDocumentManagementQueryRequest.d.ts +7 -22
  14. package/dist/types/models/api/IDocumentManagementQueryResponse.d.ts +2 -2
  15. package/dist/types/models/api/IDocumentManagementRemoveRequest.d.ts +5 -15
  16. package/dist/types/models/api/IDocumentManagementUpdateRequest.d.ts +36 -0
  17. package/dist/types/models/documentTypes.d.ts +0 -4
  18. package/docs/changelog.md +103 -0
  19. package/docs/reference/classes/DocumentManagementDataTypes.md +25 -0
  20. package/docs/reference/index.md +8 -1
  21. package/docs/reference/interfaces/IDocument.md +8 -16
  22. package/docs/reference/interfaces/IDocumentList.md +14 -6
  23. package/docs/reference/interfaces/IDocumentManagementComponent.md +165 -57
  24. package/docs/reference/interfaces/{IDocumentManagementSetRequest.md → IDocumentManagementCreateRequest.md} +13 -21
  25. package/docs/reference/interfaces/IDocumentManagementGetRequest.md +24 -18
  26. package/docs/reference/interfaces/IDocumentManagementGetResponse.md +1 -1
  27. package/docs/reference/interfaces/IDocumentManagementGetRevisionRequest.md +91 -0
  28. package/docs/reference/interfaces/IDocumentManagementGetRevisionResponse.md +23 -0
  29. package/docs/reference/interfaces/IDocumentManagementQueryRequest.md +11 -43
  30. package/docs/reference/interfaces/IDocumentManagementQueryResponse.md +1 -1
  31. package/docs/reference/interfaces/IDocumentManagementRemoveRequest.md +7 -27
  32. package/docs/reference/interfaces/IDocumentManagementUpdateRequest.md +43 -0
  33. package/docs/reference/type-aliases/DocumentContexts.md +1 -1
  34. package/docs/reference/type-aliases/DocumentTypes.md +1 -1
  35. package/docs/reference/variables/DocumentTypes.md +0 -6
  36. package/package.json +10 -8
@@ -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.
@@ -30,30 +26,38 @@ export interface IDocumentManagementGetRequest {
30
26
  * Include the blob storage metadata in the response.
31
27
  * @default false
32
28
  */
33
- includeBlobStorageMetadata?: boolean;
29
+ includeBlobStorageMetadata?: boolean | string;
34
30
  /**
35
31
  * Include the blob storage data in the response.
36
32
  * @default false
37
33
  */
38
- includeBlobStorageData?: boolean;
34
+ includeBlobStorageData?: boolean | string;
39
35
  /**
40
36
  * Include the attestation information in the response.
41
37
  * @default false
42
38
  */
43
- includeAttestation?: boolean;
39
+ includeAttestation?: boolean | string;
44
40
  /**
45
41
  * Include deleted documents in the response.
46
42
  * @default false
47
43
  */
48
- includeRemoved?: boolean;
44
+ includeRemoved?: boolean | string;
45
+ /**
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;
49
53
  /**
50
- * Max number of revisions to return.
51
- * @default 0
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?: number | 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
  }
@@ -0,0 +1,53 @@
1
+ import type { HeaderTypes, MimeTypes } from "@twin.org/web";
2
+ /**
3
+ * Request to get a document revision from an auditable item graph vertex.
4
+ */
5
+ export interface IDocumentManagementGetRevisionRequest {
6
+ /**
7
+ * The headers which can be used to determine the response data type.
8
+ */
9
+ headers?: {
10
+ [HeaderTypes.Accept]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;
11
+ };
12
+ /**
13
+ * The path parameters.
14
+ */
15
+ pathParams: {
16
+ /**
17
+ * The full id of the document to get.
18
+ */
19
+ auditableItemGraphDocumentId: string;
20
+ /**
21
+ * The revision of the document to get.
22
+ */
23
+ revision: string;
24
+ };
25
+ /**
26
+ * The query parameters.
27
+ */
28
+ query?: {
29
+ /**
30
+ * Include the blob storage metadata in the response.
31
+ * @default false
32
+ */
33
+ includeBlobStorageMetadata?: boolean | string;
34
+ /**
35
+ * Include the blob storage data in the response.
36
+ * @default false
37
+ */
38
+ includeBlobStorageData?: boolean | string;
39
+ /**
40
+ * Include the attestation information in the response.
41
+ * @default false
42
+ */
43
+ includeAttestation?: boolean | string;
44
+ /**
45
+ * If provided will extract data from the document using the specified rule group id.
46
+ */
47
+ extractRuleGroupId?: string;
48
+ /**
49
+ * By default extraction will auto detect the mime type of the document, this can be used to override the detection.
50
+ */
51
+ extractMimeType?: string;
52
+ };
53
+ }
@@ -0,0 +1,17 @@
1
+ import type { HeaderTypes, MimeTypes } from "@twin.org/web";
2
+ import type { IDocument } from "../IDocument";
3
+ /**
4
+ * Response to get a document revision from an auditable item graph vertex.
5
+ */
6
+ export interface IDocumentManagementGetRevisionResponse {
7
+ /**
8
+ * The headers which can be used to determine the response data type.
9
+ */
10
+ headers?: {
11
+ [HeaderTypes.ContentType]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;
12
+ };
13
+ /**
14
+ * The body parameters.
15
+ */
16
+ body: IDocument;
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?: number | 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
+ }
@@ -10,10 +10,6 @@ export declare const DocumentTypes: {
10
10
  * Represents a document attestation.
11
11
  */
12
12
  readonly DocumentAttestation: "DocumentAttestation";
13
- /**
14
- * Represents a document list.
15
- */
16
- readonly DocumentList: "DocumentList";
17
13
  };
18
14
  /**
19
15
  * The types of document management objects.
package/docs/changelog.md CHANGED
@@ -1,5 +1,108 @@
1
1
  # @twin.org/document-management-models - Changelog
2
2
 
3
+ ## 0.0.1 (2025-07-09)
4
+
5
+
6
+ ### Features
7
+
8
+ * release to production ([a009526](https://github.com/twinfoundation/document-management/commit/a009526032a0ee6e6b74f476a01fbe5f4c7fd4da))
9
+
10
+ ## [0.0.1-next.20](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.19...document-management-models-v0.0.1-next.20) (2025-06-20)
11
+
12
+
13
+ ### Features
14
+
15
+ * data type registration use fully qualified names ([18d27d0](https://github.com/twinfoundation/document-management/commit/18d27d0c21d0f652b7df4b409bb2d3c66cf22f84))
16
+ * document get can perform extraction ([#6](https://github.com/twinfoundation/document-management/issues/6)) ([5ce6d37](https://github.com/twinfoundation/document-management/commit/5ce6d37432ad271ca5783f422846f4be98ec2215))
17
+ * get document revision ([080eddc](https://github.com/twinfoundation/document-management/commit/080eddcc024c622dda6bb36f60f5fa80a86cf5bb))
18
+ * improve comments ([4d2f094](https://github.com/twinfoundation/document-management/commit/4d2f094b23e3320cb739917246c1ee5f6ad41c11))
19
+ * store document as a vertex ([#2](https://github.com/twinfoundation/document-management/issues/2)) ([7febedc](https://github.com/twinfoundation/document-management/commit/7febedc3fb31de9c19565d6326341046834f2c74))
20
+ * update dependencies ([f9d8641](https://github.com/twinfoundation/document-management/commit/f9d86417dba24027699225ec7473296e361dcb00))
21
+ * update ts-to-schema generation ([01a5335](https://github.com/twinfoundation/document-management/commit/01a5335372f6a4764a74d56c446d669724a308aa))
22
+ * use standard list json ld types ([20ea04b](https://github.com/twinfoundation/document-management/commit/20ea04b05fd4bc4fcedce8f66958942c3c2fa303))
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * query params force coercion ([d667d0f](https://github.com/twinfoundation/document-management/commit/d667d0f195accca2887a5ca732e9790063763996))
28
+
29
+ ## [0.0.1-next.19](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.18...document-management-models-v0.0.1-next.19) (2025-06-20)
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * query params force coercion ([d667d0f](https://github.com/twinfoundation/document-management/commit/d667d0f195accca2887a5ca732e9790063763996))
35
+
36
+ ## [0.0.1-next.18](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.17...document-management-models-v0.0.1-next.18) (2025-06-18)
37
+
38
+
39
+ ### Miscellaneous Chores
40
+
41
+ * **document-management-models:** Synchronize repo versions
42
+
43
+ ## [0.0.1-next.17](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.16...document-management-models-v0.0.1-next.17) (2025-06-12)
44
+
45
+
46
+ ### Features
47
+
48
+ * update dependencies ([f9d8641](https://github.com/twinfoundation/document-management/commit/f9d86417dba24027699225ec7473296e361dcb00))
49
+
50
+ ## [0.0.1-next.16](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.15...document-management-models-v0.0.1-next.16) (2025-06-03)
51
+
52
+
53
+ ### Features
54
+
55
+ * update ts-to-schema generation ([01a5335](https://github.com/twinfoundation/document-management/commit/01a5335372f6a4764a74d56c446d669724a308aa))
56
+
57
+ ## [0.0.1-next.15](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.14...document-management-models-v0.0.1-next.15) (2025-05-28)
58
+
59
+
60
+ ### Features
61
+
62
+ * data type registration use fully qualified names ([18d27d0](https://github.com/twinfoundation/document-management/commit/18d27d0c21d0f652b7df4b409bb2d3c66cf22f84))
63
+
64
+ ## [0.0.1-next.14](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.13...document-management-models-v0.0.1-next.14) (2025-05-08)
65
+
66
+
67
+ ### Features
68
+
69
+ * use standard list json ld types ([20ea04b](https://github.com/twinfoundation/document-management/commit/20ea04b05fd4bc4fcedce8f66958942c3c2fa303))
70
+
71
+ ## [0.0.1-next.13](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.12...document-management-models-v0.0.1-next.13) (2025-04-30)
72
+
73
+
74
+ ### Miscellaneous Chores
75
+
76
+ * **document-management-models:** Synchronize repo versions
77
+
78
+ ## [0.0.1-next.12](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.11...document-management-models-v0.0.1-next.12) (2025-04-30)
79
+
80
+
81
+ ### Features
82
+
83
+ * get document revision ([080eddc](https://github.com/twinfoundation/document-management/commit/080eddcc024c622dda6bb36f60f5fa80a86cf5bb))
84
+
85
+ ## [0.0.1-next.11](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.10...document-management-models-v0.0.1-next.11) (2025-04-28)
86
+
87
+
88
+ ### Features
89
+
90
+ * document get can perform extraction ([#6](https://github.com/twinfoundation/document-management/issues/6)) ([5ce6d37](https://github.com/twinfoundation/document-management/commit/5ce6d37432ad271ca5783f422846f4be98ec2215))
91
+
92
+ ## [0.0.1-next.10](https://github.com/twinfoundation/document-management/compare/document-management-models-v0.0.1-next.9...document-management-models-v0.0.1-next.10) (2025-04-25)
93
+
94
+
95
+ ### Miscellaneous Chores
96
+
97
+ * **document-management-models:** Synchronize repo versions
98
+
99
+ ## [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)
100
+
101
+
102
+ ### Features
103
+
104
+ * store document as a vertex ([#2](https://github.com/twinfoundation/document-management/issues/2)) ([7febedc](https://github.com/twinfoundation/document-management/commit/7febedc3fb31de9c19565d6326341046834f2c74))
105
+
3
106
  ## [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
107
 
5
108
 
@@ -0,0 +1,25 @@
1
+ # Class: DocumentManagementDataTypes
2
+
3
+ Handle all the data types for document management.
4
+
5
+ ## Constructors
6
+
7
+ ### Constructor
8
+
9
+ > **new DocumentManagementDataTypes**(): `DocumentManagementDataTypes`
10
+
11
+ #### Returns
12
+
13
+ `DocumentManagementDataTypes`
14
+
15
+ ## Methods
16
+
17
+ ### registerTypes()
18
+
19
+ > `static` **registerTypes**(): `void`
20
+
21
+ Register all the data types.
22
+
23
+ #### Returns
24
+
25
+ `void`
@@ -1,17 +1,24 @@
1
1
  # @twin.org/document-management-models
2
2
 
3
+ ## Classes
4
+
5
+ - [DocumentManagementDataTypes](classes/DocumentManagementDataTypes.md)
6
+
3
7
  ## Interfaces
4
8
 
5
9
  - [IDocument](interfaces/IDocument.md)
6
10
  - [IDocumentAttestation](interfaces/IDocumentAttestation.md)
7
11
  - [IDocumentList](interfaces/IDocumentList.md)
8
12
  - [IDocumentManagementComponent](interfaces/IDocumentManagementComponent.md)
13
+ - [IDocumentManagementCreateRequest](interfaces/IDocumentManagementCreateRequest.md)
9
14
  - [IDocumentManagementGetRequest](interfaces/IDocumentManagementGetRequest.md)
10
15
  - [IDocumentManagementGetResponse](interfaces/IDocumentManagementGetResponse.md)
16
+ - [IDocumentManagementGetRevisionRequest](interfaces/IDocumentManagementGetRevisionRequest.md)
17
+ - [IDocumentManagementGetRevisionResponse](interfaces/IDocumentManagementGetRevisionResponse.md)
11
18
  - [IDocumentManagementQueryRequest](interfaces/IDocumentManagementQueryRequest.md)
12
19
  - [IDocumentManagementQueryResponse](interfaces/IDocumentManagementQueryResponse.md)
13
20
  - [IDocumentManagementRemoveRequest](interfaces/IDocumentManagementRemoveRequest.md)
14
- - [IDocumentManagementSetRequest](interfaces/IDocumentManagementSetRequest.md)
21
+ - [IDocumentManagementUpdateRequest](interfaces/IDocumentManagementUpdateRequest.md)
15
22
 
16
23
  ## Type Aliases
17
24
 
@@ -92,6 +92,14 @@ The additional JSON-LD for blob storage if it was requested.
92
92
 
93
93
  ***
94
94
 
95
+ ### extractedData?
96
+
97
+ > `optional` **extractedData**: `unknown`
98
+
99
+ The data extracted from the document using data extraction services.
100
+
101
+ ***
102
+
95
103
  ### attestationId?
96
104
 
97
105
  > `optional` **attestationId**: `string`
@@ -145,19 +153,3 @@ The node which added the document to the graph.
145
153
  > **userIdentity**: `string`
146
154
 
147
155
  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.
@@ -6,7 +6,7 @@ Interface describing a list of document entries.
6
6
 
7
7
  ### @context
8
8
 
9
- > **@context**: \[`"https://schema.twindev.org/documents/"`, `"https://schema.twindev.org/common/"`, `...IJsonLdContextDefinitionElement[]`\]
9
+ > **@context**: \[`"https://schema.org"`, `"https://schema.twindev.org/documents/"`, `"https://schema.twindev.org/common/"`, `...IJsonLdContextDefinitionElement[]`\]
10
10
 
11
11
  JSON-LD Context.
12
12
 
@@ -14,22 +14,30 @@ JSON-LD Context.
14
14
 
15
15
  ### type
16
16
 
17
- > **type**: `"DocumentList"`
17
+ > **type**: `"ItemList"`
18
18
 
19
19
  JSON-LD Type.
20
20
 
21
21
  ***
22
22
 
23
- ### documents
23
+ ### itemListElement
24
24
 
25
- > **documents**: [`IDocument`](IDocument.md)[]
25
+ > **itemListElement**: [`IDocument`](IDocument.md)[]
26
26
 
27
27
  The list of documents.
28
28
 
29
29
  ***
30
30
 
31
- ### cursor?
31
+ ### edges?
32
32
 
33
- > `optional` **cursor**: `string`
33
+ > `optional` **edges**: `string`[]
34
+
35
+ The ids of the other vertices which are connected to the document.
36
+
37
+ ***
38
+
39
+ ### nextItem?
40
+
41
+ > `optional` **nextItem**: `string`
34
42
 
35
43
  The cursor to get the next chunk of documents.