@twin.org/data-processing-rest-client 0.0.2-next.4 → 0.0.3-next.2

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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # TWIN Data Processing REST Client
2
2
 
3
- Data processing contract implementation which can connect to REST endpoints.
3
+ REST client for calling data processing service endpoints from applications.
4
4
 
5
5
  ## Installation
6
6
 
@@ -1,12 +1,11 @@
1
- import { BaseRestClient } from '@twin.org/api-core';
2
- import { Guards, Converter, ObjectHelper, Coerce } from '@twin.org/core';
3
-
4
1
  // Copyright 2024 IOTA Stiftung.
5
2
  // SPDX-License-Identifier: Apache-2.0.
3
+ import { BaseRestClient } from "@twin.org/api-core";
4
+ import { Coerce, Converter, Guards, ObjectHelper } from "@twin.org/core";
6
5
  /**
7
6
  * Client for performing data processing through to REST endpoints.
8
7
  */
9
- class DataProcessingRestClient extends BaseRestClient {
8
+ export class DataProcessingRestClient extends BaseRestClient {
10
9
  /**
11
10
  * Runtime name for the class.
12
11
  */
@@ -18,6 +17,13 @@ class DataProcessingRestClient extends BaseRestClient {
18
17
  constructor(config) {
19
18
  super(DataProcessingRestClient.CLASS_NAME, config, "data-processing");
20
19
  }
20
+ /**
21
+ * Returns the class name of the component.
22
+ * @returns The class name of the component.
23
+ */
24
+ className() {
25
+ return DataProcessingRestClient.CLASS_NAME;
26
+ }
21
27
  /**
22
28
  * Set an extraction rule group.
23
29
  * @param ruleGroup The rule group to store.
@@ -119,5 +125,4 @@ class DataProcessingRestClient extends BaseRestClient {
119
125
  return response.body;
120
126
  }
121
127
  }
122
-
123
- export { DataProcessingRestClient };
128
+ //# sourceMappingURL=dataProcessingRestClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataProcessingRestClient.js","sourceRoot":"","sources":["../../src/dataProcessingRestClient.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseRestClient } from \"@twin.org/api-core\";\nimport type { IBaseRestClientConfig, INoContentResponse } from \"@twin.org/api-models\";\nimport { Coerce, Converter, Guards, ObjectHelper } from \"@twin.org/core\";\nimport type {\n\tIDataProcessingComponent,\n\tIDataProcessingConvertRequest,\n\tIDataProcessingConvertResponse,\n\tIDataProcessingExtractRequest,\n\tIDataProcessingExtractResponse,\n\tIDataProcessingRuleGroupGetRequest,\n\tIDataProcessingRuleGroupGetResponse,\n\tIDataProcessingRuleGroupListRequest,\n\tIDataProcessingRuleGroupListResponse,\n\tIDataProcessingRuleGroupRemoveRequest,\n\tIDataProcessingRuleGroupSetRequest,\n\tIRule,\n\tIRuleGroup\n} from \"@twin.org/data-processing-models\";\nimport { nameof } from \"@twin.org/nameof\";\n\n/**\n * Client for performing data processing through to REST endpoints.\n */\nexport class DataProcessingRestClient extends BaseRestClient implements IDataProcessingComponent {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<DataProcessingRestClient>();\n\n\t/**\n\t * Create a new instance of DataProcessingRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IBaseRestClientConfig) {\n\t\tsuper(DataProcessingRestClient.CLASS_NAME, config, \"data-processing\");\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn DataProcessingRestClient.CLASS_NAME;\n\t}\n\n\t/**\n\t * Set an extraction rule group.\n\t * @param ruleGroup The rule group to store.\n\t * @returns Nothing.\n\t */\n\tpublic async ruleGroupSet(ruleGroup: IRuleGroup): Promise<void> {\n\t\tGuards.object<IRuleGroup>(DataProcessingRestClient.CLASS_NAME, nameof(ruleGroup), ruleGroup);\n\t\tGuards.stringValue(DataProcessingRestClient.CLASS_NAME, nameof(ruleGroup.id), ruleGroup.id);\n\t\tGuards.stringValue(\n\t\t\tDataProcessingRestClient.CLASS_NAME,\n\t\t\tnameof(ruleGroup.label),\n\t\t\truleGroup.label\n\t\t);\n\t\tGuards.array<IRule>(\n\t\t\tDataProcessingRestClient.CLASS_NAME,\n\t\t\tnameof(ruleGroup.rules),\n\t\t\truleGroup.rules\n\t\t);\n\n\t\tawait this.fetch<IDataProcessingRuleGroupSetRequest, INoContentResponse>(\n\t\t\t\"/rule-group/:id\",\n\t\t\t\"PUT\",\n\t\t\t{\n\t\t\t\tpathParams: {\n\t\t\t\t\tid: ruleGroup.id\n\t\t\t\t},\n\t\t\t\tbody: {\n\t\t\t\t\tlabel: ruleGroup.label,\n\t\t\t\t\trules: ruleGroup.rules\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * Get a rule group for extraction.\n\t * @param ruleGroupId The id of the rule group to get.\n\t * @returns The rule group.\n\t */\n\tpublic async ruleGroupGet(ruleGroupId: string): Promise<IRuleGroup> {\n\t\tGuards.stringValue(DataProcessingRestClient.CLASS_NAME, nameof(ruleGroupId), ruleGroupId);\n\n\t\tconst response = await this.fetch<\n\t\t\tIDataProcessingRuleGroupGetRequest,\n\t\t\tIDataProcessingRuleGroupGetResponse\n\t\t>(\"/rule-group/:id\", \"GET\", {\n\t\t\tpathParams: {\n\t\t\t\tid: ruleGroupId\n\t\t\t}\n\t\t});\n\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Remove a rule group.\n\t * @param ruleGroupId The id of the rule group to remove.\n\t * @returns Nothing.\n\t */\n\tpublic async ruleGroupRemove(ruleGroupId: string): Promise<void> {\n\t\tGuards.stringValue(DataProcessingRestClient.CLASS_NAME, nameof(ruleGroupId), ruleGroupId);\n\n\t\tawait this.fetch<IDataProcessingRuleGroupRemoveRequest, INoContentResponse>(\n\t\t\t\"/rule-group/:id\",\n\t\t\t\"DELETE\",\n\t\t\t{\n\t\t\t\tpathParams: {\n\t\t\t\t\tid: ruleGroupId\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * Extracts data from the provided input.\n\t * @param ruleGroupId The id of the rule group to use to extract data.\n\t * @param data The data to extract from.\n\t * @param overrideExtractorType An optional override for the extractor type.\n\t * @param overrideMimeType An optional override for the mime type for conversion, will auto detect if not provided.\n\t * @returns The extracted data.\n\t */\n\tpublic async extract(\n\t\truleGroupId: string,\n\t\tdata: Uint8Array,\n\t\toverrideExtractorType?: string,\n\t\toverrideMimeType?: string\n\t): Promise<unknown> {\n\t\tGuards.stringValue(DataProcessingRestClient.CLASS_NAME, nameof(ruleGroupId), ruleGroupId);\n\t\tGuards.uint8Array(DataProcessingRestClient.CLASS_NAME, nameof(data), data);\n\n\t\tconst result = await this.fetch<IDataProcessingExtractRequest, IDataProcessingExtractResponse>(\n\t\t\t\"/extract\",\n\t\t\t\"POST\",\n\t\t\t{\n\t\t\t\tbody: {\n\t\t\t\t\truleGroupId,\n\t\t\t\t\tdata: Converter.bytesToBase64(data),\n\t\t\t\t\toverrideExtractorType,\n\t\t\t\t\toverrideMimeType\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn ObjectHelper.fromExtended(result.body);\n\t}\n\n\t/**\n\t * Converts data from the provided input to a structured JSON document.\n\t * @param data The data to convert.\n\t * @param overrideMimeType An optional override for the mime type, will auto detect if empty.\n\t * @returns The converted data.\n\t */\n\tpublic async convert(data: Uint8Array, overrideMimeType?: string): Promise<unknown> {\n\t\tGuards.uint8Array(DataProcessingRestClient.CLASS_NAME, nameof(data), data);\n\n\t\tconst result = await this.fetch<IDataProcessingConvertRequest, IDataProcessingConvertResponse>(\n\t\t\t\"/convert\",\n\t\t\t\"POST\",\n\t\t\t{\n\t\t\t\tbody: {\n\t\t\t\t\tdata: Converter.bytesToBase64(data),\n\t\t\t\t\toverrideMimeType\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn ObjectHelper.fromExtended(result.body);\n\t}\n\n\t/**\n\t * Query the rule group entries.\n\t * @param cursor The cursor to request the next chunk of entities.\n\t * @param limit Limit the number of entities to return.\n\t * @returns All the entities for the storage matching the conditions,\n\t * and a cursor which can be used to request more entities.\n\t */\n\tpublic async query(\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\t/**\n\t\t * The entities, which can be partial if a limited keys list was provided.\n\t\t */\n\t\tentities: IRuleGroup[];\n\t\t/**\n\t\t * An optional cursor, when defined can be used to call find to get more entities.\n\t\t */\n\t\tcursor?: string;\n\t}> {\n\t\tconst response = await this.fetch<\n\t\t\tIDataProcessingRuleGroupListRequest,\n\t\t\tIDataProcessingRuleGroupListResponse\n\t\t>(\"/rule-group\", \"GET\", {\n\t\t\tquery: {\n\t\t\t\tcursor,\n\t\t\t\tlimit: Coerce.string(limit)\n\t\t\t}\n\t\t});\n\n\t\treturn response.body;\n\t}\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export * from "./dataProcessingRestClient.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,+BAA+B,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./dataProcessingRestClient.js\";\n"]}
@@ -14,6 +14,11 @@ export declare class DataProcessingRestClient extends BaseRestClient implements
14
14
  * @param config The configuration for the client.
15
15
  */
16
16
  constructor(config: IBaseRestClientConfig);
17
+ /**
18
+ * Returns the class name of the component.
19
+ * @returns The class name of the component.
20
+ */
21
+ className(): string;
17
22
  /**
18
23
  * Set an extraction rule group.
19
24
  * @param ruleGroup The rule group to store.
@@ -1 +1 @@
1
- export * from "./dataProcessingRestClient";
1
+ export * from "./dataProcessingRestClient.js";
package/docs/changelog.md CHANGED
@@ -1,11 +1,52 @@
1
- # @twin.org/data-processing-rest-client - Changelog
1
+ # Changelog
2
2
 
3
- ## [0.0.2-next.4](https://github.com/twinfoundation/data-processing/compare/data-processing-rest-client-v0.0.2-next.3...data-processing-rest-client-v0.0.2-next.4) (2025-10-22)
3
+ ## [0.0.3-next.2](https://github.com/iotaledger/twin-data-processing/compare/data-processing-rest-client-v0.0.3-next.1...data-processing-rest-client-v0.0.3-next.2) (2026-05-11)
4
+
5
+
6
+ ### Features
7
+
8
+ * typescript 6 update ([b67debb](https://github.com/iotaledger/twin-data-processing/commit/b67debb8aff83c0f3b179c6db038ed733f7308b1))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/data-processing-models bumped from 0.0.3-next.1 to 0.0.3-next.2
16
+
17
+ ## [0.0.3-next.1](https://github.com/iotaledger/twin-data-processing/compare/data-processing-rest-client-v0.0.3-next.0...data-processing-rest-client-v0.0.3-next.1) (2025-11-11)
18
+
19
+
20
+ ### Features
21
+
22
+ * add context id features ([#25](https://github.com/iotaledger/twin-data-processing/issues/25)) ([2a2a955](https://github.com/iotaledger/twin-data-processing/commit/2a2a9559d54e8c703e97e2c05996e678416ef560))
23
+ * Add rule group query functionality ([#2](https://github.com/iotaledger/twin-data-processing/issues/2)) ([0fbbfb0](https://github.com/iotaledger/twin-data-processing/commit/0fbbfb065b6ecc293920b25f97ba011743105486))
24
+ * add validate-locales ([9af0874](https://github.com/iotaledger/twin-data-processing/commit/9af0874cd3f44a4cfca514dde8380f002e62337e))
25
+ * eslint migration to flat config ([a8138b0](https://github.com/iotaledger/twin-data-processing/commit/a8138b020ed58baeff162a822d4df207a6aeadc4))
26
+ * pass the mimeTypeOverride through the component extract method ([#9](https://github.com/iotaledger/twin-data-processing/issues/9)) ([a2b36de](https://github.com/iotaledger/twin-data-processing/commit/a2b36de5c19c56e4172d3f22b176aa83e1df84c8))
27
+ * update dependencies ([21b8e80](https://github.com/iotaledger/twin-data-processing/commit/21b8e8007c87136a09f0a8e35ffde13a07ff4711))
28
+ * update framework core ([96f6e80](https://github.com/iotaledger/twin-data-processing/commit/96f6e8016a4ef0fb873f6775e750b4ab42e9f491))
29
+ * use shared store mechanism ([#6](https://github.com/iotaledger/twin-data-processing/issues/6)) ([6009228](https://github.com/iotaledger/twin-data-processing/commit/600922880acef07cc2f818dee7645c342929108b))
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * supporting array usage ([#20](https://github.com/iotaledger/twin-data-processing/issues/20)) ([d2c68cd](https://github.com/iotaledger/twin-data-processing/commit/d2c68cd3983622586cc073377545d6416b87a827))
35
+ * Update endpoint for fetching rule group list ([#3](https://github.com/iotaledger/twin-data-processing/issues/3)) ([919c1b4](https://github.com/iotaledger/twin-data-processing/commit/919c1b435e760251ca57f96ed9f701b08542f318))
36
+
37
+
38
+ ### Dependencies
39
+
40
+ * The following workspace dependencies were updated
41
+ * dependencies
42
+ * @twin.org/data-processing-models bumped from 0.0.3-next.0 to 0.0.3-next.1
43
+
44
+ ## [0.0.2-next.4](https://github.com/iotaledger/twin-data-processing/compare/data-processing-rest-client-v0.0.2-next.3...data-processing-rest-client-v0.0.2-next.4) (2025-10-22)
4
45
 
5
46
 
6
47
  ### Bug Fixes
7
48
 
8
- * supporting array usage ([#20](https://github.com/twinfoundation/data-processing/issues/20)) ([d2c68cd](https://github.com/twinfoundation/data-processing/commit/d2c68cd3983622586cc073377545d6416b87a827))
49
+ * supporting array usage ([#20](https://github.com/iotaledger/twin-data-processing/issues/20)) ([d2c68cd](https://github.com/iotaledger/twin-data-processing/commit/d2c68cd3983622586cc073377545d6416b87a827))
9
50
 
10
51
 
11
52
  ### Dependencies
@@ -14,12 +55,12 @@
14
55
  * dependencies
15
56
  * @twin.org/data-processing-models bumped from 0.0.2-next.3 to 0.0.2-next.4
16
57
 
17
- ## [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)
58
+ ## [0.0.2-next.3](https://github.com/iotaledger/twin-data-processing/compare/data-processing-rest-client-v0.0.2-next.2...data-processing-rest-client-v0.0.2-next.3) (2025-10-09)
18
59
 
19
60
 
20
61
  ### Features
21
62
 
22
- * add validate-locales ([9af0874](https://github.com/twinfoundation/data-processing/commit/9af0874cd3f44a4cfca514dde8380f002e62337e))
63
+ * add validate-locales ([9af0874](https://github.com/iotaledger/twin-data-processing/commit/9af0874cd3f44a4cfca514dde8380f002e62337e))
23
64
 
24
65
 
25
66
  ### Dependencies
@@ -28,12 +69,12 @@
28
69
  * dependencies
29
70
  * @twin.org/data-processing-models bumped from 0.0.2-next.2 to 0.0.2-next.3
30
71
 
31
- ## [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)
72
+ ## [0.0.2-next.2](https://github.com/iotaledger/twin-data-processing/compare/data-processing-rest-client-v0.0.2-next.1...data-processing-rest-client-v0.0.2-next.2) (2025-08-29)
32
73
 
33
74
 
34
75
  ### Features
35
76
 
36
- * eslint migration to flat config ([a8138b0](https://github.com/twinfoundation/data-processing/commit/a8138b020ed58baeff162a822d4df207a6aeadc4))
77
+ * eslint migration to flat config ([a8138b0](https://github.com/iotaledger/twin-data-processing/commit/a8138b020ed58baeff162a822d4df207a6aeadc4))
37
78
 
38
79
 
39
80
  ### Dependencies
@@ -42,21 +83,21 @@
42
83
  * dependencies
43
84
  * @twin.org/data-processing-models bumped from 0.0.2-next.1 to 0.0.2-next.2
44
85
 
45
- ## [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)
86
+ ## [0.0.2-next.1](https://github.com/iotaledger/twin-data-processing/compare/data-processing-rest-client-v0.0.2-next.0...data-processing-rest-client-v0.0.2-next.1) (2025-08-20)
46
87
 
47
88
 
48
89
  ### Features
49
90
 
50
- * Add rule group query functionality ([#2](https://github.com/twinfoundation/data-processing/issues/2)) ([0fbbfb0](https://github.com/twinfoundation/data-processing/commit/0fbbfb065b6ecc293920b25f97ba011743105486))
51
- * pass the mimeTypeOverride through the component extract method ([#9](https://github.com/twinfoundation/data-processing/issues/9)) ([a2b36de](https://github.com/twinfoundation/data-processing/commit/a2b36de5c19c56e4172d3f22b176aa83e1df84c8))
52
- * update dependencies ([21b8e80](https://github.com/twinfoundation/data-processing/commit/21b8e8007c87136a09f0a8e35ffde13a07ff4711))
53
- * update framework core ([96f6e80](https://github.com/twinfoundation/data-processing/commit/96f6e8016a4ef0fb873f6775e750b4ab42e9f491))
54
- * use shared store mechanism ([#6](https://github.com/twinfoundation/data-processing/issues/6)) ([6009228](https://github.com/twinfoundation/data-processing/commit/600922880acef07cc2f818dee7645c342929108b))
91
+ * Add rule group query functionality ([#2](https://github.com/iotaledger/twin-data-processing/issues/2)) ([0fbbfb0](https://github.com/iotaledger/twin-data-processing/commit/0fbbfb065b6ecc293920b25f97ba011743105486))
92
+ * pass the mimeTypeOverride through the component extract method ([#9](https://github.com/iotaledger/twin-data-processing/issues/9)) ([a2b36de](https://github.com/iotaledger/twin-data-processing/commit/a2b36de5c19c56e4172d3f22b176aa83e1df84c8))
93
+ * update dependencies ([21b8e80](https://github.com/iotaledger/twin-data-processing/commit/21b8e8007c87136a09f0a8e35ffde13a07ff4711))
94
+ * update framework core ([96f6e80](https://github.com/iotaledger/twin-data-processing/commit/96f6e8016a4ef0fb873f6775e750b4ab42e9f491))
95
+ * use shared store mechanism ([#6](https://github.com/iotaledger/twin-data-processing/issues/6)) ([6009228](https://github.com/iotaledger/twin-data-processing/commit/600922880acef07cc2f818dee7645c342929108b))
55
96
 
56
97
 
57
98
  ### Bug Fixes
58
99
 
59
- * Update endpoint for fetching rule group list ([#3](https://github.com/twinfoundation/data-processing/issues/3)) ([919c1b4](https://github.com/twinfoundation/data-processing/commit/919c1b435e760251ca57f96ed9f701b08542f318))
100
+ * Update endpoint for fetching rule group list ([#3](https://github.com/iotaledger/twin-data-processing/issues/3)) ([919c1b4](https://github.com/iotaledger/twin-data-processing/commit/919c1b435e760251ca57f96ed9f701b08542f318))
60
101
 
61
102
 
62
103
  ### Dependencies
@@ -70,16 +111,16 @@
70
111
 
71
112
  ### Features
72
113
 
73
- * Add rule group query functionality ([#2](https://github.com/twinfoundation/data-processing/issues/2)) ([0fbbfb0](https://github.com/twinfoundation/data-processing/commit/0fbbfb065b6ecc293920b25f97ba011743105486))
74
- * pass the mimeTypeOverride through the component extract method ([#9](https://github.com/twinfoundation/data-processing/issues/9)) ([a2b36de](https://github.com/twinfoundation/data-processing/commit/a2b36de5c19c56e4172d3f22b176aa83e1df84c8))
75
- * release to production ([531ba89](https://github.com/twinfoundation/data-processing/commit/531ba89dea2deb2810870b72851dca3081f9d2ce))
76
- * update dependencies ([21b8e80](https://github.com/twinfoundation/data-processing/commit/21b8e8007c87136a09f0a8e35ffde13a07ff4711))
77
- * use shared store mechanism ([#6](https://github.com/twinfoundation/data-processing/issues/6)) ([6009228](https://github.com/twinfoundation/data-processing/commit/600922880acef07cc2f818dee7645c342929108b))
114
+ * Add rule group query functionality ([#2](https://github.com/iotaledger/twin-data-processing/issues/2)) ([0fbbfb0](https://github.com/iotaledger/twin-data-processing/commit/0fbbfb065b6ecc293920b25f97ba011743105486))
115
+ * pass the mimeTypeOverride through the component extract method ([#9](https://github.com/iotaledger/twin-data-processing/issues/9)) ([a2b36de](https://github.com/iotaledger/twin-data-processing/commit/a2b36de5c19c56e4172d3f22b176aa83e1df84c8))
116
+ * release to production ([531ba89](https://github.com/iotaledger/twin-data-processing/commit/531ba89dea2deb2810870b72851dca3081f9d2ce))
117
+ * update dependencies ([21b8e80](https://github.com/iotaledger/twin-data-processing/commit/21b8e8007c87136a09f0a8e35ffde13a07ff4711))
118
+ * use shared store mechanism ([#6](https://github.com/iotaledger/twin-data-processing/issues/6)) ([6009228](https://github.com/iotaledger/twin-data-processing/commit/600922880acef07cc2f818dee7645c342929108b))
78
119
 
79
120
 
80
121
  ### Bug Fixes
81
122
 
82
- * Update endpoint for fetching rule group list ([#3](https://github.com/twinfoundation/data-processing/issues/3)) ([919c1b4](https://github.com/twinfoundation/data-processing/commit/919c1b435e760251ca57f96ed9f701b08542f318))
123
+ * Update endpoint for fetching rule group list ([#3](https://github.com/iotaledger/twin-data-processing/issues/3)) ([919c1b4](https://github.com/iotaledger/twin-data-processing/commit/919c1b435e760251ca57f96ed9f701b08542f318))
83
124
 
84
125
 
85
126
  ### Dependencies
@@ -88,7 +129,7 @@
88
129
  * dependencies
89
130
  * @twin.org/data-processing-models bumped from ^0.0.0 to ^0.0.1
90
131
 
91
- ## [0.0.1-next.16](https://github.com/twinfoundation/data-processing/compare/data-processing-rest-client-v0.0.1-next.15...data-processing-rest-client-v0.0.1-next.16) (2025-06-20)
132
+ ## [0.0.1-next.16](https://github.com/iotaledger/twin-data-processing/compare/data-processing-rest-client-v0.0.1-next.15...data-processing-rest-client-v0.0.1-next.16) (2025-06-20)
92
133
 
93
134
 
94
135
  ### Miscellaneous Chores
@@ -102,12 +143,12 @@
102
143
  * dependencies
103
144
  * @twin.org/data-processing-models bumped from 0.0.1-next.15 to 0.0.1-next.16
104
145
 
105
- ## [0.0.1-next.15](https://github.com/twinfoundation/data-processing/compare/data-processing-rest-client-v0.0.1-next.14...data-processing-rest-client-v0.0.1-next.15) (2025-06-12)
146
+ ## [0.0.1-next.15](https://github.com/iotaledger/twin-data-processing/compare/data-processing-rest-client-v0.0.1-next.14...data-processing-rest-client-v0.0.1-next.15) (2025-06-12)
106
147
 
107
148
 
108
149
  ### Features
109
150
 
110
- * update dependencies ([21b8e80](https://github.com/twinfoundation/data-processing/commit/21b8e8007c87136a09f0a8e35ffde13a07ff4711))
151
+ * update dependencies ([21b8e80](https://github.com/iotaledger/twin-data-processing/commit/21b8e8007c87136a09f0a8e35ffde13a07ff4711))
111
152
 
112
153
 
113
154
  ### Dependencies
@@ -116,12 +157,12 @@
116
157
  * dependencies
117
158
  * @twin.org/data-processing-models bumped from 0.0.1-next.14 to 0.0.1-next.15
118
159
 
119
- ## [0.0.1-next.14](https://github.com/twinfoundation/data-processing/compare/data-processing-rest-client-v0.0.1-next.13...data-processing-rest-client-v0.0.1-next.14) (2025-04-28)
160
+ ## [0.0.1-next.14](https://github.com/iotaledger/twin-data-processing/compare/data-processing-rest-client-v0.0.1-next.13...data-processing-rest-client-v0.0.1-next.14) (2025-04-28)
120
161
 
121
162
 
122
163
  ### Features
123
164
 
124
- * pass the mimeTypeOverride through the component extract method ([#9](https://github.com/twinfoundation/data-processing/issues/9)) ([a2b36de](https://github.com/twinfoundation/data-processing/commit/a2b36de5c19c56e4172d3f22b176aa83e1df84c8))
165
+ * pass the mimeTypeOverride through the component extract method ([#9](https://github.com/iotaledger/twin-data-processing/issues/9)) ([a2b36de](https://github.com/iotaledger/twin-data-processing/commit/a2b36de5c19c56e4172d3f22b176aa83e1df84c8))
125
166
 
126
167
 
127
168
  ### Dependencies
@@ -130,7 +171,7 @@
130
171
  * dependencies
131
172
  * @twin.org/data-processing-models bumped from 0.0.1-next.13 to 0.0.1-next.14
132
173
 
133
- ## [0.0.1-next.13](https://github.com/twinfoundation/data-processing/compare/data-processing-rest-client-v0.0.1-next.12...data-processing-rest-client-v0.0.1-next.13) (2025-04-24)
174
+ ## [0.0.1-next.13](https://github.com/iotaledger/twin-data-processing/compare/data-processing-rest-client-v0.0.1-next.12...data-processing-rest-client-v0.0.1-next.13) (2025-04-24)
134
175
 
135
176
 
136
177
  ### Miscellaneous Chores
@@ -144,12 +185,12 @@
144
185
  * dependencies
145
186
  * @twin.org/data-processing-models bumped from 0.0.1-next.12 to 0.0.1-next.13
146
187
 
147
- ## [0.0.1-next.12](https://github.com/twinfoundation/data-processing/compare/data-processing-rest-client-v0.0.1-next.11...data-processing-rest-client-v0.0.1-next.12) (2025-04-17)
188
+ ## [0.0.1-next.12](https://github.com/iotaledger/twin-data-processing/compare/data-processing-rest-client-v0.0.1-next.11...data-processing-rest-client-v0.0.1-next.12) (2025-04-17)
148
189
 
149
190
 
150
191
  ### Features
151
192
 
152
- * use shared store mechanism ([#6](https://github.com/twinfoundation/data-processing/issues/6)) ([6009228](https://github.com/twinfoundation/data-processing/commit/600922880acef07cc2f818dee7645c342929108b))
193
+ * use shared store mechanism ([#6](https://github.com/iotaledger/twin-data-processing/issues/6)) ([6009228](https://github.com/iotaledger/twin-data-processing/commit/600922880acef07cc2f818dee7645c342929108b))
153
194
 
154
195
 
155
196
  ### Dependencies
@@ -158,17 +199,17 @@
158
199
  * dependencies
159
200
  * @twin.org/data-processing-models bumped from 0.0.1-next.11 to 0.0.1-next.12
160
201
 
161
- ## [0.0.1-next.11](https://github.com/twinfoundation/data-processing/compare/data-processing-rest-client-v0.0.1-next.10...data-processing-rest-client-v0.0.1-next.11) (2025-03-28)
202
+ ## [0.0.1-next.11](https://github.com/iotaledger/twin-data-processing/compare/data-processing-rest-client-v0.0.1-next.10...data-processing-rest-client-v0.0.1-next.11) (2025-03-28)
162
203
 
163
204
 
164
205
  ### Features
165
206
 
166
- * Add rule group query functionality ([#2](https://github.com/twinfoundation/data-processing/issues/2)) ([0fbbfb0](https://github.com/twinfoundation/data-processing/commit/0fbbfb065b6ecc293920b25f97ba011743105486))
207
+ * Add rule group query functionality ([#2](https://github.com/iotaledger/twin-data-processing/issues/2)) ([0fbbfb0](https://github.com/iotaledger/twin-data-processing/commit/0fbbfb065b6ecc293920b25f97ba011743105486))
167
208
 
168
209
 
169
210
  ### Bug Fixes
170
211
 
171
- * Update endpoint for fetching rule group list ([#3](https://github.com/twinfoundation/data-processing/issues/3)) ([919c1b4](https://github.com/twinfoundation/data-processing/commit/919c1b435e760251ca57f96ed9f701b08542f318))
212
+ * Update endpoint for fetching rule group list ([#3](https://github.com/iotaledger/twin-data-processing/issues/3)) ([919c1b4](https://github.com/iotaledger/twin-data-processing/commit/919c1b435e760251ca57f96ed9f701b08542f318))
172
213
 
173
214
 
174
215
  ### Dependencies
package/docs/examples.md CHANGED
@@ -1 +1,61 @@
1
- # @twin.org/data-processing-rest-client - Examples
1
+ # Data Processing REST Client Examples
2
+
3
+ These snippets show how to connect to a running service, maintain rule groups, and call extraction and conversion endpoints.
4
+
5
+ ## DataProcessingRestClient
6
+
7
+ ```typescript
8
+ import { ObjectHelper } from '@twin.org/core';
9
+ import type { IRuleGroup } from '@twin.org/data-processing-models';
10
+ import { DataProcessingRestClient } from '@twin.org/data-processing-rest-client';
11
+
12
+ const client = new DataProcessingRestClient({ endpoint: 'http://localhost:8080' });
13
+
14
+ console.log(client.className()); // dataProcessingRestClient
15
+
16
+ const ruleGroup: IRuleGroup = {
17
+ id: 'orders-summary',
18
+ label: 'Orders Summary',
19
+ rules: [
20
+ { source: '$.orders[*].id', target: 'orderIds' },
21
+ { source: '$.orders[*].total', target: 'totals' }
22
+ ]
23
+ };
24
+
25
+ await client.ruleGroupSet(ruleGroup);
26
+
27
+ const saved = await client.ruleGroupGet('orders-summary');
28
+ console.log(saved); // { id: 'orders-summary', label: 'Orders Summary', rules: [ { source: '$.orders[*].id', target: 'orderIds' }, { source: '$.orders[*].total', target: 'totals' } ] }
29
+ ```
30
+
31
+ ```typescript
32
+ import { ObjectHelper } from '@twin.org/core';
33
+ import { DataProcessingRestClient } from '@twin.org/data-processing-rest-client';
34
+
35
+ const client = new DataProcessingRestClient({ endpoint: 'http://localhost:8080' });
36
+
37
+ const payload = ObjectHelper.toBytes({
38
+ orders: [
39
+ { id: 'A-100', total: 19.99 },
40
+ { id: 'A-101', total: 24.5 }
41
+ ]
42
+ });
43
+
44
+ const extracted = await client.extract('orders-summary', payload);
45
+ console.log(extracted); // { orderIds: ['A-100', 'A-101'], totals: [19.99, 24.5] }
46
+
47
+ const converted = await client.convert(payload, 'application/json');
48
+ console.log(converted); // { orders: [ { id: 'A-100', total: 19.99 }, { id: 'A-101', total: 24.5 } ] }
49
+ ```
50
+
51
+ ```typescript
52
+ import { DataProcessingRestClient } from '@twin.org/data-processing-rest-client';
53
+
54
+ const client = new DataProcessingRestClient({ endpoint: 'http://localhost:8080' });
55
+
56
+ const listed = await client.query(undefined, 10);
57
+ console.log(listed.entities.length); // 1
58
+ console.log(listed.cursor); // undefined
59
+
60
+ await client.ruleGroupRemove('orders-summary');
61
+ ```
@@ -36,7 +36,7 @@ The configuration for the client.
36
36
 
37
37
  ## Properties
38
38
 
39
- ### CLASS\_NAME
39
+ ### CLASS\_NAME {#class_name}
40
40
 
41
41
  > `readonly` `static` **CLASS\_NAME**: `string`
42
42
 
@@ -44,7 +44,25 @@ Runtime name for the class.
44
44
 
45
45
  ## Methods
46
46
 
47
- ### ruleGroupSet()
47
+ ### className() {#classname}
48
+
49
+ > **className**(): `string`
50
+
51
+ Returns the class name of the component.
52
+
53
+ #### Returns
54
+
55
+ `string`
56
+
57
+ The class name of the component.
58
+
59
+ #### Implementation of
60
+
61
+ `IDataProcessingComponent.className`
62
+
63
+ ***
64
+
65
+ ### ruleGroupSet() {#rulegroupset}
48
66
 
49
67
  > **ruleGroupSet**(`ruleGroup`): `Promise`\<`void`\>
50
68
 
@@ -70,7 +88,7 @@ Nothing.
70
88
 
71
89
  ***
72
90
 
73
- ### ruleGroupGet()
91
+ ### ruleGroupGet() {#rulegroupget}
74
92
 
75
93
  > **ruleGroupGet**(`ruleGroupId`): `Promise`\<`IRuleGroup`\>
76
94
 
@@ -96,7 +114,7 @@ The rule group.
96
114
 
97
115
  ***
98
116
 
99
- ### ruleGroupRemove()
117
+ ### ruleGroupRemove() {#rulegroupremove}
100
118
 
101
119
  > **ruleGroupRemove**(`ruleGroupId`): `Promise`\<`void`\>
102
120
 
@@ -122,7 +140,7 @@ Nothing.
122
140
 
123
141
  ***
124
142
 
125
- ### extract()
143
+ ### extract() {#extract}
126
144
 
127
145
  > **extract**(`ruleGroupId`, `data`, `overrideExtractorType?`, `overrideMimeType?`): `Promise`\<`unknown`\>
128
146
 
@@ -166,7 +184,7 @@ The extracted data.
166
184
 
167
185
  ***
168
186
 
169
- ### convert()
187
+ ### convert() {#convert}
170
188
 
171
189
  > **convert**(`data`, `overrideMimeType?`): `Promise`\<`unknown`\>
172
190
 
@@ -198,7 +216,7 @@ The converted data.
198
216
 
199
217
  ***
200
218
 
201
- ### query()
219
+ ### query() {#query}
202
220
 
203
221
  > **query**(`cursor?`, `limit?`): `Promise`\<\{ `entities`: `IRuleGroup`[]; `cursor?`: `string`; \}\>
204
222
 
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@twin.org/data-processing-rest-client",
3
- "version": "0.0.2-next.4",
4
- "description": "Data processing contract implementation which can connect to REST endpoints",
3
+ "version": "0.0.3-next.2",
4
+ "description": "REST client for calling data processing service endpoints from applications",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "git+https://github.com/twinfoundation/data-processing.git",
7
+ "url": "git+https://github.com/iotaledger/data-processing.git",
8
8
  "directory": "packages/data-processing-rest-client"
9
9
  },
10
10
  "author": "martyn.janes@iota.org",
@@ -17,25 +17,23 @@
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.4",
20
+ "@twin.org/data-processing-models": "0.0.3-next.2",
21
21
  "@twin.org/entity": "next",
22
22
  "@twin.org/nameof": "next",
23
23
  "@twin.org/web": "next"
24
24
  },
25
- "main": "./dist/cjs/index.cjs",
26
- "module": "./dist/esm/index.mjs",
25
+ "main": "./dist/es/index.js",
27
26
  "types": "./dist/types/index.d.ts",
28
27
  "exports": {
29
28
  ".": {
30
29
  "types": "./dist/types/index.d.ts",
31
- "require": "./dist/cjs/index.cjs",
32
- "import": "./dist/esm/index.mjs"
30
+ "import": "./dist/es/index.js",
31
+ "default": "./dist/es/index.js"
33
32
  },
34
33
  "./locales/*.json": "./locales/*.json"
35
34
  },
36
35
  "files": [
37
- "dist/cjs",
38
- "dist/esm",
36
+ "dist/es",
39
37
  "dist/types",
40
38
  "locales",
41
39
  "docs"
@@ -53,7 +51,7 @@
53
51
  "conversion"
54
52
  ],
55
53
  "bugs": {
56
- "url": "git+https://github.com/twinfoundation/data-processing/issues"
54
+ "url": "git+https://github.com/iotaledger/data-processing/issues"
57
55
  },
58
56
  "homepage": "https://twindev.org"
59
57
  }
@@ -1,125 +0,0 @@
1
- 'use strict';
2
-
3
- var apiCore = require('@twin.org/api-core');
4
- var core = require('@twin.org/core');
5
-
6
- // Copyright 2024 IOTA Stiftung.
7
- // SPDX-License-Identifier: Apache-2.0.
8
- /**
9
- * Client for performing data processing through to REST endpoints.
10
- */
11
- class DataProcessingRestClient extends apiCore.BaseRestClient {
12
- /**
13
- * Runtime name for the class.
14
- */
15
- static CLASS_NAME = "DataProcessingRestClient";
16
- /**
17
- * Create a new instance of DataProcessingRestClient.
18
- * @param config The configuration for the client.
19
- */
20
- constructor(config) {
21
- super(DataProcessingRestClient.CLASS_NAME, config, "data-processing");
22
- }
23
- /**
24
- * Set an extraction rule group.
25
- * @param ruleGroup The rule group to store.
26
- * @returns Nothing.
27
- */
28
- async ruleGroupSet(ruleGroup) {
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);
33
- await this.fetch("/rule-group/:id", "PUT", {
34
- pathParams: {
35
- id: ruleGroup.id
36
- },
37
- body: {
38
- label: ruleGroup.label,
39
- rules: ruleGroup.rules
40
- }
41
- });
42
- }
43
- /**
44
- * Get a rule group for extraction.
45
- * @param ruleGroupId The id of the rule group to get.
46
- * @returns The rule group.
47
- */
48
- async ruleGroupGet(ruleGroupId) {
49
- core.Guards.stringValue(DataProcessingRestClient.CLASS_NAME, "ruleGroupId", ruleGroupId);
50
- const response = await this.fetch("/rule-group/:id", "GET", {
51
- pathParams: {
52
- id: ruleGroupId
53
- }
54
- });
55
- return response.body;
56
- }
57
- /**
58
- * Remove a rule group.
59
- * @param ruleGroupId The id of the rule group to remove.
60
- * @returns Nothing.
61
- */
62
- async ruleGroupRemove(ruleGroupId) {
63
- core.Guards.stringValue(DataProcessingRestClient.CLASS_NAME, "ruleGroupId", ruleGroupId);
64
- await this.fetch("/rule-group/:id", "DELETE", {
65
- pathParams: {
66
- id: ruleGroupId
67
- }
68
- });
69
- }
70
- /**
71
- * Extracts data from the provided input.
72
- * @param ruleGroupId The id of the rule group to use to extract data.
73
- * @param data The data to extract from.
74
- * @param overrideExtractorType An optional override for the extractor type.
75
- * @param overrideMimeType An optional override for the mime type for conversion, will auto detect if not provided.
76
- * @returns The extracted data.
77
- */
78
- async extract(ruleGroupId, data, overrideExtractorType, overrideMimeType) {
79
- core.Guards.stringValue(DataProcessingRestClient.CLASS_NAME, "ruleGroupId", ruleGroupId);
80
- core.Guards.uint8Array(DataProcessingRestClient.CLASS_NAME, "data", data);
81
- const result = await this.fetch("/extract", "POST", {
82
- body: {
83
- ruleGroupId,
84
- data: core.Converter.bytesToBase64(data),
85
- overrideExtractorType,
86
- overrideMimeType
87
- }
88
- });
89
- return core.ObjectHelper.fromExtended(result.body);
90
- }
91
- /**
92
- * Converts data from the provided input to a structured JSON document.
93
- * @param data The data to convert.
94
- * @param overrideMimeType An optional override for the mime type, will auto detect if empty.
95
- * @returns The converted data.
96
- */
97
- async convert(data, overrideMimeType) {
98
- core.Guards.uint8Array(DataProcessingRestClient.CLASS_NAME, "data", data);
99
- const result = await this.fetch("/convert", "POST", {
100
- body: {
101
- data: core.Converter.bytesToBase64(data),
102
- overrideMimeType
103
- }
104
- });
105
- return core.ObjectHelper.fromExtended(result.body);
106
- }
107
- /**
108
- * Query the rule group entries.
109
- * @param cursor The cursor to request the next chunk of entities.
110
- * @param limit Limit the number of entities to return.
111
- * @returns All the entities for the storage matching the conditions,
112
- * and a cursor which can be used to request more entities.
113
- */
114
- async query(cursor, limit) {
115
- const response = await this.fetch("/rule-group", "GET", {
116
- query: {
117
- cursor,
118
- limit: core.Coerce.string(limit)
119
- }
120
- });
121
- return response.body;
122
- }
123
- }
124
-
125
- exports.DataProcessingRestClient = DataProcessingRestClient;