@twin.org/blob-storage-rest-client 0.0.2-next.3 → 0.0.2-next.5

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.
@@ -10,22 +10,17 @@ var web = require('@twin.org/web');
10
10
  /**
11
11
  * Client for performing blob storage through to REST endpoints.
12
12
  */
13
- class BlobStorageClient extends apiCore.BaseRestClient {
13
+ class BlobStorageRestClient extends apiCore.BaseRestClient {
14
14
  /**
15
15
  * Runtime name for the class.
16
- * @internal
17
16
  */
18
- static _CLASS_NAME = "BlobStorageClient";
19
- /**
20
- * Runtime name for the class.
21
- */
22
- CLASS_NAME = BlobStorageClient._CLASS_NAME;
17
+ static CLASS_NAME = "BlobStorageRestClient";
23
18
  /**
24
19
  * Create a new instance of BlobStorageClient.
25
20
  * @param config The configuration for the client.
26
21
  */
27
22
  constructor(config) {
28
- super(BlobStorageClient._CLASS_NAME, config, "blob");
23
+ super(BlobStorageRestClient.CLASS_NAME, config, "blob");
29
24
  }
30
25
  /**
31
26
  * Create the blob with some metadata.
@@ -40,7 +35,7 @@ class BlobStorageClient extends apiCore.BaseRestClient {
40
35
  * @returns The id of the stored blob in urn format.
41
36
  */
42
37
  async create(blob, encodingFormat, fileExtension, metadata, options) {
43
- core.Guards.stringBase64(this.CLASS_NAME, "blob", blob);
38
+ core.Guards.stringBase64(BlobStorageRestClient.CLASS_NAME, "blob", blob);
44
39
  const response = await this.fetch("/", "POST", {
45
40
  body: {
46
41
  blob,
@@ -65,7 +60,7 @@ class BlobStorageClient extends apiCore.BaseRestClient {
65
60
  * @throws Not found error if the blob cannot be found.
66
61
  */
67
62
  async get(id, options) {
68
- core.Urn.guard(this.CLASS_NAME, "id", id);
63
+ core.Urn.guard(BlobStorageRestClient.CLASS_NAME, "id", id);
69
64
  const response = await this.fetch("/:id", "GET", {
70
65
  headers: {
71
66
  [web.HeaderTypes.Accept]: web.MimeTypes.JsonLd
@@ -91,7 +86,7 @@ class BlobStorageClient extends apiCore.BaseRestClient {
91
86
  * @throws Not found error if the blob cannot be found.
92
87
  */
93
88
  async update(id, encodingFormat, fileExtension, metadata) {
94
- core.Urn.guard(this.CLASS_NAME, "id", id);
89
+ core.Urn.guard(BlobStorageRestClient.CLASS_NAME, "id", id);
95
90
  await this.fetch("/:id", "PUT", {
96
91
  pathParams: {
97
92
  id
@@ -109,7 +104,7 @@ class BlobStorageClient extends apiCore.BaseRestClient {
109
104
  * @returns Nothing.
110
105
  */
111
106
  async remove(id) {
112
- core.Urn.guard(this.CLASS_NAME, "id", id);
107
+ core.Urn.guard(BlobStorageRestClient.CLASS_NAME, "id", id);
113
108
  await this.fetch("/:id", "DELETE", {
114
109
  pathParams: {
115
110
  id
@@ -122,11 +117,11 @@ class BlobStorageClient extends apiCore.BaseRestClient {
122
117
  * @param orderBy The order for the results, defaults to created.
123
118
  * @param orderByDirection The direction for the order, defaults to descending.
124
119
  * @param cursor The cursor to request the next page of entries.
125
- * @param pageSize The suggested number of entries to return in each chunk, in some scenarios can return a different amount.
120
+ * @param limit The suggested number of entries to return in each chunk, in some scenarios can return a different amount.
126
121
  * @returns All the entries for the storage matching the conditions,
127
122
  * and a cursor which can be used to request more entities.
128
123
  */
129
- async query(conditions, orderBy, orderByDirection, cursor, pageSize) {
124
+ async query(conditions, orderBy, orderByDirection, cursor, limit) {
130
125
  const response = await this.fetch("/", "GET", {
131
126
  headers: {
132
127
  [web.HeaderTypes.Accept]: web.MimeTypes.JsonLd
@@ -135,7 +130,7 @@ class BlobStorageClient extends apiCore.BaseRestClient {
135
130
  conditions: apiModels.HttpParameterHelper.objectToString(conditions),
136
131
  orderBy,
137
132
  orderByDirection,
138
- pageSize,
133
+ limit: core.Coerce.string(limit),
139
134
  cursor
140
135
  }
141
136
  });
@@ -149,7 +144,7 @@ class BlobStorageClient extends apiCore.BaseRestClient {
149
144
  * @returns The download link.
150
145
  */
151
146
  createDownloadLink(id, download, filename) {
152
- core.Urn.guard(this.CLASS_NAME, "id", id);
147
+ core.Urn.guard(BlobStorageRestClient.CLASS_NAME, "id", id);
153
148
  let link = core.StringHelper.trimTrailingSlashes(this.getEndpointWithPrefix());
154
149
  link += `/${id}/content`;
155
150
  const downloadQuery = [];
@@ -166,4 +161,4 @@ class BlobStorageClient extends apiCore.BaseRestClient {
166
161
  }
167
162
  }
168
163
 
169
- exports.BlobStorageClient = BlobStorageClient;
164
+ exports.BlobStorageRestClient = BlobStorageRestClient;
@@ -8,22 +8,17 @@ import { HeaderTypes, MimeTypes } from '@twin.org/web';
8
8
  /**
9
9
  * Client for performing blob storage through to REST endpoints.
10
10
  */
11
- class BlobStorageClient extends BaseRestClient {
11
+ class BlobStorageRestClient extends BaseRestClient {
12
12
  /**
13
13
  * Runtime name for the class.
14
- * @internal
15
14
  */
16
- static _CLASS_NAME = "BlobStorageClient";
17
- /**
18
- * Runtime name for the class.
19
- */
20
- CLASS_NAME = BlobStorageClient._CLASS_NAME;
15
+ static CLASS_NAME = "BlobStorageRestClient";
21
16
  /**
22
17
  * Create a new instance of BlobStorageClient.
23
18
  * @param config The configuration for the client.
24
19
  */
25
20
  constructor(config) {
26
- super(BlobStorageClient._CLASS_NAME, config, "blob");
21
+ super(BlobStorageRestClient.CLASS_NAME, config, "blob");
27
22
  }
28
23
  /**
29
24
  * Create the blob with some metadata.
@@ -38,7 +33,7 @@ class BlobStorageClient extends BaseRestClient {
38
33
  * @returns The id of the stored blob in urn format.
39
34
  */
40
35
  async create(blob, encodingFormat, fileExtension, metadata, options) {
41
- Guards.stringBase64(this.CLASS_NAME, "blob", blob);
36
+ Guards.stringBase64(BlobStorageRestClient.CLASS_NAME, "blob", blob);
42
37
  const response = await this.fetch("/", "POST", {
43
38
  body: {
44
39
  blob,
@@ -63,7 +58,7 @@ class BlobStorageClient extends BaseRestClient {
63
58
  * @throws Not found error if the blob cannot be found.
64
59
  */
65
60
  async get(id, options) {
66
- Urn.guard(this.CLASS_NAME, "id", id);
61
+ Urn.guard(BlobStorageRestClient.CLASS_NAME, "id", id);
67
62
  const response = await this.fetch("/:id", "GET", {
68
63
  headers: {
69
64
  [HeaderTypes.Accept]: MimeTypes.JsonLd
@@ -89,7 +84,7 @@ class BlobStorageClient extends BaseRestClient {
89
84
  * @throws Not found error if the blob cannot be found.
90
85
  */
91
86
  async update(id, encodingFormat, fileExtension, metadata) {
92
- Urn.guard(this.CLASS_NAME, "id", id);
87
+ Urn.guard(BlobStorageRestClient.CLASS_NAME, "id", id);
93
88
  await this.fetch("/:id", "PUT", {
94
89
  pathParams: {
95
90
  id
@@ -107,7 +102,7 @@ class BlobStorageClient extends BaseRestClient {
107
102
  * @returns Nothing.
108
103
  */
109
104
  async remove(id) {
110
- Urn.guard(this.CLASS_NAME, "id", id);
105
+ Urn.guard(BlobStorageRestClient.CLASS_NAME, "id", id);
111
106
  await this.fetch("/:id", "DELETE", {
112
107
  pathParams: {
113
108
  id
@@ -120,11 +115,11 @@ class BlobStorageClient extends BaseRestClient {
120
115
  * @param orderBy The order for the results, defaults to created.
121
116
  * @param orderByDirection The direction for the order, defaults to descending.
122
117
  * @param cursor The cursor to request the next page of entries.
123
- * @param pageSize The suggested number of entries to return in each chunk, in some scenarios can return a different amount.
118
+ * @param limit The suggested number of entries to return in each chunk, in some scenarios can return a different amount.
124
119
  * @returns All the entries for the storage matching the conditions,
125
120
  * and a cursor which can be used to request more entities.
126
121
  */
127
- async query(conditions, orderBy, orderByDirection, cursor, pageSize) {
122
+ async query(conditions, orderBy, orderByDirection, cursor, limit) {
128
123
  const response = await this.fetch("/", "GET", {
129
124
  headers: {
130
125
  [HeaderTypes.Accept]: MimeTypes.JsonLd
@@ -133,7 +128,7 @@ class BlobStorageClient extends BaseRestClient {
133
128
  conditions: HttpParameterHelper.objectToString(conditions),
134
129
  orderBy,
135
130
  orderByDirection,
136
- pageSize,
131
+ limit: Coerce.string(limit),
137
132
  cursor
138
133
  }
139
134
  });
@@ -147,7 +142,7 @@ class BlobStorageClient extends BaseRestClient {
147
142
  * @returns The download link.
148
143
  */
149
144
  createDownloadLink(id, download, filename) {
150
- Urn.guard(this.CLASS_NAME, "id", id);
145
+ Urn.guard(BlobStorageRestClient.CLASS_NAME, "id", id);
151
146
  let link = StringHelper.trimTrailingSlashes(this.getEndpointWithPrefix());
152
147
  link += `/${id}/content`;
153
148
  const downloadQuery = [];
@@ -164,4 +159,4 @@ class BlobStorageClient extends BaseRestClient {
164
159
  }
165
160
  }
166
161
 
167
- export { BlobStorageClient };
162
+ export { BlobStorageRestClient };
@@ -6,11 +6,11 @@ import type { EntityCondition, SortDirection } from "@twin.org/entity";
6
6
  /**
7
7
  * Client for performing blob storage through to REST endpoints.
8
8
  */
9
- export declare class BlobStorageClient extends BaseRestClient implements IBlobStorageComponent {
9
+ export declare class BlobStorageRestClient extends BaseRestClient implements IBlobStorageComponent {
10
10
  /**
11
11
  * Runtime name for the class.
12
12
  */
13
- readonly CLASS_NAME: string;
13
+ static readonly CLASS_NAME: string;
14
14
  /**
15
15
  * Create a new instance of BlobStorageClient.
16
16
  * @param config The configuration for the client.
@@ -70,11 +70,11 @@ export declare class BlobStorageClient extends BaseRestClient implements IBlobSt
70
70
  * @param orderBy The order for the results, defaults to created.
71
71
  * @param orderByDirection The direction for the order, defaults to descending.
72
72
  * @param cursor The cursor to request the next page of entries.
73
- * @param pageSize The suggested number of entries to return in each chunk, in some scenarios can return a different amount.
73
+ * @param limit The suggested number of entries to return in each chunk, in some scenarios can return a different amount.
74
74
  * @returns All the entries for the storage matching the conditions,
75
75
  * and a cursor which can be used to request more entities.
76
76
  */
77
- query(conditions?: EntityCondition<IBlobStorageEntry>, orderBy?: keyof Pick<IBlobStorageEntry, "dateCreated" | "dateModified">, orderByDirection?: SortDirection, cursor?: string, pageSize?: number): Promise<IBlobStorageEntryList>;
77
+ query(conditions?: EntityCondition<IBlobStorageEntry>, orderBy?: keyof Pick<IBlobStorageEntry, "dateCreated" | "dateModified">, orderByDirection?: SortDirection, cursor?: string, limit?: number): Promise<IBlobStorageEntryList>;
78
78
  /**
79
79
  * Create a download link for the blob.
80
80
  * @param id The id of the blob to get in urn format.
@@ -1 +1 @@
1
- export * from "./blobStorageClient";
1
+ export * from "./blobStorageRestClient";
package/docs/changelog.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @twin.org/blob-storage-rest-client - Changelog
2
2
 
3
+ ## [0.0.2-next.5](https://github.com/twinfoundation/blob-storage/compare/blob-storage-rest-client-v0.0.2-next.4...blob-storage-rest-client-v0.0.2-next.5) (2025-10-09)
4
+
5
+
6
+ ### Features
7
+
8
+ * add validate-locales ([f20fcec](https://github.com/twinfoundation/blob-storage/commit/f20fceced91e39a0c9edb770b2e43ce944c92f3c))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/blob-storage-models bumped from 0.0.2-next.4 to 0.0.2-next.5
16
+
17
+ ## [0.0.2-next.4](https://github.com/twinfoundation/blob-storage/compare/blob-storage-rest-client-v0.0.2-next.3...blob-storage-rest-client-v0.0.2-next.4) (2025-10-02)
18
+
19
+
20
+ ### Miscellaneous Chores
21
+
22
+ * **blob-storage-rest-client:** Synchronize repo versions
23
+
24
+
25
+ ### Dependencies
26
+
27
+ * The following workspace dependencies were updated
28
+ * dependencies
29
+ * @twin.org/blob-storage-models bumped from 0.0.2-next.3 to 0.0.2-next.4
30
+
3
31
  ## [0.0.2-next.3](https://github.com/twinfoundation/blob-storage/compare/blob-storage-rest-client-v0.0.2-next.2...blob-storage-rest-client-v0.0.2-next.3) (2025-08-29)
4
32
 
5
33
 
@@ -1,4 +1,4 @@
1
- # Class: BlobStorageClient
1
+ # Class: BlobStorageRestClient
2
2
 
3
3
  Client for performing blob storage through to REST endpoints.
4
4
 
@@ -14,7 +14,7 @@ Client for performing blob storage through to REST endpoints.
14
14
 
15
15
  ### Constructor
16
16
 
17
- > **new BlobStorageClient**(`config`): `BlobStorageClient`
17
+ > **new BlobStorageRestClient**(`config`): `BlobStorageRestClient`
18
18
 
19
19
  Create a new instance of BlobStorageClient.
20
20
 
@@ -28,7 +28,7 @@ The configuration for the client.
28
28
 
29
29
  #### Returns
30
30
 
31
- `BlobStorageClient`
31
+ `BlobStorageRestClient`
32
32
 
33
33
  #### Overrides
34
34
 
@@ -38,14 +38,10 @@ The configuration for the client.
38
38
 
39
39
  ### CLASS\_NAME
40
40
 
41
- > `readonly` **CLASS\_NAME**: `string` = `BlobStorageClient._CLASS_NAME`
41
+ > `readonly` `static` **CLASS\_NAME**: `string`
42
42
 
43
43
  Runtime name for the class.
44
44
 
45
- #### Implementation of
46
-
47
- `IBlobStorageComponent.CLASS_NAME`
48
-
49
45
  ## Methods
50
46
 
51
47
  ### create()
@@ -242,7 +238,7 @@ Nothing.
242
238
 
243
239
  ### query()
244
240
 
245
- > **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `cursor?`, `pageSize?`): `Promise`\<`IBlobStorageEntryList`\>
241
+ > **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `cursor?`, `limit?`): `Promise`\<`IBlobStorageEntryList`\>
246
242
 
247
243
  Query all the blob storage entries which match the conditions.
248
244
 
@@ -272,7 +268,7 @@ The direction for the order, defaults to descending.
272
268
 
273
269
  The cursor to request the next page of entries.
274
270
 
275
- ##### pageSize?
271
+ ##### limit?
276
272
 
277
273
  `number`
278
274
 
@@ -2,4 +2,4 @@
2
2
 
3
3
  ## Classes
4
4
 
5
- - [BlobStorageClient](classes/BlobStorageClient.md)
5
+ - [BlobStorageRestClient](classes/BlobStorageRestClient.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/blob-storage-rest-client",
3
- "version": "0.0.2-next.3",
3
+ "version": "0.0.2-next.5",
4
4
  "description": "Blob storage implementation which can connect to REST endpoints",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,7 +16,7 @@
16
16
  "dependencies": {
17
17
  "@twin.org/api-core": "next",
18
18
  "@twin.org/api-models": "next",
19
- "@twin.org/blob-storage-models": "0.0.2-next.3",
19
+ "@twin.org/blob-storage-models": "0.0.2-next.5",
20
20
  "@twin.org/core": "next",
21
21
  "@twin.org/data-json-ld": "next",
22
22
  "@twin.org/entity": "next",
@@ -40,5 +40,21 @@
40
40
  "dist/types",
41
41
  "locales",
42
42
  "docs"
43
- ]
43
+ ],
44
+ "keywords": [
45
+ "twin",
46
+ "trade",
47
+ "iota",
48
+ "framework",
49
+ "blockchain",
50
+ "blob-storage",
51
+ "blob",
52
+ "storage",
53
+ "files",
54
+ "binary"
55
+ ],
56
+ "bugs": {
57
+ "url": "git+https://github.com/twinfoundation/blob-storage/issues"
58
+ },
59
+ "homepage": "https://twindev.org"
44
60
  }