@twin.org/document-management-rest-client 0.0.1-next.10 → 0.0.1-next.12

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.
@@ -92,6 +92,8 @@ class DocumentManagementClient extends apiCore.BaseRestClient {
92
92
  * @param options.includeBlobStorageData Flag to include the blob storage data for the document, defaults to false.
93
93
  * @param options.includeAttestation Flag to include the attestation information for the document, defaults to false.
94
94
  * @param options.includeRemoved Flag to include deleted documents, defaults to false.
95
+ * @param options.extractRuleGroupId If provided will extract data from the document using the specified rule group id.
96
+ * @param options.extractMimeType By default extraction will auto detect the mime type of the document, this can be used to override the detection.
95
97
  * @param cursor The cursor to get the next chunk of revisions.
96
98
  * @param pageSize Page size of items to return, defaults to 1 so only most recent is returned.
97
99
  * @returns The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
@@ -107,12 +109,44 @@ class DocumentManagementClient extends apiCore.BaseRestClient {
107
109
  includeBlobStorageData: options?.includeBlobStorageData,
108
110
  includeAttestation: options?.includeAttestation,
109
111
  includeRemoved: options?.includeRemoved,
112
+ extractRuleGroupId: options?.extractRuleGroupId,
113
+ extractMimeType: options?.extractMimeType,
110
114
  cursor,
111
115
  pageSize: core.Coerce.string(pageSize)
112
116
  }
113
117
  });
114
118
  return response.body;
115
119
  }
120
+ /**
121
+ * Get a document revision using it's auditable item graph vertex id.
122
+ * @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.
123
+ * @param revision The revision id for the document.
124
+ * @param options Additional options for the get operation.
125
+ * @param options.includeBlobStorageMetadata Flag to include the blob storage metadata for the document, defaults to false.
126
+ * @param options.includeBlobStorageData Flag to include the blob storage data for the document, defaults to false.
127
+ * @param options.includeAttestation Flag to include the attestation information for the document, defaults to false.
128
+ * @param options.extractRuleGroupId If provided will extract data from the document using the specified rule group id.
129
+ * @param options.extractMimeType By default extraction will auto detect the mime type of the document, this can be used to override the detection.
130
+ * @returns The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
131
+ */
132
+ async getRevision(auditableItemGraphDocumentId, revision, options) {
133
+ core.Urn.guard(this.CLASS_NAME, "auditableItemGraphDocumentId", auditableItemGraphDocumentId);
134
+ core.Guards.integer(this.CLASS_NAME, "revision", revision);
135
+ const response = await this.fetch("/:auditableItemGraphDocumentId/:revision", "GET", {
136
+ pathParams: {
137
+ auditableItemGraphDocumentId,
138
+ revision: revision.toString()
139
+ },
140
+ query: {
141
+ includeBlobStorageMetadata: options?.includeBlobStorageMetadata,
142
+ includeBlobStorageData: options?.includeBlobStorageData,
143
+ includeAttestation: options?.includeAttestation,
144
+ extractRuleGroupId: options?.extractRuleGroupId,
145
+ extractMimeType: options?.extractMimeType
146
+ }
147
+ });
148
+ return response.body;
149
+ }
116
150
  /**
117
151
  * Remove an auditable item graph vertex using it's id.
118
152
  * The document dateDeleted will be set, but can still be queried with the includeRemoved flag.
@@ -90,6 +90,8 @@ class DocumentManagementClient extends BaseRestClient {
90
90
  * @param options.includeBlobStorageData Flag to include the blob storage data for the document, defaults to false.
91
91
  * @param options.includeAttestation Flag to include the attestation information for the document, defaults to false.
92
92
  * @param options.includeRemoved Flag to include deleted documents, defaults to false.
93
+ * @param options.extractRuleGroupId If provided will extract data from the document using the specified rule group id.
94
+ * @param options.extractMimeType By default extraction will auto detect the mime type of the document, this can be used to override the detection.
93
95
  * @param cursor The cursor to get the next chunk of revisions.
94
96
  * @param pageSize Page size of items to return, defaults to 1 so only most recent is returned.
95
97
  * @returns The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
@@ -105,12 +107,44 @@ class DocumentManagementClient extends BaseRestClient {
105
107
  includeBlobStorageData: options?.includeBlobStorageData,
106
108
  includeAttestation: options?.includeAttestation,
107
109
  includeRemoved: options?.includeRemoved,
110
+ extractRuleGroupId: options?.extractRuleGroupId,
111
+ extractMimeType: options?.extractMimeType,
108
112
  cursor,
109
113
  pageSize: Coerce.string(pageSize)
110
114
  }
111
115
  });
112
116
  return response.body;
113
117
  }
118
+ /**
119
+ * Get a document revision using it's auditable item graph vertex id.
120
+ * @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.
121
+ * @param revision The revision id for the document.
122
+ * @param options Additional options for the get operation.
123
+ * @param options.includeBlobStorageMetadata Flag to include the blob storage metadata for the document, defaults to false.
124
+ * @param options.includeBlobStorageData Flag to include the blob storage data for the document, defaults to false.
125
+ * @param options.includeAttestation Flag to include the attestation information for the document, defaults to false.
126
+ * @param options.extractRuleGroupId If provided will extract data from the document using the specified rule group id.
127
+ * @param options.extractMimeType By default extraction will auto detect the mime type of the document, this can be used to override the detection.
128
+ * @returns The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
129
+ */
130
+ async getRevision(auditableItemGraphDocumentId, revision, options) {
131
+ Urn.guard(this.CLASS_NAME, "auditableItemGraphDocumentId", auditableItemGraphDocumentId);
132
+ Guards.integer(this.CLASS_NAME, "revision", revision);
133
+ const response = await this.fetch("/:auditableItemGraphDocumentId/:revision", "GET", {
134
+ pathParams: {
135
+ auditableItemGraphDocumentId,
136
+ revision: revision.toString()
137
+ },
138
+ query: {
139
+ includeBlobStorageMetadata: options?.includeBlobStorageMetadata,
140
+ includeBlobStorageData: options?.includeBlobStorageData,
141
+ includeAttestation: options?.includeAttestation,
142
+ extractRuleGroupId: options?.extractRuleGroupId,
143
+ extractMimeType: options?.extractMimeType
144
+ }
145
+ });
146
+ return response.body;
147
+ }
114
148
  /**
115
149
  * Remove an auditable item graph vertex using it's id.
116
150
  * The document dateDeleted will be set, but can still be queried with the includeRemoved flag.
@@ -2,7 +2,7 @@ import { BaseRestClient } from "@twin.org/api-core";
2
2
  import type { IBaseRestClientConfig } from "@twin.org/api-models";
3
3
  import type { IAuditableItemGraphVertexList } from "@twin.org/auditable-item-graph-models";
4
4
  import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
5
- import type { IDocumentList, IDocumentManagementComponent } from "@twin.org/document-management-models";
5
+ import type { IDocument, IDocumentList, IDocumentManagementComponent } from "@twin.org/document-management-models";
6
6
  import { UneceDocumentCodes } from "@twin.org/standards-unece";
7
7
  /**
8
8
  * Client for performing document management through to REST endpoints.
@@ -65,6 +65,8 @@ export declare class DocumentManagementClient extends BaseRestClient implements
65
65
  * @param options.includeBlobStorageData Flag to include the blob storage data for the document, defaults to false.
66
66
  * @param options.includeAttestation Flag to include the attestation information for the document, defaults to false.
67
67
  * @param options.includeRemoved Flag to include deleted documents, defaults to false.
68
+ * @param options.extractRuleGroupId If provided will extract data from the document using the specified rule group id.
69
+ * @param options.extractMimeType By default extraction will auto detect the mime type of the document, this can be used to override the detection.
68
70
  * @param cursor The cursor to get the next chunk of revisions.
69
71
  * @param pageSize Page size of items to return, defaults to 1 so only most recent is returned.
70
72
  * @returns The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
@@ -74,7 +76,28 @@ export declare class DocumentManagementClient extends BaseRestClient implements
74
76
  includeBlobStorageData?: boolean;
75
77
  includeAttestation?: boolean;
76
78
  includeRemoved?: boolean;
79
+ extractRuleGroupId?: string;
80
+ extractMimeType?: string;
77
81
  }, cursor?: string, pageSize?: number): Promise<IDocumentList>;
82
+ /**
83
+ * Get a document revision using it's auditable item graph vertex id.
84
+ * @param auditableItemGraphDocumentId The auditable item graph vertex id which contains the document.
85
+ * @param revision The revision id for the document.
86
+ * @param options Additional options for the get operation.
87
+ * @param options.includeBlobStorageMetadata Flag to include the blob storage metadata for the document, defaults to false.
88
+ * @param options.includeBlobStorageData Flag to include the blob storage data for the document, defaults to false.
89
+ * @param options.includeAttestation Flag to include the attestation information for the document, defaults to false.
90
+ * @param options.extractRuleGroupId If provided will extract data from the document using the specified rule group id.
91
+ * @param options.extractMimeType By default extraction will auto detect the mime type of the document, this can be used to override the detection.
92
+ * @returns The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
93
+ */
94
+ getRevision(auditableItemGraphDocumentId: string, revision: number, options?: {
95
+ includeBlobStorageMetadata?: boolean;
96
+ includeBlobStorageData?: boolean;
97
+ includeAttestation?: boolean;
98
+ extractRuleGroupId?: string;
99
+ extractMimeType?: string;
100
+ }): Promise<IDocument>;
78
101
  /**
79
102
  * Remove an auditable item graph vertex using it's id.
80
103
  * The document dateDeleted will be set, but can still be queried with the includeRemoved flag.
package/docs/changelog.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @twin.org/document-management-rest-client - Changelog
2
2
 
3
+ ## [0.0.1-next.12](https://github.com/twinfoundation/document-management/compare/document-management-rest-client-v0.0.1-next.11...document-management-rest-client-v0.0.1-next.12) (2025-04-30)
4
+
5
+
6
+ ### Features
7
+
8
+ * get document revision ([080eddc](https://github.com/twinfoundation/document-management/commit/080eddcc024c622dda6bb36f60f5fa80a86cf5bb))
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.11 to 0.0.1-next.12
16
+
17
+ ## [0.0.1-next.11](https://github.com/twinfoundation/document-management/compare/document-management-rest-client-v0.0.1-next.10...document-management-rest-client-v0.0.1-next.11) (2025-04-28)
18
+
19
+
20
+ ### Features
21
+
22
+ * document get can perform extraction ([#6](https://github.com/twinfoundation/document-management/issues/6)) ([5ce6d37](https://github.com/twinfoundation/document-management/commit/5ce6d37432ad271ca5783f422846f4be98ec2215))
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.10 to 0.0.1-next.11
30
+
3
31
  ## [0.0.1-next.10](https://github.com/twinfoundation/document-management/compare/document-management-rest-client-v0.0.1-next.9...document-management-rest-client-v0.0.1-next.10) (2025-04-25)
4
32
 
5
33
 
@@ -216,6 +216,18 @@ Flag to include the attestation information for the document, defaults to false.
216
216
 
217
217
  Flag to include deleted documents, defaults to false.
218
218
 
219
+ ###### extractRuleGroupId?
220
+
221
+ `string`
222
+
223
+ If provided will extract data from the document using the specified rule group id.
224
+
225
+ ###### extractMimeType?
226
+
227
+ `string`
228
+
229
+ By default extraction will auto detect the mime type of the document, this can be used to override the detection.
230
+
219
231
  ##### cursor?
220
232
 
221
233
  `string`
@@ -240,6 +252,72 @@ The documents and revisions if requested, ordered by revision descending, cursor
240
252
 
241
253
  ***
242
254
 
255
+ ### getRevision()
256
+
257
+ > **getRevision**(`auditableItemGraphDocumentId`, `revision`, `options?`): `Promise`\<`IDocument`\>
258
+
259
+ Get a document revision using it's auditable item graph vertex id.
260
+
261
+ #### Parameters
262
+
263
+ ##### auditableItemGraphDocumentId
264
+
265
+ `string`
266
+
267
+ The auditable item graph vertex id which contains the document.
268
+
269
+ ##### revision
270
+
271
+ `number`
272
+
273
+ The revision id for the document.
274
+
275
+ ##### options?
276
+
277
+ Additional options for the get operation.
278
+
279
+ ###### includeBlobStorageMetadata?
280
+
281
+ `boolean`
282
+
283
+ Flag to include the blob storage metadata for the document, defaults to false.
284
+
285
+ ###### includeBlobStorageData?
286
+
287
+ `boolean`
288
+
289
+ Flag to include the blob storage data for the document, defaults to false.
290
+
291
+ ###### includeAttestation?
292
+
293
+ `boolean`
294
+
295
+ Flag to include the attestation information for the document, defaults to false.
296
+
297
+ ###### extractRuleGroupId?
298
+
299
+ `string`
300
+
301
+ If provided will extract data from the document using the specified rule group id.
302
+
303
+ ###### extractMimeType?
304
+
305
+ `string`
306
+
307
+ By default extraction will auto detect the mime type of the document, this can be used to override the detection.
308
+
309
+ #### Returns
310
+
311
+ `Promise`\<`IDocument`\>
312
+
313
+ The documents and revisions if requested, ordered by revision descending, cursor is set if there are more document revisions.
314
+
315
+ #### Implementation of
316
+
317
+ `IDocumentManagementComponent.getRevision`
318
+
319
+ ***
320
+
243
321
  ### removeRevision()
244
322
 
245
323
  > **removeRevision**(`auditableItemGraphDocumentId`, `revision`): `Promise`\<`void`\>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/document-management-rest-client",
3
- "version": "0.0.1-next.10",
3
+ "version": "0.0.1-next.12",
4
4
  "description": "Document management contract implementation which can connect to REST endpoints",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,7 +19,7 @@
19
19
  "@twin.org/auditable-item-graph-models": "next",
20
20
  "@twin.org/core": "next",
21
21
  "@twin.org/data-json-ld": "next",
22
- "@twin.org/document-management-models": "0.0.1-next.10",
22
+ "@twin.org/document-management-models": "0.0.1-next.12",
23
23
  "@twin.org/entity": "next",
24
24
  "@twin.org/nameof": "next",
25
25
  "@twin.org/standards-unece": "next",