@twin.org/document-management-rest-client 0.0.1-next.11 → 0.0.1-next.13

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.
@@ -117,6 +117,36 @@ class DocumentManagementClient extends apiCore.BaseRestClient {
117
117
  });
118
118
  return response.body;
119
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
+ }
120
150
  /**
121
151
  * Remove an auditable item graph vertex using it's id.
122
152
  * The document dateDeleted will be set, but can still be queried with the includeRemoved flag.
@@ -115,6 +115,36 @@ class DocumentManagementClient extends BaseRestClient {
115
115
  });
116
116
  return response.body;
117
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
+ }
118
148
  /**
119
149
  * Remove an auditable item graph vertex using it's id.
120
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.
@@ -79,6 +79,25 @@ export declare class DocumentManagementClient extends BaseRestClient implements
79
79
  extractRuleGroupId?: string;
80
80
  extractMimeType?: string;
81
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>;
82
101
  /**
83
102
  * Remove an auditable item graph vertex using it's id.
84
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.13](https://github.com/twinfoundation/document-management/compare/document-management-rest-client-v0.0.1-next.12...document-management-rest-client-v0.0.1-next.13) (2025-04-30)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **document-management-rest-client:** Synchronize repo versions
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.12 to 0.0.1-next.13
16
+
17
+ ## [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)
18
+
19
+
20
+ ### Features
21
+
22
+ * get document revision ([080eddc](https://github.com/twinfoundation/document-management/commit/080eddcc024c622dda6bb36f60f5fa80a86cf5bb))
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.11 to 0.0.1-next.12
30
+
3
31
  ## [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)
4
32
 
5
33
 
@@ -252,6 +252,72 @@ The documents and revisions if requested, ordered by revision descending, cursor
252
252
 
253
253
  ***
254
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
+
255
321
  ### removeRevision()
256
322
 
257
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.11",
3
+ "version": "0.0.1-next.13",
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.11",
22
+ "@twin.org/document-management-models": "0.0.1-next.13",
23
23
  "@twin.org/entity": "next",
24
24
  "@twin.org/nameof": "next",
25
25
  "@twin.org/standards-unece": "next",