@twin.org/blob-storage-models 0.0.1-next.33 → 0.0.1-next.35
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 +17 -9
- package/dist/esm/index.mjs +17 -9
- package/dist/types/models/IBlobStorageComponent.d.ts +18 -4
- package/dist/types/models/IBlobStorageEntry.d.ts +4 -0
- package/dist/types/models/api/IBlobStorageCreateRequest.d.ts +10 -0
- package/dist/types/models/api/IBlobStorageGetContentRequest.d.ts +11 -1
- package/dist/types/models/api/IBlobStorageGetRequest.d.ts +11 -1
- package/dist/types/models/api/IBlobStorageUpdateRequest.d.ts +10 -0
- package/docs/changelog.md +14 -0
- package/docs/reference/interfaces/IBlobStorageComponent.md +36 -4
- package/docs/reference/interfaces/IBlobStorageCreateRequest.md +24 -0
- package/docs/reference/interfaces/IBlobStorageEntry.md +8 -0
- package/docs/reference/interfaces/IBlobStorageGetContentRequest.md +25 -1
- package/docs/reference/interfaces/IBlobStorageGetRequest.md +25 -1
- package/docs/reference/interfaces/IBlobStorageUpdateRequest.md +24 -0
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -33,12 +33,19 @@ const BlobStorageTypes = {
|
|
|
33
33
|
Entry: "BlobStorageEntry"
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
+
var $schema = "https://json-schema.org/draft/2020-12/schema";
|
|
37
|
+
var $id = "https://schema.twindev.org/blob-storage/BlobStorageEntry";
|
|
38
|
+
var description = "Interface describing a blob storage entry.";
|
|
36
39
|
var type = "object";
|
|
37
40
|
var properties = {
|
|
38
41
|
"@context": {
|
|
39
42
|
type: "array",
|
|
40
43
|
minItems: 2,
|
|
41
|
-
items:
|
|
44
|
+
items: {
|
|
45
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
|
|
46
|
+
},
|
|
47
|
+
description: "JSON-LD Context.",
|
|
48
|
+
prefixItems: [
|
|
42
49
|
{
|
|
43
50
|
type: "string",
|
|
44
51
|
"const": "https://schema.twindev.org/blob-storage/"
|
|
@@ -47,11 +54,7 @@ var properties = {
|
|
|
47
54
|
type: "string",
|
|
48
55
|
"const": "https://schema.twindev.org/common/"
|
|
49
56
|
}
|
|
50
|
-
]
|
|
51
|
-
additionalItems: {
|
|
52
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
|
|
53
|
-
},
|
|
54
|
-
description: "JSON-LD Context."
|
|
57
|
+
]
|
|
55
58
|
},
|
|
56
59
|
type: {
|
|
57
60
|
type: "string",
|
|
@@ -82,6 +85,10 @@ var properties = {
|
|
|
82
85
|
type: "string",
|
|
83
86
|
description: "The mime type for the blob."
|
|
84
87
|
},
|
|
88
|
+
isEncrypted: {
|
|
89
|
+
type: "boolean",
|
|
90
|
+
description: "Indicates if the blob is encrypted."
|
|
91
|
+
},
|
|
85
92
|
fileExtension: {
|
|
86
93
|
type: "string",
|
|
87
94
|
description: "The extension."
|
|
@@ -104,13 +111,14 @@ var required = [
|
|
|
104
111
|
"blobHash"
|
|
105
112
|
];
|
|
106
113
|
var additionalProperties = false;
|
|
107
|
-
var description = "Interface describing a blob storage entry.";
|
|
108
114
|
var BlobStorageEntrySchema = {
|
|
115
|
+
$schema: $schema,
|
|
116
|
+
$id: $id,
|
|
117
|
+
description: description,
|
|
109
118
|
type: type,
|
|
110
119
|
properties: properties,
|
|
111
120
|
required: required,
|
|
112
|
-
additionalProperties: additionalProperties
|
|
113
|
-
description: description
|
|
121
|
+
additionalProperties: additionalProperties
|
|
114
122
|
};
|
|
115
123
|
|
|
116
124
|
// Copyright 2024 IOTA Stiftung.
|
package/dist/esm/index.mjs
CHANGED
|
@@ -31,12 +31,19 @@ const BlobStorageTypes = {
|
|
|
31
31
|
Entry: "BlobStorageEntry"
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
+
var $schema = "https://json-schema.org/draft/2020-12/schema";
|
|
35
|
+
var $id = "https://schema.twindev.org/blob-storage/BlobStorageEntry";
|
|
36
|
+
var description = "Interface describing a blob storage entry.";
|
|
34
37
|
var type = "object";
|
|
35
38
|
var properties = {
|
|
36
39
|
"@context": {
|
|
37
40
|
type: "array",
|
|
38
41
|
minItems: 2,
|
|
39
|
-
items:
|
|
42
|
+
items: {
|
|
43
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
|
|
44
|
+
},
|
|
45
|
+
description: "JSON-LD Context.",
|
|
46
|
+
prefixItems: [
|
|
40
47
|
{
|
|
41
48
|
type: "string",
|
|
42
49
|
"const": "https://schema.twindev.org/blob-storage/"
|
|
@@ -45,11 +52,7 @@ var properties = {
|
|
|
45
52
|
type: "string",
|
|
46
53
|
"const": "https://schema.twindev.org/common/"
|
|
47
54
|
}
|
|
48
|
-
]
|
|
49
|
-
additionalItems: {
|
|
50
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
|
|
51
|
-
},
|
|
52
|
-
description: "JSON-LD Context."
|
|
55
|
+
]
|
|
53
56
|
},
|
|
54
57
|
type: {
|
|
55
58
|
type: "string",
|
|
@@ -80,6 +83,10 @@ var properties = {
|
|
|
80
83
|
type: "string",
|
|
81
84
|
description: "The mime type for the blob."
|
|
82
85
|
},
|
|
86
|
+
isEncrypted: {
|
|
87
|
+
type: "boolean",
|
|
88
|
+
description: "Indicates if the blob is encrypted."
|
|
89
|
+
},
|
|
83
90
|
fileExtension: {
|
|
84
91
|
type: "string",
|
|
85
92
|
description: "The extension."
|
|
@@ -102,13 +109,14 @@ var required = [
|
|
|
102
109
|
"blobHash"
|
|
103
110
|
];
|
|
104
111
|
var additionalProperties = false;
|
|
105
|
-
var description = "Interface describing a blob storage entry.";
|
|
106
112
|
var BlobStorageEntrySchema = {
|
|
113
|
+
$schema: $schema,
|
|
114
|
+
$id: $id,
|
|
115
|
+
description: description,
|
|
107
116
|
type: type,
|
|
108
117
|
properties: properties,
|
|
109
118
|
required: required,
|
|
110
|
-
additionalProperties: additionalProperties
|
|
111
|
-
description: description
|
|
119
|
+
additionalProperties: additionalProperties
|
|
112
120
|
};
|
|
113
121
|
|
|
114
122
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -13,22 +13,36 @@ export interface IBlobStorageComponent extends IComponent {
|
|
|
13
13
|
* @param encodingFormat Mime type for the blob, will be detected if left undefined.
|
|
14
14
|
* @param fileExtension Extension for the blob, will be detected if left undefined.
|
|
15
15
|
* @param metadata Data for the custom metadata as JSON-LD.
|
|
16
|
-
* @param
|
|
16
|
+
* @param options Optional options for the creation of the blob.
|
|
17
|
+
* @param options.disableEncryption Disables encryption if enabled by default.
|
|
18
|
+
* @param options.overrideVaultKeyId Use a different vault key id for encryption, if not provided the default vault key id will be used.
|
|
19
|
+
* @param options.namespace The namespace to use for storing, defaults to component configured namespace.
|
|
17
20
|
* @param userIdentity The user identity to use with storage operations.
|
|
18
21
|
* @param nodeIdentity The node identity to use with storage operations.
|
|
19
22
|
* @returns The id of the stored blob in urn format.
|
|
20
23
|
*/
|
|
21
|
-
create(blob: string, encodingFormat?: string, fileExtension?: string, metadata?: IJsonLdNodeObject,
|
|
24
|
+
create(blob: string, encodingFormat?: string, fileExtension?: string, metadata?: IJsonLdNodeObject, options?: {
|
|
25
|
+
disableEncryption?: boolean;
|
|
26
|
+
overrideVaultKeyId?: string;
|
|
27
|
+
namespace?: string;
|
|
28
|
+
}, userIdentity?: string, nodeIdentity?: string): Promise<string>;
|
|
22
29
|
/**
|
|
23
30
|
* Get the blob and metadata.
|
|
24
31
|
* @param id The id of the blob to get in urn format.
|
|
25
|
-
* @param
|
|
32
|
+
* @param options Optional options for the retrieval of the blob.
|
|
33
|
+
* @param options.includeContent Include the content, or just get the metadata.
|
|
34
|
+
* @param options.disableDecryption Disables decryption if enabled by default.
|
|
35
|
+
* @param options.overrideVaultKeyId Use a different vault key id for decryption, if not provided the default vault key id will be used.
|
|
26
36
|
* @param userIdentity The user identity to use with storage operations.
|
|
27
37
|
* @param nodeIdentity The node identity to use with storage operations.
|
|
28
38
|
* @returns The data and metadata for the blob if it can be found.
|
|
29
39
|
* @throws Not found error if the blob cannot be found.
|
|
30
40
|
*/
|
|
31
|
-
get(id: string,
|
|
41
|
+
get(id: string, options?: {
|
|
42
|
+
includeContent?: boolean;
|
|
43
|
+
disableDecryption?: boolean;
|
|
44
|
+
overrideVaultKeyId?: string;
|
|
45
|
+
}, userIdentity?: string, nodeIdentity?: string): Promise<IBlobStorageEntry>;
|
|
32
46
|
/**
|
|
33
47
|
* Update the blob with metadata.
|
|
34
48
|
* @param id The id of the blob metadata to update.
|
|
@@ -23,6 +23,16 @@ export interface IBlobStorageCreateRequest {
|
|
|
23
23
|
* Custom metadata to associate with the blob as JSON-LD.
|
|
24
24
|
*/
|
|
25
25
|
metadata?: IJsonLdNodeObject;
|
|
26
|
+
/**
|
|
27
|
+
* Disables encryption if enabled by default.
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
disableEncryption?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Use a different vault key id for encryption, if not provided the default vault key id will be used.
|
|
33
|
+
* @default undefined
|
|
34
|
+
*/
|
|
35
|
+
overrideVaultKeyId?: string;
|
|
26
36
|
/**
|
|
27
37
|
* The namespace to store the data in, defaults to component configured namespace.
|
|
28
38
|
*/
|
|
@@ -15,12 +15,22 @@ export interface IBlobStorageGetContentRequest {
|
|
|
15
15
|
* The query parameters.
|
|
16
16
|
*/
|
|
17
17
|
query?: {
|
|
18
|
+
/**
|
|
19
|
+
* Disables decryption if enabled by default.
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
disableDecryption?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Use a different vault key id for decryption, if not provided the default vault key id will be used.
|
|
25
|
+
* @default undefined
|
|
26
|
+
*/
|
|
27
|
+
overrideVaultKeyId?: string;
|
|
18
28
|
/**
|
|
19
29
|
* Set the download flag which should prompt the browser to save the file.
|
|
20
30
|
* Otherwise the browser should show the content inside the page.
|
|
21
31
|
* @default false
|
|
22
32
|
*/
|
|
23
|
-
download?:
|
|
33
|
+
download?: string;
|
|
24
34
|
/**
|
|
25
35
|
* Set the filename to use when a download is triggered.
|
|
26
36
|
* A filename will be generated if not provided.
|
|
@@ -26,6 +26,16 @@ export interface IBlobStorageGetRequest {
|
|
|
26
26
|
* Include the content in the response, otherwise only metadata is returned.
|
|
27
27
|
* @default false
|
|
28
28
|
*/
|
|
29
|
-
includeContent?:
|
|
29
|
+
includeContent?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Disables decryption if enabled by default.
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
disableDecryption?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Use a different vault key id for decryption, if not provided the default vault key id will be used.
|
|
37
|
+
* @default undefined
|
|
38
|
+
*/
|
|
39
|
+
overrideVaultKeyId?: string;
|
|
30
40
|
};
|
|
31
41
|
}
|
|
@@ -28,5 +28,15 @@ export interface IBlobStorageUpdateRequest {
|
|
|
28
28
|
* Custom metadata to associate with the blob as JSON-LD.
|
|
29
29
|
*/
|
|
30
30
|
metadata?: IJsonLdNodeObject;
|
|
31
|
+
/**
|
|
32
|
+
* Disables encryption if enabled by default.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
disableEncryption?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Use a different vault key id for encryption, if not provided the default vault key id will be used.
|
|
38
|
+
* @default undefined
|
|
39
|
+
*/
|
|
40
|
+
overrideVaultKeyId?: string;
|
|
31
41
|
};
|
|
32
42
|
}
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @twin.org/blob-storage-models - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.1-next.35](https://github.com/twinfoundation/blob-storage/compare/blob-storage-models-v0.0.1-next.34...blob-storage-models-v0.0.1-next.35) (2025-06-17)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* additional encryption options on per item basis ([4b95a65](https://github.com/twinfoundation/blob-storage/commit/4b95a656d19e3b571cea905e36f29b679b13e1e8))
|
|
9
|
+
|
|
10
|
+
## [0.0.1-next.34](https://github.com/twinfoundation/blob-storage/compare/blob-storage-models-v0.0.1-next.33...blob-storage-models-v0.0.1-next.34) (2025-06-12)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* update dependencies ([56f0094](https://github.com/twinfoundation/blob-storage/commit/56f0094b68d8bd22864cd899ac1b61d95540f719))
|
|
16
|
+
|
|
3
17
|
## [0.0.1-next.33](https://github.com/twinfoundation/blob-storage/compare/blob-storage-models-v0.0.1-next.32...blob-storage-models-v0.0.1-next.33) (2025-06-03)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -10,7 +10,7 @@ Interface describing an blob storage component.
|
|
|
10
10
|
|
|
11
11
|
### create()
|
|
12
12
|
|
|
13
|
-
> **create**(`blob`, `encodingFormat?`, `fileExtension?`, `metadata?`, `
|
|
13
|
+
> **create**(`blob`, `encodingFormat?`, `fileExtension?`, `metadata?`, `options?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`string`\>
|
|
14
14
|
|
|
15
15
|
Create the blob with some metadata.
|
|
16
16
|
|
|
@@ -40,7 +40,23 @@ Extension for the blob, will be detected if left undefined.
|
|
|
40
40
|
|
|
41
41
|
Data for the custom metadata as JSON-LD.
|
|
42
42
|
|
|
43
|
-
#####
|
|
43
|
+
##### options?
|
|
44
|
+
|
|
45
|
+
Optional options for the creation of the blob.
|
|
46
|
+
|
|
47
|
+
###### disableEncryption?
|
|
48
|
+
|
|
49
|
+
`boolean`
|
|
50
|
+
|
|
51
|
+
Disables encryption if enabled by default.
|
|
52
|
+
|
|
53
|
+
###### overrideVaultKeyId?
|
|
54
|
+
|
|
55
|
+
`string`
|
|
56
|
+
|
|
57
|
+
Use a different vault key id for encryption, if not provided the default vault key id will be used.
|
|
58
|
+
|
|
59
|
+
###### namespace?
|
|
44
60
|
|
|
45
61
|
`string`
|
|
46
62
|
|
|
@@ -68,7 +84,7 @@ The id of the stored blob in urn format.
|
|
|
68
84
|
|
|
69
85
|
### get()
|
|
70
86
|
|
|
71
|
-
> **get**(`id`, `
|
|
87
|
+
> **get**(`id`, `options?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<[`IBlobStorageEntry`](IBlobStorageEntry.md)\>
|
|
72
88
|
|
|
73
89
|
Get the blob and metadata.
|
|
74
90
|
|
|
@@ -80,12 +96,28 @@ Get the blob and metadata.
|
|
|
80
96
|
|
|
81
97
|
The id of the blob to get in urn format.
|
|
82
98
|
|
|
83
|
-
#####
|
|
99
|
+
##### options?
|
|
100
|
+
|
|
101
|
+
Optional options for the retrieval of the blob.
|
|
102
|
+
|
|
103
|
+
###### includeContent?
|
|
84
104
|
|
|
85
105
|
`boolean`
|
|
86
106
|
|
|
87
107
|
Include the content, or just get the metadata.
|
|
88
108
|
|
|
109
|
+
###### disableDecryption?
|
|
110
|
+
|
|
111
|
+
`boolean`
|
|
112
|
+
|
|
113
|
+
Disables decryption if enabled by default.
|
|
114
|
+
|
|
115
|
+
###### overrideVaultKeyId?
|
|
116
|
+
|
|
117
|
+
`string`
|
|
118
|
+
|
|
119
|
+
Use a different vault key id for decryption, if not provided the default vault key id will be used.
|
|
120
|
+
|
|
89
121
|
##### userIdentity?
|
|
90
122
|
|
|
91
123
|
`string`
|
|
@@ -34,6 +34,30 @@ The extension of the blob, will be detected if left undefined.
|
|
|
34
34
|
|
|
35
35
|
Custom metadata to associate with the blob as JSON-LD.
|
|
36
36
|
|
|
37
|
+
#### disableEncryption?
|
|
38
|
+
|
|
39
|
+
> `optional` **disableEncryption**: `boolean`
|
|
40
|
+
|
|
41
|
+
Disables encryption if enabled by default.
|
|
42
|
+
|
|
43
|
+
##### Default
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
false
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
#### overrideVaultKeyId?
|
|
50
|
+
|
|
51
|
+
> `optional` **overrideVaultKeyId**: `string`
|
|
52
|
+
|
|
53
|
+
Use a different vault key id for encryption, if not provided the default vault key id will be used.
|
|
54
|
+
|
|
55
|
+
##### Default
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
undefined
|
|
59
|
+
```
|
|
60
|
+
|
|
37
61
|
#### namespace?
|
|
38
62
|
|
|
39
63
|
> `optional` **namespace**: `string`
|
|
@@ -24,9 +24,33 @@ The id of the blob to get in urn format.
|
|
|
24
24
|
|
|
25
25
|
The query parameters.
|
|
26
26
|
|
|
27
|
+
#### disableDecryption?
|
|
28
|
+
|
|
29
|
+
> `optional` **disableDecryption**: `string`
|
|
30
|
+
|
|
31
|
+
Disables decryption if enabled by default.
|
|
32
|
+
|
|
33
|
+
##### Default
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
false
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
#### overrideVaultKeyId?
|
|
40
|
+
|
|
41
|
+
> `optional` **overrideVaultKeyId**: `string`
|
|
42
|
+
|
|
43
|
+
Use a different vault key id for decryption, if not provided the default vault key id will be used.
|
|
44
|
+
|
|
45
|
+
##### Default
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
undefined
|
|
49
|
+
```
|
|
50
|
+
|
|
27
51
|
#### download?
|
|
28
52
|
|
|
29
|
-
> `optional` **download**: `
|
|
53
|
+
> `optional` **download**: `string`
|
|
30
54
|
|
|
31
55
|
Set the download flag which should prompt the browser to save the file.
|
|
32
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**: `
|
|
41
|
+
> `optional` **includeContent**: `string`
|
|
42
42
|
|
|
43
43
|
Include the content in the response, otherwise only metadata is returned.
|
|
44
44
|
|
|
@@ -47,3 +47,27 @@ Include the content in the response, otherwise only metadata is returned.
|
|
|
47
47
|
```ts
|
|
48
48
|
false
|
|
49
49
|
```
|
|
50
|
+
|
|
51
|
+
#### disableDecryption?
|
|
52
|
+
|
|
53
|
+
> `optional` **disableDecryption**: `string`
|
|
54
|
+
|
|
55
|
+
Disables decryption if enabled by default.
|
|
56
|
+
|
|
57
|
+
##### Default
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
false
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### overrideVaultKeyId?
|
|
64
|
+
|
|
65
|
+
> `optional` **overrideVaultKeyId**: `string`
|
|
66
|
+
|
|
67
|
+
Use a different vault key id for decryption, if not provided the default vault key id will be used.
|
|
68
|
+
|
|
69
|
+
##### Default
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
undefined
|
|
73
|
+
```
|
|
@@ -41,3 +41,27 @@ The extension of the blob, will be detected if left undefined.
|
|
|
41
41
|
> `optional` **metadata**: `IJsonLdNodeObject`
|
|
42
42
|
|
|
43
43
|
Custom metadata to associate with the blob as JSON-LD.
|
|
44
|
+
|
|
45
|
+
#### disableEncryption?
|
|
46
|
+
|
|
47
|
+
> `optional` **disableEncryption**: `boolean`
|
|
48
|
+
|
|
49
|
+
Disables encryption if enabled by default.
|
|
50
|
+
|
|
51
|
+
##### Default
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
false
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
#### overrideVaultKeyId?
|
|
58
|
+
|
|
59
|
+
> `optional` **overrideVaultKeyId**: `string`
|
|
60
|
+
|
|
61
|
+
Use a different vault key id for encryption, if not provided the default vault key id will be used.
|
|
62
|
+
|
|
63
|
+
##### Default
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
undefined
|
|
67
|
+
```
|