@twin.org/blob-storage-rest-client 0.0.1-next.9 → 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.
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var apiCore = require('@twin.org/api-core');
4
+ var apiModels = require('@twin.org/api-models');
4
5
  var core = require('@twin.org/core');
5
6
  var web = require('@twin.org/web');
6
7
 
@@ -29,21 +30,26 @@ class BlobStorageClient extends apiCore.BaseRestClient {
29
30
  /**
30
31
  * Create the blob with some metadata.
31
32
  * @param blob The data for the blob in base64 format.
32
- * @param mimeType Mime type for the blob, will be detected if left undefined.
33
- * @param extension Extension for the blob, will be detected if left undefined.
33
+ * @param encodingFormat Mime type for the blob, will be detected if left undefined.
34
+ * @param fileExtension Extension for the blob, will be detected if left undefined.
34
35
  * @param metadata Data for the custom metadata as JSON-LD.
35
- * @param namespace The namespace to use for storing, defaults to component configured namespace.
36
+ * @param options Optional options for the creation of the blob.
37
+ * @param options.disableEncryption Disables encryption if enabled by default.
38
+ * @param options.overrideVaultKeyId Use a different vault key id for encryption, if not provided the default vault key id will be used.
39
+ * @param options.namespace The namespace to use for storing, defaults to component configured namespace.
36
40
  * @returns The id of the stored blob in urn format.
37
41
  */
38
- async create(blob, mimeType, extension, metadata, namespace) {
42
+ async create(blob, encodingFormat, fileExtension, metadata, options) {
39
43
  core.Guards.stringBase64(this.CLASS_NAME, "blob", blob);
40
44
  const response = await this.fetch("/", "POST", {
41
45
  body: {
42
46
  blob,
43
- mimeType,
44
- extension,
47
+ encodingFormat,
48
+ fileExtension,
45
49
  metadata,
46
- namespace
50
+ disableEncryption: options?.disableEncryption,
51
+ overrideVaultKeyId: options?.overrideVaultKeyId,
52
+ namespace: options?.namespace
47
53
  }
48
54
  });
49
55
  return response.headers[web.HeaderTypes.Location];
@@ -51,45 +57,48 @@ class BlobStorageClient extends apiCore.BaseRestClient {
51
57
  /**
52
58
  * Get the blob and metadata.
53
59
  * @param id The id of the blob to get in urn format.
54
- * @param includeContent Include the content, or just get the metadata.
60
+ * @param options Optional options for the retrieval of the blob.
61
+ * @param options.includeContent Include the content, or just get the metadata.
62
+ * @param options.overrideVaultKeyId Use a different vault key id for decryption, if not provided the default vault key id will be used.
63
+ * @param options.decompress If the content should be decompressed, if it was compressed when stored, defaults to true.
55
64
  * @returns The metadata and data for the blob if it can be found.
56
65
  * @throws Not found error if the blob cannot be found.
57
66
  */
58
- async get(id, includeContent) {
67
+ async get(id, options) {
59
68
  core.Urn.guard(this.CLASS_NAME, "id", id);
60
69
  const response = await this.fetch("/:id", "GET", {
70
+ headers: {
71
+ [web.HeaderTypes.Accept]: web.MimeTypes.JsonLd
72
+ },
61
73
  pathParams: {
62
74
  id
63
75
  },
64
76
  query: {
65
- includeContent
77
+ includeContent: core.Coerce.string(options?.includeContent),
78
+ decompress: core.Coerce.string(options?.decompress),
79
+ overrideVaultKeyId: options?.overrideVaultKeyId
66
80
  }
67
81
  });
68
- return {
69
- blob: response.body.blob,
70
- mimeType: response.body.mimeType,
71
- extension: response.body.extension,
72
- metadata: response.body.metadata
73
- };
82
+ return response.body;
74
83
  }
75
84
  /**
76
85
  * Update the blob with metadata.
77
86
  * @param id The id of the blob metadata to update.
78
- * @param mimeType Mime type for the blob, will be detected if left undefined.
79
- * @param extension Extension for the blob, will be detected if left undefined.
87
+ * @param encodingFormat Mime type for the blob, will be detected if left undefined.
88
+ * @param fileExtension Extension for the blob, will be detected if left undefined.
80
89
  * @param metadata Data for the custom metadata as JSON-LD.
81
90
  * @returns Nothing.
82
91
  * @throws Not found error if the blob cannot be found.
83
92
  */
84
- async update(id, mimeType, extension, metadata) {
93
+ async update(id, encodingFormat, fileExtension, metadata) {
85
94
  core.Urn.guard(this.CLASS_NAME, "id", id);
86
95
  await this.fetch("/:id", "PUT", {
87
96
  pathParams: {
88
97
  id
89
98
  },
90
99
  body: {
91
- mimeType,
92
- extension,
100
+ encodingFormat,
101
+ fileExtension,
93
102
  metadata
94
103
  }
95
104
  });
@@ -107,6 +116,31 @@ class BlobStorageClient extends apiCore.BaseRestClient {
107
116
  }
108
117
  });
109
118
  }
119
+ /**
120
+ * Query all the blob storage entries which match the conditions.
121
+ * @param conditions The conditions to match for the entries.
122
+ * @param orderBy The order for the results, defaults to created.
123
+ * @param orderByDirection The direction for the order, defaults to descending.
124
+ * @param cursor The cursor to request the next page of entries.
125
+ * @param pageSize The suggested number of entries to return in each chunk, in some scenarios can return a different amount.
126
+ * @returns All the entries for the storage matching the conditions,
127
+ * and a cursor which can be used to request more entities.
128
+ */
129
+ async query(conditions, orderBy, orderByDirection, cursor, pageSize) {
130
+ const response = await this.fetch("/", "GET", {
131
+ headers: {
132
+ [web.HeaderTypes.Accept]: web.MimeTypes.JsonLd
133
+ },
134
+ query: {
135
+ conditions: apiModels.HttpParameterHelper.objectToString(conditions),
136
+ orderBy,
137
+ orderByDirection,
138
+ pageSize,
139
+ cursor
140
+ }
141
+ });
142
+ return response.body;
143
+ }
110
144
  /**
111
145
  * Create a download link for the blob.
112
146
  * @param id The id of the blob to get in urn format.
@@ -1,6 +1,7 @@
1
1
  import { BaseRestClient } from '@twin.org/api-core';
2
- import { Guards, Urn, StringHelper, Is } from '@twin.org/core';
3
- import { HeaderTypes } from '@twin.org/web';
2
+ import { HttpParameterHelper } from '@twin.org/api-models';
3
+ import { Guards, Urn, Coerce, StringHelper, Is } from '@twin.org/core';
4
+ import { HeaderTypes, MimeTypes } from '@twin.org/web';
4
5
 
5
6
  // Copyright 2024 IOTA Stiftung.
6
7
  // SPDX-License-Identifier: Apache-2.0.
@@ -27,21 +28,26 @@ class BlobStorageClient extends BaseRestClient {
27
28
  /**
28
29
  * Create the blob with some metadata.
29
30
  * @param blob The data for the blob in base64 format.
30
- * @param mimeType Mime type for the blob, will be detected if left undefined.
31
- * @param extension Extension for the blob, will be detected if left undefined.
31
+ * @param encodingFormat Mime type for the blob, will be detected if left undefined.
32
+ * @param fileExtension Extension for the blob, will be detected if left undefined.
32
33
  * @param metadata Data for the custom metadata as JSON-LD.
33
- * @param namespace The namespace to use for storing, defaults to component configured namespace.
34
+ * @param options Optional options for the creation of the blob.
35
+ * @param options.disableEncryption Disables encryption if enabled by default.
36
+ * @param options.overrideVaultKeyId Use a different vault key id for encryption, if not provided the default vault key id will be used.
37
+ * @param options.namespace The namespace to use for storing, defaults to component configured namespace.
34
38
  * @returns The id of the stored blob in urn format.
35
39
  */
36
- async create(blob, mimeType, extension, metadata, namespace) {
40
+ async create(blob, encodingFormat, fileExtension, metadata, options) {
37
41
  Guards.stringBase64(this.CLASS_NAME, "blob", blob);
38
42
  const response = await this.fetch("/", "POST", {
39
43
  body: {
40
44
  blob,
41
- mimeType,
42
- extension,
45
+ encodingFormat,
46
+ fileExtension,
43
47
  metadata,
44
- namespace
48
+ disableEncryption: options?.disableEncryption,
49
+ overrideVaultKeyId: options?.overrideVaultKeyId,
50
+ namespace: options?.namespace
45
51
  }
46
52
  });
47
53
  return response.headers[HeaderTypes.Location];
@@ -49,45 +55,48 @@ class BlobStorageClient extends BaseRestClient {
49
55
  /**
50
56
  * Get the blob and metadata.
51
57
  * @param id The id of the blob to get in urn format.
52
- * @param includeContent Include the content, or just get the metadata.
58
+ * @param options Optional options for the retrieval of the blob.
59
+ * @param options.includeContent Include the content, or just get the metadata.
60
+ * @param options.overrideVaultKeyId Use a different vault key id for decryption, if not provided the default vault key id will be used.
61
+ * @param options.decompress If the content should be decompressed, if it was compressed when stored, defaults to true.
53
62
  * @returns The metadata and data for the blob if it can be found.
54
63
  * @throws Not found error if the blob cannot be found.
55
64
  */
56
- async get(id, includeContent) {
65
+ async get(id, options) {
57
66
  Urn.guard(this.CLASS_NAME, "id", id);
58
67
  const response = await this.fetch("/:id", "GET", {
68
+ headers: {
69
+ [HeaderTypes.Accept]: MimeTypes.JsonLd
70
+ },
59
71
  pathParams: {
60
72
  id
61
73
  },
62
74
  query: {
63
- includeContent
75
+ includeContent: Coerce.string(options?.includeContent),
76
+ decompress: Coerce.string(options?.decompress),
77
+ overrideVaultKeyId: options?.overrideVaultKeyId
64
78
  }
65
79
  });
66
- return {
67
- blob: response.body.blob,
68
- mimeType: response.body.mimeType,
69
- extension: response.body.extension,
70
- metadata: response.body.metadata
71
- };
80
+ return response.body;
72
81
  }
73
82
  /**
74
83
  * Update the blob with metadata.
75
84
  * @param id The id of the blob metadata to update.
76
- * @param mimeType Mime type for the blob, will be detected if left undefined.
77
- * @param extension Extension for the blob, will be detected if left undefined.
85
+ * @param encodingFormat Mime type for the blob, will be detected if left undefined.
86
+ * @param fileExtension Extension for the blob, will be detected if left undefined.
78
87
  * @param metadata Data for the custom metadata as JSON-LD.
79
88
  * @returns Nothing.
80
89
  * @throws Not found error if the blob cannot be found.
81
90
  */
82
- async update(id, mimeType, extension, metadata) {
91
+ async update(id, encodingFormat, fileExtension, metadata) {
83
92
  Urn.guard(this.CLASS_NAME, "id", id);
84
93
  await this.fetch("/:id", "PUT", {
85
94
  pathParams: {
86
95
  id
87
96
  },
88
97
  body: {
89
- mimeType,
90
- extension,
98
+ encodingFormat,
99
+ fileExtension,
91
100
  metadata
92
101
  }
93
102
  });
@@ -105,6 +114,31 @@ class BlobStorageClient extends BaseRestClient {
105
114
  }
106
115
  });
107
116
  }
117
+ /**
118
+ * Query all the blob storage entries which match the conditions.
119
+ * @param conditions The conditions to match for the entries.
120
+ * @param orderBy The order for the results, defaults to created.
121
+ * @param orderByDirection The direction for the order, defaults to descending.
122
+ * @param cursor The cursor to request the next page of entries.
123
+ * @param pageSize The suggested number of entries to return in each chunk, in some scenarios can return a different amount.
124
+ * @returns All the entries for the storage matching the conditions,
125
+ * and a cursor which can be used to request more entities.
126
+ */
127
+ async query(conditions, orderBy, orderByDirection, cursor, pageSize) {
128
+ const response = await this.fetch("/", "GET", {
129
+ headers: {
130
+ [HeaderTypes.Accept]: MimeTypes.JsonLd
131
+ },
132
+ query: {
133
+ conditions: HttpParameterHelper.objectToString(conditions),
134
+ orderBy,
135
+ orderByDirection,
136
+ pageSize,
137
+ cursor
138
+ }
139
+ });
140
+ return response.body;
141
+ }
108
142
  /**
109
143
  * Create a download link for the blob.
110
144
  * @param id The id of the blob to get in urn format.
@@ -1,7 +1,8 @@
1
1
  import { BaseRestClient } from "@twin.org/api-core";
2
- import type { IBaseRestClientConfig } from "@twin.org/api-models";
3
- import type { IBlobStorageComponent } from "@twin.org/blob-storage-models";
2
+ import { type IBaseRestClientConfig } from "@twin.org/api-models";
3
+ import type { IBlobStorageComponent, IBlobStorageEntry, IBlobStorageEntryList } from "@twin.org/blob-storage-models";
4
4
  import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
5
+ import type { EntityCondition, SortDirection } from "@twin.org/entity";
5
6
  /**
6
7
  * Client for performing blob storage through to REST endpoints.
7
8
  */
@@ -18,42 +19,62 @@ export declare class BlobStorageClient extends BaseRestClient implements IBlobSt
18
19
  /**
19
20
  * Create the blob with some metadata.
20
21
  * @param blob The data for the blob in base64 format.
21
- * @param mimeType Mime type for the blob, will be detected if left undefined.
22
- * @param extension Extension for the blob, will be detected if left undefined.
22
+ * @param encodingFormat Mime type for the blob, will be detected if left undefined.
23
+ * @param fileExtension Extension for the blob, will be detected if left undefined.
23
24
  * @param metadata Data for the custom metadata as JSON-LD.
24
- * @param namespace The namespace to use for storing, defaults to component configured namespace.
25
+ * @param options Optional options for the creation of the blob.
26
+ * @param options.disableEncryption Disables encryption if enabled by default.
27
+ * @param options.overrideVaultKeyId Use a different vault key id for encryption, if not provided the default vault key id will be used.
28
+ * @param options.namespace The namespace to use for storing, defaults to component configured namespace.
25
29
  * @returns The id of the stored blob in urn format.
26
30
  */
27
- create(blob: string, mimeType?: string, extension?: string, metadata?: IJsonLdNodeObject, namespace?: string): Promise<string>;
31
+ create(blob: string, encodingFormat?: string, fileExtension?: string, metadata?: IJsonLdNodeObject, options?: {
32
+ disableEncryption?: boolean;
33
+ overrideVaultKeyId?: string;
34
+ namespace?: string;
35
+ }): Promise<string>;
28
36
  /**
29
37
  * Get the blob and metadata.
30
38
  * @param id The id of the blob to get in urn format.
31
- * @param includeContent Include the content, or just get the metadata.
39
+ * @param options Optional options for the retrieval of the blob.
40
+ * @param options.includeContent Include the content, or just get the metadata.
41
+ * @param options.overrideVaultKeyId Use a different vault key id for decryption, if not provided the default vault key id will be used.
42
+ * @param options.decompress If the content should be decompressed, if it was compressed when stored, defaults to true.
32
43
  * @returns The metadata and data for the blob if it can be found.
33
44
  * @throws Not found error if the blob cannot be found.
34
45
  */
35
- get(id: string, includeContent: boolean): Promise<{
36
- blob?: string;
37
- mimeType?: string;
38
- extension?: string;
39
- metadata?: IJsonLdNodeObject;
40
- }>;
46
+ get(id: string, options?: {
47
+ includeContent?: boolean;
48
+ decompress?: boolean;
49
+ overrideVaultKeyId?: string;
50
+ }): Promise<IBlobStorageEntry>;
41
51
  /**
42
52
  * Update the blob with metadata.
43
53
  * @param id The id of the blob metadata to update.
44
- * @param mimeType Mime type for the blob, will be detected if left undefined.
45
- * @param extension Extension for the blob, will be detected if left undefined.
54
+ * @param encodingFormat Mime type for the blob, will be detected if left undefined.
55
+ * @param fileExtension Extension for the blob, will be detected if left undefined.
46
56
  * @param metadata Data for the custom metadata as JSON-LD.
47
57
  * @returns Nothing.
48
58
  * @throws Not found error if the blob cannot be found.
49
59
  */
50
- update(id: string, mimeType?: string, extension?: string, metadata?: IJsonLdNodeObject): Promise<void>;
60
+ update(id: string, encodingFormat?: string, fileExtension?: string, metadata?: IJsonLdNodeObject): Promise<void>;
51
61
  /**
52
62
  * Remove the blob.
53
63
  * @param id The id of the blob to remove in urn format.
54
64
  * @returns Nothing.
55
65
  */
56
66
  remove(id: string): Promise<void>;
67
+ /**
68
+ * Query all the blob storage entries which match the conditions.
69
+ * @param conditions The conditions to match for the entries.
70
+ * @param orderBy The order for the results, defaults to created.
71
+ * @param orderByDirection The direction for the order, defaults to descending.
72
+ * @param cursor The cursor to request the next page of entries.
73
+ * @param pageSize The suggested number of entries to return in each chunk, in some scenarios can return a different amount.
74
+ * @returns All the entries for the storage matching the conditions,
75
+ * and a cursor which can be used to request more entities.
76
+ */
77
+ query(conditions?: EntityCondition<IBlobStorageEntry>, orderBy?: keyof Pick<IBlobStorageEntry, "dateCreated" | "dateModified">, orderByDirection?: SortDirection, cursor?: string, pageSize?: number): Promise<IBlobStorageEntryList>;
57
78
  /**
58
79
  * Create a download link for the blob.
59
80
  * @param id The id of the blob to get in urn format.
package/docs/changelog.md CHANGED
@@ -1,5 +1,145 @@
1
1
  # @twin.org/blob-storage-rest-client - Changelog
2
2
 
3
- ## v0.0.1-next.9
3
+ ## 0.0.1 (2025-07-04)
4
+
5
+
6
+ ### Features
7
+
8
+ * release to production ([eacfe75](https://github.com/twinfoundation/blob-storage/commit/eacfe754a0dcd9243d9e13d86422327d0a605164))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/blob-storage-models bumped from ^0.0.0 to ^0.0.1
16
+
17
+ ## [0.0.1-next.37](https://github.com/twinfoundation/blob-storage/compare/blob-storage-rest-client-v0.0.1-next.36...blob-storage-rest-client-v0.0.1-next.37) (2025-06-20)
18
+
19
+
20
+ ### Miscellaneous Chores
21
+
22
+ * **blob-storage-rest-client:** Synchronize repo versions
23
+
24
+
25
+ ### Dependencies
26
+
27
+ * The following workspace dependencies were updated
28
+ * dependencies
29
+ * @twin.org/blob-storage-models bumped from 0.0.1-next.36 to 0.0.1-next.37
30
+
31
+ ## [0.0.1-next.36](https://github.com/twinfoundation/blob-storage/compare/blob-storage-rest-client-v0.0.1-next.35...blob-storage-rest-client-v0.0.1-next.36) (2025-06-19)
32
+
33
+
34
+ ### Features
35
+
36
+ * add compression support ([67d239b](https://github.com/twinfoundation/blob-storage/commit/67d239bca8321bd90bf4ff93167c564130309730))
37
+
38
+
39
+ ### Dependencies
40
+
41
+ * The following workspace dependencies were updated
42
+ * dependencies
43
+ * @twin.org/blob-storage-models bumped from 0.0.1-next.35 to 0.0.1-next.36
44
+
45
+ ## [0.0.1-next.35](https://github.com/twinfoundation/blob-storage/compare/blob-storage-rest-client-v0.0.1-next.34...blob-storage-rest-client-v0.0.1-next.35) (2025-06-17)
46
+
47
+
48
+ ### Features
49
+
50
+ * additional encryption options on per item basis ([4b95a65](https://github.com/twinfoundation/blob-storage/commit/4b95a656d19e3b571cea905e36f29b679b13e1e8))
51
+
52
+
53
+ ### Dependencies
54
+
55
+ * The following workspace dependencies were updated
56
+ * dependencies
57
+ * @twin.org/blob-storage-models bumped from 0.0.1-next.34 to 0.0.1-next.35
58
+
59
+ ## [0.0.1-next.34](https://github.com/twinfoundation/blob-storage/compare/blob-storage-rest-client-v0.0.1-next.33...blob-storage-rest-client-v0.0.1-next.34) (2025-06-12)
60
+
61
+
62
+ ### Features
63
+
64
+ * update dependencies ([56f0094](https://github.com/twinfoundation/blob-storage/commit/56f0094b68d8bd22864cd899ac1b61d95540f719))
65
+
66
+
67
+ ### Dependencies
68
+
69
+ * The following workspace dependencies were updated
70
+ * dependencies
71
+ * @twin.org/blob-storage-models bumped from 0.0.1-next.33 to 0.0.1-next.34
72
+
73
+ ## [0.0.1-next.33](https://github.com/twinfoundation/blob-storage/compare/blob-storage-rest-client-v0.0.1-next.32...blob-storage-rest-client-v0.0.1-next.33) (2025-06-03)
74
+
75
+
76
+ ### Miscellaneous Chores
77
+
78
+ * **blob-storage-rest-client:** Synchronize repo versions
79
+
80
+
81
+ ### Dependencies
82
+
83
+ * The following workspace dependencies were updated
84
+ * dependencies
85
+ * @twin.org/blob-storage-models bumped from 0.0.1-next.32 to 0.0.1-next.33
86
+
87
+ ## [0.0.1-next.32](https://github.com/twinfoundation/blob-storage/compare/blob-storage-rest-client-v0.0.1-next.31...blob-storage-rest-client-v0.0.1-next.32) (2025-05-28)
88
+
89
+
90
+ ### Miscellaneous Chores
91
+
92
+ * **blob-storage-rest-client:** Synchronize repo versions
93
+
94
+
95
+ ### Dependencies
96
+
97
+ * The following workspace dependencies were updated
98
+ * dependencies
99
+ * @twin.org/blob-storage-models bumped from 0.0.1-next.31 to 0.0.1-next.32
100
+
101
+ ## [0.0.1-next.31](https://github.com/twinfoundation/blob-storage/compare/blob-storage-rest-client-v0.0.1-next.30...blob-storage-rest-client-v0.0.1-next.31) (2025-05-08)
102
+
103
+
104
+ ### Miscellaneous Chores
105
+
106
+ * **blob-storage-rest-client:** Synchronize repo versions
107
+
108
+
109
+ ### Dependencies
110
+
111
+ * The following workspace dependencies were updated
112
+ * dependencies
113
+ * @twin.org/blob-storage-models bumped from 0.0.1-next.30 to 0.0.1-next.31
114
+
115
+ ## [0.0.1-next.30](https://github.com/twinfoundation/blob-storage/compare/blob-storage-rest-client-v0.0.1-next.29...blob-storage-rest-client-v0.0.1-next.30) (2025-04-17)
116
+
117
+
118
+ ### Features
119
+
120
+ * use shared store mechanism ([#12](https://github.com/twinfoundation/blob-storage/issues/12)) ([cae8110](https://github.com/twinfoundation/blob-storage/commit/cae8110681847a1ac4fcac968b8196694e49c320))
121
+
122
+
123
+ ### Dependencies
124
+
125
+ * The following workspace dependencies were updated
126
+ * dependencies
127
+ * @twin.org/blob-storage-models bumped from 0.0.1-next.29 to 0.0.1-next.30
128
+
129
+ ## [0.0.1-next.29](https://github.com/twinfoundation/blob-storage/compare/blob-storage-rest-client-v0.0.1-next.28...blob-storage-rest-client-v0.0.1-next.29) (2025-03-28)
130
+
131
+
132
+ ### Miscellaneous Chores
133
+
134
+ * **blob-storage-rest-client:** Synchronize repo versions
135
+
136
+
137
+ ### Dependencies
138
+
139
+ * The following workspace dependencies were updated
140
+ * dependencies
141
+ * @twin.org/blob-storage-models bumped from 0.0.1-next.28 to 0.0.1-next.29
142
+
143
+ ## v0.0.1-next.28
4
144
 
5
145
  - Initial Release
@@ -12,21 +12,23 @@ Client for performing blob storage through to REST endpoints.
12
12
 
13
13
  ## Constructors
14
14
 
15
- ### new BlobStorageClient()
15
+ ### Constructor
16
16
 
17
- > **new BlobStorageClient**(`config`): [`BlobStorageClient`](BlobStorageClient.md)
17
+ > **new BlobStorageClient**(`config`): `BlobStorageClient`
18
18
 
19
19
  Create a new instance of BlobStorageClient.
20
20
 
21
21
  #### Parameters
22
22
 
23
- **config**: `IBaseRestClientConfig`
23
+ ##### config
24
+
25
+ `IBaseRestClientConfig`
24
26
 
25
27
  The configuration for the client.
26
28
 
27
29
  #### Returns
28
30
 
29
- [`BlobStorageClient`](BlobStorageClient.md)
31
+ `BlobStorageClient`
30
32
 
31
33
  #### Overrides
32
34
 
@@ -48,29 +50,55 @@ Runtime name for the class.
48
50
 
49
51
  ### create()
50
52
 
51
- > **create**(`blob`, `mimeType`?, `extension`?, `metadata`?, `namespace`?): `Promise`\<`string`\>
53
+ > **create**(`blob`, `encodingFormat?`, `fileExtension?`, `metadata?`, `options?`): `Promise`\<`string`\>
52
54
 
53
55
  Create the blob with some metadata.
54
56
 
55
57
  #### Parameters
56
58
 
57
- **blob**: `string`
59
+ ##### blob
60
+
61
+ `string`
58
62
 
59
63
  The data for the blob in base64 format.
60
64
 
61
- **mimeType?**: `string`
65
+ ##### encodingFormat?
66
+
67
+ `string`
62
68
 
63
69
  Mime type for the blob, will be detected if left undefined.
64
70
 
65
- **extension?**: `string`
71
+ ##### fileExtension?
72
+
73
+ `string`
66
74
 
67
75
  Extension for the blob, will be detected if left undefined.
68
76
 
69
- **metadata?**: `IJsonLdNodeObject`
77
+ ##### metadata?
78
+
79
+ `IJsonLdNodeObject`
70
80
 
71
81
  Data for the custom metadata as JSON-LD.
72
82
 
73
- **namespace?**: `string`
83
+ ##### options?
84
+
85
+ Optional options for the creation of the blob.
86
+
87
+ ###### disableEncryption?
88
+
89
+ `boolean`
90
+
91
+ Disables encryption if enabled by default.
92
+
93
+ ###### overrideVaultKeyId?
94
+
95
+ `string`
96
+
97
+ Use a different vault key id for encryption, if not provided the default vault key id will be used.
98
+
99
+ ###### namespace?
100
+
101
+ `string`
74
102
 
75
103
  The namespace to use for storing, defaults to component configured namespace.
76
104
 
@@ -88,41 +116,45 @@ The id of the stored blob in urn format.
88
116
 
89
117
  ### get()
90
118
 
91
- > **get**(`id`, `includeContent`): `Promise`\<`object`\>
119
+ > **get**(`id`, `options?`): `Promise`\<`IBlobStorageEntry`\>
92
120
 
93
121
  Get the blob and metadata.
94
122
 
95
123
  #### Parameters
96
124
 
97
- **id**: `string`
125
+ ##### id
126
+
127
+ `string`
98
128
 
99
129
  The id of the blob to get in urn format.
100
130
 
101
- **includeContent**: `boolean`
131
+ ##### options?
102
132
 
103
- Include the content, or just get the metadata.
133
+ Optional options for the retrieval of the blob.
104
134
 
105
- #### Returns
135
+ ###### includeContent?
106
136
 
107
- `Promise`\<`object`\>
137
+ `boolean`
108
138
 
109
- The metadata and data for the blob if it can be found.
139
+ Include the content, or just get the metadata.
110
140
 
111
- ##### blob?
141
+ ###### decompress?
112
142
 
113
- > `optional` **blob**: `string`
143
+ `boolean`
114
144
 
115
- ##### mimeType?
145
+ If the content should be decompressed, if it was compressed when stored, defaults to true.
116
146
 
117
- > `optional` **mimeType**: `string`
147
+ ###### overrideVaultKeyId?
118
148
 
119
- ##### extension?
149
+ `string`
120
150
 
121
- > `optional` **extension**: `string`
151
+ Use a different vault key id for decryption, if not provided the default vault key id will be used.
122
152
 
123
- ##### metadata?
153
+ #### Returns
124
154
 
125
- > `optional` **metadata**: `IJsonLdNodeObject`
155
+ `Promise`\<`IBlobStorageEntry`\>
156
+
157
+ The metadata and data for the blob if it can be found.
126
158
 
127
159
  #### Throws
128
160
 
@@ -136,25 +168,33 @@ Not found error if the blob cannot be found.
136
168
 
137
169
  ### update()
138
170
 
139
- > **update**(`id`, `mimeType`?, `extension`?, `metadata`?): `Promise`\<`void`\>
171
+ > **update**(`id`, `encodingFormat?`, `fileExtension?`, `metadata?`): `Promise`\<`void`\>
140
172
 
141
173
  Update the blob with metadata.
142
174
 
143
175
  #### Parameters
144
176
 
145
- **id**: `string`
177
+ ##### id
178
+
179
+ `string`
146
180
 
147
181
  The id of the blob metadata to update.
148
182
 
149
- **mimeType?**: `string`
183
+ ##### encodingFormat?
184
+
185
+ `string`
150
186
 
151
187
  Mime type for the blob, will be detected if left undefined.
152
188
 
153
- **extension?**: `string`
189
+ ##### fileExtension?
190
+
191
+ `string`
154
192
 
155
193
  Extension for the blob, will be detected if left undefined.
156
194
 
157
- **metadata?**: `IJsonLdNodeObject`
195
+ ##### metadata?
196
+
197
+ `IJsonLdNodeObject`
158
198
 
159
199
  Data for the custom metadata as JSON-LD.
160
200
 
@@ -182,7 +222,9 @@ Remove the blob.
182
222
 
183
223
  #### Parameters
184
224
 
185
- **id**: `string`
225
+ ##### id
226
+
227
+ `string`
186
228
 
187
229
  The id of the blob to remove in urn format.
188
230
 
@@ -198,23 +240,80 @@ Nothing.
198
240
 
199
241
  ***
200
242
 
243
+ ### query()
244
+
245
+ > **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `cursor?`, `pageSize?`): `Promise`\<`IBlobStorageEntryList`\>
246
+
247
+ Query all the blob storage entries which match the conditions.
248
+
249
+ #### Parameters
250
+
251
+ ##### conditions?
252
+
253
+ `EntityCondition`\<`IBlobStorageEntry`\>
254
+
255
+ The conditions to match for the entries.
256
+
257
+ ##### orderBy?
258
+
259
+ The order for the results, defaults to created.
260
+
261
+ `"dateCreated"` | `"dateModified"`
262
+
263
+ ##### orderByDirection?
264
+
265
+ `SortDirection`
266
+
267
+ The direction for the order, defaults to descending.
268
+
269
+ ##### cursor?
270
+
271
+ `string`
272
+
273
+ The cursor to request the next page of entries.
274
+
275
+ ##### pageSize?
276
+
277
+ `number`
278
+
279
+ The suggested number of entries to return in each chunk, in some scenarios can return a different amount.
280
+
281
+ #### Returns
282
+
283
+ `Promise`\<`IBlobStorageEntryList`\>
284
+
285
+ All the entries for the storage matching the conditions,
286
+ and a cursor which can be used to request more entities.
287
+
288
+ #### Implementation of
289
+
290
+ `IBlobStorageComponent.query`
291
+
292
+ ***
293
+
201
294
  ### createDownloadLink()
202
295
 
203
- > **createDownloadLink**(`id`, `download`?, `filename`?): `string`
296
+ > **createDownloadLink**(`id`, `download?`, `filename?`): `string`
204
297
 
205
298
  Create a download link for the blob.
206
299
 
207
300
  #### Parameters
208
301
 
209
- **id**: `string`
302
+ ##### id
303
+
304
+ `string`
210
305
 
211
306
  The id of the blob to get in urn format.
212
307
 
213
- **download?**: `boolean`
308
+ ##### download?
309
+
310
+ `boolean`
214
311
 
215
312
  Should the content disposition be set to download.
216
313
 
217
- **filename?**: `string`
314
+ ##### filename?
315
+
316
+ `string`
218
317
 
219
318
  The filename to use for the download.
220
319
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/blob-storage-rest-client",
3
- "version": "0.0.1-next.9",
3
+ "version": "0.0.1",
4
4
  "description": "Blob storage implementation which can connect to REST endpoints",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,24 +14,25 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/api-core": "next",
18
- "@twin.org/api-models": "next",
19
- "@twin.org/blob-storage-models": "0.0.1-next.9",
20
- "@twin.org/core": "next",
21
- "@twin.org/data-json-ld": "next",
22
- "@twin.org/nameof": "next",
23
- "@twin.org/web": "next"
17
+ "@twin.org/api-core": "^0.0.1",
18
+ "@twin.org/api-models": "^0.0.1",
19
+ "@twin.org/blob-storage-models": "^0.0.1",
20
+ "@twin.org/core": "^0.0.1",
21
+ "@twin.org/data-json-ld": "^0.0.1",
22
+ "@twin.org/entity": "^0.0.1",
23
+ "@twin.org/nameof": "^0.0.1",
24
+ "@twin.org/web": "^0.0.1"
24
25
  },
25
26
  "main": "./dist/cjs/index.cjs",
26
27
  "module": "./dist/esm/index.mjs",
27
28
  "types": "./dist/types/index.d.ts",
28
29
  "exports": {
29
30
  ".": {
31
+ "types": "./dist/types/index.d.ts",
30
32
  "require": "./dist/cjs/index.cjs",
31
- "import": "./dist/esm/index.mjs",
32
- "types": "./dist/types/index.d.ts"
33
+ "import": "./dist/esm/index.mjs"
33
34
  },
34
- "./locales": "./locales"
35
+ "./locales/*.json": "./locales/*.json"
35
36
  },
36
37
  "files": [
37
38
  "dist/cjs",