@twin.org/blob-storage-service 0.0.1-next.8 → 0.0.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.
Files changed (28) hide show
  1. package/dist/cjs/index.cjs +643 -114
  2. package/dist/esm/index.mjs +645 -117
  3. package/dist/types/blobStorageRoutes.d.ts +17 -3
  4. package/dist/types/blobStorageService.d.ts +55 -31
  5. package/dist/types/entities/blobStorageEntry.d.ts +55 -0
  6. package/dist/types/index.d.ts +2 -1
  7. package/dist/types/models/IBlobStorageServiceConfig.d.ts +9 -2
  8. package/dist/types/models/IBlobStorageServiceConstructorOptions.d.ts +19 -0
  9. package/dist/types/restEntryPoints.d.ts +5 -0
  10. package/docs/changelog.md +161 -1
  11. package/docs/open-api/spec.json +1230 -1853
  12. package/docs/reference/classes/BlobStorageEntry.md +109 -0
  13. package/docs/reference/classes/BlobStorageService.md +188 -49
  14. package/docs/reference/functions/blobStorageCreate.md +9 -3
  15. package/docs/reference/functions/blobStorageGet.md +9 -3
  16. package/docs/reference/functions/blobStorageGetContent.md +9 -3
  17. package/docs/reference/functions/blobStorageList.md +31 -0
  18. package/docs/reference/functions/blobStorageRemove.md +9 -3
  19. package/docs/reference/functions/blobStorageUpdate.md +9 -3
  20. package/docs/reference/functions/generateRestRoutesBlobStorage.md +24 -4
  21. package/docs/reference/index.md +3 -1
  22. package/docs/reference/interfaces/IBlobStorageServiceConfig.md +17 -7
  23. package/docs/reference/interfaces/IBlobStorageServiceConstructorOptions.md +33 -0
  24. package/docs/reference/variables/restEntryPoints.md +4 -0
  25. package/locales/en.json +2 -1
  26. package/package.json +15 -13
  27. package/dist/types/entities/blobMetadata.d.ts +0 -22
  28. package/docs/reference/classes/BlobMetadata.md +0 -45
@@ -0,0 +1,109 @@
1
+ # Class: BlobStorageEntry
2
+
3
+ Class representing entry for the blob storage.
4
+
5
+ ## Constructors
6
+
7
+ ### Constructor
8
+
9
+ > **new BlobStorageEntry**(): `BlobStorageEntry`
10
+
11
+ #### Returns
12
+
13
+ `BlobStorageEntry`
14
+
15
+ ## Properties
16
+
17
+ ### id
18
+
19
+ > **id**: `string`
20
+
21
+ The id for the blob.
22
+
23
+ ***
24
+
25
+ ### dateCreated
26
+
27
+ > **dateCreated**: `string`
28
+
29
+ The date/time when the entry was created.
30
+
31
+ ***
32
+
33
+ ### dateModified?
34
+
35
+ > `optional` **dateModified**: `string`
36
+
37
+ The date/time when the entry was modified.
38
+
39
+ ***
40
+
41
+ ### blobSize
42
+
43
+ > **blobSize**: `number`
44
+
45
+ The length of the data in the blob.
46
+
47
+ ***
48
+
49
+ ### blobHash
50
+
51
+ > **blobHash**: `string`
52
+
53
+ The hash of the data in the blob.
54
+
55
+ ***
56
+
57
+ ### encodingFormat?
58
+
59
+ > `optional` **encodingFormat**: `string`
60
+
61
+ The mime type for the blob.
62
+
63
+ ***
64
+
65
+ ### fileExtension?
66
+
67
+ > `optional` **fileExtension**: `string`
68
+
69
+ The extension.
70
+
71
+ ***
72
+
73
+ ### metadata?
74
+
75
+ > `optional` **metadata**: `IJsonLdNodeObject`
76
+
77
+ The metadata for the blob as JSON-LD.
78
+
79
+ ***
80
+
81
+ ### isEncrypted
82
+
83
+ > **isEncrypted**: `boolean`
84
+
85
+ Is the entry encrypted.
86
+
87
+ ***
88
+
89
+ ### compression?
90
+
91
+ > `optional` **compression**: `BlobStorageCompressionType`
92
+
93
+ Is the entry compressed.
94
+
95
+ ***
96
+
97
+ ### userIdentity?
98
+
99
+ > `optional` **userIdentity**: `string`
100
+
101
+ The user identity that created the blob.
102
+
103
+ ***
104
+
105
+ ### nodeIdentity?
106
+
107
+ > `optional` **nodeIdentity**: `string`
108
+
109
+ The node identity that created the blob.
@@ -8,33 +8,23 @@ Service for performing blob storage operations to a connector.
8
8
 
9
9
  ## Constructors
10
10
 
11
- ### new BlobStorageService()
11
+ ### Constructor
12
12
 
13
- > **new BlobStorageService**(`options`?): [`BlobStorageService`](BlobStorageService.md)
13
+ > **new BlobStorageService**(`options?`): `BlobStorageService`
14
14
 
15
15
  Create a new instance of BlobStorageService.
16
16
 
17
17
  #### Parameters
18
18
 
19
- **options?**
19
+ ##### options?
20
20
 
21
- The dependencies for the service.
21
+ [`IBlobStorageServiceConstructorOptions`](../interfaces/IBlobStorageServiceConstructorOptions.md)
22
22
 
23
- **options.metadataEntityStorageType?**: `string`
24
-
25
- The type of the storage connector for the metadata, defaults to "blob-metadata".
26
-
27
- • **options.vaultConnectorType?**: `string`
28
-
29
- The type of the vault connector for encryption, if undefined no encryption will be performed.
30
-
31
- • **options.config?**: [`IBlobStorageServiceConfig`](../interfaces/IBlobStorageServiceConfig.md)
32
-
33
- The configuration for the service.
23
+ The options for the service.
34
24
 
35
25
  #### Returns
36
26
 
37
- [`BlobStorageService`](BlobStorageService.md)
27
+ `BlobStorageService`
38
28
 
39
29
  ## Properties
40
30
 
@@ -60,35 +50,75 @@ Runtime name for the class.
60
50
 
61
51
  ### create()
62
52
 
63
- > **create**(`blob`, `mimeType`?, `extension`?, `metadata`?, `namespace`?, `nodeIdentity`?): `Promise`\<`string`\>
53
+ > **create**(`blob`, `encodingFormat?`, `fileExtension?`, `metadata?`, `options?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`string`\>
64
54
 
65
55
  Create the blob with some metadata.
66
56
 
67
57
  #### Parameters
68
58
 
69
- **blob**: `string`
59
+ ##### blob
60
+
61
+ `string`
70
62
 
71
63
  The data for the blob in base64 format.
72
64
 
73
- **mimeType?**: `string`
65
+ ##### encodingFormat?
66
+
67
+ `string`
74
68
 
75
69
  Mime type for the blob, will be detected if left undefined.
76
70
 
77
- **extension?**: `string`
71
+ ##### fileExtension?
72
+
73
+ `string`
78
74
 
79
75
  Extension for the blob, will be detected if left undefined.
80
76
 
81
- **metadata?**: `IJsonLdNodeObject`
77
+ ##### metadata?
78
+
79
+ `IJsonLdNodeObject`
82
80
 
83
81
  Data for the custom metadata as JSON-LD.
84
82
 
85
- **namespace?**: `string`
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
+ ###### compress?
100
+
101
+ `BlobStorageCompressionType`
102
+
103
+ Optional compression type to use for the blob, defaults to no compression.*
104
+
105
+ ###### namespace?
106
+
107
+ `string`
86
108
 
87
109
  The namespace to use for storing, defaults to component configured namespace.
88
110
 
89
- **nodeIdentity?**: `string`
111
+ ##### userIdentity?
90
112
 
91
- The node identity which controls the vault key.
113
+ `string`
114
+
115
+ The user identity to use with storage operations.
116
+
117
+ ##### nodeIdentity?
118
+
119
+ `string`
120
+
121
+ The node identity to use with storage operations.
92
122
 
93
123
  #### Returns
94
124
 
@@ -104,45 +134,57 @@ The id of the stored blob in urn format.
104
134
 
105
135
  ### get()
106
136
 
107
- > **get**(`id`, `includeContent`, `nodeIdentity`?): `Promise`\<`object`\>
137
+ > **get**(`id`, `options?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`IBlobStorageEntry`\>
108
138
 
109
- Get the blob and metadata.
139
+ Get the blob entry.
110
140
 
111
141
  #### Parameters
112
142
 
113
- **id**: `string`
143
+ ##### id
144
+
145
+ `string`
114
146
 
115
147
  The id of the blob to get in urn format.
116
148
 
117
- **includeContent**: `boolean`
149
+ ##### options?
150
+
151
+ Optional options for the retrieval of the blob.
152
+
153
+ ###### includeContent?
154
+
155
+ `boolean`
118
156
 
119
157
  Include the content, or just get the metadata.
120
158
 
121
- **nodeIdentity?**: `string`
159
+ ###### decompress?
122
160
 
123
- The node identity which controls the vault key.
161
+ `boolean`
124
162
 
125
- #### Returns
163
+ If the content should be decompressed, if it was compressed when stored, defaults to true.
126
164
 
127
- `Promise`\<`object`\>
165
+ ###### overrideVaultKeyId?
128
166
 
129
- The metadata and data for the blob if it can be found.
167
+ `string`
130
168
 
131
- ##### blob?
169
+ Use a different vault key id for decryption, if not provided the default vault key id will be used.
132
170
 
133
- > `optional` **blob**: `string`
171
+ ##### userIdentity?
134
172
 
135
- ##### mimeType?
173
+ `string`
136
174
 
137
- > `optional` **mimeType**: `string`
175
+ The user identity to use with storage operations.
138
176
 
139
- ##### extension?
177
+ ##### nodeIdentity?
140
178
 
141
- > `optional` **extension**: `string`
179
+ `string`
142
180
 
143
- ##### metadata?
181
+ The node identity to use with storage operations.
182
+
183
+ #### Returns
184
+
185
+ `Promise`\<`IBlobStorageEntry`\>
144
186
 
145
- > `optional` **metadata**: `IJsonLdNodeObject`
187
+ The entry and data for the blob if it can be found.
146
188
 
147
189
  #### Throws
148
190
 
@@ -156,28 +198,48 @@ Not found error if the blob cannot be found.
156
198
 
157
199
  ### update()
158
200
 
159
- > **update**(`id`, `mimeType`?, `extension`?, `metadata`?): `Promise`\<`void`\>
201
+ > **update**(`id`, `encodingFormat?`, `fileExtension?`, `metadata?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`void`\>
160
202
 
161
203
  Update the blob with metadata.
162
204
 
163
205
  #### Parameters
164
206
 
165
- **id**: `string`
207
+ ##### id
208
+
209
+ `string`
166
210
 
167
- The id of the blob metadata to update.
211
+ The id of the blob entry to update.
168
212
 
169
- **mimeType?**: `string`
213
+ ##### encodingFormat?
214
+
215
+ `string`
170
216
 
171
217
  Mime type for the blob, will be detected if left undefined.
172
218
 
173
- **extension?**: `string`
219
+ ##### fileExtension?
220
+
221
+ `string`
174
222
 
175
223
  Extension for the blob, will be detected if left undefined.
176
224
 
177
- **metadata?**: `IJsonLdNodeObject`
225
+ ##### metadata?
226
+
227
+ `IJsonLdNodeObject`
178
228
 
179
229
  Data for the custom metadata as JSON-LD.
180
230
 
231
+ ##### userIdentity?
232
+
233
+ `string`
234
+
235
+ The user identity to use with storage operations.
236
+
237
+ ##### nodeIdentity?
238
+
239
+ `string`
240
+
241
+ The node identity to use with storage operations.
242
+
181
243
  #### Returns
182
244
 
183
245
  `Promise`\<`void`\>
@@ -196,16 +258,30 @@ Not found error if the blob cannot be found.
196
258
 
197
259
  ### remove()
198
260
 
199
- > **remove**(`id`): `Promise`\<`void`\>
261
+ > **remove**(`id`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`void`\>
200
262
 
201
263
  Remove the blob.
202
264
 
203
265
  #### Parameters
204
266
 
205
- **id**: `string`
267
+ ##### id
268
+
269
+ `string`
206
270
 
207
271
  The id of the blob to remove in urn format.
208
272
 
273
+ ##### userIdentity?
274
+
275
+ `string`
276
+
277
+ The user identity to use with storage operations.
278
+
279
+ ##### nodeIdentity?
280
+
281
+ `string`
282
+
283
+ The node identity to use with storage operations.
284
+
209
285
  #### Returns
210
286
 
211
287
  `Promise`\<`void`\>
@@ -215,3 +291,66 @@ Nothing.
215
291
  #### Implementation of
216
292
 
217
293
  `IBlobStorageComponent.remove`
294
+
295
+ ***
296
+
297
+ ### query()
298
+
299
+ > **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `cursor?`, `pageSize?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`IBlobStorageEntryList`\>
300
+
301
+ Query all the blob storage entries which match the conditions.
302
+
303
+ #### Parameters
304
+
305
+ ##### conditions?
306
+
307
+ `EntityCondition`\<`IBlobStorageEntry`\>
308
+
309
+ The conditions to match for the entries.
310
+
311
+ ##### orderBy?
312
+
313
+ The order for the results, defaults to created.
314
+
315
+ `"dateCreated"` | `"dateModified"`
316
+
317
+ ##### orderByDirection?
318
+
319
+ `SortDirection`
320
+
321
+ The direction for the order, defaults to descending.
322
+
323
+ ##### cursor?
324
+
325
+ `string`
326
+
327
+ The cursor to request the next page of entries.
328
+
329
+ ##### pageSize?
330
+
331
+ `number`
332
+
333
+ The suggested number of entries to return in each chunk, in some scenarios can return a different amount.
334
+
335
+ ##### userIdentity?
336
+
337
+ `string`
338
+
339
+ The user identity to use with storage operations.
340
+
341
+ ##### nodeIdentity?
342
+
343
+ `string`
344
+
345
+ The node identity to use with storage operations.
346
+
347
+ #### Returns
348
+
349
+ `Promise`\<`IBlobStorageEntryList`\>
350
+
351
+ All the entries for the storage matching the conditions,
352
+ and a cursor which can be used to request more entities.
353
+
354
+ #### Implementation of
355
+
356
+ `IBlobStorageComponent.query`
@@ -6,15 +6,21 @@ Create a blob in storage.
6
6
 
7
7
  ## Parameters
8
8
 
9
- **httpRequestContext**: `IHttpRequestContext`
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
10
12
 
11
13
  The request context for the API.
12
14
 
13
- **componentName**: `string`
15
+ ### componentName
16
+
17
+ `string`
14
18
 
15
19
  The name of the component to use in the routes.
16
20
 
17
- **request**: `IBlobStorageCreateRequest`
21
+ ### request
22
+
23
+ `IBlobStorageCreateRequest`
18
24
 
19
25
  The request.
20
26
 
@@ -6,15 +6,21 @@ Get the blob from storage.
6
6
 
7
7
  ## Parameters
8
8
 
9
- **httpRequestContext**: `IHttpRequestContext`
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
10
12
 
11
13
  The request context for the API.
12
14
 
13
- **componentName**: `string`
15
+ ### componentName
16
+
17
+ `string`
14
18
 
15
19
  The name of the component to use in the routes.
16
20
 
17
- **request**: `IBlobStorageGetRequest`
21
+ ### request
22
+
23
+ `IBlobStorageGetRequest`
18
24
 
19
25
  The request.
20
26
 
@@ -6,15 +6,21 @@ Get the blob from storage.
6
6
 
7
7
  ## Parameters
8
8
 
9
- **httpRequestContext**: `IHttpRequestContext`
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
10
12
 
11
13
  The request context for the API.
12
14
 
13
- **componentName**: `string`
15
+ ### componentName
16
+
17
+ `string`
14
18
 
15
19
  The name of the component to use in the routes.
16
20
 
17
- **request**: `IBlobStorageGetContentRequest`
21
+ ### request
22
+
23
+ `IBlobStorageGetContentRequest`
18
24
 
19
25
  The request.
20
26
 
@@ -0,0 +1,31 @@
1
+ # Function: blobStorageList()
2
+
3
+ > **blobStorageList**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IBlobStorageListResponse`\>
4
+
5
+ List the entries from blob storage.
6
+
7
+ ## Parameters
8
+
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
12
+
13
+ The request context for the API.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes.
20
+
21
+ ### request
22
+
23
+ `IBlobStorageListRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`IBlobStorageListResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -6,15 +6,21 @@ Remove the blob from storage.
6
6
 
7
7
  ## Parameters
8
8
 
9
- **httpRequestContext**: `IHttpRequestContext`
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
10
12
 
11
13
  The request context for the API.
12
14
 
13
- **componentName**: `string`
15
+ ### componentName
16
+
17
+ `string`
14
18
 
15
19
  The name of the component to use in the routes.
16
20
 
17
- **request**: `IBlobStorageRemoveRequest`
21
+ ### request
22
+
23
+ `IBlobStorageRemoveRequest`
18
24
 
19
25
  The request.
20
26
 
@@ -6,15 +6,21 @@ Update the blob storage metadata.
6
6
 
7
7
  ## Parameters
8
8
 
9
- **httpRequestContext**: `IHttpRequestContext`
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
10
12
 
11
13
  The request context for the API.
12
14
 
13
- **componentName**: `string`
15
+ ### componentName
16
+
17
+ `string`
14
18
 
15
19
  The name of the component to use in the routes.
16
20
 
17
- **request**: `IBlobStorageUpdateRequest`
21
+ ### request
22
+
23
+ `IBlobStorageUpdateRequest`
18
24
 
19
25
  The request.
20
26
 
@@ -1,21 +1,41 @@
1
1
  # Function: generateRestRoutesBlobStorage()
2
2
 
3
- > **generateRestRoutesBlobStorage**(`baseRouteName`, `componentName`): `IRestRoute`[]
3
+ > **generateRestRoutesBlobStorage**(`baseRouteName`, `componentName`, `options?`): `IRestRoute`\<`any`, `any`\>[]
4
4
 
5
5
  The REST routes for blob storage.
6
6
 
7
7
  ## Parameters
8
8
 
9
- **baseRouteName**: `string`
9
+ ### baseRouteName
10
+
11
+ `string`
10
12
 
11
13
  Prefix to prepend to the paths.
12
14
 
13
- **componentName**: `string`
15
+ ### componentName
16
+
17
+ `string`
14
18
 
15
19
  The name of the component to use in the routes stored in the ComponentFactory.
16
20
 
21
+ ### options?
22
+
23
+ Additional options for the routes.
24
+
25
+ #### typeName?
26
+
27
+ `string`
28
+
29
+ Optional type name to use in the routes, defaults to Blob Storage.
30
+
31
+ #### tagName?
32
+
33
+ `string`
34
+
35
+ Optional name to use in OpenAPI spec for tag.
36
+
17
37
  ## Returns
18
38
 
19
- `IRestRoute`[]
39
+ `IRestRoute`\<`any`, `any`\>[]
20
40
 
21
41
  The generated routes.
@@ -3,11 +3,12 @@
3
3
  ## Classes
4
4
 
5
5
  - [BlobStorageService](classes/BlobStorageService.md)
6
- - [BlobMetadata](classes/BlobMetadata.md)
6
+ - [BlobStorageEntry](classes/BlobStorageEntry.md)
7
7
 
8
8
  ## Interfaces
9
9
 
10
10
  - [IBlobStorageServiceConfig](interfaces/IBlobStorageServiceConfig.md)
11
+ - [IBlobStorageServiceConstructorOptions](interfaces/IBlobStorageServiceConstructorOptions.md)
11
12
 
12
13
  ## Variables
13
14
 
@@ -22,4 +23,5 @@
22
23
  - [blobStorageGetContent](functions/blobStorageGetContent.md)
23
24
  - [blobStorageUpdate](functions/blobStorageUpdate.md)
24
25
  - [blobStorageRemove](functions/blobStorageRemove.md)
26
+ - [blobStorageList](functions/blobStorageList.md)
25
27
  - [initSchema](functions/initSchema.md)