@twin.org/blob-storage-rest-client 0.0.1-next.9 → 0.0.2-next.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.
- package/dist/cjs/index.cjs +55 -21
- package/dist/esm/index.mjs +57 -23
- package/dist/types/blobStorageClient.d.ts +37 -16
- package/docs/changelog.md +158 -1
- package/docs/reference/classes/BlobStorageClient.md +134 -35
- package/package.json +6 -5
package/dist/cjs/index.cjs
CHANGED
|
@@ -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
|
|
33
|
-
* @param
|
|
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
|
|
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,
|
|
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
|
-
|
|
44
|
-
|
|
47
|
+
encodingFormat,
|
|
48
|
+
fileExtension,
|
|
45
49
|
metadata,
|
|
46
|
-
|
|
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
|
|
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,
|
|
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
|
|
79
|
-
* @param
|
|
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,
|
|
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
|
-
|
|
92
|
-
|
|
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.
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BaseRestClient } from '@twin.org/api-core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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
|
|
31
|
-
* @param
|
|
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
|
|
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,
|
|
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
|
-
|
|
42
|
-
|
|
45
|
+
encodingFormat,
|
|
46
|
+
fileExtension,
|
|
43
47
|
metadata,
|
|
44
|
-
|
|
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
|
|
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,
|
|
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
|
|
77
|
-
* @param
|
|
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,
|
|
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
|
-
|
|
90
|
-
|
|
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
|
|
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
|
|
22
|
-
* @param
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
|
45
|
-
* @param
|
|
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,
|
|
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,162 @@
|
|
|
1
1
|
# @twin.org/blob-storage-rest-client - Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## [0.0.2-next.1](https://github.com/twinfoundation/blob-storage/compare/blob-storage-rest-client-v0.0.2-next.0...blob-storage-rest-client-v0.0.2-next.1) (2025-07-24)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add compression support ([67d239b](https://github.com/twinfoundation/blob-storage/commit/67d239bca8321bd90bf4ff93167c564130309730))
|
|
9
|
+
* additional encryption options on per item basis ([4b95a65](https://github.com/twinfoundation/blob-storage/commit/4b95a656d19e3b571cea905e36f29b679b13e1e8))
|
|
10
|
+
* update dependencies ([56f0094](https://github.com/twinfoundation/blob-storage/commit/56f0094b68d8bd22864cd899ac1b61d95540f719))
|
|
11
|
+
* use shared store mechanism ([#12](https://github.com/twinfoundation/blob-storage/issues/12)) ([cae8110](https://github.com/twinfoundation/blob-storage/commit/cae8110681847a1ac4fcac968b8196694e49c320))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Dependencies
|
|
15
|
+
|
|
16
|
+
* The following workspace dependencies were updated
|
|
17
|
+
* dependencies
|
|
18
|
+
* @twin.org/blob-storage-models bumped from 0.0.2-next.0 to 0.0.2-next.1
|
|
19
|
+
|
|
20
|
+
## 0.0.1 (2025-07-04)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
* release to production ([eacfe75](https://github.com/twinfoundation/blob-storage/commit/eacfe754a0dcd9243d9e13d86422327d0a605164))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Dependencies
|
|
29
|
+
|
|
30
|
+
* The following workspace dependencies were updated
|
|
31
|
+
* dependencies
|
|
32
|
+
* @twin.org/blob-storage-models bumped from ^0.0.0 to ^0.0.1
|
|
33
|
+
|
|
34
|
+
## [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)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Miscellaneous Chores
|
|
38
|
+
|
|
39
|
+
* **blob-storage-rest-client:** Synchronize repo versions
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Dependencies
|
|
43
|
+
|
|
44
|
+
* The following workspace dependencies were updated
|
|
45
|
+
* dependencies
|
|
46
|
+
* @twin.org/blob-storage-models bumped from 0.0.1-next.36 to 0.0.1-next.37
|
|
47
|
+
|
|
48
|
+
## [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)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Features
|
|
52
|
+
|
|
53
|
+
* add compression support ([67d239b](https://github.com/twinfoundation/blob-storage/commit/67d239bca8321bd90bf4ff93167c564130309730))
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### Dependencies
|
|
57
|
+
|
|
58
|
+
* The following workspace dependencies were updated
|
|
59
|
+
* dependencies
|
|
60
|
+
* @twin.org/blob-storage-models bumped from 0.0.1-next.35 to 0.0.1-next.36
|
|
61
|
+
|
|
62
|
+
## [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)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
### Features
|
|
66
|
+
|
|
67
|
+
* additional encryption options on per item basis ([4b95a65](https://github.com/twinfoundation/blob-storage/commit/4b95a656d19e3b571cea905e36f29b679b13e1e8))
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
### Dependencies
|
|
71
|
+
|
|
72
|
+
* The following workspace dependencies were updated
|
|
73
|
+
* dependencies
|
|
74
|
+
* @twin.org/blob-storage-models bumped from 0.0.1-next.34 to 0.0.1-next.35
|
|
75
|
+
|
|
76
|
+
## [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)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
### Features
|
|
80
|
+
|
|
81
|
+
* update dependencies ([56f0094](https://github.com/twinfoundation/blob-storage/commit/56f0094b68d8bd22864cd899ac1b61d95540f719))
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
### Dependencies
|
|
85
|
+
|
|
86
|
+
* The following workspace dependencies were updated
|
|
87
|
+
* dependencies
|
|
88
|
+
* @twin.org/blob-storage-models bumped from 0.0.1-next.33 to 0.0.1-next.34
|
|
89
|
+
|
|
90
|
+
## [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)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
### Miscellaneous Chores
|
|
94
|
+
|
|
95
|
+
* **blob-storage-rest-client:** Synchronize repo versions
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
### Dependencies
|
|
99
|
+
|
|
100
|
+
* The following workspace dependencies were updated
|
|
101
|
+
* dependencies
|
|
102
|
+
* @twin.org/blob-storage-models bumped from 0.0.1-next.32 to 0.0.1-next.33
|
|
103
|
+
|
|
104
|
+
## [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)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
### Miscellaneous Chores
|
|
108
|
+
|
|
109
|
+
* **blob-storage-rest-client:** Synchronize repo versions
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
### Dependencies
|
|
113
|
+
|
|
114
|
+
* The following workspace dependencies were updated
|
|
115
|
+
* dependencies
|
|
116
|
+
* @twin.org/blob-storage-models bumped from 0.0.1-next.31 to 0.0.1-next.32
|
|
117
|
+
|
|
118
|
+
## [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)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
### Miscellaneous Chores
|
|
122
|
+
|
|
123
|
+
* **blob-storage-rest-client:** Synchronize repo versions
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
### Dependencies
|
|
127
|
+
|
|
128
|
+
* The following workspace dependencies were updated
|
|
129
|
+
* dependencies
|
|
130
|
+
* @twin.org/blob-storage-models bumped from 0.0.1-next.30 to 0.0.1-next.31
|
|
131
|
+
|
|
132
|
+
## [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)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
### Features
|
|
136
|
+
|
|
137
|
+
* use shared store mechanism ([#12](https://github.com/twinfoundation/blob-storage/issues/12)) ([cae8110](https://github.com/twinfoundation/blob-storage/commit/cae8110681847a1ac4fcac968b8196694e49c320))
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
### Dependencies
|
|
141
|
+
|
|
142
|
+
* The following workspace dependencies were updated
|
|
143
|
+
* dependencies
|
|
144
|
+
* @twin.org/blob-storage-models bumped from 0.0.1-next.29 to 0.0.1-next.30
|
|
145
|
+
|
|
146
|
+
## [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)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
### Miscellaneous Chores
|
|
150
|
+
|
|
151
|
+
* **blob-storage-rest-client:** Synchronize repo versions
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
### Dependencies
|
|
155
|
+
|
|
156
|
+
* The following workspace dependencies were updated
|
|
157
|
+
* dependencies
|
|
158
|
+
* @twin.org/blob-storage-models bumped from 0.0.1-next.28 to 0.0.1-next.29
|
|
159
|
+
|
|
160
|
+
## v0.0.1-next.28
|
|
4
161
|
|
|
5
162
|
- Initial Release
|
|
@@ -12,21 +12,23 @@ Client for performing blob storage through to REST endpoints.
|
|
|
12
12
|
|
|
13
13
|
## Constructors
|
|
14
14
|
|
|
15
|
-
###
|
|
15
|
+
### Constructor
|
|
16
16
|
|
|
17
|
-
> **new BlobStorageClient**(`config`):
|
|
17
|
+
> **new BlobStorageClient**(`config`): `BlobStorageClient`
|
|
18
18
|
|
|
19
19
|
Create a new instance of BlobStorageClient.
|
|
20
20
|
|
|
21
21
|
#### Parameters
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
##### config
|
|
24
|
+
|
|
25
|
+
`IBaseRestClientConfig`
|
|
24
26
|
|
|
25
27
|
The configuration for the client.
|
|
26
28
|
|
|
27
29
|
#### Returns
|
|
28
30
|
|
|
29
|
-
|
|
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`, `
|
|
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
|
-
|
|
59
|
+
##### blob
|
|
60
|
+
|
|
61
|
+
`string`
|
|
58
62
|
|
|
59
63
|
The data for the blob in base64 format.
|
|
60
64
|
|
|
61
|
-
|
|
65
|
+
##### encodingFormat?
|
|
66
|
+
|
|
67
|
+
`string`
|
|
62
68
|
|
|
63
69
|
Mime type for the blob, will be detected if left undefined.
|
|
64
70
|
|
|
65
|
-
|
|
71
|
+
##### fileExtension?
|
|
72
|
+
|
|
73
|
+
`string`
|
|
66
74
|
|
|
67
75
|
Extension for the blob, will be detected if left undefined.
|
|
68
76
|
|
|
69
|
-
|
|
77
|
+
##### metadata?
|
|
78
|
+
|
|
79
|
+
`IJsonLdNodeObject`
|
|
70
80
|
|
|
71
81
|
Data for the custom metadata as JSON-LD.
|
|
72
82
|
|
|
73
|
-
|
|
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`, `
|
|
119
|
+
> **get**(`id`, `options?`): `Promise`\<`IBlobStorageEntry`\>
|
|
92
120
|
|
|
93
121
|
Get the blob and metadata.
|
|
94
122
|
|
|
95
123
|
#### Parameters
|
|
96
124
|
|
|
97
|
-
|
|
125
|
+
##### id
|
|
126
|
+
|
|
127
|
+
`string`
|
|
98
128
|
|
|
99
129
|
The id of the blob to get in urn format.
|
|
100
130
|
|
|
101
|
-
|
|
131
|
+
##### options?
|
|
102
132
|
|
|
103
|
-
|
|
133
|
+
Optional options for the retrieval of the blob.
|
|
104
134
|
|
|
105
|
-
|
|
135
|
+
###### includeContent?
|
|
106
136
|
|
|
107
|
-
`
|
|
137
|
+
`boolean`
|
|
108
138
|
|
|
109
|
-
|
|
139
|
+
Include the content, or just get the metadata.
|
|
110
140
|
|
|
111
|
-
|
|
141
|
+
###### decompress?
|
|
112
142
|
|
|
113
|
-
|
|
143
|
+
`boolean`
|
|
114
144
|
|
|
115
|
-
|
|
145
|
+
If the content should be decompressed, if it was compressed when stored, defaults to true.
|
|
116
146
|
|
|
117
|
-
|
|
147
|
+
###### overrideVaultKeyId?
|
|
118
148
|
|
|
119
|
-
|
|
149
|
+
`string`
|
|
120
150
|
|
|
121
|
-
|
|
151
|
+
Use a different vault key id for decryption, if not provided the default vault key id will be used.
|
|
122
152
|
|
|
123
|
-
|
|
153
|
+
#### Returns
|
|
124
154
|
|
|
125
|
-
|
|
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`, `
|
|
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
|
-
|
|
177
|
+
##### id
|
|
178
|
+
|
|
179
|
+
`string`
|
|
146
180
|
|
|
147
181
|
The id of the blob metadata to update.
|
|
148
182
|
|
|
149
|
-
|
|
183
|
+
##### encodingFormat?
|
|
184
|
+
|
|
185
|
+
`string`
|
|
150
186
|
|
|
151
187
|
Mime type for the blob, will be detected if left undefined.
|
|
152
188
|
|
|
153
|
-
|
|
189
|
+
##### fileExtension?
|
|
190
|
+
|
|
191
|
+
`string`
|
|
154
192
|
|
|
155
193
|
Extension for the blob, will be detected if left undefined.
|
|
156
194
|
|
|
157
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
302
|
+
##### id
|
|
303
|
+
|
|
304
|
+
`string`
|
|
210
305
|
|
|
211
306
|
The id of the blob to get in urn format.
|
|
212
307
|
|
|
213
|
-
|
|
308
|
+
##### download?
|
|
309
|
+
|
|
310
|
+
`boolean`
|
|
214
311
|
|
|
215
312
|
Should the content disposition be set to download.
|
|
216
313
|
|
|
217
|
-
|
|
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.
|
|
3
|
+
"version": "0.0.2-next.1",
|
|
4
4
|
"description": "Blob storage implementation which can connect to REST endpoints",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@twin.org/api-core": "next",
|
|
18
18
|
"@twin.org/api-models": "next",
|
|
19
|
-
"@twin.org/blob-storage-models": "0.0.
|
|
19
|
+
"@twin.org/blob-storage-models": "0.0.2-next.1",
|
|
20
20
|
"@twin.org/core": "next",
|
|
21
21
|
"@twin.org/data-json-ld": "next",
|
|
22
|
+
"@twin.org/entity": "next",
|
|
22
23
|
"@twin.org/nameof": "next",
|
|
23
24
|
"@twin.org/web": "next"
|
|
24
25
|
},
|
|
@@ -27,11 +28,11 @@
|
|
|
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",
|