@twin.org/blob-storage-models 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.
Files changed (33) hide show
  1. package/dist/cjs/index.cjs +132 -0
  2. package/dist/esm/index.mjs +130 -1
  3. package/dist/types/dataTypes/blobStorageDataTypes.d.ts +9 -0
  4. package/dist/types/index.d.ts +7 -0
  5. package/dist/types/models/IBlobStorageComponent.d.ts +32 -15
  6. package/dist/types/models/IBlobStorageEntry.d.ts +56 -0
  7. package/dist/types/models/IBlobStorageEntryList.d.ts +30 -0
  8. package/dist/types/models/api/IBlobStorageCreateRequest.d.ts +2 -2
  9. package/dist/types/models/api/IBlobStorageGetRequest.d.ts +7 -0
  10. package/dist/types/models/api/IBlobStorageGetResponse.d.ts +9 -19
  11. package/dist/types/models/api/IBlobStorageListRequest.d.ts +39 -0
  12. package/dist/types/models/api/IBlobStorageListResponse.d.ts +17 -0
  13. package/dist/types/models/api/IBlobStorageUpdateRequest.d.ts +2 -2
  14. package/dist/types/models/blobStorageContexts.d.ts +17 -0
  15. package/dist/types/models/blobStorageTypes.d.ts +13 -0
  16. package/docs/changelog.md +22 -1
  17. package/docs/reference/classes/BlobStorageDataTypes.md +25 -0
  18. package/docs/reference/index.md +15 -0
  19. package/docs/reference/interfaces/IBlobStorageComponent.md +142 -35
  20. package/docs/reference/interfaces/IBlobStorageConnector.md +11 -5
  21. package/docs/reference/interfaces/IBlobStorageCreateRequest.md +4 -4
  22. package/docs/reference/interfaces/IBlobStorageEntry.md +91 -0
  23. package/docs/reference/interfaces/IBlobStorageEntryList.md +35 -0
  24. package/docs/reference/interfaces/IBlobStorageGetRequest.md +12 -0
  25. package/docs/reference/interfaces/IBlobStorageGetResponse.md +9 -21
  26. package/docs/reference/interfaces/IBlobStorageListRequest.md +53 -0
  27. package/docs/reference/interfaces/IBlobStorageListResponse.md +23 -0
  28. package/docs/reference/interfaces/IBlobStorageUpdateRequest.md +4 -4
  29. package/docs/reference/type-aliases/BlobStorageContexts.md +5 -0
  30. package/docs/reference/type-aliases/BlobStorageTypes.md +5 -0
  31. package/docs/reference/variables/BlobStorageContexts.md +19 -0
  32. package/docs/reference/variables/BlobStorageTypes.md +13 -0
  33. package/package.json +9 -31
package/docs/changelog.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @twin.org/blob-storage-models - Changelog
2
2
 
3
- ## v0.0.1-next.3
3
+ ## [0.0.1-next.31](https://github.com/twinfoundation/blob-storage/compare/blob-storage-models-v0.0.1-next.30...blob-storage-models-v0.0.1-next.31) (2025-05-08)
4
+
5
+
6
+ ### Features
7
+
8
+ * use standard list json ld types ([d6bdfd6](https://github.com/twinfoundation/blob-storage/commit/d6bdfd68af47f70f3cc53658b4a12543497e1f48))
9
+
10
+ ## [0.0.1-next.30](https://github.com/twinfoundation/blob-storage/compare/blob-storage-models-v0.0.1-next.29...blob-storage-models-v0.0.1-next.30) (2025-04-17)
11
+
12
+
13
+ ### Features
14
+
15
+ * use shared store mechanism ([#12](https://github.com/twinfoundation/blob-storage/issues/12)) ([cae8110](https://github.com/twinfoundation/blob-storage/commit/cae8110681847a1ac4fcac968b8196694e49c320))
16
+
17
+ ## [0.0.1-next.29](https://github.com/twinfoundation/blob-storage/compare/blob-storage-models-v0.0.1-next.28...blob-storage-models-v0.0.1-next.29) (2025-03-28)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * 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))
23
+
24
+ ## v0.0.1-next.28
4
25
 
5
26
  - Initial Release
@@ -0,0 +1,25 @@
1
+ # Class: BlobStorageDataTypes
2
+
3
+ Handle all the data types for blob storage.
4
+
5
+ ## Constructors
6
+
7
+ ### Constructor
8
+
9
+ > **new BlobStorageDataTypes**(): `BlobStorageDataTypes`
10
+
11
+ #### Returns
12
+
13
+ `BlobStorageDataTypes`
14
+
15
+ ## Methods
16
+
17
+ ### registerTypes()
18
+
19
+ > `static` **registerTypes**(): `void`
20
+
21
+ Register all the data types.
22
+
23
+ #### Returns
24
+
25
+ `void`
@@ -1,17 +1,32 @@
1
1
  # @twin.org/blob-storage-models
2
2
 
3
+ ## Classes
4
+
5
+ - [BlobStorageDataTypes](classes/BlobStorageDataTypes.md)
6
+
3
7
  ## Interfaces
4
8
 
5
9
  - [IBlobStorageComponent](interfaces/IBlobStorageComponent.md)
6
10
  - [IBlobStorageConnector](interfaces/IBlobStorageConnector.md)
11
+ - [IBlobStorageEntry](interfaces/IBlobStorageEntry.md)
12
+ - [IBlobStorageEntryList](interfaces/IBlobStorageEntryList.md)
7
13
  - [IBlobStorageCreateRequest](interfaces/IBlobStorageCreateRequest.md)
8
14
  - [IBlobStorageGetContentRequest](interfaces/IBlobStorageGetContentRequest.md)
9
15
  - [IBlobStorageGetContentResponse](interfaces/IBlobStorageGetContentResponse.md)
10
16
  - [IBlobStorageGetRequest](interfaces/IBlobStorageGetRequest.md)
11
17
  - [IBlobStorageGetResponse](interfaces/IBlobStorageGetResponse.md)
18
+ - [IBlobStorageListRequest](interfaces/IBlobStorageListRequest.md)
19
+ - [IBlobStorageListResponse](interfaces/IBlobStorageListResponse.md)
12
20
  - [IBlobStorageRemoveRequest](interfaces/IBlobStorageRemoveRequest.md)
13
21
  - [IBlobStorageUpdateRequest](interfaces/IBlobStorageUpdateRequest.md)
14
22
 
23
+ ## Type Aliases
24
+
25
+ - [BlobStorageContexts](type-aliases/BlobStorageContexts.md)
26
+ - [BlobStorageTypes](type-aliases/BlobStorageTypes.md)
27
+
15
28
  ## Variables
16
29
 
17
30
  - [BlobStorageConnectorFactory](variables/BlobStorageConnectorFactory.md)
31
+ - [BlobStorageContexts](variables/BlobStorageContexts.md)
32
+ - [BlobStorageTypes](variables/BlobStorageTypes.md)
@@ -10,35 +10,53 @@ Interface describing an blob storage component.
10
10
 
11
11
  ### create()
12
12
 
13
- > **create**(`blob`, `mimeType`?, `extension`?, `metadata`?, `namespace`?, `nodeIdentity`?): `Promise`\<`string`\>
13
+ > **create**(`blob`, `encodingFormat?`, `fileExtension?`, `metadata?`, `namespace?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`string`\>
14
14
 
15
15
  Create the blob with some metadata.
16
16
 
17
17
  #### Parameters
18
18
 
19
- **blob**: `string`
19
+ ##### blob
20
+
21
+ `string`
20
22
 
21
23
  The data for the blob in base64 format.
22
24
 
23
- **mimeType?**: `string`
25
+ ##### encodingFormat?
26
+
27
+ `string`
24
28
 
25
29
  Mime type for the blob, will be detected if left undefined.
26
30
 
27
- **extension?**: `string`
31
+ ##### fileExtension?
32
+
33
+ `string`
28
34
 
29
35
  Extension for the blob, will be detected if left undefined.
30
36
 
31
- **metadata?**: `IJsonLdNodeObject`
37
+ ##### metadata?
38
+
39
+ `IJsonLdNodeObject`
32
40
 
33
41
  Data for the custom metadata as JSON-LD.
34
42
 
35
- **namespace?**: `string`
43
+ ##### namespace?
44
+
45
+ `string`
36
46
 
37
47
  The namespace to use for storing, defaults to component configured namespace.
38
48
 
39
- **nodeIdentity?**: `string`
49
+ ##### userIdentity?
50
+
51
+ `string`
52
+
53
+ The user identity to use with storage operations.
54
+
55
+ ##### nodeIdentity?
40
56
 
41
- The node identity which controls the vault key.
57
+ `string`
58
+
59
+ The node identity to use with storage operations.
42
60
 
43
61
  #### Returns
44
62
 
@@ -50,45 +68,41 @@ The id of the stored blob in urn format.
50
68
 
51
69
  ### get()
52
70
 
53
- > **get**(`id`, `includeContent`, `nodeIdentity`?): `Promise`\<`object`\>
71
+ > **get**(`id`, `includeContent`, `userIdentity?`, `nodeIdentity?`): `Promise`\<[`IBlobStorageEntry`](IBlobStorageEntry.md)\>
54
72
 
55
73
  Get the blob and metadata.
56
74
 
57
75
  #### Parameters
58
76
 
59
- **id**: `string`
60
-
61
- The id of the blob to get in urn format.
77
+ ##### id
62
78
 
63
- • **includeContent**: `boolean`
64
-
65
- Include the content, or just get the metadata.
79
+ `string`
66
80
 
67
- **nodeIdentity?**: `string`
81
+ The id of the blob to get in urn format.
68
82
 
69
- The node identity which controls the vault key.
83
+ ##### includeContent
70
84
 
71
- #### Returns
85
+ `boolean`
72
86
 
73
- `Promise`\<`object`\>
87
+ Include the content, or just get the metadata.
74
88
 
75
- The data and metadata for the blob if it can be found.
89
+ ##### userIdentity?
76
90
 
77
- ##### blob?
91
+ `string`
78
92
 
79
- > `optional` **blob**: `string`
93
+ The user identity to use with storage operations.
80
94
 
81
- ##### mimeType?
95
+ ##### nodeIdentity?
82
96
 
83
- > `optional` **mimeType**: `string`
97
+ `string`
84
98
 
85
- ##### extension?
99
+ The node identity to use with storage operations.
86
100
 
87
- > `optional` **extension**: `string`
101
+ #### Returns
88
102
 
89
- ##### metadata?
103
+ `Promise`\<[`IBlobStorageEntry`](IBlobStorageEntry.md)\>
90
104
 
91
- > `optional` **metadata**: `IJsonLdNodeObject`
105
+ The data and metadata for the blob if it can be found.
92
106
 
93
107
  #### Throws
94
108
 
@@ -98,28 +112,48 @@ Not found error if the blob cannot be found.
98
112
 
99
113
  ### update()
100
114
 
101
- > **update**(`id`, `mimeType`?, `extension`?, `metadata`?): `Promise`\<`void`\>
115
+ > **update**(`id`, `encodingFormat?`, `fileExtension?`, `metadata?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`void`\>
102
116
 
103
117
  Update the blob with metadata.
104
118
 
105
119
  #### Parameters
106
120
 
107
- **id**: `string`
121
+ ##### id
122
+
123
+ `string`
108
124
 
109
125
  The id of the blob metadata to update.
110
126
 
111
- **mimeType?**: `string`
127
+ ##### encodingFormat?
128
+
129
+ `string`
112
130
 
113
131
  Mime type for the blob, will be detected if left undefined.
114
132
 
115
- **extension?**: `string`
133
+ ##### fileExtension?
134
+
135
+ `string`
116
136
 
117
137
  Extension for the blob, will be detected if left undefined.
118
138
 
119
- **metadata?**: `IJsonLdNodeObject`
139
+ ##### metadata?
140
+
141
+ `IJsonLdNodeObject`
120
142
 
121
143
  Data for the custom metadata as JSON-LD.
122
144
 
145
+ ##### userIdentity?
146
+
147
+ `string`
148
+
149
+ The user identity to use with storage operations.
150
+
151
+ ##### nodeIdentity?
152
+
153
+ `string`
154
+
155
+ The node identity to use with storage operations.
156
+
123
157
  #### Returns
124
158
 
125
159
  `Promise`\<`void`\>
@@ -134,16 +168,30 @@ Not found error if the blob cannot be found.
134
168
 
135
169
  ### remove()
136
170
 
137
- > **remove**(`id`): `Promise`\<`void`\>
171
+ > **remove**(`id`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`void`\>
138
172
 
139
173
  Remove the blob.
140
174
 
141
175
  #### Parameters
142
176
 
143
- **id**: `string`
177
+ ##### id
178
+
179
+ `string`
144
180
 
145
181
  The id of the blob to remove in urn format.
146
182
 
183
+ ##### userIdentity?
184
+
185
+ `string`
186
+
187
+ The user identity to use with storage operations.
188
+
189
+ ##### nodeIdentity?
190
+
191
+ `string`
192
+
193
+ The node identity to use with storage operations.
194
+
147
195
  #### Returns
148
196
 
149
197
  `Promise`\<`void`\>
@@ -153,3 +201,62 @@ Nothing.
153
201
  #### Throws
154
202
 
155
203
  Not found error if the blob cannot be found.
204
+
205
+ ***
206
+
207
+ ### query()
208
+
209
+ > **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `cursor?`, `pageSize?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<[`IBlobStorageEntryList`](IBlobStorageEntryList.md)\>
210
+
211
+ Query all the blob storage entries which match the conditions.
212
+
213
+ #### Parameters
214
+
215
+ ##### conditions?
216
+
217
+ `EntityCondition`\<[`IBlobStorageEntry`](IBlobStorageEntry.md)\>
218
+
219
+ The conditions to match for the entries.
220
+
221
+ ##### orderBy?
222
+
223
+ The order for the results, defaults to created.
224
+
225
+ `"dateCreated"` | `"dateModified"`
226
+
227
+ ##### orderByDirection?
228
+
229
+ `SortDirection`
230
+
231
+ The direction for the order, defaults to descending.
232
+
233
+ ##### cursor?
234
+
235
+ `string`
236
+
237
+ The cursor to request the next page of entries.
238
+
239
+ ##### pageSize?
240
+
241
+ `number`
242
+
243
+ The suggested number of entries to return in each chunk, in some scenarios can return a different amount.
244
+
245
+ ##### userIdentity?
246
+
247
+ `string`
248
+
249
+ The user identity to use with storage operations.
250
+
251
+ ##### nodeIdentity?
252
+
253
+ `string`
254
+
255
+ The node identity to use with storage operations.
256
+
257
+ #### Returns
258
+
259
+ `Promise`\<[`IBlobStorageEntryList`](IBlobStorageEntryList.md)\>
260
+
261
+ All the entries for the storage matching the conditions,
262
+ and a cursor which can be used to request more entities.
@@ -16,7 +16,9 @@ Set the blob.
16
16
 
17
17
  #### Parameters
18
18
 
19
- **blob**: `Uint8Array`
19
+ ##### blob
20
+
21
+ `Uint8Array`
20
22
 
21
23
  The data for the blob.
22
24
 
@@ -30,19 +32,21 @@ The id of the stored blob in urn format.
30
32
 
31
33
  ### get()
32
34
 
33
- > **get**(`id`): `Promise`\<`undefined` \| `Uint8Array`\>
35
+ > **get**(`id`): `Promise`\<`undefined` \| `Uint8Array`\<`ArrayBufferLike`\>\>
34
36
 
35
37
  Get the blob.
36
38
 
37
39
  #### Parameters
38
40
 
39
- **id**: `string`
41
+ ##### id
42
+
43
+ `string`
40
44
 
41
45
  The id of the blob to get in urn format.
42
46
 
43
47
  #### Returns
44
48
 
45
- `Promise`\<`undefined` \| `Uint8Array`\>
49
+ `Promise`\<`undefined` \| `Uint8Array`\<`ArrayBufferLike`\>\>
46
50
 
47
51
  The data for the blob if it can be found or undefined.
48
52
 
@@ -56,7 +60,9 @@ Remove the blob.
56
60
 
57
61
  #### Parameters
58
62
 
59
- **id**: `string`
63
+ ##### id
64
+
65
+ `string`
60
66
 
61
67
  The id of the blob to remove in urn format.
62
68
 
@@ -16,15 +16,15 @@ The body parameters.
16
16
 
17
17
  The data to store in base64 encoding.
18
18
 
19
- #### mimeType?
19
+ #### encodingFormat?
20
20
 
21
- > `optional` **mimeType**: `string`
21
+ > `optional` **encodingFormat**: `string`
22
22
 
23
23
  The mime type of the blob, will be detected if left undefined.
24
24
 
25
- #### extension?
25
+ #### fileExtension?
26
26
 
27
- > `optional` **extension**: `string`
27
+ > `optional` **fileExtension**: `string`
28
28
 
29
29
  The extension of the blob, will be detected if left undefined.
30
30
 
@@ -0,0 +1,91 @@
1
+ # Interface: IBlobStorageEntry
2
+
3
+ Interface describing a blob storage entry.
4
+
5
+ ## Properties
6
+
7
+ ### @context
8
+
9
+ > **@context**: \[`"https://schema.twindev.org/blob-storage/"`, `"https://schema.twindev.org/common/"`, `...IJsonLdContextDefinitionElement[]`\]
10
+
11
+ JSON-LD Context.
12
+
13
+ ***
14
+
15
+ ### type
16
+
17
+ > **type**: `"BlobStorageEntry"`
18
+
19
+ JSON-LD Type.
20
+
21
+ ***
22
+
23
+ ### id
24
+
25
+ > **id**: `string`
26
+
27
+ The id for the blob.
28
+
29
+ ***
30
+
31
+ ### dateCreated
32
+
33
+ > **dateCreated**: `string`
34
+
35
+ The date/time when the entry was created.
36
+
37
+ ***
38
+
39
+ ### dateModified?
40
+
41
+ > `optional` **dateModified**: `string`
42
+
43
+ The date/time when the entry was modified.
44
+
45
+ ***
46
+
47
+ ### blobSize
48
+
49
+ > **blobSize**: `number`
50
+
51
+ The size of the data in the blob.
52
+
53
+ ***
54
+
55
+ ### blobHash
56
+
57
+ > **blobHash**: `string`
58
+
59
+ The hash of the data in the blob.
60
+
61
+ ***
62
+
63
+ ### encodingFormat?
64
+
65
+ > `optional` **encodingFormat**: `string`
66
+
67
+ The mime type for the blob.
68
+
69
+ ***
70
+
71
+ ### fileExtension?
72
+
73
+ > `optional` **fileExtension**: `string`
74
+
75
+ The extension.
76
+
77
+ ***
78
+
79
+ ### metadata?
80
+
81
+ > `optional` **metadata**: `IJsonLdNodeObject`
82
+
83
+ The metadata for the blob as JSON-LD.
84
+
85
+ ***
86
+
87
+ ### blob?
88
+
89
+ > `optional` **blob**: `string`
90
+
91
+ The blob in base64 format, included if the includeContent flag was set in the request.
@@ -0,0 +1,35 @@
1
+ # Interface: IBlobStorageEntryList
2
+
3
+ Interface describing an blob storage entry list.
4
+
5
+ ## Properties
6
+
7
+ ### @context
8
+
9
+ > **@context**: \[`"https://schema.org"`, `"https://schema.twindev.org/blob-storage/"`, `"https://schema.twindev.org/common/"`, `...IJsonLdContextDefinitionElement[]`\]
10
+
11
+ JSON-LD Context.
12
+
13
+ ***
14
+
15
+ ### type
16
+
17
+ > **type**: `"ItemList"`
18
+
19
+ JSON-LD Type.
20
+
21
+ ***
22
+
23
+ ### itemListElement
24
+
25
+ > **itemListElement**: [`IBlobStorageEntry`](IBlobStorageEntry.md)[]
26
+
27
+ The list of entries.
28
+
29
+ ***
30
+
31
+ ### nextItem?
32
+
33
+ > `optional` **nextItem**: `string`
34
+
35
+ The cursor to get the next chunk of entries.
@@ -4,6 +4,18 @@ Request to get an entry from blob storage.
4
4
 
5
5
  ## Properties
6
6
 
7
+ ### headers?
8
+
9
+ > `optional` **headers**: `object`
10
+
11
+ The headers which can be used to determine the response data type.
12
+
13
+ #### accept
14
+
15
+ > **accept**: `"application/json"` \| `"application/ld+json"`
16
+
17
+ ***
18
+
7
19
  ### pathParams
8
20
 
9
21
  > **pathParams**: `object`
@@ -4,32 +4,20 @@ Response to get an entry from blob storage.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### body
8
-
9
- > **body**: `object`
10
-
11
- The body parameters.
12
-
13
- #### mimeType?
7
+ ### headers?
14
8
 
15
- > `optional` **mimeType**: `string`
9
+ > `optional` **headers**: `object`
16
10
 
17
- The mime type of the blob.
11
+ The headers which can be used to determine the response data type.
18
12
 
19
- #### extension?
13
+ #### content-type
20
14
 
21
- > `optional` **extension**: `string`
15
+ > **content-type**: `"application/json"` \| `"application/ld+json"`
22
16
 
23
- The extension of the blob.
17
+ ***
24
18
 
25
- #### metadata?
26
-
27
- > `optional` **metadata**: `IJsonLdNodeObject`
28
-
29
- Custom metadata to associate with the blob as JSON-LD.
30
-
31
- #### blob?
19
+ ### body
32
20
 
33
- > `optional` **blob**: `string`
21
+ > **body**: [`IBlobStorageEntry`](IBlobStorageEntry.md)
34
22
 
35
- The blob in base64 format, if the includeContent flag was set in the request.
23
+ The body parameters.
@@ -0,0 +1,53 @@
1
+ # Interface: IBlobStorageListRequest
2
+
3
+ Query the entries from blob storage.
4
+
5
+ ## Properties
6
+
7
+ ### headers?
8
+
9
+ > `optional` **headers**: `object`
10
+
11
+ The headers which can be used to determine the response data type.
12
+
13
+ #### accept
14
+
15
+ > **accept**: `"application/json"` \| `"application/ld+json"`
16
+
17
+ ***
18
+
19
+ ### query?
20
+
21
+ > `optional` **query**: `object`
22
+
23
+ The parameters from the query.
24
+
25
+ #### conditions?
26
+
27
+ > `optional` **conditions**: `string`
28
+
29
+ The condition for the query as JSON version of EntityCondition type.
30
+
31
+ #### orderBy?
32
+
33
+ > `optional` **orderBy**: `"dateCreated"` \| `"dateModified"`
34
+
35
+ The order for the results, default to created.
36
+
37
+ #### orderByDirection?
38
+
39
+ > `optional` **orderByDirection**: `SortDirection`
40
+
41
+ The direction for the order, defaults to desc.
42
+
43
+ #### pageSize?
44
+
45
+ > `optional` **pageSize**: `number`
46
+
47
+ The number of entries to return per page.
48
+
49
+ #### cursor?
50
+
51
+ > `optional` **cursor**: `string`
52
+
53
+ The cursor to get next chunk of data, returned in previous response.
@@ -0,0 +1,23 @@
1
+ # Interface: IBlobStorageListResponse
2
+
3
+ Response to getting the list of entries from a query.
4
+
5
+ ## Properties
6
+
7
+ ### headers?
8
+
9
+ > `optional` **headers**: `object`
10
+
11
+ The headers which can be used to determine the response data type.
12
+
13
+ #### content-type
14
+
15
+ > **content-type**: `"application/json"` \| `"application/ld+json"`
16
+
17
+ ***
18
+
19
+ ### body
20
+
21
+ > **body**: [`IBlobStorageEntryList`](IBlobStorageEntryList.md)
22
+
23
+ The list of entries from the query.