erdo 0.1.4__py3-none-any.whl → 0.1.5__py3-none-any.whl

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.

Potentially problematic release.


This version of erdo might be problematic. Click here for more details.

@@ -6,22 +6,34 @@ Provides type-safe action definitions for utils service.
6
6
  Actual execution happens in the Go backend after syncing.
7
7
  """
8
8
 
9
- from typing import Any, Dict, Optional, Union
9
+ from typing import Any, List, Optional, Union
10
10
 
11
11
  from pydantic import BaseModel, Field
12
12
 
13
+ from erdo._generated.types import Resource
13
14
  from erdo.template import TemplateString
14
- from erdo.types import StepMetadata
15
15
 
16
16
 
17
- class EchoParams(BaseModel):
17
+ class BaseActionParams(BaseModel):
18
+ """Base class for all action parameter classes.
19
+
20
+ Provides common fields that all actions support:
21
+ - name: The action type identifier
22
+ - step_metadata: Optional configuration for the step created from this action
23
+ """
24
+
25
+ name: str
26
+ step_metadata: Optional[Any] = None
27
+
28
+
29
+ class EchoParams(BaseActionParams):
18
30
  """Echo parameters back as output parameters"""
19
31
 
20
32
  name: str = "utils.echo" # Action type for roundtrip compatibility
21
33
  data: Optional[Any] = None # data parameter
22
34
 
23
35
 
24
- class ParseJsonParams(BaseModel):
36
+ class ParseJsonParams(BaseActionParams):
25
37
  """Parse JSON string and validate required keys parameters"""
26
38
 
27
39
  model_config = {"populate_by_name": True} # Allow both field names and aliases
@@ -33,7 +45,7 @@ class ParseJsonParams(BaseModel):
33
45
  required_keys: Optional[Any] = None # required_keys parameter
34
46
 
35
47
 
36
- class ConcatParams(BaseModel):
48
+ class ConcatParams(BaseActionParams):
37
49
  """Concatenate arrays or strings from specified keys parameters"""
38
50
 
39
51
  name: str = "utils.concat" # Action type for roundtrip compatibility
@@ -41,7 +53,7 @@ class ConcatParams(BaseModel):
41
53
  data: Optional[Any] = None # data parameter
42
54
 
43
55
 
44
- class CastParams(BaseModel):
56
+ class CastParams(BaseActionParams):
45
57
  """Cast string values to different types (string, integer, float, bool) parameters"""
46
58
 
47
59
  model_config = {"populate_by_name": True} # Allow both field names and aliases
@@ -53,7 +65,7 @@ class CastParams(BaseModel):
53
65
  ) # type parameter
54
66
 
55
67
 
56
- class RaiseParams(BaseModel):
68
+ class RaiseParams(BaseActionParams):
57
69
  """Raise a status with message and parameters parameters"""
58
70
 
59
71
  name: str = "utils.raise" # Action type for roundtrip compatibility
@@ -62,7 +74,7 @@ class RaiseParams(BaseModel):
62
74
  parameters: Optional[Any] = None # parameters parameter
63
75
 
64
76
 
65
- class CaptureExceptionParams(BaseModel):
77
+ class CaptureExceptionParams(BaseActionParams):
66
78
  """Capture an exception to Sentry and return an error result parameters"""
67
79
 
68
80
  name: str = "utils.capture_exception" # Action type for roundtrip compatibility
@@ -71,7 +83,7 @@ class CaptureExceptionParams(BaseModel):
71
83
  error_type: Optional[Union[str, TemplateString]] = None # error_type parameter
72
84
 
73
85
 
74
- class SendStatusParams(BaseModel):
86
+ class SendStatusParams(BaseActionParams):
75
87
  """Send a status event to the client parameters"""
76
88
 
77
89
  name: str = "utils.send_status" # Action type for roundtrip compatibility
@@ -80,7 +92,7 @@ class SendStatusParams(BaseModel):
80
92
  details: Optional[Any] = None # details parameter
81
93
 
82
94
 
83
- class WriteParams(BaseModel):
95
+ class WriteParams(BaseActionParams):
84
96
  """Write output message with specified content types parameters"""
85
97
 
86
98
  name: str = "utils.write" # Action type for roundtrip compatibility
@@ -92,85 +104,146 @@ class WriteParams(BaseModel):
92
104
  ui_content_type: Optional[Union[str, TemplateString]] = (
93
105
  None # ui_content_type parameter
94
106
  )
107
+ output_channels: Optional[Any] = None # output_channels parameter
108
+
109
+
110
+ class ProcessIntegrationQueriesParams(BaseActionParams):
111
+ """Process integration queries to create resource-specific search queries parameters"""
112
+
113
+ name: str = (
114
+ "utils.process_integration_queries" # Action type for roundtrip compatibility
115
+ )
116
+ query: Optional[Union[str, TemplateString]] = None # query parameter
117
+ resource: Optional[Any] = None # resource parameter
118
+ queries: Optional[Any] = None # queries parameter
119
+
120
+
121
+ class PopulateResourceIdsParams(BaseActionParams):
122
+ """Assigns incremental IDs to new resources based on the maximum existing resource ID parameters"""
123
+
124
+ name: str = "utils.populate_resource_ids" # Action type for roundtrip compatibility
125
+ all_resources: Optional[Any] = None # all_resources parameter
126
+ new_resources: Optional[Any] = None # new_resources parameter
95
127
 
96
128
 
97
129
  class EchoResult(BaseModel):
98
130
  """Echo parameters back as output result type
99
131
 
100
- Result schema for utils.echo action.
132
+ Generic result schema for utils.echo action.
101
133
  """
102
134
 
103
- data: Optional[Dict[str, Any]] # Action result data
135
+ success: bool = True # Whether the action was successful
136
+
137
+ class Config:
138
+ extra = "allow" # Allow additional fields dynamically
104
139
 
105
140
 
106
141
  class ParseJsonResult(BaseModel):
107
142
  """Parse JSON string and validate required keys result type
108
143
 
109
- Result schema for utils.parse_json action.
144
+ Generic result schema for utils.parse_json action.
110
145
  """
111
146
 
112
- data: Optional[Dict[str, Any]] # Action result data
147
+ success: bool = True # Whether the action was successful
148
+
149
+ class Config:
150
+ extra = "allow" # Allow additional fields dynamically
113
151
 
114
152
 
115
153
  class ConcatResult(BaseModel):
116
154
  """Concatenate arrays or strings from specified keys result type
117
155
 
118
- Result schema for utils.concat action.
156
+ Generic result schema for utils.concat action.
119
157
  """
120
158
 
121
- data: Optional[Dict[str, Any]] # Action result data
159
+ success: bool = True # Whether the action was successful
160
+
161
+ class Config:
162
+ extra = "allow" # Allow additional fields dynamically
122
163
 
123
164
 
124
165
  class CastResult(BaseModel):
125
166
  """Cast string values to different types (string, integer, float, bool) result type
126
167
 
127
- Result schema for utils.cast action.
168
+ Generic result schema for utils.cast action.
128
169
  """
129
170
 
130
- data: Optional[Dict[str, Any]] # Action result data
171
+ success: bool = True # Whether the action was successful
172
+
173
+ class Config:
174
+ extra = "allow" # Allow additional fields dynamically
131
175
 
132
176
 
133
177
  class RaiseResult(BaseModel):
134
178
  """Raise a status with message and parameters result type
135
179
 
136
- Result schema for utils.raise action.
180
+ Generic result schema for utils.raise action.
137
181
  """
138
182
 
139
- data: Optional[Dict[str, Any]] # Action result data
183
+ success: bool = True # Whether the action was successful
184
+
185
+ class Config:
186
+ extra = "allow" # Allow additional fields dynamically
140
187
 
141
188
 
142
189
  class CaptureExceptionResult(BaseModel):
143
190
  """Capture an exception to Sentry and return an error result result type
144
191
 
145
- Result schema for utils.capture_exception action.
192
+ Generic result schema for utils.capture_exception action.
146
193
  """
147
194
 
148
- data: Optional[Dict[str, Any]] # Action result data
195
+ success: bool = True # Whether the action was successful
196
+
197
+ class Config:
198
+ extra = "allow" # Allow additional fields dynamically
149
199
 
150
200
 
151
201
  class SendStatusResult(BaseModel):
152
202
  """Send a status event to the client result type
153
203
 
154
- Result schema for utils.send_status action.
204
+ Generic result schema for utils.send_status action.
155
205
  """
156
206
 
157
- data: Optional[Dict[str, Any]] # Action result data
207
+ success: bool = True # Whether the action was successful
208
+
209
+ class Config:
210
+ extra = "allow" # Allow additional fields dynamically
158
211
 
159
212
 
160
213
  class WriteResult(BaseModel):
161
214
  """Write output message with specified content types result type
162
215
 
163
- Result schema for utils.write action.
216
+ Generic result schema for utils.write action.
164
217
  """
165
218
 
166
- data: Optional[Dict[str, Any]] # Action result data
219
+ success: bool = True # Whether the action was successful
167
220
 
221
+ class Config:
222
+ extra = "allow" # Allow additional fields dynamically
168
223
 
169
- def echo(
170
- data: Optional[Any] = None,
171
- step_metadata: Optional[StepMetadata] = None,
172
- **params: Any,
173
- ) -> EchoParams:
224
+
225
+ class ProcessIntegrationQueriesResult(BaseModel):
226
+ """Process integration queries to create resource-specific search queries result type
227
+
228
+ Generic result schema for utils.process_integration_queries action.
229
+ """
230
+
231
+ success: bool = True # Whether the action was successful
232
+
233
+ class Config:
234
+ extra = "allow" # Allow additional fields dynamically
235
+
236
+
237
+ class PopulateResourceIdsResult(BaseModel):
238
+ """Assigns incremental IDs to new resources based on the maximum existing resource ID result type
239
+
240
+ Result schema for utils.populate_resource_ids action.
241
+ """
242
+
243
+ new_resources: List[Resource]
244
+
245
+
246
+ def echo(data: Optional[Any] = None, **params: Any) -> EchoParams:
174
247
  """Echo parameters back as output
175
248
 
176
249
  Args:
@@ -185,14 +258,13 @@ def echo(
185
258
  # Remove None values for optional parameters
186
259
  param_dict = {k: v for k, v in param_dict.items() if v is not None}
187
260
  param_dict.update(params)
188
-
189
- return EchoParams(**param_dict)
261
+ params_obj = EchoParams(**param_dict)
262
+ return params_obj
190
263
 
191
264
 
192
265
  def parse_json(
193
266
  json_data: Optional[Union[str, TemplateString]] = None,
194
267
  required_keys: Optional[Any] = None,
195
- step_metadata: Optional[StepMetadata] = None,
196
268
  **params: Any,
197
269
  ) -> ParseJsonParams:
198
270
  """Parse JSON string and validate required keys
@@ -211,15 +283,12 @@ def parse_json(
211
283
  # Remove None values for optional parameters
212
284
  param_dict = {k: v for k, v in param_dict.items() if v is not None}
213
285
  param_dict.update(params)
214
-
215
- return ParseJsonParams(**param_dict)
286
+ params_obj = ParseJsonParams(**param_dict)
287
+ return params_obj
216
288
 
217
289
 
218
290
  def concat(
219
- concat: Optional[Any] = None,
220
- data: Optional[Any] = None,
221
- step_metadata: Optional[StepMetadata] = None,
222
- **params: Any,
291
+ concat: Optional[Any] = None, data: Optional[Any] = None, **params: Any
223
292
  ) -> ConcatParams:
224
293
  """Concatenate arrays or strings from specified keys
225
294
 
@@ -237,14 +306,13 @@ def concat(
237
306
  # Remove None values for optional parameters
238
307
  param_dict = {k: v for k, v in param_dict.items() if v is not None}
239
308
  param_dict.update(params)
240
-
241
- return ConcatParams(**param_dict)
309
+ params_obj = ConcatParams(**param_dict)
310
+ return params_obj
242
311
 
243
312
 
244
313
  def cast(
245
314
  value: Optional[Union[str, TemplateString]] = None,
246
315
  type_name: Optional[Union[str, TemplateString]] = None,
247
- step_metadata: Optional[StepMetadata] = None,
248
316
  **params: Any,
249
317
  ) -> CastParams:
250
318
  """Cast string values to different types (string, integer, float, bool)
@@ -263,15 +331,14 @@ def cast(
263
331
  # Remove None values for optional parameters
264
332
  param_dict = {k: v for k, v in param_dict.items() if v is not None}
265
333
  param_dict.update(params)
266
-
267
- return CastParams(**param_dict)
334
+ params_obj = CastParams(**param_dict)
335
+ return params_obj
268
336
 
269
337
 
270
338
  def raise_error(
271
339
  status: Optional[Union[str, TemplateString]] = None,
272
340
  message: Optional[Union[str, TemplateString]] = None,
273
341
  parameters: Optional[Any] = None,
274
- step_metadata: Optional[StepMetadata] = None,
275
342
  **params: Any,
276
343
  ) -> RaiseParams:
277
344
  """Raise a status with message and parameters
@@ -292,15 +359,14 @@ def raise_error(
292
359
  # Remove None values for optional parameters
293
360
  param_dict = {k: v for k, v in param_dict.items() if v is not None}
294
361
  param_dict.update(params)
295
-
296
- return RaiseParams(**param_dict)
362
+ params_obj = RaiseParams(**param_dict)
363
+ return params_obj
297
364
 
298
365
 
299
366
  def capture_exception(
300
367
  exception: Optional[Union[str, TemplateString]] = None,
301
368
  message: Optional[Union[str, TemplateString]] = None,
302
369
  error_type: Optional[Union[str, TemplateString]] = None,
303
- step_metadata: Optional[StepMetadata] = None,
304
370
  **params: Any,
305
371
  ) -> CaptureExceptionParams:
306
372
  """Capture an exception to Sentry and return an error result
@@ -321,15 +387,14 @@ def capture_exception(
321
387
  # Remove None values for optional parameters
322
388
  param_dict = {k: v for k, v in param_dict.items() if v is not None}
323
389
  param_dict.update(params)
324
-
325
- return CaptureExceptionParams(**param_dict)
390
+ params_obj = CaptureExceptionParams(**param_dict)
391
+ return params_obj
326
392
 
327
393
 
328
394
  def send_status(
329
395
  status: Optional[Union[str, TemplateString]] = None,
330
396
  message: Optional[Union[str, TemplateString]] = None,
331
397
  details: Optional[Any] = None,
332
- step_metadata: Optional[StepMetadata] = None,
333
398
  **params: Any,
334
399
  ) -> SendStatusParams:
335
400
  """Send a status event to the client
@@ -350,8 +415,8 @@ def send_status(
350
415
  # Remove None values for optional parameters
351
416
  param_dict = {k: v for k, v in param_dict.items() if v is not None}
352
417
  param_dict.update(params)
353
-
354
- return SendStatusParams(**param_dict)
418
+ params_obj = SendStatusParams(**param_dict)
419
+ return params_obj
355
420
 
356
421
 
357
422
  def write(
@@ -359,7 +424,7 @@ def write(
359
424
  content_type: Optional[Union[str, TemplateString]] = None,
360
425
  history_content_type: Optional[Union[str, TemplateString]] = None,
361
426
  ui_content_type: Optional[Union[str, TemplateString]] = None,
362
- step_metadata: Optional[StepMetadata] = None,
427
+ output_channels: Optional[Any] = None,
363
428
  **params: Any,
364
429
  ) -> WriteParams:
365
430
  """Write output message with specified content types
@@ -369,6 +434,7 @@ def write(
369
434
  content_type: content_type parameter
370
435
  history_content_type: history_content_type parameter
371
436
  ui_content_type: ui_content_type parameter
437
+ output_channels: output_channels parameter
372
438
 
373
439
  Returns:
374
440
  WriteParams: Type-safe parameter object
@@ -378,12 +444,66 @@ def write(
378
444
  "content_type": content_type,
379
445
  "history_content_type": history_content_type,
380
446
  "ui_content_type": ui_content_type,
447
+ "output_channels": output_channels,
448
+ }
449
+ # Remove None values for optional parameters
450
+ param_dict = {k: v for k, v in param_dict.items() if v is not None}
451
+ param_dict.update(params)
452
+ params_obj = WriteParams(**param_dict)
453
+ return params_obj
454
+
455
+
456
+ def process_integration_queries(
457
+ query: Optional[Union[str, TemplateString]] = None,
458
+ resource: Optional[Any] = None,
459
+ queries: Optional[Any] = None,
460
+ **params: Any,
461
+ ) -> ProcessIntegrationQueriesParams:
462
+ """Process integration queries to create resource-specific search queries
463
+
464
+ Args:
465
+ query: query parameter
466
+ resource: resource parameter
467
+ queries: queries parameter
468
+
469
+ Returns:
470
+ ProcessIntegrationQueriesParams: Type-safe parameter object
471
+ """
472
+ param_dict = {
473
+ "query": query,
474
+ "resource": resource,
475
+ "queries": queries,
381
476
  }
382
477
  # Remove None values for optional parameters
383
478
  param_dict = {k: v for k, v in param_dict.items() if v is not None}
384
479
  param_dict.update(params)
480
+ params_obj = ProcessIntegrationQueriesParams(**param_dict)
481
+ return params_obj
482
+
483
+
484
+ def populate_resource_ids(
485
+ all_resources: Optional[Any] = None,
486
+ new_resources: Optional[Any] = None,
487
+ **params: Any,
488
+ ) -> PopulateResourceIdsParams:
489
+ """Assigns incremental IDs to new resources based on the maximum existing resource ID
490
+
491
+ Args:
492
+ all_resources: all_resources parameter
493
+ new_resources: new_resources parameter
385
494
 
386
- return WriteParams(**param_dict)
495
+ Returns:
496
+ PopulateResourceIdsParams: Type-safe parameter object
497
+ """
498
+ param_dict = {
499
+ "all_resources": all_resources,
500
+ "new_resources": new_resources,
501
+ }
502
+ # Remove None values for optional parameters
503
+ param_dict = {k: v for k, v in param_dict.items() if v is not None}
504
+ param_dict.update(params)
505
+ params_obj = PopulateResourceIdsParams(**param_dict)
506
+ return params_obj
387
507
 
388
508
 
389
509
  # Associate parameter classes with their result types
@@ -395,3 +515,5 @@ RaiseParams._result = RaiseResult
395
515
  CaptureExceptionParams._result = CaptureExceptionResult
396
516
  SendStatusParams._result = SendStatusResult
397
517
  WriteParams._result = WriteResult
518
+ ProcessIntegrationQueriesParams._result = ProcessIntegrationQueriesResult
519
+ PopulateResourceIdsParams._result = PopulateResourceIdsResult
@@ -11,10 +11,21 @@ from typing import Any, Optional, Union
11
11
  from pydantic import BaseModel
12
12
 
13
13
  from erdo.template import TemplateString
14
- from erdo.types import StepMetadata
15
14
 
16
15
 
17
- class ParseParams(BaseModel):
16
+ class BaseActionParams(BaseModel):
17
+ """Base class for all action parameter classes.
18
+
19
+ Provides common fields that all actions support:
20
+ - name: The action type identifier
21
+ - step_metadata: Optional configuration for the step created from this action
22
+ """
23
+
24
+ name: str
25
+ step_metadata: Optional[Any] = None
26
+
27
+
28
+ class ParseParams(BaseActionParams):
18
29
  """Parse website content using Jina's reader API to extract text, images, and links parameters"""
19
30
 
20
31
  name: str = "webparser.parse" # Action type for roundtrip compatibility
@@ -66,7 +77,6 @@ def parse(
66
77
  return_format: Optional[Union[str, TemplateString]] = None,
67
78
  timeout: Optional[Union[int, TemplateString]] = None,
68
79
  no_cache: Optional[Union[bool, TemplateString]] = None,
69
- step_metadata: Optional[StepMetadata] = None,
70
80
  **params: Any,
71
81
  ) -> ParseParams:
72
82
  """Parse website content using Jina's reader API to extract text, images, and links
@@ -101,8 +111,8 @@ def parse(
101
111
  # Remove None values for optional parameters
102
112
  param_dict = {k: v for k, v in param_dict.items() if v is not None}
103
113
  param_dict.update(params)
104
-
105
- return ParseParams(**param_dict)
114
+ params_obj = ParseParams(**param_dict)
115
+ return params_obj
106
116
 
107
117
 
108
118
  # Associate parameter classes with their result types
@@ -11,10 +11,21 @@ from typing import Any, List, Optional, Union
11
11
  from pydantic import BaseModel
12
12
 
13
13
  from erdo.template import TemplateString
14
- from erdo.types import StepMetadata
15
14
 
16
15
 
17
- class SearchParams(BaseModel):
16
+ class BaseActionParams(BaseModel):
17
+ """Base class for all action parameter classes.
18
+
19
+ Provides common fields that all actions support:
20
+ - name: The action type identifier
21
+ - step_metadata: Optional configuration for the step created from this action
22
+ """
23
+
24
+ name: str
25
+ step_metadata: Optional[Any] = None
26
+
27
+
28
+ class SearchParams(BaseActionParams):
18
29
  """Search the web using Jina's search API and return relevant results parameters"""
19
30
 
20
31
  name: str = "websearch.search" # Action type for roundtrip compatibility
@@ -42,7 +53,6 @@ def search(
42
53
  country: Optional[Union[str, TemplateString]] = None,
43
54
  location: Optional[Union[str, TemplateString]] = None,
44
55
  num_results: Optional[Union[int, TemplateString]] = None,
45
- step_metadata: Optional[StepMetadata] = None,
46
56
  **params: Any,
47
57
  ) -> SearchParams:
48
58
  """Search the web using Jina's search API and return relevant results
@@ -67,8 +77,8 @@ def search(
67
77
  # Remove None values for optional parameters
68
78
  param_dict = {k: v for k, v in param_dict.items() if v is not None}
69
79
  param_dict.update(params)
70
-
71
- return SearchParams(**param_dict)
80
+ params_obj = SearchParams(**param_dict)
81
+ return params_obj
72
82
 
73
83
 
74
84
  # Associate parameter classes with their result types