@twin.org/blob-storage-models 0.0.2-next.5 → 0.0.3-next.2
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/es/dataTypes/blobStorageDataTypes.js +30 -0
- package/dist/es/dataTypes/blobStorageDataTypes.js.map +1 -0
- package/dist/es/factories/blobStorageConnectorFactory.js +9 -0
- package/dist/es/factories/blobStorageConnectorFactory.js.map +1 -0
- package/dist/es/index.js +21 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/IBlobStorageComponent.js +2 -0
- package/dist/es/models/IBlobStorageComponent.js.map +1 -0
- package/dist/es/models/IBlobStorageConnector.js +2 -0
- package/dist/es/models/IBlobStorageConnector.js.map +1 -0
- package/dist/es/models/IBlobStorageEntry.js +2 -0
- package/dist/es/models/IBlobStorageEntry.js.map +1 -0
- package/dist/es/models/IBlobStorageEntryList.js +2 -0
- package/dist/es/models/IBlobStorageEntryList.js.map +1 -0
- package/dist/es/models/api/IBlobStorageCreateRequest.js +2 -0
- package/dist/es/models/api/IBlobStorageCreateRequest.js.map +1 -0
- package/dist/es/models/api/IBlobStorageGetContentRequest.js +4 -0
- package/dist/es/models/api/IBlobStorageGetContentRequest.js.map +1 -0
- package/dist/es/models/api/IBlobStorageGetContentResponse.js +4 -0
- package/dist/es/models/api/IBlobStorageGetContentResponse.js.map +1 -0
- package/dist/es/models/api/IBlobStorageGetRequest.js +2 -0
- package/dist/es/models/api/IBlobStorageGetRequest.js.map +1 -0
- package/dist/es/models/api/IBlobStorageGetResponse.js +2 -0
- package/dist/es/models/api/IBlobStorageGetResponse.js.map +1 -0
- package/dist/es/models/api/IBlobStorageListRequest.js +2 -0
- package/dist/es/models/api/IBlobStorageListRequest.js.map +1 -0
- package/dist/es/models/api/IBlobStorageListResponse.js +2 -0
- package/dist/es/models/api/IBlobStorageListResponse.js.map +1 -0
- package/dist/es/models/api/IBlobStorageRemoveRequest.js +4 -0
- package/dist/es/models/api/IBlobStorageRemoveRequest.js.map +1 -0
- package/dist/es/models/api/IBlobStorageUpdateRequest.js +2 -0
- package/dist/es/models/api/IBlobStorageUpdateRequest.js.map +1 -0
- package/dist/es/models/blobStorageCompressionType.js +17 -0
- package/dist/es/models/blobStorageCompressionType.js.map +1 -0
- package/dist/es/models/blobStorageContexts.js +17 -0
- package/dist/es/models/blobStorageContexts.js.map +1 -0
- package/dist/es/models/blobStorageTypes.js +17 -0
- package/dist/es/models/blobStorageTypes.js.map +1 -0
- package/dist/es/schemas/BlobStorageCompressionType.json +10 -0
- package/dist/es/schemas/BlobStorageEntry.json +84 -0
- package/dist/types/factories/blobStorageConnectorFactory.d.ts +1 -1
- package/dist/types/index.d.ts +18 -18
- package/dist/types/models/IBlobStorageComponent.d.ts +8 -15
- package/dist/types/models/IBlobStorageEntry.d.ts +5 -5
- package/dist/types/models/IBlobStorageEntryList.d.ts +5 -5
- package/dist/types/models/api/IBlobStorageCreateRequest.d.ts +1 -1
- package/dist/types/models/api/IBlobStorageGetContentRequest.d.ts +2 -2
- package/dist/types/models/api/IBlobStorageGetRequest.d.ts +2 -2
- package/dist/types/models/api/IBlobStorageGetResponse.d.ts +1 -1
- package/dist/types/models/api/IBlobStorageListRequest.d.ts +1 -1
- package/dist/types/models/api/IBlobStorageListResponse.d.ts +1 -1
- package/dist/types/models/blobStorageContexts.d.ts +2 -2
- package/docs/changelog.md +31 -0
- package/docs/reference/interfaces/IBlobStorageComponent.md +5 -55
- package/docs/reference/interfaces/IBlobStorageConnector.md +2 -10
- package/docs/reference/interfaces/IBlobStorageGetContentRequest.md +2 -2
- package/docs/reference/interfaces/IBlobStorageGetRequest.md +2 -2
- package/docs/reference/variables/BlobStorageContexts.md +4 -4
- package/package.json +5 -7
- package/dist/cjs/index.cjs +0 -201
- package/dist/esm/index.mjs +0 -195
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SortDirection } from "@twin.org/entity";
|
|
2
2
|
import type { HeaderTypes, MimeTypes } from "@twin.org/web";
|
|
3
|
-
import type { IBlobStorageEntry } from "../IBlobStorageEntry";
|
|
3
|
+
import type { IBlobStorageEntry } from "../IBlobStorageEntry.js";
|
|
4
4
|
/**
|
|
5
5
|
* Query the entries from blob storage.
|
|
6
6
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HeaderTypes, MimeTypes } from "@twin.org/web";
|
|
2
|
-
import type { IBlobStorageEntryList } from "../IBlobStorageEntryList";
|
|
2
|
+
import type { IBlobStorageEntryList } from "../IBlobStorageEntryList.js";
|
|
3
3
|
/**
|
|
4
4
|
* Response to getting the list of entries from a query.
|
|
5
5
|
*/
|
|
@@ -5,11 +5,11 @@ export declare const BlobStorageContexts: {
|
|
|
5
5
|
/**
|
|
6
6
|
* The context root for the blob storage types.
|
|
7
7
|
*/
|
|
8
|
-
readonly
|
|
8
|
+
readonly Namespace: "https://schema.twindev.org/blob-storage/";
|
|
9
9
|
/**
|
|
10
10
|
* The context root for the common types.
|
|
11
11
|
*/
|
|
12
|
-
readonly
|
|
12
|
+
readonly NamespaceCommon: "https://schema.twindev.org/common/";
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* The contexts of blob storage data.
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @twin.org/blob-storage-models - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.2](https://github.com/twinfoundation/blob-storage/compare/blob-storage-models-v0.0.3-next.1...blob-storage-models-v0.0.3-next.2) (2026-01-14)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* update contexts and namespaces ([#32](https://github.com/twinfoundation/blob-storage/issues/32)) ([187ed36](https://github.com/twinfoundation/blob-storage/commit/187ed36a7d83062665f70689ec5e2b2f553a592e))
|
|
9
|
+
|
|
10
|
+
## [0.0.3-next.1](https://github.com/twinfoundation/blob-storage/compare/blob-storage-models-v0.0.3-next.0...blob-storage-models-v0.0.3-next.1) (2025-11-11)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* add compression support ([67d239b](https://github.com/twinfoundation/blob-storage/commit/67d239bca8321bd90bf4ff93167c564130309730))
|
|
16
|
+
* add context id features ([#30](https://github.com/twinfoundation/blob-storage/issues/30)) ([fbf1c92](https://github.com/twinfoundation/blob-storage/commit/fbf1c9276424c841ef5ef3f4de8469ab3fba7e9c))
|
|
17
|
+
* add validate-locales ([f20fcec](https://github.com/twinfoundation/blob-storage/commit/f20fceced91e39a0c9edb770b2e43ce944c92f3c))
|
|
18
|
+
* additional encryption options on per item basis ([4b95a65](https://github.com/twinfoundation/blob-storage/commit/4b95a656d19e3b571cea905e36f29b679b13e1e8))
|
|
19
|
+
* eslint migration to flat config ([e4239dd](https://github.com/twinfoundation/blob-storage/commit/e4239dd1c721955cff7f0357255d2bba15319972))
|
|
20
|
+
* remove includeNodeIdentity flag ([13bc334](https://github.com/twinfoundation/blob-storage/commit/13bc33445b179879688af3c98e8be8a5609d3f46))
|
|
21
|
+
* update dependencies ([56f0094](https://github.com/twinfoundation/blob-storage/commit/56f0094b68d8bd22864cd899ac1b61d95540f719))
|
|
22
|
+
* update framework core ([ff339fe](https://github.com/twinfoundation/blob-storage/commit/ff339fe7e3f09ddff429907834bdf43617e9c05e))
|
|
23
|
+
* update to support fully qualified data type names ([3297d69](https://github.com/twinfoundation/blob-storage/commit/3297d69d332058b0f0141002087f56ba230620e1))
|
|
24
|
+
* update ts-to-schema generation ([03439c7](https://github.com/twinfoundation/blob-storage/commit/03439c726108bf645941290e41824c57a6a23de3))
|
|
25
|
+
* use shared store mechanism ([#12](https://github.com/twinfoundation/blob-storage/issues/12)) ([cae8110](https://github.com/twinfoundation/blob-storage/commit/cae8110681847a1ac4fcac968b8196694e49c320))
|
|
26
|
+
* use standard list json ld types ([d6bdfd6](https://github.com/twinfoundation/blob-storage/commit/d6bdfd68af47f70f3cc53658b4a12543497e1f48))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* Adding the optional flag to the entity ([#10](https://github.com/twinfoundation/blob-storage/issues/10)) ([626677e](https://github.com/twinfoundation/blob-storage/commit/626677e5730d23535a0eb1f36f8394d941ff2447))
|
|
32
|
+
* query params force coercion ([a5e547a](https://github.com/twinfoundation/blob-storage/commit/a5e547a775f8997cb04780938c7a9561ddb048d1))
|
|
33
|
+
|
|
3
34
|
## [0.0.2-next.5](https://github.com/twinfoundation/blob-storage/compare/blob-storage-models-v0.0.2-next.4...blob-storage-models-v0.0.2-next.5) (2025-10-09)
|
|
4
35
|
|
|
5
36
|
|
|
@@ -6,19 +6,11 @@ Interface describing an blob storage component.
|
|
|
6
6
|
|
|
7
7
|
- `IComponent`
|
|
8
8
|
|
|
9
|
-
## Indexable
|
|
10
|
-
|
|
11
|
-
\[`key`: `string`\]: `any`
|
|
12
|
-
|
|
13
|
-
All methods are optional, so we introduce an index signature to allow
|
|
14
|
-
any additional properties or methods, which removes the TypeScript error where
|
|
15
|
-
the class has no properties in common with the type.
|
|
16
|
-
|
|
17
9
|
## Methods
|
|
18
10
|
|
|
19
11
|
### create()
|
|
20
12
|
|
|
21
|
-
> **create**(`blob`, `encodingFormat?`, `fileExtension?`, `metadata?`, `options
|
|
13
|
+
> **create**(`blob`, `encodingFormat?`, `fileExtension?`, `metadata?`, `options?`): `Promise`\<`string`\>
|
|
22
14
|
|
|
23
15
|
Create the blob with some metadata.
|
|
24
16
|
|
|
@@ -76,18 +68,6 @@ Optional compression type to use for the blob, defaults to no compression.
|
|
|
76
68
|
|
|
77
69
|
The namespace to use for storing, defaults to component configured namespace.
|
|
78
70
|
|
|
79
|
-
##### userIdentity?
|
|
80
|
-
|
|
81
|
-
`string`
|
|
82
|
-
|
|
83
|
-
The user identity to use with storage operations.
|
|
84
|
-
|
|
85
|
-
##### nodeIdentity?
|
|
86
|
-
|
|
87
|
-
`string`
|
|
88
|
-
|
|
89
|
-
The node identity to use with storage operations.
|
|
90
|
-
|
|
91
71
|
#### Returns
|
|
92
72
|
|
|
93
73
|
`Promise`\<`string`\>
|
|
@@ -98,7 +78,7 @@ The id of the stored blob in urn format.
|
|
|
98
78
|
|
|
99
79
|
### get()
|
|
100
80
|
|
|
101
|
-
> **get**(`id`, `options
|
|
81
|
+
> **get**(`id`, `options?`): `Promise`\<[`IBlobStorageEntry`](IBlobStorageEntry.md)\>
|
|
102
82
|
|
|
103
83
|
Get the blob and metadata.
|
|
104
84
|
|
|
@@ -132,18 +112,6 @@ If the content should be decompressed, if it was compressed when stored, default
|
|
|
132
112
|
|
|
133
113
|
Use a different vault key id for decryption, if not provided the default vault key id will be used.
|
|
134
114
|
|
|
135
|
-
##### userIdentity?
|
|
136
|
-
|
|
137
|
-
`string`
|
|
138
|
-
|
|
139
|
-
The user identity to use with storage operations.
|
|
140
|
-
|
|
141
|
-
##### nodeIdentity?
|
|
142
|
-
|
|
143
|
-
`string`
|
|
144
|
-
|
|
145
|
-
The node identity to use with storage operations.
|
|
146
|
-
|
|
147
115
|
#### Returns
|
|
148
116
|
|
|
149
117
|
`Promise`\<[`IBlobStorageEntry`](IBlobStorageEntry.md)\>
|
|
@@ -158,7 +126,7 @@ Not found error if the blob cannot be found.
|
|
|
158
126
|
|
|
159
127
|
### update()
|
|
160
128
|
|
|
161
|
-
> **update**(`id`, `encodingFormat?`, `fileExtension?`, `metadata
|
|
129
|
+
> **update**(`id`, `encodingFormat?`, `fileExtension?`, `metadata?`): `Promise`\<`void`\>
|
|
162
130
|
|
|
163
131
|
Update the blob with metadata.
|
|
164
132
|
|
|
@@ -188,12 +156,6 @@ Extension for the blob, will be detected if left undefined.
|
|
|
188
156
|
|
|
189
157
|
Data for the custom metadata as JSON-LD.
|
|
190
158
|
|
|
191
|
-
##### userIdentity?
|
|
192
|
-
|
|
193
|
-
`string`
|
|
194
|
-
|
|
195
|
-
The user identity to use with storage operations.
|
|
196
|
-
|
|
197
159
|
#### Returns
|
|
198
160
|
|
|
199
161
|
`Promise`\<`void`\>
|
|
@@ -208,7 +170,7 @@ Not found error if the blob cannot be found.
|
|
|
208
170
|
|
|
209
171
|
### remove()
|
|
210
172
|
|
|
211
|
-
> **remove**(`id
|
|
173
|
+
> **remove**(`id`): `Promise`\<`void`\>
|
|
212
174
|
|
|
213
175
|
Remove the blob.
|
|
214
176
|
|
|
@@ -220,12 +182,6 @@ Remove the blob.
|
|
|
220
182
|
|
|
221
183
|
The id of the blob to remove in urn format.
|
|
222
184
|
|
|
223
|
-
##### userIdentity?
|
|
224
|
-
|
|
225
|
-
`string`
|
|
226
|
-
|
|
227
|
-
The user identity to use with storage operations.
|
|
228
|
-
|
|
229
185
|
#### Returns
|
|
230
186
|
|
|
231
187
|
`Promise`\<`void`\>
|
|
@@ -240,7 +196,7 @@ Not found error if the blob cannot be found.
|
|
|
240
196
|
|
|
241
197
|
### query()
|
|
242
198
|
|
|
243
|
-
> **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `cursor?`, `limit
|
|
199
|
+
> **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `cursor?`, `limit?`): `Promise`\<[`IBlobStorageEntryList`](IBlobStorageEntryList.md)\>
|
|
244
200
|
|
|
245
201
|
Query all the blob storage entries which match the conditions.
|
|
246
202
|
|
|
@@ -276,12 +232,6 @@ The cursor to request the next page of entries.
|
|
|
276
232
|
|
|
277
233
|
The suggested number of entries to return in each chunk, in some scenarios can return a different amount.
|
|
278
234
|
|
|
279
|
-
##### userIdentity?
|
|
280
|
-
|
|
281
|
-
`string`
|
|
282
|
-
|
|
283
|
-
The user identity to use with storage operations.
|
|
284
|
-
|
|
285
235
|
#### Returns
|
|
286
236
|
|
|
287
237
|
`Promise`\<[`IBlobStorageEntryList`](IBlobStorageEntryList.md)\>
|
|
@@ -6,14 +6,6 @@ Interface describing an blob storage connector.
|
|
|
6
6
|
|
|
7
7
|
- `IComponent`
|
|
8
8
|
|
|
9
|
-
## Indexable
|
|
10
|
-
|
|
11
|
-
\[`key`: `string`\]: `any`
|
|
12
|
-
|
|
13
|
-
All methods are optional, so we introduce an index signature to allow
|
|
14
|
-
any additional properties or methods, which removes the TypeScript error where
|
|
15
|
-
the class has no properties in common with the type.
|
|
16
|
-
|
|
17
9
|
## Methods
|
|
18
10
|
|
|
19
11
|
### set()
|
|
@@ -40,7 +32,7 @@ The id of the stored blob in urn format.
|
|
|
40
32
|
|
|
41
33
|
### get()
|
|
42
34
|
|
|
43
|
-
> **get**(`id`): `Promise`\<`
|
|
35
|
+
> **get**(`id`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\> \| `undefined`\>
|
|
44
36
|
|
|
45
37
|
Get the blob.
|
|
46
38
|
|
|
@@ -54,7 +46,7 @@ The id of the blob to get in urn format.
|
|
|
54
46
|
|
|
55
47
|
#### Returns
|
|
56
48
|
|
|
57
|
-
`Promise`\<`
|
|
49
|
+
`Promise`\<`Uint8Array`\<`ArrayBufferLike`\> \| `undefined`\>
|
|
58
50
|
|
|
59
51
|
The data for the blob if it can be found or undefined.
|
|
60
52
|
|
|
@@ -26,7 +26,7 @@ The query parameters.
|
|
|
26
26
|
|
|
27
27
|
#### decompress?
|
|
28
28
|
|
|
29
|
-
> `optional` **decompress**: `string`
|
|
29
|
+
> `optional` **decompress**: `string`
|
|
30
30
|
|
|
31
31
|
If the content should be decompressed, if it was compressed when stored, defaults to true.
|
|
32
32
|
|
|
@@ -50,7 +50,7 @@ undefined
|
|
|
50
50
|
|
|
51
51
|
#### download?
|
|
52
52
|
|
|
53
|
-
> `optional` **download**: `string`
|
|
53
|
+
> `optional` **download**: `string`
|
|
54
54
|
|
|
55
55
|
Set the download flag which should prompt the browser to save the file.
|
|
56
56
|
Otherwise the browser should show the content inside the page.
|
|
@@ -38,7 +38,7 @@ The query parameters.
|
|
|
38
38
|
|
|
39
39
|
#### includeContent?
|
|
40
40
|
|
|
41
|
-
> `optional` **includeContent**: `string`
|
|
41
|
+
> `optional` **includeContent**: `string`
|
|
42
42
|
|
|
43
43
|
Include the content in the response, otherwise only metadata is returned.
|
|
44
44
|
|
|
@@ -50,7 +50,7 @@ false
|
|
|
50
50
|
|
|
51
51
|
#### decompress?
|
|
52
52
|
|
|
53
|
-
> `optional` **decompress**: `string`
|
|
53
|
+
> `optional` **decompress**: `string`
|
|
54
54
|
|
|
55
55
|
If the content should be decompressed, if it was compressed when stored, defaults to true.
|
|
56
56
|
|
|
@@ -6,14 +6,14 @@ The contexts of blob storage data.
|
|
|
6
6
|
|
|
7
7
|
## Type Declaration
|
|
8
8
|
|
|
9
|
-
###
|
|
9
|
+
### Namespace
|
|
10
10
|
|
|
11
|
-
> `readonly` **
|
|
11
|
+
> `readonly` **Namespace**: `"https://schema.twindev.org/blob-storage/"` = `"https://schema.twindev.org/blob-storage/"`
|
|
12
12
|
|
|
13
13
|
The context root for the blob storage types.
|
|
14
14
|
|
|
15
|
-
###
|
|
15
|
+
### NamespaceCommon
|
|
16
16
|
|
|
17
|
-
> `readonly` **
|
|
17
|
+
> `readonly` **NamespaceCommon**: `"https://schema.twindev.org/common/"` = `"https://schema.twindev.org/common/"`
|
|
18
18
|
|
|
19
19
|
The context root for the common types.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/blob-storage-models",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3-next.2",
|
|
4
4
|
"description": "Models which define the structure of the blob storage contracts and connectors",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,20 +22,18 @@
|
|
|
22
22
|
"@twin.org/standards-schema-org": "next",
|
|
23
23
|
"@twin.org/web": "next"
|
|
24
24
|
},
|
|
25
|
-
"main": "./dist/
|
|
26
|
-
"module": "./dist/esm/index.mjs",
|
|
25
|
+
"main": "./dist/es/index.js",
|
|
27
26
|
"types": "./dist/types/index.d.ts",
|
|
28
27
|
"exports": {
|
|
29
28
|
".": {
|
|
30
29
|
"types": "./dist/types/index.d.ts",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
30
|
+
"import": "./dist/es/index.js",
|
|
31
|
+
"default": "./dist/es/index.js"
|
|
33
32
|
},
|
|
34
33
|
"./locales/*.json": "./locales/*.json"
|
|
35
34
|
},
|
|
36
35
|
"files": [
|
|
37
|
-
"dist/
|
|
38
|
-
"dist/esm",
|
|
36
|
+
"dist/es",
|
|
39
37
|
"dist/types",
|
|
40
38
|
"locales",
|
|
41
39
|
"docs"
|
package/dist/cjs/index.cjs
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var dataCore = require('@twin.org/data-core');
|
|
4
|
-
var core = require('@twin.org/core');
|
|
5
|
-
|
|
6
|
-
// Copyright 2024 IOTA Stiftung.
|
|
7
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
8
|
-
/**
|
|
9
|
-
* The contexts of blob storage data.
|
|
10
|
-
*/
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
12
|
-
const BlobStorageContexts = {
|
|
13
|
-
/**
|
|
14
|
-
* The context root for the blob storage types.
|
|
15
|
-
*/
|
|
16
|
-
ContextRoot: "https://schema.twindev.org/blob-storage/",
|
|
17
|
-
/**
|
|
18
|
-
* The context root for the common types.
|
|
19
|
-
*/
|
|
20
|
-
ContextRootCommon: "https://schema.twindev.org/common/"
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// Copyright 2024 IOTA Stiftung.
|
|
24
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
25
|
-
/**
|
|
26
|
-
* The types of blob storage data.
|
|
27
|
-
*/
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
29
|
-
const BlobStorageTypes = {
|
|
30
|
-
/**
|
|
31
|
-
* Represents blob storage entry.
|
|
32
|
-
*/
|
|
33
|
-
Entry: "BlobStorageEntry",
|
|
34
|
-
/**
|
|
35
|
-
* Represents blob storage entry compression.
|
|
36
|
-
*/
|
|
37
|
-
CompressionType: "BlobStorageCompressionType"
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
var $schema$1 = "https://json-schema.org/draft/2020-12/schema";
|
|
41
|
-
var $id$1 = "https://schema.twindev.org/blob-storage/BlobStorageCompressionType";
|
|
42
|
-
var description$1 = "The types of compression for blob storage data.";
|
|
43
|
-
var type$1 = "string";
|
|
44
|
-
var BlobStorageCompressionTypeSchema = {
|
|
45
|
-
$schema: $schema$1,
|
|
46
|
-
$id: $id$1,
|
|
47
|
-
description: description$1,
|
|
48
|
-
type: type$1,
|
|
49
|
-
"enum": [
|
|
50
|
-
"gzip",
|
|
51
|
-
"deflate"
|
|
52
|
-
]
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
var $schema = "https://json-schema.org/draft/2020-12/schema";
|
|
56
|
-
var $id = "https://schema.twindev.org/blob-storage/BlobStorageEntry";
|
|
57
|
-
var description = "Interface describing a blob storage entry.";
|
|
58
|
-
var type = "object";
|
|
59
|
-
var properties = {
|
|
60
|
-
"@context": {
|
|
61
|
-
type: "array",
|
|
62
|
-
minItems: 2,
|
|
63
|
-
items: {
|
|
64
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
|
|
65
|
-
},
|
|
66
|
-
description: "JSON-LD Context.",
|
|
67
|
-
prefixItems: [
|
|
68
|
-
{
|
|
69
|
-
type: "string",
|
|
70
|
-
"const": "https://schema.twindev.org/blob-storage/"
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
type: "string",
|
|
74
|
-
"const": "https://schema.twindev.org/common/"
|
|
75
|
-
}
|
|
76
|
-
]
|
|
77
|
-
},
|
|
78
|
-
type: {
|
|
79
|
-
type: "string",
|
|
80
|
-
"const": "BlobStorageEntry",
|
|
81
|
-
description: "JSON-LD Type."
|
|
82
|
-
},
|
|
83
|
-
id: {
|
|
84
|
-
type: "string",
|
|
85
|
-
description: "The id for the blob."
|
|
86
|
-
},
|
|
87
|
-
dateCreated: {
|
|
88
|
-
type: "string",
|
|
89
|
-
description: "The date/time when the entry was created."
|
|
90
|
-
},
|
|
91
|
-
dateModified: {
|
|
92
|
-
type: "string",
|
|
93
|
-
description: "The date/time when the entry was modified."
|
|
94
|
-
},
|
|
95
|
-
blobSize: {
|
|
96
|
-
type: "number",
|
|
97
|
-
description: "The size of the data in the blob."
|
|
98
|
-
},
|
|
99
|
-
blobHash: {
|
|
100
|
-
type: "string",
|
|
101
|
-
description: "The hash of the data in the blob."
|
|
102
|
-
},
|
|
103
|
-
encodingFormat: {
|
|
104
|
-
type: "string",
|
|
105
|
-
description: "The mime type for the blob."
|
|
106
|
-
},
|
|
107
|
-
isEncrypted: {
|
|
108
|
-
type: "boolean",
|
|
109
|
-
description: "Indicates if the blob is encrypted."
|
|
110
|
-
},
|
|
111
|
-
compression: {
|
|
112
|
-
$ref: "https://schema.twindev.org/blob-storage/BlobStorageCompressionType",
|
|
113
|
-
description: "The type of compression used for the blob, if not set it is not stored with compression."
|
|
114
|
-
},
|
|
115
|
-
fileExtension: {
|
|
116
|
-
type: "string",
|
|
117
|
-
description: "The extension."
|
|
118
|
-
},
|
|
119
|
-
metadata: {
|
|
120
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
|
|
121
|
-
description: "The metadata for the blob as JSON-LD."
|
|
122
|
-
},
|
|
123
|
-
blob: {
|
|
124
|
-
type: "string",
|
|
125
|
-
description: "The blob in base64 format, included if the includeContent flag was set in the request."
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
var required = [
|
|
129
|
-
"@context",
|
|
130
|
-
"type",
|
|
131
|
-
"id",
|
|
132
|
-
"dateCreated",
|
|
133
|
-
"blobSize",
|
|
134
|
-
"blobHash"
|
|
135
|
-
];
|
|
136
|
-
var additionalProperties = false;
|
|
137
|
-
var BlobStorageEntrySchema = {
|
|
138
|
-
$schema: $schema,
|
|
139
|
-
$id: $id,
|
|
140
|
-
description: description,
|
|
141
|
-
type: type,
|
|
142
|
-
properties: properties,
|
|
143
|
-
required: required,
|
|
144
|
-
additionalProperties: additionalProperties
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
// Copyright 2024 IOTA Stiftung.
|
|
148
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
149
|
-
/**
|
|
150
|
-
* Handle all the data types for blob storage.
|
|
151
|
-
*/
|
|
152
|
-
class BlobStorageDataTypes {
|
|
153
|
-
/**
|
|
154
|
-
* Register all the data types.
|
|
155
|
-
*/
|
|
156
|
-
static registerTypes() {
|
|
157
|
-
dataCore.DataTypeHandlerFactory.register(`${BlobStorageContexts.ContextRoot}${BlobStorageTypes.Entry}`, () => ({
|
|
158
|
-
context: BlobStorageContexts.ContextRoot,
|
|
159
|
-
type: BlobStorageTypes.Entry,
|
|
160
|
-
defaultValue: {},
|
|
161
|
-
jsonSchema: async () => BlobStorageEntrySchema
|
|
162
|
-
}));
|
|
163
|
-
dataCore.DataTypeHandlerFactory.register(`${BlobStorageContexts.ContextRoot}${BlobStorageTypes.CompressionType}`, () => ({
|
|
164
|
-
context: BlobStorageContexts.ContextRoot,
|
|
165
|
-
type: BlobStorageTypes.CompressionType,
|
|
166
|
-
defaultValue: {},
|
|
167
|
-
jsonSchema: async () => BlobStorageCompressionTypeSchema
|
|
168
|
-
}));
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// Copyright 2024 IOTA Stiftung.
|
|
173
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
174
|
-
/**
|
|
175
|
-
* Factory for creating blob storage connectors.
|
|
176
|
-
*/
|
|
177
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
178
|
-
const BlobStorageConnectorFactory = core.Factory.createFactory("blob-storage");
|
|
179
|
-
|
|
180
|
-
// Copyright 2024 IOTA Stiftung.
|
|
181
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
182
|
-
/**
|
|
183
|
-
* The types of compression for blob storage data.
|
|
184
|
-
*/
|
|
185
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
186
|
-
const BlobStorageCompressionType = {
|
|
187
|
-
/**
|
|
188
|
-
* Gzip.
|
|
189
|
-
*/
|
|
190
|
-
Gzip: "gzip",
|
|
191
|
-
/**
|
|
192
|
-
* Deflate.
|
|
193
|
-
*/
|
|
194
|
-
Deflate: "deflate"
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
exports.BlobStorageCompressionType = BlobStorageCompressionType;
|
|
198
|
-
exports.BlobStorageConnectorFactory = BlobStorageConnectorFactory;
|
|
199
|
-
exports.BlobStorageContexts = BlobStorageContexts;
|
|
200
|
-
exports.BlobStorageDataTypes = BlobStorageDataTypes;
|
|
201
|
-
exports.BlobStorageTypes = BlobStorageTypes;
|