@twin.org/blob-storage-service 0.0.1-next.3 → 0.0.1-next.31

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.
@@ -0,0 +1,93 @@
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
+ ### userIdentity?
82
+
83
+ > `optional` **userIdentity**: `string`
84
+
85
+ The user identity that created the blob.
86
+
87
+ ***
88
+
89
+ ### nodeIdentity?
90
+
91
+ > `optional` **nodeIdentity**: `string`
92
+
93
+ 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,53 @@ 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?`, `namespace?`, `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
+ ##### namespace?
84
+
85
+ `string`
86
86
 
87
87
  The namespace to use for storing, defaults to component configured namespace.
88
88
 
89
- **nodeIdentity?**: `string`
89
+ ##### userIdentity?
90
+
91
+ `string`
92
+
93
+ The user identity to use with storage operations.
94
+
95
+ ##### nodeIdentity?
96
+
97
+ `string`
90
98
 
91
- The node identity which controls the vault key.
99
+ The node identity to use with storage operations.
92
100
 
93
101
  #### Returns
94
102
 
@@ -104,45 +112,41 @@ The id of the stored blob in urn format.
104
112
 
105
113
  ### get()
106
114
 
107
- > **get**(`id`, `includeContent`, `nodeIdentity`?): `Promise`\<`object`\>
115
+ > **get**(`id`, `includeContent`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`IBlobStorageEntry`\>
108
116
 
109
- Get the blob and metadata.
117
+ Get the blob entry.
110
118
 
111
119
  #### Parameters
112
120
 
113
- **id**: `string`
121
+ ##### id
114
122
 
115
- The id of the blob to get in urn format.
116
-
117
- • **includeContent**: `boolean`
123
+ `string`
118
124
 
119
- Include the content, or just get the metadata.
125
+ The id of the blob to get in urn format.
120
126
 
121
- **nodeIdentity?**: `string`
127
+ ##### includeContent
122
128
 
123
- The node identity which controls the vault key.
129
+ `boolean`
124
130
 
125
- #### Returns
131
+ Include the content, or just get the metadata.
126
132
 
127
- `Promise`\<`object`\>
133
+ ##### userIdentity?
128
134
 
129
- The metadata and data for the blob if it can be found.
135
+ `string`
130
136
 
131
- ##### blob?
137
+ The user identity to use with storage operations.
132
138
 
133
- > `optional` **blob**: `string`
139
+ ##### nodeIdentity?
134
140
 
135
- ##### mimeType?
141
+ `string`
136
142
 
137
- > `optional` **mimeType**: `string`
143
+ The node identity to use with storage operations.
138
144
 
139
- ##### extension?
145
+ #### Returns
140
146
 
141
- > `optional` **extension**: `string`
147
+ `Promise`\<`IBlobStorageEntry`\>
142
148
 
143
- ##### metadata?
144
-
145
- > `optional` **metadata**: `IJsonLdNodeObject`
149
+ The entry and data for the blob if it can be found.
146
150
 
147
151
  #### Throws
148
152
 
@@ -156,28 +160,48 @@ Not found error if the blob cannot be found.
156
160
 
157
161
  ### update()
158
162
 
159
- > **update**(`id`, `mimeType`?, `extension`?, `metadata`?): `Promise`\<`void`\>
163
+ > **update**(`id`, `encodingFormat?`, `fileExtension?`, `metadata?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`void`\>
160
164
 
161
165
  Update the blob with metadata.
162
166
 
163
167
  #### Parameters
164
168
 
165
- **id**: `string`
169
+ ##### id
170
+
171
+ `string`
166
172
 
167
- The id of the blob metadata to update.
173
+ The id of the blob entry to update.
168
174
 
169
- **mimeType?**: `string`
175
+ ##### encodingFormat?
176
+
177
+ `string`
170
178
 
171
179
  Mime type for the blob, will be detected if left undefined.
172
180
 
173
- **extension?**: `string`
181
+ ##### fileExtension?
182
+
183
+ `string`
174
184
 
175
185
  Extension for the blob, will be detected if left undefined.
176
186
 
177
- **metadata?**: `IJsonLdNodeObject`
187
+ ##### metadata?
188
+
189
+ `IJsonLdNodeObject`
178
190
 
179
191
  Data for the custom metadata as JSON-LD.
180
192
 
193
+ ##### userIdentity?
194
+
195
+ `string`
196
+
197
+ The user identity to use with storage operations.
198
+
199
+ ##### nodeIdentity?
200
+
201
+ `string`
202
+
203
+ The node identity to use with storage operations.
204
+
181
205
  #### Returns
182
206
 
183
207
  `Promise`\<`void`\>
@@ -196,16 +220,30 @@ Not found error if the blob cannot be found.
196
220
 
197
221
  ### remove()
198
222
 
199
- > **remove**(`id`): `Promise`\<`void`\>
223
+ > **remove**(`id`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`void`\>
200
224
 
201
225
  Remove the blob.
202
226
 
203
227
  #### Parameters
204
228
 
205
- **id**: `string`
229
+ ##### id
230
+
231
+ `string`
206
232
 
207
233
  The id of the blob to remove in urn format.
208
234
 
235
+ ##### userIdentity?
236
+
237
+ `string`
238
+
239
+ The user identity to use with storage operations.
240
+
241
+ ##### nodeIdentity?
242
+
243
+ `string`
244
+
245
+ The node identity to use with storage operations.
246
+
209
247
  #### Returns
210
248
 
211
249
  `Promise`\<`void`\>
@@ -215,3 +253,66 @@ Nothing.
215
253
  #### Implementation of
216
254
 
217
255
  `IBlobStorageComponent.remove`
256
+
257
+ ***
258
+
259
+ ### query()
260
+
261
+ > **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `cursor?`, `pageSize?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`IBlobStorageEntryList`\>
262
+
263
+ Query all the blob storage entries which match the conditions.
264
+
265
+ #### Parameters
266
+
267
+ ##### conditions?
268
+
269
+ `EntityCondition`\<`IBlobStorageEntry`\>
270
+
271
+ The conditions to match for the entries.
272
+
273
+ ##### orderBy?
274
+
275
+ The order for the results, defaults to created.
276
+
277
+ `"dateCreated"` | `"dateModified"`
278
+
279
+ ##### orderByDirection?
280
+
281
+ `SortDirection`
282
+
283
+ The direction for the order, defaults to descending.
284
+
285
+ ##### cursor?
286
+
287
+ `string`
288
+
289
+ The cursor to request the next page of entries.
290
+
291
+ ##### pageSize?
292
+
293
+ `number`
294
+
295
+ The suggested number of entries to return in each chunk, in some scenarios can return a different amount.
296
+
297
+ ##### userIdentity?
298
+
299
+ `string`
300
+
301
+ The user identity to use with storage operations.
302
+
303
+ ##### nodeIdentity?
304
+
305
+ `string`
306
+
307
+ The node identity to use with storage operations.
308
+
309
+ #### Returns
310
+
311
+ `Promise`\<`IBlobStorageEntryList`\>
312
+
313
+ All the entries for the storage matching the conditions,
314
+ and a cursor which can be used to request more entities.
315
+
316
+ #### Implementation of
317
+
318
+ `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)
@@ -24,3 +24,19 @@ blob-storage.
24
24
 
25
25
  The namespace of the default storage connector to use.
26
26
  Defaults to the first entry in the factory if not provided.
27
+
28
+ ***
29
+
30
+ ### includeNodeIdentity?
31
+
32
+ > `optional` **includeNodeIdentity**: `boolean`
33
+
34
+ Include the node identity when performing storage operations, defaults to true.
35
+
36
+ ***
37
+
38
+ ### includeUserIdentity?
39
+
40
+ > `optional` **includeUserIdentity**: `boolean`
41
+
42
+ Include the user identity when performing storage operations, defaults to true.
@@ -0,0 +1,33 @@
1
+ # Interface: IBlobStorageServiceConstructorOptions
2
+
3
+ Options for the Blob Storage Service constructor.
4
+
5
+ ## Properties
6
+
7
+ ### entryEntityStorageType?
8
+
9
+ > `optional` **entryEntityStorageType**: `string`
10
+
11
+ The type of the storage connector for the metadata.
12
+
13
+ #### Default
14
+
15
+ ```ts
16
+ blob-storage-entry
17
+ ```
18
+
19
+ ***
20
+
21
+ ### vaultConnectorType?
22
+
23
+ > `optional` **vaultConnectorType**: `string`
24
+
25
+ The type of the vault connector for encryption, if undefined no encryption will be performed.
26
+
27
+ ***
28
+
29
+ ### config?
30
+
31
+ > `optional` **config**: [`IBlobStorageServiceConfig`](IBlobStorageServiceConfig.md)
32
+
33
+ The configuration for the service.
@@ -1,3 +1,7 @@
1
1
  # Variable: restEntryPoints
2
2
 
3
3
  > `const` **restEntryPoints**: `IRestRouteEntryPoint`[]
4
+
5
+ These are dummy entry points for the blob storage service.
6
+ In reality your application would create its own entry points based on the
7
+ blob types it wants to store, using a custom defaultBaseRoute.