airbyte-agent-greenhouse 0.17.48__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.
Files changed (57) hide show
  1. airbyte_agent_greenhouse/__init__.py +105 -0
  2. airbyte_agent_greenhouse/_vendored/__init__.py +1 -0
  3. airbyte_agent_greenhouse/_vendored/connector_sdk/__init__.py +82 -0
  4. airbyte_agent_greenhouse/_vendored/connector_sdk/auth_strategies.py +1120 -0
  5. airbyte_agent_greenhouse/_vendored/connector_sdk/auth_template.py +135 -0
  6. airbyte_agent_greenhouse/_vendored/connector_sdk/cloud_utils/__init__.py +5 -0
  7. airbyte_agent_greenhouse/_vendored/connector_sdk/cloud_utils/client.py +213 -0
  8. airbyte_agent_greenhouse/_vendored/connector_sdk/connector_model_loader.py +965 -0
  9. airbyte_agent_greenhouse/_vendored/connector_sdk/constants.py +78 -0
  10. airbyte_agent_greenhouse/_vendored/connector_sdk/exceptions.py +23 -0
  11. airbyte_agent_greenhouse/_vendored/connector_sdk/executor/__init__.py +31 -0
  12. airbyte_agent_greenhouse/_vendored/connector_sdk/executor/hosted_executor.py +196 -0
  13. airbyte_agent_greenhouse/_vendored/connector_sdk/executor/local_executor.py +1724 -0
  14. airbyte_agent_greenhouse/_vendored/connector_sdk/executor/models.py +190 -0
  15. airbyte_agent_greenhouse/_vendored/connector_sdk/extensions.py +693 -0
  16. airbyte_agent_greenhouse/_vendored/connector_sdk/http/__init__.py +37 -0
  17. airbyte_agent_greenhouse/_vendored/connector_sdk/http/adapters/__init__.py +9 -0
  18. airbyte_agent_greenhouse/_vendored/connector_sdk/http/adapters/httpx_adapter.py +251 -0
  19. airbyte_agent_greenhouse/_vendored/connector_sdk/http/config.py +98 -0
  20. airbyte_agent_greenhouse/_vendored/connector_sdk/http/exceptions.py +119 -0
  21. airbyte_agent_greenhouse/_vendored/connector_sdk/http/protocols.py +114 -0
  22. airbyte_agent_greenhouse/_vendored/connector_sdk/http/response.py +104 -0
  23. airbyte_agent_greenhouse/_vendored/connector_sdk/http_client.py +693 -0
  24. airbyte_agent_greenhouse/_vendored/connector_sdk/introspection.py +262 -0
  25. airbyte_agent_greenhouse/_vendored/connector_sdk/logging/__init__.py +11 -0
  26. airbyte_agent_greenhouse/_vendored/connector_sdk/logging/logger.py +273 -0
  27. airbyte_agent_greenhouse/_vendored/connector_sdk/logging/types.py +93 -0
  28. airbyte_agent_greenhouse/_vendored/connector_sdk/observability/__init__.py +11 -0
  29. airbyte_agent_greenhouse/_vendored/connector_sdk/observability/config.py +179 -0
  30. airbyte_agent_greenhouse/_vendored/connector_sdk/observability/models.py +19 -0
  31. airbyte_agent_greenhouse/_vendored/connector_sdk/observability/redactor.py +81 -0
  32. airbyte_agent_greenhouse/_vendored/connector_sdk/observability/session.py +103 -0
  33. airbyte_agent_greenhouse/_vendored/connector_sdk/performance/__init__.py +6 -0
  34. airbyte_agent_greenhouse/_vendored/connector_sdk/performance/instrumentation.py +57 -0
  35. airbyte_agent_greenhouse/_vendored/connector_sdk/performance/metrics.py +93 -0
  36. airbyte_agent_greenhouse/_vendored/connector_sdk/schema/__init__.py +75 -0
  37. airbyte_agent_greenhouse/_vendored/connector_sdk/schema/base.py +164 -0
  38. airbyte_agent_greenhouse/_vendored/connector_sdk/schema/components.py +239 -0
  39. airbyte_agent_greenhouse/_vendored/connector_sdk/schema/connector.py +120 -0
  40. airbyte_agent_greenhouse/_vendored/connector_sdk/schema/extensions.py +230 -0
  41. airbyte_agent_greenhouse/_vendored/connector_sdk/schema/operations.py +146 -0
  42. airbyte_agent_greenhouse/_vendored/connector_sdk/schema/security.py +223 -0
  43. airbyte_agent_greenhouse/_vendored/connector_sdk/secrets.py +182 -0
  44. airbyte_agent_greenhouse/_vendored/connector_sdk/telemetry/__init__.py +10 -0
  45. airbyte_agent_greenhouse/_vendored/connector_sdk/telemetry/config.py +32 -0
  46. airbyte_agent_greenhouse/_vendored/connector_sdk/telemetry/events.py +59 -0
  47. airbyte_agent_greenhouse/_vendored/connector_sdk/telemetry/tracker.py +155 -0
  48. airbyte_agent_greenhouse/_vendored/connector_sdk/types.py +245 -0
  49. airbyte_agent_greenhouse/_vendored/connector_sdk/utils.py +60 -0
  50. airbyte_agent_greenhouse/_vendored/connector_sdk/validation.py +828 -0
  51. airbyte_agent_greenhouse/connector.py +1391 -0
  52. airbyte_agent_greenhouse/connector_model.py +2356 -0
  53. airbyte_agent_greenhouse/models.py +281 -0
  54. airbyte_agent_greenhouse/types.py +136 -0
  55. airbyte_agent_greenhouse-0.17.48.dist-info/METADATA +116 -0
  56. airbyte_agent_greenhouse-0.17.48.dist-info/RECORD +57 -0
  57. airbyte_agent_greenhouse-0.17.48.dist-info/WHEEL +4 -0
@@ -0,0 +1,190 @@
1
+ """Data models and protocols for executor implementations."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from collections.abc import AsyncIterator
6
+ from dataclasses import dataclass, field
7
+ from pathlib import Path
8
+ from typing import Any, Protocol, runtime_checkable
9
+
10
+ from dotenv import load_dotenv
11
+
12
+ # Load environment variables from .env file
13
+ _env_path = Path(__file__).parent.parent.parent / ".env"
14
+ if _env_path.exists():
15
+ load_dotenv(dotenv_path=_env_path)
16
+
17
+
18
+ @dataclass
19
+ class ExecutionConfig:
20
+ """Configuration for connector execution.
21
+
22
+ Used by both LocalExecutor and HostedExecutor to specify the operation to execute.
23
+ Executor-specific configuration (like api_url for HostedExecutor) is passed to
24
+ the executor's constructor instead of being part of the execution config.
25
+
26
+ Args:
27
+ entity: Entity name (e.g., "customers", "invoices")
28
+ action: Operation action (e.g., "list", "get", "create")
29
+ params: Optional parameters for the operation
30
+ - For GET: {"id": "cus_123"}
31
+ - For LIST: {"limit": 10}
32
+ - For CREATE: {"email": "...", "name": "..."}
33
+
34
+ Example:
35
+ config = ExecutionConfig(
36
+ entity="customers",
37
+ action="list",
38
+ params={"limit": 10}
39
+ )
40
+ """
41
+
42
+ entity: str
43
+ action: str
44
+ params: dict[str, Any] | None = field(default=None, kw_only=True)
45
+
46
+
47
+ @dataclass
48
+ class StandardExecuteResult:
49
+ """Result from standard operation handlers (GET, LIST, CREATE, UPDATE, DELETE, etc.).
50
+
51
+ This is returned by _StandardOperationHandler to provide type-safe data and metadata
52
+ returns instead of using tuples. Download operations continue to return AsyncIterator[bytes]
53
+ directly for simplicity.
54
+
55
+ Args:
56
+ data: Response data from the operation
57
+ metadata: Optional metadata extracted from response (e.g., pagination info)
58
+
59
+ Example:
60
+ result = StandardExecuteResult(
61
+ data={"id": "1", "name": "Test"},
62
+ metadata={"pagination": {"cursor": "next123", "totalRecords": 100}}
63
+ )
64
+ """
65
+
66
+ data: dict[str, Any]
67
+ metadata: dict[str, Any] | None = None
68
+
69
+
70
+ @dataclass
71
+ class ExecutionResult:
72
+ """Result of a connector execution.
73
+
74
+ This is returned by all executor implementations. It provides a consistent
75
+ interface for handling both successful executions and execution failures.
76
+
77
+ Args:
78
+ success: True if execution completed successfully, False if it failed
79
+ data: Response data from the execution
80
+ - dict[str, Any] for standard operations (GET, LIST, CREATE, etc.)
81
+ - AsyncIterator[bytes] for download operations (streaming file content)
82
+ error: Error message if success=False, None otherwise
83
+ meta: Optional metadata extracted from response (e.g., pagination info)
84
+
85
+ Example (Success - Standard):
86
+ result = ExecutionResult(
87
+ success=True,
88
+ data=[{"id": "1"}, {"id": "2"}],
89
+ error=None,
90
+ meta={"pagination": {"cursor": "next123", "totalRecords": 100}}
91
+ )
92
+
93
+ Example (Success - Download):
94
+ result = ExecutionResult(
95
+ success=True,
96
+ data=async_iterator_of_bytes,
97
+ error=None
98
+ )
99
+
100
+ Example (Failure):
101
+ result = ExecutionResult(
102
+ success=False,
103
+ data={},
104
+ error="Entity 'invalid' not found",
105
+ meta=None
106
+ )
107
+ """
108
+
109
+ success: bool
110
+ data: dict[str, Any] | AsyncIterator[bytes]
111
+ error: str | None = None
112
+ meta: dict[str, Any] | None = None
113
+
114
+
115
+ # ============================================================================
116
+ # Executor Protocol
117
+ # ============================================================================
118
+
119
+
120
+ @runtime_checkable
121
+ class ExecutorProtocol(Protocol):
122
+ """Protocol for connector execution.
123
+
124
+ This defines the interface that both LocalExecutor and HostedExecutor implement.
125
+ Uses structural typing (Protocol) - any class with a matching execute() method
126
+ satisfies this protocol, regardless of inheritance.
127
+
128
+ The @runtime_checkable decorator allows isinstance() checks at runtime.
129
+
130
+ Example:
131
+ def run_connector(executor: ExecutorProtocol, config: ExecutionConfig):
132
+ result = await executor.execute(config)
133
+ if result.success:
134
+ print(f"Success: {result.data}")
135
+ else:
136
+ print(f"Error: {result.error}")
137
+ """
138
+
139
+ async def execute(self, config: ExecutionConfig) -> ExecutionResult:
140
+ """Execute connector with given configuration.
141
+
142
+ Args:
143
+ config: Configuration for execution (entity, action, params)
144
+
145
+ Returns:
146
+ ExecutionResult with success status, data, and optional error message
147
+
148
+ Raises:
149
+ Infrastructure exceptions (network errors, HTTP errors, auth failures)
150
+ These are exceptional cases where the system cannot complete the request.
151
+
152
+ Execution errors (entity not found, invalid operation) are returned
153
+ in ExecutionResult.error instead of being raised.
154
+ """
155
+ ...
156
+
157
+
158
+ # ============================================================================
159
+ # Executor Exceptions
160
+ # ============================================================================
161
+
162
+
163
+ class ExecutorError(Exception):
164
+ """Base exception for executor errors."""
165
+
166
+ pass
167
+
168
+
169
+ class EntityNotFoundError(ExecutorError):
170
+ """Raised when an entity is not found in the connector."""
171
+
172
+ pass
173
+
174
+
175
+ class ActionNotSupportedError(ExecutorError):
176
+ """Raised when an action is not supported for an entity."""
177
+
178
+ pass
179
+
180
+
181
+ class MissingParameterError(ExecutorError):
182
+ """Raised when a required parameter is missing."""
183
+
184
+ pass
185
+
186
+
187
+ class InvalidParameterError(ExecutorError):
188
+ """Raised when a parameter has an invalid type or value."""
189
+
190
+ pass