@twin.org/data-processing-rest-client 0.0.2-next.1 → 0.0.2-next.3

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.
@@ -8,22 +8,17 @@ var core = require('@twin.org/core');
8
8
  /**
9
9
  * Client for performing data processing through to REST endpoints.
10
10
  */
11
- class DataProcessingClient extends apiCore.BaseRestClient {
11
+ class DataProcessingRestClient extends apiCore.BaseRestClient {
12
12
  /**
13
13
  * Runtime name for the class.
14
- * @internal
15
14
  */
16
- static _CLASS_NAME = "DataProcessingClient";
17
- /**
18
- * Runtime name for the class.
19
- */
20
- CLASS_NAME = DataProcessingClient._CLASS_NAME;
15
+ static CLASS_NAME = "DataProcessingRestClient";
21
16
  /**
22
17
  * Create a new instance of DataProcessingClient.
23
18
  * @param config The configuration for the client.
24
19
  */
25
20
  constructor(config) {
26
- super(DataProcessingClient._CLASS_NAME, config, "data-processing");
21
+ super(DataProcessingRestClient.CLASS_NAME, config, "data-processing");
27
22
  }
28
23
  /**
29
24
  * Set an extraction rule group.
@@ -31,10 +26,10 @@ class DataProcessingClient extends apiCore.BaseRestClient {
31
26
  * @returns Nothing.
32
27
  */
33
28
  async ruleGroupSet(ruleGroup) {
34
- core.Guards.object(this.CLASS_NAME, "ruleGroup", ruleGroup);
35
- core.Guards.stringValue(this.CLASS_NAME, "ruleGroup.id", ruleGroup.id);
36
- core.Guards.stringValue(this.CLASS_NAME, "ruleGroup.label", ruleGroup.label);
37
- core.Guards.array(this.CLASS_NAME, "ruleGroup.rules", ruleGroup.rules);
29
+ core.Guards.object(DataProcessingRestClient.CLASS_NAME, "ruleGroup", ruleGroup);
30
+ core.Guards.stringValue(DataProcessingRestClient.CLASS_NAME, "ruleGroup.id", ruleGroup.id);
31
+ core.Guards.stringValue(DataProcessingRestClient.CLASS_NAME, "ruleGroup.label", ruleGroup.label);
32
+ core.Guards.array(DataProcessingRestClient.CLASS_NAME, "ruleGroup.rules", ruleGroup.rules);
38
33
  await this.fetch("/rule-group/:id", "PUT", {
39
34
  pathParams: {
40
35
  id: ruleGroup.id
@@ -51,7 +46,7 @@ class DataProcessingClient extends apiCore.BaseRestClient {
51
46
  * @returns The rule group.
52
47
  */
53
48
  async ruleGroupGet(ruleGroupId) {
54
- core.Guards.stringValue(this.CLASS_NAME, "ruleGroupId", ruleGroupId);
49
+ core.Guards.stringValue(DataProcessingRestClient.CLASS_NAME, "ruleGroupId", ruleGroupId);
55
50
  const response = await this.fetch("/rule-group/:id", "GET", {
56
51
  pathParams: {
57
52
  id: ruleGroupId
@@ -65,7 +60,7 @@ class DataProcessingClient extends apiCore.BaseRestClient {
65
60
  * @returns Nothing.
66
61
  */
67
62
  async ruleGroupRemove(ruleGroupId) {
68
- core.Guards.stringValue(this.CLASS_NAME, "ruleGroupId", ruleGroupId);
63
+ core.Guards.stringValue(DataProcessingRestClient.CLASS_NAME, "ruleGroupId", ruleGroupId);
69
64
  await this.fetch("/rule-group/:id", "DELETE", {
70
65
  pathParams: {
71
66
  id: ruleGroupId
@@ -81,8 +76,8 @@ class DataProcessingClient extends apiCore.BaseRestClient {
81
76
  * @returns The extracted data.
82
77
  */
83
78
  async extract(ruleGroupId, data, overrideExtractorType, overrideMimeType) {
84
- core.Guards.stringValue(this.CLASS_NAME, "ruleGroupId", ruleGroupId);
85
- core.Guards.uint8Array(this.CLASS_NAME, "data", data);
79
+ core.Guards.stringValue(DataProcessingRestClient.CLASS_NAME, "ruleGroupId", ruleGroupId);
80
+ core.Guards.uint8Array(DataProcessingRestClient.CLASS_NAME, "data", data);
86
81
  const result = await this.fetch("/extract", "POST", {
87
82
  body: {
88
83
  ruleGroupId,
@@ -100,7 +95,7 @@ class DataProcessingClient extends apiCore.BaseRestClient {
100
95
  * @returns The converted data.
101
96
  */
102
97
  async convert(data, overrideMimeType) {
103
- core.Guards.uint8Array(this.CLASS_NAME, "data", data);
98
+ core.Guards.uint8Array(DataProcessingRestClient.CLASS_NAME, "data", data);
104
99
  const result = await this.fetch("/convert", "POST", {
105
100
  body: {
106
101
  data: core.Converter.bytesToBase64(data),
@@ -111,20 +106,20 @@ class DataProcessingClient extends apiCore.BaseRestClient {
111
106
  }
112
107
  /**
113
108
  * Query the rule group entries.
114
- * @param cursor The cursor to request the next page of entities.
115
- * @param pageSize The maximum number of entities in a page.
109
+ * @param cursor The cursor to request the next chunk of entities.
110
+ * @param limit Limit the number of entities to return.
116
111
  * @returns All the entities for the storage matching the conditions,
117
112
  * and a cursor which can be used to request more entities.
118
113
  */
119
- async query(cursor, pageSize) {
114
+ async query(cursor, limit) {
120
115
  const response = await this.fetch("/rule-group", "GET", {
121
116
  query: {
122
117
  cursor,
123
- pageSize
118
+ limit: core.Coerce.string(limit)
124
119
  }
125
120
  });
126
121
  return response.body;
127
122
  }
128
123
  }
129
124
 
130
- exports.DataProcessingClient = DataProcessingClient;
125
+ exports.DataProcessingRestClient = DataProcessingRestClient;
@@ -1,27 +1,22 @@
1
1
  import { BaseRestClient } from '@twin.org/api-core';
2
- import { Guards, Converter, ObjectHelper } from '@twin.org/core';
2
+ import { Guards, Converter, ObjectHelper, Coerce } from '@twin.org/core';
3
3
 
4
4
  // Copyright 2024 IOTA Stiftung.
5
5
  // SPDX-License-Identifier: Apache-2.0.
6
6
  /**
7
7
  * Client for performing data processing through to REST endpoints.
8
8
  */
9
- class DataProcessingClient extends BaseRestClient {
9
+ class DataProcessingRestClient extends BaseRestClient {
10
10
  /**
11
11
  * Runtime name for the class.
12
- * @internal
13
12
  */
14
- static _CLASS_NAME = "DataProcessingClient";
15
- /**
16
- * Runtime name for the class.
17
- */
18
- CLASS_NAME = DataProcessingClient._CLASS_NAME;
13
+ static CLASS_NAME = "DataProcessingRestClient";
19
14
  /**
20
15
  * Create a new instance of DataProcessingClient.
21
16
  * @param config The configuration for the client.
22
17
  */
23
18
  constructor(config) {
24
- super(DataProcessingClient._CLASS_NAME, config, "data-processing");
19
+ super(DataProcessingRestClient.CLASS_NAME, config, "data-processing");
25
20
  }
26
21
  /**
27
22
  * Set an extraction rule group.
@@ -29,10 +24,10 @@ class DataProcessingClient extends BaseRestClient {
29
24
  * @returns Nothing.
30
25
  */
31
26
  async ruleGroupSet(ruleGroup) {
32
- Guards.object(this.CLASS_NAME, "ruleGroup", ruleGroup);
33
- Guards.stringValue(this.CLASS_NAME, "ruleGroup.id", ruleGroup.id);
34
- Guards.stringValue(this.CLASS_NAME, "ruleGroup.label", ruleGroup.label);
35
- Guards.array(this.CLASS_NAME, "ruleGroup.rules", ruleGroup.rules);
27
+ Guards.object(DataProcessingRestClient.CLASS_NAME, "ruleGroup", ruleGroup);
28
+ Guards.stringValue(DataProcessingRestClient.CLASS_NAME, "ruleGroup.id", ruleGroup.id);
29
+ Guards.stringValue(DataProcessingRestClient.CLASS_NAME, "ruleGroup.label", ruleGroup.label);
30
+ Guards.array(DataProcessingRestClient.CLASS_NAME, "ruleGroup.rules", ruleGroup.rules);
36
31
  await this.fetch("/rule-group/:id", "PUT", {
37
32
  pathParams: {
38
33
  id: ruleGroup.id
@@ -49,7 +44,7 @@ class DataProcessingClient extends BaseRestClient {
49
44
  * @returns The rule group.
50
45
  */
51
46
  async ruleGroupGet(ruleGroupId) {
52
- Guards.stringValue(this.CLASS_NAME, "ruleGroupId", ruleGroupId);
47
+ Guards.stringValue(DataProcessingRestClient.CLASS_NAME, "ruleGroupId", ruleGroupId);
53
48
  const response = await this.fetch("/rule-group/:id", "GET", {
54
49
  pathParams: {
55
50
  id: ruleGroupId
@@ -63,7 +58,7 @@ class DataProcessingClient extends BaseRestClient {
63
58
  * @returns Nothing.
64
59
  */
65
60
  async ruleGroupRemove(ruleGroupId) {
66
- Guards.stringValue(this.CLASS_NAME, "ruleGroupId", ruleGroupId);
61
+ Guards.stringValue(DataProcessingRestClient.CLASS_NAME, "ruleGroupId", ruleGroupId);
67
62
  await this.fetch("/rule-group/:id", "DELETE", {
68
63
  pathParams: {
69
64
  id: ruleGroupId
@@ -79,8 +74,8 @@ class DataProcessingClient extends BaseRestClient {
79
74
  * @returns The extracted data.
80
75
  */
81
76
  async extract(ruleGroupId, data, overrideExtractorType, overrideMimeType) {
82
- Guards.stringValue(this.CLASS_NAME, "ruleGroupId", ruleGroupId);
83
- Guards.uint8Array(this.CLASS_NAME, "data", data);
77
+ Guards.stringValue(DataProcessingRestClient.CLASS_NAME, "ruleGroupId", ruleGroupId);
78
+ Guards.uint8Array(DataProcessingRestClient.CLASS_NAME, "data", data);
84
79
  const result = await this.fetch("/extract", "POST", {
85
80
  body: {
86
81
  ruleGroupId,
@@ -98,7 +93,7 @@ class DataProcessingClient extends BaseRestClient {
98
93
  * @returns The converted data.
99
94
  */
100
95
  async convert(data, overrideMimeType) {
101
- Guards.uint8Array(this.CLASS_NAME, "data", data);
96
+ Guards.uint8Array(DataProcessingRestClient.CLASS_NAME, "data", data);
102
97
  const result = await this.fetch("/convert", "POST", {
103
98
  body: {
104
99
  data: Converter.bytesToBase64(data),
@@ -109,20 +104,20 @@ class DataProcessingClient extends BaseRestClient {
109
104
  }
110
105
  /**
111
106
  * Query the rule group entries.
112
- * @param cursor The cursor to request the next page of entities.
113
- * @param pageSize The maximum number of entities in a page.
107
+ * @param cursor The cursor to request the next chunk of entities.
108
+ * @param limit Limit the number of entities to return.
114
109
  * @returns All the entities for the storage matching the conditions,
115
110
  * and a cursor which can be used to request more entities.
116
111
  */
117
- async query(cursor, pageSize) {
112
+ async query(cursor, limit) {
118
113
  const response = await this.fetch("/rule-group", "GET", {
119
114
  query: {
120
115
  cursor,
121
- pageSize
116
+ limit: Coerce.string(limit)
122
117
  }
123
118
  });
124
119
  return response.body;
125
120
  }
126
121
  }
127
122
 
128
- export { DataProcessingClient };
123
+ export { DataProcessingRestClient };
@@ -4,11 +4,11 @@ import type { IDataProcessingComponent, IRuleGroup } from "@twin.org/data-proces
4
4
  /**
5
5
  * Client for performing data processing through to REST endpoints.
6
6
  */
7
- export declare class DataProcessingClient extends BaseRestClient implements IDataProcessingComponent {
7
+ export declare class DataProcessingRestClient extends BaseRestClient implements IDataProcessingComponent {
8
8
  /**
9
9
  * Runtime name for the class.
10
10
  */
11
- readonly CLASS_NAME: string;
11
+ static readonly CLASS_NAME: string;
12
12
  /**
13
13
  * Create a new instance of DataProcessingClient.
14
14
  * @param config The configuration for the client.
@@ -50,12 +50,12 @@ export declare class DataProcessingClient extends BaseRestClient implements IDat
50
50
  convert(data: Uint8Array, overrideMimeType?: string): Promise<unknown>;
51
51
  /**
52
52
  * Query the rule group entries.
53
- * @param cursor The cursor to request the next page of entities.
54
- * @param pageSize The maximum number of entities in a page.
53
+ * @param cursor The cursor to request the next chunk of entities.
54
+ * @param limit Limit the number of entities to return.
55
55
  * @returns All the entities for the storage matching the conditions,
56
56
  * and a cursor which can be used to request more entities.
57
57
  */
58
- query(cursor?: string, pageSize?: number): Promise<{
58
+ query(cursor?: string, limit?: number): Promise<{
59
59
  /**
60
60
  * The entities, which can be partial if a limited keys list was provided.
61
61
  */
@@ -1 +1 @@
1
- export * from "./dataProcessingClient";
1
+ export * from "./dataProcessingRestClient";
package/docs/changelog.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @twin.org/data-processing-rest-client - Changelog
2
2
 
3
+ ## [0.0.2-next.3](https://github.com/twinfoundation/data-processing/compare/data-processing-rest-client-v0.0.2-next.2...data-processing-rest-client-v0.0.2-next.3) (2025-10-09)
4
+
5
+
6
+ ### Features
7
+
8
+ * add validate-locales ([9af0874](https://github.com/twinfoundation/data-processing/commit/9af0874cd3f44a4cfca514dde8380f002e62337e))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/data-processing-models bumped from 0.0.2-next.2 to 0.0.2-next.3
16
+
17
+ ## [0.0.2-next.2](https://github.com/twinfoundation/data-processing/compare/data-processing-rest-client-v0.0.2-next.1...data-processing-rest-client-v0.0.2-next.2) (2025-08-29)
18
+
19
+
20
+ ### Features
21
+
22
+ * eslint migration to flat config ([a8138b0](https://github.com/twinfoundation/data-processing/commit/a8138b020ed58baeff162a822d4df207a6aeadc4))
23
+
24
+
25
+ ### Dependencies
26
+
27
+ * The following workspace dependencies were updated
28
+ * dependencies
29
+ * @twin.org/data-processing-models bumped from 0.0.2-next.1 to 0.0.2-next.2
30
+
3
31
  ## [0.0.2-next.1](https://github.com/twinfoundation/data-processing/compare/data-processing-rest-client-v0.0.2-next.0...data-processing-rest-client-v0.0.2-next.1) (2025-08-20)
4
32
 
5
33
 
@@ -1,4 +1,4 @@
1
- # Class: DataProcessingClient
1
+ # Class: DataProcessingRestClient
2
2
 
3
3
  Client for performing data processing through to REST endpoints.
4
4
 
@@ -14,7 +14,7 @@ Client for performing data processing through to REST endpoints.
14
14
 
15
15
  ### Constructor
16
16
 
17
- > **new DataProcessingClient**(`config`): `DataProcessingClient`
17
+ > **new DataProcessingRestClient**(`config`): `DataProcessingRestClient`
18
18
 
19
19
  Create a new instance of DataProcessingClient.
20
20
 
@@ -28,7 +28,7 @@ The configuration for the client.
28
28
 
29
29
  #### Returns
30
30
 
31
- `DataProcessingClient`
31
+ `DataProcessingRestClient`
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` = `DataProcessingClient._CLASS_NAME`
41
+ > `readonly` `static` **CLASS\_NAME**: `string`
42
42
 
43
43
  Runtime name for the class.
44
44
 
45
- #### Implementation of
46
-
47
- `IDataProcessingComponent.CLASS_NAME`
48
-
49
45
  ## Methods
50
46
 
51
47
  ### ruleGroupSet()
@@ -204,7 +200,7 @@ The converted data.
204
200
 
205
201
  ### query()
206
202
 
207
- > **query**(`cursor?`, `pageSize?`): `Promise`\<\{ `entities`: `IRuleGroup`[]; `cursor?`: `string`; \}\>
203
+ > **query**(`cursor?`, `limit?`): `Promise`\<\{ `entities`: `IRuleGroup`[]; `cursor?`: `string`; \}\>
208
204
 
209
205
  Query the rule group entries.
210
206
 
@@ -214,13 +210,13 @@ Query the rule group entries.
214
210
 
215
211
  `string`
216
212
 
217
- The cursor to request the next page of entities.
213
+ The cursor to request the next chunk of entities.
218
214
 
219
- ##### pageSize?
215
+ ##### limit?
220
216
 
221
217
  `number`
222
218
 
223
- The maximum number of entities in a page.
219
+ Limit the number of entities to return.
224
220
 
225
221
  #### Returns
226
222
 
@@ -2,4 +2,4 @@
2
2
 
3
3
  ## Classes
4
4
 
5
- - [DataProcessingClient](classes/DataProcessingClient.md)
5
+ - [DataProcessingRestClient](classes/DataProcessingRestClient.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/data-processing-rest-client",
3
- "version": "0.0.2-next.1",
3
+ "version": "0.0.2-next.3",
4
4
  "description": "Data processing contract implementation which can connect to REST endpoints",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,7 +17,7 @@
17
17
  "@twin.org/api-core": "next",
18
18
  "@twin.org/api-models": "next",
19
19
  "@twin.org/core": "next",
20
- "@twin.org/data-processing-models": "0.0.2-next.1",
20
+ "@twin.org/data-processing-models": "0.0.2-next.3",
21
21
  "@twin.org/entity": "next",
22
22
  "@twin.org/nameof": "next",
23
23
  "@twin.org/web": "next"
@@ -39,5 +39,21 @@
39
39
  "dist/types",
40
40
  "locales",
41
41
  "docs"
42
- ]
42
+ ],
43
+ "keywords": [
44
+ "twin",
45
+ "trade",
46
+ "iota",
47
+ "framework",
48
+ "blockchain",
49
+ "data-processing",
50
+ "data",
51
+ "processing",
52
+ "transformation",
53
+ "conversion"
54
+ ],
55
+ "bugs": {
56
+ "url": "git+https://github.com/twinfoundation/data-processing/issues"
57
+ },
58
+ "homepage": "https://twindev.org"
43
59
  }