@twin.org/blob-storage-models 0.0.1-next.35 → 0.0.1-next.36

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.
@@ -30,7 +30,26 @@ const BlobStorageTypes = {
30
30
  /**
31
31
  * Represents blob storage entry.
32
32
  */
33
- Entry: "BlobStorageEntry"
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
+ ]
34
53
  };
35
54
 
36
55
  var $schema = "https://json-schema.org/draft/2020-12/schema";
@@ -89,6 +108,10 @@ var properties = {
89
108
  type: "boolean",
90
109
  description: "Indicates if the blob is encrypted."
91
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
+ },
92
115
  fileExtension: {
93
116
  type: "string",
94
117
  description: "The extension."
@@ -137,6 +160,12 @@ class BlobStorageDataTypes {
137
160
  defaultValue: {},
138
161
  jsonSchema: async () => BlobStorageEntrySchema
139
162
  }));
163
+ dataCore.DataTypeHandlerFactory.register(`${BlobStorageContexts.ContextRoot}${BlobStorageTypes.CompressionType}`, () => ({
164
+ context: BlobStorageContexts.ContextRoot,
165
+ type: BlobStorageTypes.CompressionType,
166
+ defaultValue: {},
167
+ jsonSchema: async () => BlobStorageCompressionTypeSchema
168
+ }));
140
169
  }
141
170
  }
142
171
 
@@ -148,6 +177,24 @@ class BlobStorageDataTypes {
148
177
  // eslint-disable-next-line @typescript-eslint/naming-convention
149
178
  const BlobStorageConnectorFactory = core.Factory.createFactory("blob-storage");
150
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;
151
198
  exports.BlobStorageConnectorFactory = BlobStorageConnectorFactory;
152
199
  exports.BlobStorageContexts = BlobStorageContexts;
153
200
  exports.BlobStorageDataTypes = BlobStorageDataTypes;
@@ -28,7 +28,26 @@ const BlobStorageTypes = {
28
28
  /**
29
29
  * Represents blob storage entry.
30
30
  */
31
- Entry: "BlobStorageEntry"
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
+ ]
32
51
  };
33
52
 
34
53
  var $schema = "https://json-schema.org/draft/2020-12/schema";
@@ -87,6 +106,10 @@ var properties = {
87
106
  type: "boolean",
88
107
  description: "Indicates if the blob is encrypted."
89
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
+ },
90
113
  fileExtension: {
91
114
  type: "string",
92
115
  description: "The extension."
@@ -135,6 +158,12 @@ class BlobStorageDataTypes {
135
158
  defaultValue: {},
136
159
  jsonSchema: async () => BlobStorageEntrySchema
137
160
  }));
161
+ DataTypeHandlerFactory.register(`${BlobStorageContexts.ContextRoot}${BlobStorageTypes.CompressionType}`, () => ({
162
+ context: BlobStorageContexts.ContextRoot,
163
+ type: BlobStorageTypes.CompressionType,
164
+ defaultValue: {},
165
+ jsonSchema: async () => BlobStorageCompressionTypeSchema
166
+ }));
138
167
  }
139
168
  }
140
169
 
@@ -146,4 +175,21 @@ class BlobStorageDataTypes {
146
175
  // eslint-disable-next-line @typescript-eslint/naming-convention
147
176
  const BlobStorageConnectorFactory = Factory.createFactory("blob-storage");
148
177
 
149
- export { BlobStorageConnectorFactory, BlobStorageContexts, BlobStorageDataTypes, BlobStorageTypes };
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 };
@@ -9,6 +9,7 @@ export * from "./models/api/IBlobStorageListRequest";
9
9
  export * from "./models/api/IBlobStorageListResponse";
10
10
  export * from "./models/api/IBlobStorageRemoveRequest";
11
11
  export * from "./models/api/IBlobStorageUpdateRequest";
12
+ export * from "./models/blobStorageCompressionType";
12
13
  export * from "./models/blobStorageContexts";
13
14
  export * from "./models/blobStorageTypes";
14
15
  export * from "./models/IBlobStorageComponent";
@@ -1,6 +1,7 @@
1
1
  import type { IComponent } from "@twin.org/core";
2
2
  import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
3
3
  import type { EntityCondition, SortDirection } from "@twin.org/entity";
4
+ import type { BlobStorageCompressionType } from "./blobStorageCompressionType";
4
5
  import type { IBlobStorageEntry } from "./IBlobStorageEntry";
5
6
  import type { IBlobStorageEntryList } from "./IBlobStorageEntryList";
6
7
  /**
@@ -16,6 +17,7 @@ export interface IBlobStorageComponent extends IComponent {
16
17
  * @param options Optional options for the creation of the blob.
17
18
  * @param options.disableEncryption Disables encryption if enabled by default.
18
19
  * @param options.overrideVaultKeyId Use a different vault key id for encryption, if not provided the default vault key id will be used.
20
+ * @param options.compress Optional compression type to use for the blob, defaults to no compression.
19
21
  * @param options.namespace The namespace to use for storing, defaults to component configured namespace.
20
22
  * @param userIdentity The user identity to use with storage operations.
21
23
  * @param nodeIdentity The node identity to use with storage operations.
@@ -24,6 +26,7 @@ export interface IBlobStorageComponent extends IComponent {
24
26
  create(blob: string, encodingFormat?: string, fileExtension?: string, metadata?: IJsonLdNodeObject, options?: {
25
27
  disableEncryption?: boolean;
26
28
  overrideVaultKeyId?: string;
29
+ compress?: BlobStorageCompressionType;
27
30
  namespace?: string;
28
31
  }, userIdentity?: string, nodeIdentity?: string): Promise<string>;
29
32
  /**
@@ -31,8 +34,8 @@ export interface IBlobStorageComponent extends IComponent {
31
34
  * @param id The id of the blob to get in urn format.
32
35
  * @param options Optional options for the retrieval of the blob.
33
36
  * @param options.includeContent Include the content, or just get the metadata.
34
- * @param options.disableDecryption Disables decryption if enabled by default.
35
37
  * @param options.overrideVaultKeyId Use a different vault key id for decryption, if not provided the default vault key id will be used.
38
+ * @param options.decompress If the content should be decompressed, if it was compressed when stored, defaults to true.
36
39
  * @param userIdentity The user identity to use with storage operations.
37
40
  * @param nodeIdentity The node identity to use with storage operations.
38
41
  * @returns The data and metadata for the blob if it can be found.
@@ -40,7 +43,7 @@ export interface IBlobStorageComponent extends IComponent {
40
43
  */
41
44
  get(id: string, options?: {
42
45
  includeContent?: boolean;
43
- disableDecryption?: boolean;
46
+ decompress?: boolean;
44
47
  overrideVaultKeyId?: string;
45
48
  }, userIdentity?: string, nodeIdentity?: string): Promise<IBlobStorageEntry>;
46
49
  /**
@@ -1,4 +1,5 @@
1
1
  import type { IJsonLdContextDefinitionElement, IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
+ import type { BlobStorageCompressionType } from "./blobStorageCompressionType";
2
3
  import type { BlobStorageContexts } from "./blobStorageContexts";
3
4
  import type { BlobStorageTypes } from "./blobStorageTypes";
4
5
  /**
@@ -45,6 +46,10 @@ export interface IBlobStorageEntry {
45
46
  * Indicates if the blob is encrypted.
46
47
  */
47
48
  isEncrypted?: boolean;
49
+ /**
50
+ * The type of compression used for the blob, if not set it is not stored with compression.
51
+ */
52
+ compression?: BlobStorageCompressionType;
48
53
  /**
49
54
  * The extension.
50
55
  */
@@ -1,4 +1,5 @@
1
1
  import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
+ import type { BlobStorageCompressionType } from "../blobStorageCompressionType";
2
3
  /**
3
4
  * Request to create an entry in blob storage.
4
5
  */
@@ -28,6 +29,10 @@ export interface IBlobStorageCreateRequest {
28
29
  * @default false
29
30
  */
30
31
  disableEncryption?: boolean;
32
+ /**
33
+ * Optional compression type to use for the blob, defaults to no compression.
34
+ */
35
+ compress?: BlobStorageCompressionType;
31
36
  /**
32
37
  * Use a different vault key id for encryption, if not provided the default vault key id will be used.
33
38
  * @default undefined
@@ -16,10 +16,10 @@ export interface IBlobStorageGetContentRequest {
16
16
  */
17
17
  query?: {
18
18
  /**
19
- * Disables decryption if enabled by default.
20
- * @default false
19
+ * If the content should be decompressed, if it was compressed when stored, defaults to true.
20
+ * @default true
21
21
  */
22
- disableDecryption?: string;
22
+ decompress?: string;
23
23
  /**
24
24
  * Use a different vault key id for decryption, if not provided the default vault key id will be used.
25
25
  * @default undefined
@@ -28,10 +28,10 @@ export interface IBlobStorageGetRequest {
28
28
  */
29
29
  includeContent?: string;
30
30
  /**
31
- * Disables decryption if enabled by default.
32
- * @default false
31
+ * If the content should be decompressed, if it was compressed when stored, defaults to true.
32
+ * @default true
33
33
  */
34
- disableDecryption?: string;
34
+ decompress?: string;
35
35
  /**
36
36
  * Use a different vault key id for decryption, if not provided the default vault key id will be used.
37
37
  * @default undefined
@@ -28,15 +28,5 @@ 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;
41
31
  };
42
32
  }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The types of compression for blob storage data.
3
+ */
4
+ export declare const BlobStorageCompressionType: {
5
+ /**
6
+ * Gzip.
7
+ */
8
+ readonly Gzip: "gzip";
9
+ /**
10
+ * Deflate.
11
+ */
12
+ readonly Deflate: "deflate";
13
+ };
14
+ /**
15
+ * The types of compression for blob storage data.
16
+ */
17
+ export type BlobStorageCompressionType = (typeof BlobStorageCompressionType)[keyof typeof BlobStorageCompressionType];
@@ -6,6 +6,10 @@ export declare const BlobStorageTypes: {
6
6
  * Represents blob storage entry.
7
7
  */
8
8
  readonly Entry: "BlobStorageEntry";
9
+ /**
10
+ * Represents blob storage entry compression.
11
+ */
12
+ readonly CompressionType: "BlobStorageCompressionType";
9
13
  };
10
14
  /**
11
15
  * The types of blob storage data.
package/docs/changelog.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @twin.org/blob-storage-models - Changelog
2
2
 
3
+ ## [0.0.1-next.36](https://github.com/twinfoundation/blob-storage/compare/blob-storage-models-v0.0.1-next.35...blob-storage-models-v0.0.1-next.36) (2025-06-19)
4
+
5
+
6
+ ### Features
7
+
8
+ * add compression support ([67d239b](https://github.com/twinfoundation/blob-storage/commit/67d239bca8321bd90bf4ff93167c564130309730))
9
+
3
10
  ## [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
11
 
5
12
 
@@ -22,11 +22,13 @@
22
22
 
23
23
  ## Type Aliases
24
24
 
25
+ - [BlobStorageCompressionType](type-aliases/BlobStorageCompressionType.md)
25
26
  - [BlobStorageContexts](type-aliases/BlobStorageContexts.md)
26
27
  - [BlobStorageTypes](type-aliases/BlobStorageTypes.md)
27
28
 
28
29
  ## Variables
29
30
 
30
31
  - [BlobStorageConnectorFactory](variables/BlobStorageConnectorFactory.md)
32
+ - [BlobStorageCompressionType](variables/BlobStorageCompressionType.md)
31
33
  - [BlobStorageContexts](variables/BlobStorageContexts.md)
32
34
  - [BlobStorageTypes](variables/BlobStorageTypes.md)
@@ -56,6 +56,12 @@ Disables encryption if enabled by default.
56
56
 
57
57
  Use a different vault key id for encryption, if not provided the default vault key id will be used.
58
58
 
59
+ ###### compress?
60
+
61
+ [`BlobStorageCompressionType`](../type-aliases/BlobStorageCompressionType.md)
62
+
63
+ Optional compression type to use for the blob, defaults to no compression.
64
+
59
65
  ###### namespace?
60
66
 
61
67
  `string`
@@ -106,11 +112,11 @@ Optional options for the retrieval of the blob.
106
112
 
107
113
  Include the content, or just get the metadata.
108
114
 
109
- ###### disableDecryption?
115
+ ###### decompress?
110
116
 
111
117
  `boolean`
112
118
 
113
- Disables decryption if enabled by default.
119
+ If the content should be decompressed, if it was compressed when stored, defaults to true.
114
120
 
115
121
  ###### overrideVaultKeyId?
116
122
 
@@ -46,6 +46,12 @@ Disables encryption if enabled by default.
46
46
  false
47
47
  ```
48
48
 
49
+ #### compress?
50
+
51
+ > `optional` **compress**: [`BlobStorageCompressionType`](../type-aliases/BlobStorageCompressionType.md)
52
+
53
+ Optional compression type to use for the blob, defaults to no compression.
54
+
49
55
  #### overrideVaultKeyId?
50
56
 
51
57
  > `optional` **overrideVaultKeyId**: `string`
@@ -76,6 +76,14 @@ Indicates if the blob is encrypted.
76
76
 
77
77
  ***
78
78
 
79
+ ### compression?
80
+
81
+ > `optional` **compression**: [`BlobStorageCompressionType`](../type-aliases/BlobStorageCompressionType.md)
82
+
83
+ The type of compression used for the blob, if not set it is not stored with compression.
84
+
85
+ ***
86
+
79
87
  ### fileExtension?
80
88
 
81
89
  > `optional` **fileExtension**: `string`
@@ -24,16 +24,16 @@ The id of the blob to get in urn format.
24
24
 
25
25
  The query parameters.
26
26
 
27
- #### disableDecryption?
27
+ #### decompress?
28
28
 
29
- > `optional` **disableDecryption**: `string`
29
+ > `optional` **decompress**: `string`
30
30
 
31
- Disables decryption if enabled by default.
31
+ If the content should be decompressed, if it was compressed when stored, defaults to true.
32
32
 
33
33
  ##### Default
34
34
 
35
35
  ```ts
36
- false
36
+ true
37
37
  ```
38
38
 
39
39
  #### overrideVaultKeyId?
@@ -48,16 +48,16 @@ Include the content in the response, otherwise only metadata is returned.
48
48
  false
49
49
  ```
50
50
 
51
- #### disableDecryption?
51
+ #### decompress?
52
52
 
53
- > `optional` **disableDecryption**: `string`
53
+ > `optional` **decompress**: `string`
54
54
 
55
- Disables decryption if enabled by default.
55
+ If the content should be decompressed, if it was compressed when stored, defaults to true.
56
56
 
57
57
  ##### Default
58
58
 
59
59
  ```ts
60
- false
60
+ true
61
61
  ```
62
62
 
63
63
  #### overrideVaultKeyId?
@@ -41,27 +41,3 @@ 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
- ```
@@ -0,0 +1,5 @@
1
+ # Type Alias: BlobStorageCompressionType
2
+
3
+ > **BlobStorageCompressionType** = *typeof* [`BlobStorageCompressionType`](../variables/BlobStorageCompressionType.md)\[keyof *typeof* [`BlobStorageCompressionType`](../variables/BlobStorageCompressionType.md)\]
4
+
5
+ The types of compression for blob storage data.
@@ -0,0 +1,19 @@
1
+ # Variable: BlobStorageCompressionType
2
+
3
+ > `const` **BlobStorageCompressionType**: `object`
4
+
5
+ The types of compression for blob storage data.
6
+
7
+ ## Type declaration
8
+
9
+ ### Gzip
10
+
11
+ > `readonly` **Gzip**: `"gzip"` = `"gzip"`
12
+
13
+ Gzip.
14
+
15
+ ### Deflate
16
+
17
+ > `readonly` **Deflate**: `"deflate"` = `"deflate"`
18
+
19
+ Deflate.
@@ -11,3 +11,9 @@ The types of blob storage data.
11
11
  > `readonly` **Entry**: `"BlobStorageEntry"` = `"BlobStorageEntry"`
12
12
 
13
13
  Represents blob storage entry.
14
+
15
+ ### CompressionType
16
+
17
+ > `readonly` **CompressionType**: `"BlobStorageCompressionType"` = `"BlobStorageCompressionType"`
18
+
19
+ Represents blob storage entry compression.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/blob-storage-models",
3
- "version": "0.0.1-next.35",
3
+ "version": "0.0.1-next.36",
4
4
  "description": "Models which define the structure of the blob storage contracts and connectors",
5
5
  "repository": {
6
6
  "type": "git",