erdo 0.1.4__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.

@@ -0,0 +1,504 @@
1
+ # DO NOT EDIT THIS FILE MANUALLY - it will be overwritten.
2
+ # Generated by: erdo gen-client
3
+ """
4
+ Condition classes auto-generated from Go condition types.
5
+
6
+ These classes provide type-safe condition definitions that match
7
+ the backend condition system exactly.
8
+ """
9
+
10
+ from typing import TYPE_CHECKING, Any, Dict, List, Union
11
+
12
+ if TYPE_CHECKING:
13
+ # Forward reference for condition types
14
+ Condition = Union[
15
+ "_BaseCondition", "_AndCondition", "_OrCondition", "_NotCondition"
16
+ ]
17
+
18
+
19
+ # Composite condition functions (matching Go pattern)
20
+ class _AndCondition:
21
+ def __init__(self, *conditions: Any) -> None:
22
+ self.conditions = list(conditions)
23
+
24
+ def to_dict(self) -> Dict[str, Any]:
25
+ """Convert to dict format expected by backend."""
26
+ return {
27
+ "type": "And",
28
+ "conditions": [
29
+ c.to_dict() if hasattr(c, "to_dict") else c for c in self.conditions
30
+ ],
31
+ }
32
+
33
+ def __and__(self, other: Any) -> "_AndCondition":
34
+ """Support & operator for chaining AND conditions."""
35
+ if isinstance(other, _AndCondition):
36
+ return _AndCondition(*(self.conditions + other.conditions))
37
+ return _AndCondition(*(self.conditions + [other]))
38
+
39
+ def __or__(self, other: Any) -> "_OrCondition":
40
+ """Support | operator for OR conditions."""
41
+ return _OrCondition(self, other)
42
+
43
+ def __invert__(self) -> "_NotCondition":
44
+ """Support ~ operator for NOT conditions."""
45
+ return _NotCondition(self)
46
+
47
+
48
+ class _OrCondition:
49
+ def __init__(self, *conditions: Any) -> None:
50
+ self.conditions = list(conditions)
51
+
52
+ def to_dict(self) -> Dict[str, Any]:
53
+ """Convert to dict format expected by backend."""
54
+ return {
55
+ "type": "Or",
56
+ "conditions": [
57
+ c.to_dict() if hasattr(c, "to_dict") else c for c in self.conditions
58
+ ],
59
+ }
60
+
61
+ def __and__(self, other: Any) -> "_AndCondition":
62
+ """Support & operator for AND conditions."""
63
+ return _AndCondition(self, other)
64
+
65
+ def __or__(self, other: Any) -> "_OrCondition":
66
+ """Support | operator for chaining OR conditions."""
67
+ if isinstance(other, _OrCondition):
68
+ return _OrCondition(*(self.conditions + other.conditions))
69
+ return _OrCondition(*(self.conditions + [other]))
70
+
71
+ def __invert__(self) -> "_NotCondition":
72
+ """Support ~ operator for NOT conditions."""
73
+ return _NotCondition(self)
74
+
75
+
76
+ class _NotCondition:
77
+ def __init__(self, condition: Any) -> None:
78
+ self.condition = condition
79
+
80
+ def to_dict(self) -> Dict[str, Any]:
81
+ """Convert to dict format expected by backend."""
82
+ return {
83
+ "type": "Not",
84
+ "conditions": (
85
+ self.condition.to_dict()
86
+ if hasattr(self.condition, "to_dict")
87
+ else self.condition
88
+ ),
89
+ }
90
+
91
+ def __and__(self, other: Any) -> "_AndCondition":
92
+ """Support & operator for AND conditions."""
93
+ return _AndCondition(self, other)
94
+
95
+ def __or__(self, other: Any) -> "_OrCondition":
96
+ """Support | operator for OR conditions."""
97
+ return _OrCondition(self, other)
98
+
99
+ def __invert__(self) -> Any:
100
+ """Support ~ operator for double negation (returns original condition)."""
101
+ return self.condition
102
+
103
+
104
+ def And(*conditions: "Condition") -> _AndCondition:
105
+ """Create an AND condition from multiple conditions"""
106
+ return _AndCondition(*conditions)
107
+
108
+
109
+ def Or(*conditions: "Condition") -> _OrCondition:
110
+ """Create an OR condition from multiple conditions"""
111
+ return _OrCondition(*conditions)
112
+
113
+
114
+ def Not(condition: "Condition") -> _NotCondition:
115
+ """Create a NOT condition from a single condition"""
116
+ return _NotCondition(condition)
117
+
118
+
119
+ # Base class for leaf conditions to support operators
120
+ class _BaseCondition:
121
+ """Base class for all leaf conditions to support operator overloading."""
122
+
123
+ def __and__(self, other: Any) -> "_AndCondition":
124
+ """Support & operator for AND conditions."""
125
+ return _AndCondition(self, other)
126
+
127
+ def __or__(self, other: Any) -> "_OrCondition":
128
+ """Support | operator for OR conditions."""
129
+ return _OrCondition(self, other)
130
+
131
+ def __invert__(self) -> "_NotCondition":
132
+ """Support ~ operator for NOT conditions."""
133
+ return _NotCondition(self)
134
+
135
+
136
+ class IsNull(_BaseCondition):
137
+ def __init__(self, key: Any = None) -> None:
138
+ self.key = key
139
+
140
+ def to_dict(self) -> Dict[str, Any]:
141
+ """Convert to dict format expected by backend."""
142
+ result: Dict[str, Any] = {}
143
+ result["type"] = "IsNull"
144
+
145
+ # Add field values to leaf object (backend expects leaf format)
146
+ leaf: Dict[str, Any] = {}
147
+ if self.key is not None:
148
+ leaf["key"] = self.key
149
+
150
+ if leaf:
151
+ result["leaf"] = leaf
152
+
153
+ return result
154
+
155
+
156
+ class IsSuccess(_BaseCondition):
157
+ def __init__(self) -> None:
158
+ pass
159
+
160
+ def to_dict(self) -> Dict[str, Any]:
161
+ """Convert to dict format expected by backend."""
162
+ return {"type": "IsSuccess", "leaf": {}}
163
+
164
+
165
+ class AndCondition(_BaseCondition):
166
+ def __init__(self, conditions: Any = None) -> None:
167
+ self.conditions = conditions
168
+
169
+ def to_dict(self) -> Dict[str, Any]:
170
+ """Convert to dict format expected by backend."""
171
+ result: Dict[str, Any] = {}
172
+ result["type"] = "AndCondition"
173
+
174
+ # Add field values to leaf object (backend expects leaf format)
175
+ leaf: Dict[str, Any] = {}
176
+ if self.conditions is not None:
177
+ leaf["conditions"] = self.conditions
178
+
179
+ if leaf:
180
+ result["leaf"] = leaf
181
+
182
+ return result
183
+
184
+
185
+ class EarlierThan(_BaseCondition):
186
+ def __init__(self, time: Any = None, value: Any = None) -> None:
187
+ self.time = time
188
+ self.value = value
189
+
190
+ def to_dict(self) -> Dict[str, Any]:
191
+ """Convert to dict format expected by backend."""
192
+ result: Dict[str, Any] = {}
193
+ result["type"] = "EarlierThan"
194
+
195
+ # Add field values to leaf object (backend expects leaf format)
196
+ leaf: Dict[str, Any] = {}
197
+ if self.time is not None:
198
+ leaf["time"] = self.time
199
+ if self.value is not None:
200
+ leaf["value"] = self.value
201
+
202
+ if leaf:
203
+ result["leaf"] = leaf
204
+
205
+ return result
206
+
207
+
208
+ class FalseCondition(_BaseCondition):
209
+ def __init__(self) -> None:
210
+ pass
211
+
212
+ def to_dict(self) -> Dict[str, Any]:
213
+ """Convert to dict format expected by backend."""
214
+ return {"type": "FalseCondition", "leaf": {}}
215
+
216
+
217
+ class IsError(_BaseCondition):
218
+ def __init__(self) -> None:
219
+ pass
220
+
221
+ def to_dict(self) -> Dict[str, Any]:
222
+ """Convert to dict format expected by backend."""
223
+ return {"type": "IsError", "leaf": {}}
224
+
225
+
226
+ class LessThan(_BaseCondition):
227
+ def __init__(self, number: Any = None, value: Any = None) -> None:
228
+ self.number = number
229
+ self.value = value
230
+
231
+ def to_dict(self) -> Dict[str, Any]:
232
+ """Convert to dict format expected by backend."""
233
+ result: Dict[str, Any] = {}
234
+ result["type"] = "LessThan"
235
+
236
+ # Add field values to leaf object (backend expects leaf format)
237
+ leaf: Dict[str, Any] = {}
238
+ if self.number is not None:
239
+ leaf["number"] = self.number
240
+ if self.value is not None:
241
+ leaf["value"] = self.value
242
+
243
+ if leaf:
244
+ result["leaf"] = leaf
245
+
246
+ return result
247
+
248
+
249
+ class TextEquals(_BaseCondition):
250
+ def __init__(self, text: Any = None, value: Any = None) -> None:
251
+ self.text = text
252
+ self.value = value
253
+
254
+ def to_dict(self) -> Dict[str, Any]:
255
+ """Convert to dict format expected by backend."""
256
+ result: Dict[str, Any] = {}
257
+ result["type"] = "TextEquals"
258
+
259
+ # Add field values to leaf object (backend expects leaf format)
260
+ leaf: Dict[str, Any] = {}
261
+ if self.text is not None:
262
+ leaf["text"] = self.text
263
+ if self.value is not None:
264
+ leaf["value"] = self.value
265
+
266
+ if leaf:
267
+ result["leaf"] = leaf
268
+
269
+ return result
270
+
271
+
272
+ class TextStartsWith(_BaseCondition):
273
+ def __init__(self, text: Any = None, value: Any = None) -> None:
274
+ self.text = text
275
+ self.value = value
276
+
277
+ def to_dict(self) -> Dict[str, Any]:
278
+ """Convert to dict format expected by backend."""
279
+ result: Dict[str, Any] = {}
280
+ result["type"] = "TextStartsWith"
281
+
282
+ # Add field values to leaf object (backend expects leaf format)
283
+ leaf: Dict[str, Any] = {}
284
+ if self.text is not None:
285
+ leaf["text"] = self.text
286
+ if self.value is not None:
287
+ leaf["value"] = self.value
288
+
289
+ if leaf:
290
+ result["leaf"] = leaf
291
+
292
+ return result
293
+
294
+
295
+ class TrueCondition(_BaseCondition):
296
+ def __init__(self) -> None:
297
+ pass
298
+
299
+ def to_dict(self) -> Dict[str, Any]:
300
+ """Convert to dict format expected by backend."""
301
+ return {"type": "TrueCondition", "leaf": {}}
302
+
303
+
304
+ class NotCondition(_BaseCondition):
305
+ def __init__(self, condition: Any = None) -> None:
306
+ self.condition = condition
307
+
308
+ def to_dict(self) -> Dict[str, Any]:
309
+ """Convert to dict format expected by backend."""
310
+ result: Dict[str, Any] = {}
311
+ result["type"] = "NotCondition"
312
+
313
+ # Add field values to leaf object (backend expects leaf format)
314
+ leaf: Dict[str, Any] = {}
315
+ if self.condition is not None:
316
+ leaf["condition"] = self.condition
317
+
318
+ if leaf:
319
+ result["leaf"] = leaf
320
+
321
+ return result
322
+
323
+
324
+ class IsErrorActionNotFound(_BaseCondition):
325
+ def __init__(self) -> None:
326
+ pass
327
+
328
+ def to_dict(self) -> Dict[str, Any]:
329
+ """Convert to dict format expected by backend."""
330
+ return {"type": "IsErrorActionNotFound", "leaf": {}}
331
+
332
+
333
+ class IsErrorTerminated(_BaseCondition):
334
+ def __init__(self) -> None:
335
+ pass
336
+
337
+ def to_dict(self) -> Dict[str, Any]:
338
+ """Convert to dict format expected by backend."""
339
+ return {"type": "IsErrorTerminated", "leaf": {}}
340
+
341
+
342
+ class TextContains(_BaseCondition):
343
+ def __init__(self, text: Any = None, value: Any = None) -> None:
344
+ self.text = text
345
+ self.value = value
346
+
347
+ def to_dict(self) -> Dict[str, Any]:
348
+ """Convert to dict format expected by backend."""
349
+ result: Dict[str, Any] = {}
350
+ result["type"] = "TextContains"
351
+
352
+ # Add field values to leaf object (backend expects leaf format)
353
+ leaf: Dict[str, Any] = {}
354
+ if self.text is not None:
355
+ leaf["text"] = self.text
356
+ if self.value is not None:
357
+ leaf["value"] = self.value
358
+
359
+ if leaf:
360
+ result["leaf"] = leaf
361
+
362
+ return result
363
+
364
+
365
+ class OrCondition(_BaseCondition):
366
+ def __init__(self, conditions: Any = None) -> None:
367
+ self.conditions = conditions
368
+
369
+ def to_dict(self) -> Dict[str, Any]:
370
+ """Convert to dict format expected by backend."""
371
+ result: Dict[str, Any] = {}
372
+ result["type"] = "OrCondition"
373
+
374
+ # Add field values to leaf object (backend expects leaf format)
375
+ leaf: Dict[str, Any] = {}
376
+ if self.conditions is not None:
377
+ leaf["conditions"] = self.conditions
378
+
379
+ if leaf:
380
+ result["leaf"] = leaf
381
+
382
+ return result
383
+
384
+
385
+ class GreaterThan(_BaseCondition):
386
+ def __init__(self, number: Any = None, value: Any = None) -> None:
387
+ self.number = number
388
+ self.value = value
389
+
390
+ def to_dict(self) -> Dict[str, Any]:
391
+ """Convert to dict format expected by backend."""
392
+ result: Dict[str, Any] = {}
393
+ result["type"] = "GreaterThan"
394
+
395
+ # Add field values to leaf object (backend expects leaf format)
396
+ leaf: Dict[str, Any] = {}
397
+ if self.number is not None:
398
+ leaf["number"] = self.number
399
+ if self.value is not None:
400
+ leaf["value"] = self.value
401
+
402
+ if leaf:
403
+ result["leaf"] = leaf
404
+
405
+ return result
406
+
407
+
408
+ class IsAny(_BaseCondition):
409
+ def __init__(self, key: Any = None, value: Any = None) -> None:
410
+ self.key = key
411
+ self.value = value
412
+
413
+ def to_dict(self) -> Dict[str, Any]:
414
+ """Convert to dict format expected by backend."""
415
+ result: Dict[str, Any] = {}
416
+ result["type"] = "IsAny"
417
+
418
+ # Add field values to leaf object (backend expects leaf format)
419
+ leaf: Dict[str, Any] = {}
420
+ if self.key is not None:
421
+ leaf["key"] = self.key
422
+ if self.value is not None:
423
+ leaf["value"] = self.value
424
+
425
+ if leaf:
426
+ result["leaf"] = leaf
427
+
428
+ return result
429
+
430
+
431
+ class IsErrorInfoNeeded(_BaseCondition):
432
+ def __init__(self) -> None:
433
+ pass
434
+
435
+ def to_dict(self) -> Dict[str, Any]:
436
+ """Convert to dict format expected by backend."""
437
+ return {"type": "IsErrorInfoNeeded", "leaf": {}}
438
+
439
+
440
+ class IsErrorInternalError(_BaseCondition):
441
+ def __init__(self) -> None:
442
+ pass
443
+
444
+ def to_dict(self) -> Dict[str, Any]:
445
+ """Convert to dict format expected by backend."""
446
+ return {"type": "IsErrorInternalError", "leaf": {}}
447
+
448
+
449
+ class IsFormattedError(_BaseCondition):
450
+ def __init__(self) -> None:
451
+ pass
452
+
453
+ def to_dict(self) -> Dict[str, Any]:
454
+ """Convert to dict format expected by backend."""
455
+ return {"type": "IsFormattedError", "leaf": {}}
456
+
457
+
458
+ class TextEndsWith(_BaseCondition):
459
+ def __init__(self, text: Any = None, value: Any = None) -> None:
460
+ self.text = text
461
+ self.value = value
462
+
463
+ def to_dict(self) -> Dict[str, Any]:
464
+ """Convert to dict format expected by backend."""
465
+ result: Dict[str, Any] = {}
466
+ result["type"] = "TextEndsWith"
467
+
468
+ # Add field values to leaf object (backend expects leaf format)
469
+ leaf: Dict[str, Any] = {}
470
+ if self.text is not None:
471
+ leaf["text"] = self.text
472
+ if self.value is not None:
473
+ leaf["value"] = self.value
474
+
475
+ if leaf:
476
+ result["leaf"] = leaf
477
+
478
+ return result
479
+
480
+
481
+ # Auto-generated __all__ list for import *
482
+ __all__ = [
483
+ "And",
484
+ "Or",
485
+ "Not",
486
+ "LessThan",
487
+ "TextEquals",
488
+ "TextStartsWith",
489
+ "TrueCondition",
490
+ "IsErrorActionNotFound",
491
+ "IsErrorTerminated",
492
+ "TextContains",
493
+ "GreaterThan",
494
+ "IsAny",
495
+ "IsErrorInfoNeeded",
496
+ "IsErrorInternalError",
497
+ "IsFormattedError",
498
+ "TextEndsWith",
499
+ "IsNull",
500
+ "IsSuccess",
501
+ "EarlierThan",
502
+ "FalseCondition",
503
+ "IsError",
504
+ ]
@@ -0,0 +1,51 @@
1
+ # DO NOT EDIT THIS FILE MANUALLY - it will be overwritten.
2
+ # Generated by: erdo gen-client
3
+ """
4
+ Internal action functions auto-generated from backend/bot/action.go.
5
+
6
+ These functions provide Python implementations of internal actions
7
+ that are handled directly by the bot execution engine.
8
+ """
9
+
10
+ from typing import Any, Optional
11
+
12
+ from pydantic import BaseModel
13
+
14
+ from .types import Result
15
+
16
+
17
+ class CheckpointAttemptParams(BaseModel):
18
+ """checkpoint_attempt parameters"""
19
+
20
+ attempts: Optional[Any] = None # Attempt data
21
+ loops: Optional[Any] = None # Loop data
22
+
23
+
24
+ class RefreshResourceParams(BaseModel):
25
+ """refresh_resource parameters"""
26
+
27
+ resource: Any # Resource to refresh
28
+
29
+
30
+ def refresh_resource(resource) -> Result:
31
+ """Refreshes one or more resources by updating their dataset information."""
32
+ if isinstance(resource, list):
33
+ output = {"resources": resource}
34
+ else:
35
+ output = {"resource": resource}
36
+ return Result(
37
+ status="success", parameters={}, output=output, message=None, error=None
38
+ )
39
+
40
+
41
+ def checkpoint_attempt(loops, attempts=None) -> Result:
42
+ """Creates a checkpoint for the current attempt with the specified number of loops."""
43
+ # Don't try to convert template strings to int - they'll be resolved at runtime
44
+ if isinstance(loops, str) and not loops.startswith("{{"):
45
+ loops = int(loops)
46
+ output = {"loops": loops}
47
+ if attempts is not None:
48
+ output["attempts"] = attempts
49
+ return Result(
50
+ status="success", parameters={}, output=output, message=None, error=None
51
+ )
@@ -0,0 +1,79 @@
1
+ # DO NOT EDIT THIS FILE MANUALLY - it will be overwritten.
2
+ # Generated by: erdo gen-client
3
+ """
4
+ Internal action functions auto-generated from backend/bot/action.go.
5
+
6
+ These functions provide Python implementations of internal actions
7
+ that are handled directly by the bot execution engine.
8
+ """
9
+
10
+ from typing import Any, Dict, Optional, Union
11
+
12
+ from pydantic import BaseModel
13
+
14
+ from erdo.template import TemplateString
15
+
16
+
17
+ class CheckpointAttemptParams(BaseModel):
18
+ """checkpoint_attempt parameters"""
19
+
20
+ name: str = "checkpoint_attempt" # Action type for roundtrip compatibility
21
+ attempts: Optional[Union[Any, TemplateString]] = None # Attempt data
22
+ loops: Optional[Union[Any, TemplateString]] = None # Loop data
23
+
24
+
25
+ class RefreshResourceParams(BaseModel):
26
+ """refresh_resource parameters"""
27
+
28
+ name: str = "refresh_resource" # Action type for roundtrip compatibility
29
+ resource: Union[str, Dict[str, Any], TemplateString] # Resource to refresh
30
+
31
+
32
+ def checkpoint_attempt(
33
+ attempts: Optional[Union[Any, TemplateString]] = None,
34
+ loops: Optional[Union[Any, TemplateString]] = None,
35
+ **kwargs: Any,
36
+ ) -> CheckpointAttemptParams:
37
+ """checkpoint_attempt internal action
38
+
39
+ Internal action that is handled directly by the bot execution engine.
40
+
41
+ Args:
42
+ attempts: Optional attempt data
43
+ loops: Optional loop data
44
+
45
+ Returns:
46
+ CheckpointAttemptParams: Type-safe parameter object
47
+ """
48
+ params = {
49
+ "attempts": attempts,
50
+ "loops": loops,
51
+ }
52
+ # Remove None values for optional parameters
53
+ params = {k: v for k, v in params.items() if v is not None}
54
+ params.update(kwargs)
55
+
56
+ return CheckpointAttemptParams.model_validate(params)
57
+
58
+
59
+ def refresh_resource(
60
+ resource: Union[str, Dict[str, Any], TemplateString], **kwargs: Any
61
+ ) -> RefreshResourceParams:
62
+ """refresh_resource internal action
63
+
64
+ Internal action that is handled directly by the bot execution engine.
65
+
66
+ Args:
67
+ resource: Resource to refresh
68
+
69
+ Returns:
70
+ RefreshResourceParams: Type-safe parameter object
71
+ """
72
+ params = {
73
+ "resource": resource,
74
+ }
75
+ # Remove None values for optional parameters
76
+ params = {k: v for k, v in params.items() if v is not None}
77
+ params.update(kwargs)
78
+
79
+ return RefreshResourceParams.model_validate(params)
@@ -0,0 +1,17 @@
1
+ # DO NOT EDIT THIS FILE MANUALLY - it will be overwritten.
2
+ # Generated by: erdo gen-client
3
+ """
4
+ Integration parameters type definitions.
5
+
6
+ Type-safe access to integration parameters via PARAMETERS['integration_key']['field_name']
7
+ """
8
+
9
+ from typing import TYPE_CHECKING, TypedDict
10
+
11
+ if TYPE_CHECKING:
12
+ pass
13
+
14
+
15
+ # Master type dictionary for IDE autocompletion
16
+ class ParametersDict(TypedDict):
17
+ """Type-safe access to integration parameters: PARAMETERS['integration_key']"""
@@ -0,0 +1,17 @@
1
+ # DO NOT EDIT THIS FILE MANUALLY - it will be overwritten.
2
+ # Generated by: erdo gen-client
3
+ """
4
+ Integration secrets type definitions.
5
+
6
+ Type-safe access to integration secrets via SECRETS['integration_key']['field_name']
7
+ """
8
+
9
+ from typing import TYPE_CHECKING, TypedDict
10
+
11
+ if TYPE_CHECKING:
12
+ pass
13
+
14
+
15
+ # Master type dictionary for IDE autocompletion
16
+ class SecretsDict(TypedDict):
17
+ """Type-safe access to integration secrets: SECRETS['integration_key']"""