@3sixty/data-processing-service 0.0.0-stage → 0.20.0-next.1

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 (46) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +24 -2
  3. package/dist/es/dataProcessingRoutes.js +384 -0
  4. package/dist/es/dataProcessingRoutes.js.map +1 -0
  5. package/dist/es/dataProcessingService.js +175 -0
  6. package/dist/es/dataProcessingService.js.map +1 -0
  7. package/dist/es/entities/extractionRule.js +43 -0
  8. package/dist/es/entities/extractionRule.js.map +1 -0
  9. package/dist/es/entities/extractionRuleGroup.js +37 -0
  10. package/dist/es/entities/extractionRuleGroup.js.map +1 -0
  11. package/dist/es/index.js +10 -0
  12. package/dist/es/index.js.map +1 -0
  13. package/dist/es/models/IDataProcessingServiceConstructorOptions.js +4 -0
  14. package/dist/es/models/IDataProcessingServiceConstructorOptions.js.map +1 -0
  15. package/dist/es/restEntryPoints.js +13 -0
  16. package/dist/es/restEntryPoints.js.map +1 -0
  17. package/dist/es/schema.js +13 -0
  18. package/dist/es/schema.js.map +1 -0
  19. package/dist/types/dataProcessingRoutes.d.ts +61 -0
  20. package/dist/types/dataProcessingService.d.ts +73 -0
  21. package/dist/types/entities/extractionRule.d.ts +22 -0
  22. package/dist/types/entities/extractionRuleGroup.d.ts +18 -0
  23. package/dist/types/index.d.ts +7 -0
  24. package/dist/types/models/IDataProcessingServiceConstructorOptions.d.ts +14 -0
  25. package/dist/types/restEntryPoints.d.ts +5 -0
  26. package/dist/types/schema.d.ts +4 -0
  27. package/docs/changelog.md +19 -0
  28. package/docs/examples.md +112 -0
  29. package/docs/open-api/spec.json +894 -0
  30. package/docs/reference/classes/DataProcessingService.md +244 -0
  31. package/docs/reference/classes/ExtractionRule.md +45 -0
  32. package/docs/reference/classes/ExtractionRuleGroup.md +37 -0
  33. package/docs/reference/functions/dataProcessingConvert.md +31 -0
  34. package/docs/reference/functions/dataProcessingExtract.md +31 -0
  35. package/docs/reference/functions/dataProcessingGetRuleGroup.md +31 -0
  36. package/docs/reference/functions/dataProcessingRemoveRuleGroup.md +31 -0
  37. package/docs/reference/functions/dataProcessingSetRuleGroup.md +31 -0
  38. package/docs/reference/functions/generateRestRoutesDataProcessing.md +25 -0
  39. package/docs/reference/functions/initSchema.md +9 -0
  40. package/docs/reference/functions/ruleGroupList.md +31 -0
  41. package/docs/reference/index.md +27 -0
  42. package/docs/reference/interfaces/IDataProcessingServiceConstructorOptions.md +25 -0
  43. package/docs/reference/variables/restEntryPoints.md +5 -0
  44. package/docs/reference/variables/tagsDataProcessing.md +5 -0
  45. package/locales/en.json +10 -0
  46. package/package.json +59 -5
@@ -0,0 +1,244 @@
1
+ # Class: DataProcessingService
2
+
3
+ Class for processing data from a source.
4
+
5
+ ## Implements
6
+
7
+ - `IDataProcessingComponent`
8
+
9
+ ## Constructors
10
+
11
+ ### Constructor
12
+
13
+ > **new DataProcessingService**(`options?`): `DataProcessingService`
14
+
15
+ Create a new instance of DataExtractionService.
16
+
17
+ #### Parameters
18
+
19
+ ##### options?
20
+
21
+ [`IDataProcessingServiceConstructorOptions`](../interfaces/IDataProcessingServiceConstructorOptions.md)
22
+
23
+ The options for the connector.
24
+
25
+ #### Returns
26
+
27
+ `DataProcessingService`
28
+
29
+ #### Throws
30
+
31
+ GeneralError If no extractor connector is registered.
32
+
33
+ ## Properties
34
+
35
+ ### CLASS\_NAME {#class_name}
36
+
37
+ > `readonly` `static` **CLASS\_NAME**: `string`
38
+
39
+ Runtime name for the class.
40
+
41
+ ## Methods
42
+
43
+ ### className() {#classname}
44
+
45
+ > **className**(): `string`
46
+
47
+ Returns the class name of the component.
48
+
49
+ #### Returns
50
+
51
+ `string`
52
+
53
+ The class name of the component.
54
+
55
+ #### Implementation of
56
+
57
+ `IDataProcessingComponent.className`
58
+
59
+ ***
60
+
61
+ ### ruleGroupSet() {#rulegroupset}
62
+
63
+ > **ruleGroupSet**(`ruleGroup`): `Promise`\<`void`\>
64
+
65
+ Set an extraction rule group.
66
+
67
+ #### Parameters
68
+
69
+ ##### ruleGroup
70
+
71
+ `IRuleGroup`
72
+
73
+ The rule group to store.
74
+
75
+ #### Returns
76
+
77
+ `Promise`\<`void`\>
78
+
79
+ A promise that resolves when the rule group has been stored.
80
+
81
+ #### Implementation of
82
+
83
+ `IDataProcessingComponent.ruleGroupSet`
84
+
85
+ ***
86
+
87
+ ### ruleGroupGet() {#rulegroupget}
88
+
89
+ > **ruleGroupGet**(`ruleGroupId`): `Promise`\<`IRuleGroup`\>
90
+
91
+ Get a rule group for extraction.
92
+
93
+ #### Parameters
94
+
95
+ ##### ruleGroupId
96
+
97
+ `string`
98
+
99
+ The id of the rule group to get.
100
+
101
+ #### Returns
102
+
103
+ `Promise`\<`IRuleGroup`\>
104
+
105
+ The rule group.
106
+
107
+ #### Implementation of
108
+
109
+ `IDataProcessingComponent.ruleGroupGet`
110
+
111
+ ***
112
+
113
+ ### ruleGroupRemove() {#rulegroupremove}
114
+
115
+ > **ruleGroupRemove**(`ruleGroupId`): `Promise`\<`void`\>
116
+
117
+ Remove a rule group.
118
+
119
+ #### Parameters
120
+
121
+ ##### ruleGroupId
122
+
123
+ `string`
124
+
125
+ The id of the rule group to remove.
126
+
127
+ #### Returns
128
+
129
+ `Promise`\<`void`\>
130
+
131
+ A promise that resolves when the rule group has been removed.
132
+
133
+ #### Implementation of
134
+
135
+ `IDataProcessingComponent.ruleGroupRemove`
136
+
137
+ ***
138
+
139
+ ### extract() {#extract}
140
+
141
+ > **extract**(`ruleGroupId`, `data`, `overrideExtractorType?`, `overrideMimeType?`): `Promise`\<`unknown`\>
142
+
143
+ Extracts data from the provided input.
144
+
145
+ #### Parameters
146
+
147
+ ##### ruleGroupId
148
+
149
+ `string`
150
+
151
+ The id of the rule group to use to extract data.
152
+
153
+ ##### data
154
+
155
+ `Uint8Array`
156
+
157
+ The data to extract from.
158
+
159
+ ##### overrideExtractorType?
160
+
161
+ `string`
162
+
163
+ An optional override for the extractor type.
164
+
165
+ ##### overrideMimeType?
166
+
167
+ `string`
168
+
169
+ An optional override for the mime type for conversion, will auto detect if not provided.
170
+
171
+ #### Returns
172
+
173
+ `Promise`\<`unknown`\>
174
+
175
+ The extracted data.
176
+
177
+ #### Implementation of
178
+
179
+ `IDataProcessingComponent.extract`
180
+
181
+ ***
182
+
183
+ ### convert() {#convert}
184
+
185
+ > **convert**(`data`, `overrideMimeType?`): `Promise`\<`unknown`\>
186
+
187
+ Converts data from the provided input to a structured JSON document.
188
+
189
+ #### Parameters
190
+
191
+ ##### data
192
+
193
+ `Uint8Array`
194
+
195
+ The data to convert.
196
+
197
+ ##### overrideMimeType?
198
+
199
+ `string`
200
+
201
+ An optional override for the mime type, will auto detect if empty.
202
+
203
+ #### Returns
204
+
205
+ `Promise`\<`unknown`\>
206
+
207
+ The converted data.
208
+
209
+ #### Implementation of
210
+
211
+ `IDataProcessingComponent.convert`
212
+
213
+ ***
214
+
215
+ ### query() {#query}
216
+
217
+ > **query**(`cursor?`, `limit?`): `Promise`\<\{ `entities`: `IRuleGroup`[]; `cursor?`: `string`; \}\>
218
+
219
+ Query the rule group entries.
220
+
221
+ #### Parameters
222
+
223
+ ##### cursor?
224
+
225
+ `string`
226
+
227
+ The cursor to request the next chunk of entities.
228
+
229
+ ##### limit?
230
+
231
+ `number`
232
+
233
+ Limit the number of entities to return.
234
+
235
+ #### Returns
236
+
237
+ `Promise`\<\{ `entities`: `IRuleGroup`[]; `cursor?`: `string`; \}\>
238
+
239
+ All the entities for the storage matching the conditions,
240
+ and a cursor which can be used to request more entities.
241
+
242
+ #### Implementation of
243
+
244
+ `IDataProcessingComponent.query`
@@ -0,0 +1,45 @@
1
+ # Class: ExtractionRule
2
+
3
+ Class defining an extraction rule.
4
+
5
+ ## Constructors
6
+
7
+ ### Constructor
8
+
9
+ > **new ExtractionRule**(): `ExtractionRule`
10
+
11
+ #### Returns
12
+
13
+ `ExtractionRule`
14
+
15
+ ## Properties
16
+
17
+ ### source {#source}
18
+
19
+ > **source**: `string`
20
+
21
+ The JSONPath expression identifying the source field in the input document.
22
+
23
+ ***
24
+
25
+ ### target {#target}
26
+
27
+ > **target**: `string`
28
+
29
+ The dotted path identifying where to store the extracted value in the output.
30
+
31
+ ***
32
+
33
+ ### retainPathDepth? {#retainpathdepth}
34
+
35
+ > `optional` **retainPathDepth?**: `number`
36
+
37
+ The number of path segments from the source location to preserve in the target path.
38
+
39
+ ***
40
+
41
+ ### coerce? {#coerce}
42
+
43
+ > `optional` **coerce?**: `CoerceType`
44
+
45
+ The type to coerce the extracted value to.
@@ -0,0 +1,37 @@
1
+ # Class: ExtractionRuleGroup
2
+
3
+ Class defining an extraction rule group.
4
+
5
+ ## Constructors
6
+
7
+ ### Constructor
8
+
9
+ > **new ExtractionRuleGroup**(): `ExtractionRuleGroup`
10
+
11
+ #### Returns
12
+
13
+ `ExtractionRuleGroup`
14
+
15
+ ## Properties
16
+
17
+ ### id {#id}
18
+
19
+ > **id**: `string`
20
+
21
+ The unique identifier for the rule group.
22
+
23
+ ***
24
+
25
+ ### label {#label}
26
+
27
+ > **label**: `string`
28
+
29
+ The human-readable label for the rule group.
30
+
31
+ ***
32
+
33
+ ### rules {#rules}
34
+
35
+ > **rules**: [`ExtractionRule`](ExtractionRule.md)[]
36
+
37
+ The extraction rules that belong to this group.
@@ -0,0 +1,31 @@
1
+ # Function: dataProcessingConvert()
2
+
3
+ > **dataProcessingConvert**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IDataProcessingConvertResponse`\>
4
+
5
+ Convert data using the specified rule group.
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
+ `IDataProcessingConvertRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`IDataProcessingConvertResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: dataProcessingExtract()
2
+
3
+ > **dataProcessingExtract**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IDataProcessingExtractResponse`\>
4
+
5
+ Extract data using the specified rule group.
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
+ `IDataProcessingExtractRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`IDataProcessingExtractResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: dataProcessingGetRuleGroup()
2
+
3
+ > **dataProcessingGetRuleGroup**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IDataProcessingRuleGroupGetResponse`\>
4
+
5
+ Get an extraction rule group.
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
+ `IDataProcessingRuleGroupGetRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`IDataProcessingRuleGroupGetResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: dataProcessingRemoveRuleGroup()
2
+
3
+ > **dataProcessingRemoveRuleGroup**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
4
+
5
+ Remove an extraction rule group.
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
+ `IDataProcessingRuleGroupRemoveRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`INoContentResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: dataProcessingSetRuleGroup()
2
+
3
+ > **dataProcessingSetRuleGroup**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
4
+
5
+ Store an extraction rule group.
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
+ `IDataProcessingRuleGroupSetRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`INoContentResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,25 @@
1
+ # Function: generateRestRoutesDataProcessing()
2
+
3
+ > **generateRestRoutesDataProcessing**(`baseRouteName`, `componentName`): `IRestRoute`\<`any`, `any`\>[]
4
+
5
+ The REST routes for data processing.
6
+
7
+ ## Parameters
8
+
9
+ ### baseRouteName
10
+
11
+ `string`
12
+
13
+ Prefix to prepend to the paths.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes stored in the ComponentFactory.
20
+
21
+ ## Returns
22
+
23
+ `IRestRoute`\<`any`, `any`\>[]
24
+
25
+ The generated routes.
@@ -0,0 +1,9 @@
1
+ # Function: initSchema()
2
+
3
+ > **initSchema**(): `void`
4
+
5
+ Registers entity schemas for the data extraction connector entity storage.
6
+
7
+ ## Returns
8
+
9
+ `void`
@@ -0,0 +1,31 @@
1
+ # Function: ruleGroupList()
2
+
3
+ > **ruleGroupList**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IDataProcessingRuleGroupListResponse`\>
4
+
5
+ Get a list of the rule group entries.
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
+ `IDataProcessingRuleGroupListRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`IDataProcessingRuleGroupListResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,27 @@
1
+ # @3sixty/data-processing-service
2
+
3
+ ## Classes
4
+
5
+ - [DataProcessingService](classes/DataProcessingService.md)
6
+ - [ExtractionRule](classes/ExtractionRule.md)
7
+ - [ExtractionRuleGroup](classes/ExtractionRuleGroup.md)
8
+
9
+ ## Interfaces
10
+
11
+ - [IDataProcessingServiceConstructorOptions](interfaces/IDataProcessingServiceConstructorOptions.md)
12
+
13
+ ## Variables
14
+
15
+ - [tagsDataProcessing](variables/tagsDataProcessing.md)
16
+ - [restEntryPoints](variables/restEntryPoints.md)
17
+
18
+ ## Functions
19
+
20
+ - [generateRestRoutesDataProcessing](functions/generateRestRoutesDataProcessing.md)
21
+ - [dataProcessingSetRuleGroup](functions/dataProcessingSetRuleGroup.md)
22
+ - [dataProcessingGetRuleGroup](functions/dataProcessingGetRuleGroup.md)
23
+ - [dataProcessingRemoveRuleGroup](functions/dataProcessingRemoveRuleGroup.md)
24
+ - [dataProcessingExtract](functions/dataProcessingExtract.md)
25
+ - [dataProcessingConvert](functions/dataProcessingConvert.md)
26
+ - [ruleGroupList](functions/ruleGroupList.md)
27
+ - [initSchema](functions/initSchema.md)
@@ -0,0 +1,25 @@
1
+ # Interface: IDataProcessingServiceConstructorOptions
2
+
3
+ The options for the data processing service constructor.
4
+
5
+ ## Properties
6
+
7
+ ### extractionRuleGroupStorageConnectorType? {#extractionrulegroupstorageconnectortype}
8
+
9
+ > `optional` **extractionRuleGroupStorageConnectorType?**: `string`
10
+
11
+ The type of the entity storage connector to use for extraction rule groups.
12
+
13
+ #### Default
14
+
15
+ ```ts
16
+ extraction-rule-group
17
+ ```
18
+
19
+ ***
20
+
21
+ ### defaultExtractorType? {#defaultextractortype}
22
+
23
+ > `optional` **defaultExtractorType?**: `string`
24
+
25
+ The default extractor type to use, if not provided uses the first in the factory.
@@ -0,0 +1,5 @@
1
+ # Variable: restEntryPoints
2
+
3
+ > `const` **restEntryPoints**: `IRestRouteEntryPoint`[]
4
+
5
+ The REST entry points for the data processing service.
@@ -0,0 +1,5 @@
1
+ # Variable: tagsDataProcessing
2
+
3
+ > `const` **tagsDataProcessing**: `ITag`[]
4
+
5
+ The tag to associate with the routes.
@@ -0,0 +1,10 @@
1
+ {
2
+ "error": {
3
+ "dataProcessingService": {
4
+ "noExtractorFound": "No extractors could be found in the factory",
5
+ "ruleGroupNotFound": "The rule group with id \"{notFoundId}\" could not be found",
6
+ "mimeTypeNotFound": "Unable to detect MIME type from data",
7
+ "converterNotFound": "Unable to find a converter for the MIME type \"{notFoundId}\""
8
+ }
9
+ }
10
+ }
package/package.json CHANGED
@@ -1,6 +1,60 @@
1
1
  {
2
- "name": "@3sixty/data-processing-service",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@3sixty/data-processing-service",
3
+ "version": "0.20.0-next.1",
4
+ "description": "Service routes and orchestration logic for extraction and conversion workflows",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/3sixtyglobal/data-processing.git",
8
+ "directory": "packages/data-processing-service"
9
+ },
10
+ "author": "martyn.janes@iota.org",
11
+ "license": "Apache-2.0",
12
+ "type": "module",
13
+ "engines": {
14
+ "node": ">=24.0.0"
15
+ },
16
+ "dependencies": {
17
+ "@3sixty/api-models": "next",
18
+ "@3sixty/core": "next",
19
+ "@3sixty/data-processing-models": "0.20.0-next.1",
20
+ "@3sixty/entity": "next",
21
+ "@3sixty/entity-storage-models": "next",
22
+ "@3sixty/nameof": "next",
23
+ "@3sixty/web": "next"
24
+ },
25
+ "main": "./dist/es/index.js",
26
+ "types": "./dist/types/index.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/types/index.d.ts",
30
+ "import": "./dist/es/index.js",
31
+ "default": "./dist/es/index.js"
32
+ },
33
+ "./locales/*.json": "./locales/*.json"
34
+ },
35
+ "files": [
36
+ "dist/es",
37
+ "dist/types",
38
+ "locales",
39
+ "docs"
40
+ ],
41
+ "keywords": [
42
+ "twin",
43
+ "trade",
44
+ "iota",
45
+ "framework",
46
+ "blockchain",
47
+ "data-processing",
48
+ "data",
49
+ "processing",
50
+ "transformation",
51
+ "conversion",
52
+ "service",
53
+ "microservice",
54
+ "business-logic"
55
+ ],
56
+ "bugs": {
57
+ "url": "git+https://github.com/3sixtyglobal/data-processing/issues"
58
+ },
59
+ "homepage": "https://3sixty.global"
60
+ }