@twin.org/blob-storage-models 0.0.2-next.4 → 0.0.3-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/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 +9 -16
- package/dist/types/models/IBlobStorageEntry.d.ts +3 -3
- package/dist/types/models/IBlobStorageEntryList.d.ts +2 -2
- package/dist/types/models/api/IBlobStorageCreateRequest.d.ts +1 -1
- package/dist/types/models/api/IBlobStorageGetResponse.d.ts +1 -1
- package/dist/types/models/api/IBlobStorageListRequest.d.ts +3 -3
- package/dist/types/models/api/IBlobStorageListResponse.d.ts +1 -1
- package/docs/changelog.md +31 -0
- package/docs/reference/interfaces/IBlobStorageComponent.md +6 -48
- package/docs/reference/interfaces/IBlobStorageConnector.md +2 -2
- package/docs/reference/interfaces/IBlobStorageListRequest.md +3 -3
- package/package.json +10 -8
- package/dist/cjs/index.cjs +0 -201
- package/dist/esm/index.mjs +0 -195
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @twin.org/blob-storage-models - Changelog
|
|
2
2
|
|
|
3
|
+
## [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)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add compression support ([67d239b](https://github.com/twinfoundation/blob-storage/commit/67d239bca8321bd90bf4ff93167c564130309730))
|
|
9
|
+
* add context id features ([#30](https://github.com/twinfoundation/blob-storage/issues/30)) ([fbf1c92](https://github.com/twinfoundation/blob-storage/commit/fbf1c9276424c841ef5ef3f4de8469ab3fba7e9c))
|
|
10
|
+
* add validate-locales ([f20fcec](https://github.com/twinfoundation/blob-storage/commit/f20fceced91e39a0c9edb770b2e43ce944c92f3c))
|
|
11
|
+
* additional encryption options on per item basis ([4b95a65](https://github.com/twinfoundation/blob-storage/commit/4b95a656d19e3b571cea905e36f29b679b13e1e8))
|
|
12
|
+
* eslint migration to flat config ([e4239dd](https://github.com/twinfoundation/blob-storage/commit/e4239dd1c721955cff7f0357255d2bba15319972))
|
|
13
|
+
* remove includeNodeIdentity flag ([13bc334](https://github.com/twinfoundation/blob-storage/commit/13bc33445b179879688af3c98e8be8a5609d3f46))
|
|
14
|
+
* update dependencies ([56f0094](https://github.com/twinfoundation/blob-storage/commit/56f0094b68d8bd22864cd899ac1b61d95540f719))
|
|
15
|
+
* update framework core ([ff339fe](https://github.com/twinfoundation/blob-storage/commit/ff339fe7e3f09ddff429907834bdf43617e9c05e))
|
|
16
|
+
* update to support fully qualified data type names ([3297d69](https://github.com/twinfoundation/blob-storage/commit/3297d69d332058b0f0141002087f56ba230620e1))
|
|
17
|
+
* update ts-to-schema generation ([03439c7](https://github.com/twinfoundation/blob-storage/commit/03439c726108bf645941290e41824c57a6a23de3))
|
|
18
|
+
* use shared store mechanism ([#12](https://github.com/twinfoundation/blob-storage/issues/12)) ([cae8110](https://github.com/twinfoundation/blob-storage/commit/cae8110681847a1ac4fcac968b8196694e49c320))
|
|
19
|
+
* use standard list json ld types ([d6bdfd6](https://github.com/twinfoundation/blob-storage/commit/d6bdfd68af47f70f3cc53658b4a12543497e1f48))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* 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))
|
|
25
|
+
* query params force coercion ([a5e547a](https://github.com/twinfoundation/blob-storage/commit/a5e547a775f8997cb04780938c7a9561ddb048d1))
|
|
26
|
+
|
|
27
|
+
## [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)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
|
|
32
|
+
* add validate-locales ([f20fcec](https://github.com/twinfoundation/blob-storage/commit/f20fceced91e39a0c9edb770b2e43ce944c92f3c))
|
|
33
|
+
|
|
3
34
|
## [0.0.2-next.4](https://github.com/twinfoundation/blob-storage/compare/blob-storage-models-v0.0.2-next.3...blob-storage-models-v0.0.2-next.4) (2025-10-02)
|
|
4
35
|
|
|
5
36
|
|
|
@@ -10,7 +10,7 @@ Interface describing an blob storage component.
|
|
|
10
10
|
|
|
11
11
|
### create()
|
|
12
12
|
|
|
13
|
-
> **create**(`blob`, `encodingFormat?`, `fileExtension?`, `metadata?`, `options
|
|
13
|
+
> **create**(`blob`, `encodingFormat?`, `fileExtension?`, `metadata?`, `options?`): `Promise`\<`string`\>
|
|
14
14
|
|
|
15
15
|
Create the blob with some metadata.
|
|
16
16
|
|
|
@@ -68,18 +68,6 @@ Optional compression type to use for the blob, defaults to no compression.
|
|
|
68
68
|
|
|
69
69
|
The namespace to use for storing, defaults to component configured namespace.
|
|
70
70
|
|
|
71
|
-
##### userIdentity?
|
|
72
|
-
|
|
73
|
-
`string`
|
|
74
|
-
|
|
75
|
-
The user identity to use with storage operations.
|
|
76
|
-
|
|
77
|
-
##### nodeIdentity?
|
|
78
|
-
|
|
79
|
-
`string`
|
|
80
|
-
|
|
81
|
-
The node identity to use with storage operations.
|
|
82
|
-
|
|
83
71
|
#### Returns
|
|
84
72
|
|
|
85
73
|
`Promise`\<`string`\>
|
|
@@ -90,7 +78,7 @@ The id of the stored blob in urn format.
|
|
|
90
78
|
|
|
91
79
|
### get()
|
|
92
80
|
|
|
93
|
-
> **get**(`id`, `options
|
|
81
|
+
> **get**(`id`, `options?`): `Promise`\<[`IBlobStorageEntry`](IBlobStorageEntry.md)\>
|
|
94
82
|
|
|
95
83
|
Get the blob and metadata.
|
|
96
84
|
|
|
@@ -124,18 +112,6 @@ If the content should be decompressed, if it was compressed when stored, default
|
|
|
124
112
|
|
|
125
113
|
Use a different vault key id for decryption, if not provided the default vault key id will be used.
|
|
126
114
|
|
|
127
|
-
##### userIdentity?
|
|
128
|
-
|
|
129
|
-
`string`
|
|
130
|
-
|
|
131
|
-
The user identity to use with storage operations.
|
|
132
|
-
|
|
133
|
-
##### nodeIdentity?
|
|
134
|
-
|
|
135
|
-
`string`
|
|
136
|
-
|
|
137
|
-
The node identity to use with storage operations.
|
|
138
|
-
|
|
139
115
|
#### Returns
|
|
140
116
|
|
|
141
117
|
`Promise`\<[`IBlobStorageEntry`](IBlobStorageEntry.md)\>
|
|
@@ -150,7 +126,7 @@ Not found error if the blob cannot be found.
|
|
|
150
126
|
|
|
151
127
|
### update()
|
|
152
128
|
|
|
153
|
-
> **update**(`id`, `encodingFormat?`, `fileExtension?`, `metadata
|
|
129
|
+
> **update**(`id`, `encodingFormat?`, `fileExtension?`, `metadata?`): `Promise`\<`void`\>
|
|
154
130
|
|
|
155
131
|
Update the blob with metadata.
|
|
156
132
|
|
|
@@ -180,12 +156,6 @@ Extension for the blob, will be detected if left undefined.
|
|
|
180
156
|
|
|
181
157
|
Data for the custom metadata as JSON-LD.
|
|
182
158
|
|
|
183
|
-
##### userIdentity?
|
|
184
|
-
|
|
185
|
-
`string`
|
|
186
|
-
|
|
187
|
-
The user identity to use with storage operations.
|
|
188
|
-
|
|
189
159
|
#### Returns
|
|
190
160
|
|
|
191
161
|
`Promise`\<`void`\>
|
|
@@ -200,7 +170,7 @@ Not found error if the blob cannot be found.
|
|
|
200
170
|
|
|
201
171
|
### remove()
|
|
202
172
|
|
|
203
|
-
> **remove**(`id
|
|
173
|
+
> **remove**(`id`): `Promise`\<`void`\>
|
|
204
174
|
|
|
205
175
|
Remove the blob.
|
|
206
176
|
|
|
@@ -212,12 +182,6 @@ Remove the blob.
|
|
|
212
182
|
|
|
213
183
|
The id of the blob to remove in urn format.
|
|
214
184
|
|
|
215
|
-
##### userIdentity?
|
|
216
|
-
|
|
217
|
-
`string`
|
|
218
|
-
|
|
219
|
-
The user identity to use with storage operations.
|
|
220
|
-
|
|
221
185
|
#### Returns
|
|
222
186
|
|
|
223
187
|
`Promise`\<`void`\>
|
|
@@ -232,7 +196,7 @@ Not found error if the blob cannot be found.
|
|
|
232
196
|
|
|
233
197
|
### query()
|
|
234
198
|
|
|
235
|
-
> **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `cursor?`, `
|
|
199
|
+
> **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `cursor?`, `limit?`): `Promise`\<[`IBlobStorageEntryList`](IBlobStorageEntryList.md)\>
|
|
236
200
|
|
|
237
201
|
Query all the blob storage entries which match the conditions.
|
|
238
202
|
|
|
@@ -262,18 +226,12 @@ The direction for the order, defaults to descending.
|
|
|
262
226
|
|
|
263
227
|
The cursor to request the next page of entries.
|
|
264
228
|
|
|
265
|
-
#####
|
|
229
|
+
##### limit?
|
|
266
230
|
|
|
267
231
|
`number`
|
|
268
232
|
|
|
269
233
|
The suggested number of entries to return in each chunk, in some scenarios can return a different amount.
|
|
270
234
|
|
|
271
|
-
##### userIdentity?
|
|
272
|
-
|
|
273
|
-
`string`
|
|
274
|
-
|
|
275
|
-
The user identity to use with storage operations.
|
|
276
|
-
|
|
277
235
|
#### Returns
|
|
278
236
|
|
|
279
237
|
`Promise`\<[`IBlobStorageEntryList`](IBlobStorageEntryList.md)\>
|
|
@@ -32,7 +32,7 @@ The id of the stored blob in urn format.
|
|
|
32
32
|
|
|
33
33
|
### get()
|
|
34
34
|
|
|
35
|
-
> **get**(`id`): `Promise`\<`
|
|
35
|
+
> **get**(`id`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\> \| `undefined`\>
|
|
36
36
|
|
|
37
37
|
Get the blob.
|
|
38
38
|
|
|
@@ -46,7 +46,7 @@ The id of the blob to get in urn format.
|
|
|
46
46
|
|
|
47
47
|
#### Returns
|
|
48
48
|
|
|
49
|
-
`Promise`\<`
|
|
49
|
+
`Promise`\<`Uint8Array`\<`ArrayBufferLike`\> \| `undefined`\>
|
|
50
50
|
|
|
51
51
|
The data for the blob if it can be found or undefined.
|
|
52
52
|
|
|
@@ -40,11 +40,11 @@ The order for the results, default to created.
|
|
|
40
40
|
|
|
41
41
|
The direction for the order, defaults to desc.
|
|
42
42
|
|
|
43
|
-
####
|
|
43
|
+
#### limit?
|
|
44
44
|
|
|
45
|
-
> `optional` **
|
|
45
|
+
> `optional` **limit**: `string`
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
Limit the number of entities to return.
|
|
48
48
|
|
|
49
49
|
#### cursor?
|
|
50
50
|
|
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.1",
|
|
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"
|
|
@@ -54,5 +52,9 @@
|
|
|
54
52
|
"models",
|
|
55
53
|
"types",
|
|
56
54
|
"schemas"
|
|
57
|
-
]
|
|
55
|
+
],
|
|
56
|
+
"bugs": {
|
|
57
|
+
"url": "git+https://github.com/twinfoundation/blob-storage/issues"
|
|
58
|
+
},
|
|
59
|
+
"homepage": "https://twindev.org"
|
|
58
60
|
}
|
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;
|
package/dist/esm/index.mjs
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import { DataTypeHandlerFactory } from '@twin.org/data-core';
|
|
2
|
-
import { Factory } from '@twin.org/core';
|
|
3
|
-
|
|
4
|
-
// Copyright 2024 IOTA Stiftung.
|
|
5
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
6
|
-
/**
|
|
7
|
-
* The contexts of blob storage data.
|
|
8
|
-
*/
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10
|
-
const BlobStorageContexts = {
|
|
11
|
-
/**
|
|
12
|
-
* The context root for the blob storage types.
|
|
13
|
-
*/
|
|
14
|
-
ContextRoot: "https://schema.twindev.org/blob-storage/",
|
|
15
|
-
/**
|
|
16
|
-
* The context root for the common types.
|
|
17
|
-
*/
|
|
18
|
-
ContextRootCommon: "https://schema.twindev.org/common/"
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
// Copyright 2024 IOTA Stiftung.
|
|
22
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
23
|
-
/**
|
|
24
|
-
* The types of blob storage data.
|
|
25
|
-
*/
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
27
|
-
const BlobStorageTypes = {
|
|
28
|
-
/**
|
|
29
|
-
* Represents blob storage entry.
|
|
30
|
-
*/
|
|
31
|
-
Entry: "BlobStorageEntry",
|
|
32
|
-
/**
|
|
33
|
-
* Represents blob storage entry compression.
|
|
34
|
-
*/
|
|
35
|
-
CompressionType: "BlobStorageCompressionType"
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
var $schema$1 = "https://json-schema.org/draft/2020-12/schema";
|
|
39
|
-
var $id$1 = "https://schema.twindev.org/blob-storage/BlobStorageCompressionType";
|
|
40
|
-
var description$1 = "The types of compression for blob storage data.";
|
|
41
|
-
var type$1 = "string";
|
|
42
|
-
var BlobStorageCompressionTypeSchema = {
|
|
43
|
-
$schema: $schema$1,
|
|
44
|
-
$id: $id$1,
|
|
45
|
-
description: description$1,
|
|
46
|
-
type: type$1,
|
|
47
|
-
"enum": [
|
|
48
|
-
"gzip",
|
|
49
|
-
"deflate"
|
|
50
|
-
]
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
var $schema = "https://json-schema.org/draft/2020-12/schema";
|
|
54
|
-
var $id = "https://schema.twindev.org/blob-storage/BlobStorageEntry";
|
|
55
|
-
var description = "Interface describing a blob storage entry.";
|
|
56
|
-
var type = "object";
|
|
57
|
-
var properties = {
|
|
58
|
-
"@context": {
|
|
59
|
-
type: "array",
|
|
60
|
-
minItems: 2,
|
|
61
|
-
items: {
|
|
62
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
|
|
63
|
-
},
|
|
64
|
-
description: "JSON-LD Context.",
|
|
65
|
-
prefixItems: [
|
|
66
|
-
{
|
|
67
|
-
type: "string",
|
|
68
|
-
"const": "https://schema.twindev.org/blob-storage/"
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
type: "string",
|
|
72
|
-
"const": "https://schema.twindev.org/common/"
|
|
73
|
-
}
|
|
74
|
-
]
|
|
75
|
-
},
|
|
76
|
-
type: {
|
|
77
|
-
type: "string",
|
|
78
|
-
"const": "BlobStorageEntry",
|
|
79
|
-
description: "JSON-LD Type."
|
|
80
|
-
},
|
|
81
|
-
id: {
|
|
82
|
-
type: "string",
|
|
83
|
-
description: "The id for the blob."
|
|
84
|
-
},
|
|
85
|
-
dateCreated: {
|
|
86
|
-
type: "string",
|
|
87
|
-
description: "The date/time when the entry was created."
|
|
88
|
-
},
|
|
89
|
-
dateModified: {
|
|
90
|
-
type: "string",
|
|
91
|
-
description: "The date/time when the entry was modified."
|
|
92
|
-
},
|
|
93
|
-
blobSize: {
|
|
94
|
-
type: "number",
|
|
95
|
-
description: "The size of the data in the blob."
|
|
96
|
-
},
|
|
97
|
-
blobHash: {
|
|
98
|
-
type: "string",
|
|
99
|
-
description: "The hash of the data in the blob."
|
|
100
|
-
},
|
|
101
|
-
encodingFormat: {
|
|
102
|
-
type: "string",
|
|
103
|
-
description: "The mime type for the blob."
|
|
104
|
-
},
|
|
105
|
-
isEncrypted: {
|
|
106
|
-
type: "boolean",
|
|
107
|
-
description: "Indicates if the blob is encrypted."
|
|
108
|
-
},
|
|
109
|
-
compression: {
|
|
110
|
-
$ref: "https://schema.twindev.org/blob-storage/BlobStorageCompressionType",
|
|
111
|
-
description: "The type of compression used for the blob, if not set it is not stored with compression."
|
|
112
|
-
},
|
|
113
|
-
fileExtension: {
|
|
114
|
-
type: "string",
|
|
115
|
-
description: "The extension."
|
|
116
|
-
},
|
|
117
|
-
metadata: {
|
|
118
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
|
|
119
|
-
description: "The metadata for the blob as JSON-LD."
|
|
120
|
-
},
|
|
121
|
-
blob: {
|
|
122
|
-
type: "string",
|
|
123
|
-
description: "The blob in base64 format, included if the includeContent flag was set in the request."
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
var required = [
|
|
127
|
-
"@context",
|
|
128
|
-
"type",
|
|
129
|
-
"id",
|
|
130
|
-
"dateCreated",
|
|
131
|
-
"blobSize",
|
|
132
|
-
"blobHash"
|
|
133
|
-
];
|
|
134
|
-
var additionalProperties = false;
|
|
135
|
-
var BlobStorageEntrySchema = {
|
|
136
|
-
$schema: $schema,
|
|
137
|
-
$id: $id,
|
|
138
|
-
description: description,
|
|
139
|
-
type: type,
|
|
140
|
-
properties: properties,
|
|
141
|
-
required: required,
|
|
142
|
-
additionalProperties: additionalProperties
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
// Copyright 2024 IOTA Stiftung.
|
|
146
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
147
|
-
/**
|
|
148
|
-
* Handle all the data types for blob storage.
|
|
149
|
-
*/
|
|
150
|
-
class BlobStorageDataTypes {
|
|
151
|
-
/**
|
|
152
|
-
* Register all the data types.
|
|
153
|
-
*/
|
|
154
|
-
static registerTypes() {
|
|
155
|
-
DataTypeHandlerFactory.register(`${BlobStorageContexts.ContextRoot}${BlobStorageTypes.Entry}`, () => ({
|
|
156
|
-
context: BlobStorageContexts.ContextRoot,
|
|
157
|
-
type: BlobStorageTypes.Entry,
|
|
158
|
-
defaultValue: {},
|
|
159
|
-
jsonSchema: async () => BlobStorageEntrySchema
|
|
160
|
-
}));
|
|
161
|
-
DataTypeHandlerFactory.register(`${BlobStorageContexts.ContextRoot}${BlobStorageTypes.CompressionType}`, () => ({
|
|
162
|
-
context: BlobStorageContexts.ContextRoot,
|
|
163
|
-
type: BlobStorageTypes.CompressionType,
|
|
164
|
-
defaultValue: {},
|
|
165
|
-
jsonSchema: async () => BlobStorageCompressionTypeSchema
|
|
166
|
-
}));
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// Copyright 2024 IOTA Stiftung.
|
|
171
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
172
|
-
/**
|
|
173
|
-
* Factory for creating blob storage connectors.
|
|
174
|
-
*/
|
|
175
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
176
|
-
const BlobStorageConnectorFactory = Factory.createFactory("blob-storage");
|
|
177
|
-
|
|
178
|
-
// Copyright 2024 IOTA Stiftung.
|
|
179
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
180
|
-
/**
|
|
181
|
-
* The types of compression for blob storage data.
|
|
182
|
-
*/
|
|
183
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
184
|
-
const BlobStorageCompressionType = {
|
|
185
|
-
/**
|
|
186
|
-
* Gzip.
|
|
187
|
-
*/
|
|
188
|
-
Gzip: "gzip",
|
|
189
|
-
/**
|
|
190
|
-
* Deflate.
|
|
191
|
-
*/
|
|
192
|
-
Deflate: "deflate"
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
export { BlobStorageCompressionType, BlobStorageConnectorFactory, BlobStorageContexts, BlobStorageDataTypes, BlobStorageTypes };
|