airbyte-agent-jira 0.1.22__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 (56) hide show
  1. airbyte_agent_jira/__init__.py +91 -0
  2. airbyte_agent_jira/_vendored/__init__.py +1 -0
  3. airbyte_agent_jira/_vendored/connector_sdk/__init__.py +82 -0
  4. airbyte_agent_jira/_vendored/connector_sdk/auth_strategies.py +1123 -0
  5. airbyte_agent_jira/_vendored/connector_sdk/auth_template.py +135 -0
  6. airbyte_agent_jira/_vendored/connector_sdk/cloud_utils/__init__.py +5 -0
  7. airbyte_agent_jira/_vendored/connector_sdk/cloud_utils/client.py +213 -0
  8. airbyte_agent_jira/_vendored/connector_sdk/connector_model_loader.py +965 -0
  9. airbyte_agent_jira/_vendored/connector_sdk/constants.py +78 -0
  10. airbyte_agent_jira/_vendored/connector_sdk/exceptions.py +23 -0
  11. airbyte_agent_jira/_vendored/connector_sdk/executor/__init__.py +31 -0
  12. airbyte_agent_jira/_vendored/connector_sdk/executor/hosted_executor.py +197 -0
  13. airbyte_agent_jira/_vendored/connector_sdk/executor/local_executor.py +1574 -0
  14. airbyte_agent_jira/_vendored/connector_sdk/executor/models.py +190 -0
  15. airbyte_agent_jira/_vendored/connector_sdk/extensions.py +694 -0
  16. airbyte_agent_jira/_vendored/connector_sdk/http/__init__.py +37 -0
  17. airbyte_agent_jira/_vendored/connector_sdk/http/adapters/__init__.py +9 -0
  18. airbyte_agent_jira/_vendored/connector_sdk/http/adapters/httpx_adapter.py +251 -0
  19. airbyte_agent_jira/_vendored/connector_sdk/http/config.py +98 -0
  20. airbyte_agent_jira/_vendored/connector_sdk/http/exceptions.py +119 -0
  21. airbyte_agent_jira/_vendored/connector_sdk/http/protocols.py +114 -0
  22. airbyte_agent_jira/_vendored/connector_sdk/http/response.py +102 -0
  23. airbyte_agent_jira/_vendored/connector_sdk/http_client.py +686 -0
  24. airbyte_agent_jira/_vendored/connector_sdk/introspection.py +262 -0
  25. airbyte_agent_jira/_vendored/connector_sdk/logging/__init__.py +11 -0
  26. airbyte_agent_jira/_vendored/connector_sdk/logging/logger.py +264 -0
  27. airbyte_agent_jira/_vendored/connector_sdk/logging/types.py +92 -0
  28. airbyte_agent_jira/_vendored/connector_sdk/observability/__init__.py +11 -0
  29. airbyte_agent_jira/_vendored/connector_sdk/observability/models.py +19 -0
  30. airbyte_agent_jira/_vendored/connector_sdk/observability/redactor.py +81 -0
  31. airbyte_agent_jira/_vendored/connector_sdk/observability/session.py +94 -0
  32. airbyte_agent_jira/_vendored/connector_sdk/performance/__init__.py +6 -0
  33. airbyte_agent_jira/_vendored/connector_sdk/performance/instrumentation.py +57 -0
  34. airbyte_agent_jira/_vendored/connector_sdk/performance/metrics.py +93 -0
  35. airbyte_agent_jira/_vendored/connector_sdk/schema/__init__.py +75 -0
  36. airbyte_agent_jira/_vendored/connector_sdk/schema/base.py +161 -0
  37. airbyte_agent_jira/_vendored/connector_sdk/schema/components.py +239 -0
  38. airbyte_agent_jira/_vendored/connector_sdk/schema/connector.py +131 -0
  39. airbyte_agent_jira/_vendored/connector_sdk/schema/extensions.py +109 -0
  40. airbyte_agent_jira/_vendored/connector_sdk/schema/operations.py +146 -0
  41. airbyte_agent_jira/_vendored/connector_sdk/schema/security.py +223 -0
  42. airbyte_agent_jira/_vendored/connector_sdk/secrets.py +182 -0
  43. airbyte_agent_jira/_vendored/connector_sdk/telemetry/__init__.py +10 -0
  44. airbyte_agent_jira/_vendored/connector_sdk/telemetry/config.py +32 -0
  45. airbyte_agent_jira/_vendored/connector_sdk/telemetry/events.py +58 -0
  46. airbyte_agent_jira/_vendored/connector_sdk/telemetry/tracker.py +151 -0
  47. airbyte_agent_jira/_vendored/connector_sdk/types.py +245 -0
  48. airbyte_agent_jira/_vendored/connector_sdk/utils.py +60 -0
  49. airbyte_agent_jira/_vendored/connector_sdk/validation.py +822 -0
  50. airbyte_agent_jira/connector.py +978 -0
  51. airbyte_agent_jira/connector_model.py +2827 -0
  52. airbyte_agent_jira/models.py +741 -0
  53. airbyte_agent_jira/types.py +117 -0
  54. airbyte_agent_jira-0.1.22.dist-info/METADATA +113 -0
  55. airbyte_agent_jira-0.1.22.dist-info/RECORD +56 -0
  56. airbyte_agent_jira-0.1.22.dist-info/WHEEL +4 -0
@@ -0,0 +1,245 @@
1
+ """Type definitions for Airbyte SDK."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from enum import Enum
6
+ from typing import Any
7
+ from uuid import UUID
8
+
9
+ from pydantic import BaseModel, ConfigDict, Field
10
+
11
+ from .constants import OPENAPI_DEFAULT_VERSION
12
+ from .schema.components import PathOverrideConfig
13
+ from .schema.extensions import RetryConfig
14
+ from .schema.security import AirbyteAuthConfig
15
+
16
+
17
+ class Action(str, Enum):
18
+ """Supported actions for Entity operations."""
19
+
20
+ GET = "get"
21
+ CREATE = "create"
22
+ UPDATE = "update"
23
+ DELETE = "delete"
24
+ LIST = "list"
25
+ SEARCH = "search"
26
+ DOWNLOAD = "download"
27
+ AUTHORIZE = "authorize"
28
+
29
+
30
+ class AuthType(str, Enum):
31
+ """Supported authentication types."""
32
+
33
+ API_KEY = "api_key"
34
+ BEARER = "bearer"
35
+ HTTP = "http"
36
+ BASIC = "basic"
37
+ OAUTH2 = "oauth2"
38
+
39
+
40
+ class ContentType(str, Enum):
41
+ """Supported content types for request bodies."""
42
+
43
+ JSON = "application/json"
44
+ FORM_URLENCODED = "application/x-www-form-urlencoded"
45
+ FORM_DATA = "multipart/form-data"
46
+
47
+
48
+ class ParameterLocation(str, Enum):
49
+ """Location of operation parameters."""
50
+
51
+ PATH = "path"
52
+ QUERY = "query"
53
+ HEADER = "header"
54
+ COOKIE = "cookie"
55
+
56
+
57
+ # All comprehensive OpenAPI 3.0 models are now in connector_sdk.schema package
58
+ # Import from connector_sdk.schema for: OpenAPIConnector, Components, Schema, Operation, etc.
59
+
60
+
61
+ class AuthOption(BaseModel):
62
+ """A single authentication option in a multi-auth connector.
63
+
64
+ Represents one security scheme from OpenAPI components.securitySchemes.
65
+ Each option defines a complete authentication method with its own type,
66
+ configuration, and user-facing credential specification.
67
+
68
+ Example:
69
+ For a connector supporting both OAuth2 and API Key auth:
70
+ - AuthOption(scheme_name="oauth", type=OAUTH2, ...)
71
+ - AuthOption(scheme_name="apikey", type=BEARER, ...)
72
+ """
73
+
74
+ scheme_name: str = Field(description="Security scheme name from OpenAPI spec (e.g., 'githubOAuth', 'githubPAT')")
75
+ type: AuthType = Field(description="Authentication type for this option")
76
+ config: dict[str, Any] = Field(
77
+ default_factory=dict,
78
+ description="Auth-specific configuration (e.g., OAuth2 refresh settings)",
79
+ )
80
+ user_config_spec: AirbyteAuthConfig | None = Field(
81
+ None,
82
+ description="User-facing credential specification from x-airbyte-auth-config",
83
+ )
84
+
85
+
86
+ class AuthConfig(BaseModel):
87
+ """Authentication configuration supporting single or multiple auth methods.
88
+
89
+ Connectors can define either:
90
+ - Single auth: One authentication method (backwards compatible)
91
+ - Multi-auth: Multiple authentication methods (user/agent selects one)
92
+
93
+ For single-auth connectors (most common):
94
+ AuthConfig(type=OAUTH2, config={...}, user_config_spec={...})
95
+
96
+ For multi-auth connectors:
97
+ AuthConfig(options=[
98
+ AuthOption(scheme_name="oauth", type=OAUTH2, ...),
99
+ AuthOption(scheme_name="apikey", type=BEARER, ...)
100
+ ])
101
+ """
102
+
103
+ # Single-auth mode (backwards compatible)
104
+ type: AuthType | None = Field(
105
+ None,
106
+ description="Authentication type (single-auth mode only)",
107
+ )
108
+ config: dict[str, Any] = Field(
109
+ default_factory=dict,
110
+ description="Auth configuration (single-auth mode only)",
111
+ )
112
+ user_config_spec: AirbyteAuthConfig | None = Field(
113
+ None,
114
+ description="User-facing config spec from x-airbyte-auth-config (single-auth mode)",
115
+ )
116
+
117
+ # Multi-auth mode
118
+ options: list[AuthOption] | None = Field(
119
+ None,
120
+ description="Multiple authentication options (multi-auth mode only)",
121
+ )
122
+
123
+ def is_multi_auth(self) -> bool:
124
+ """Check if this configuration supports multiple authentication methods.
125
+
126
+ Returns:
127
+ True if multiple auth options are available, False for single-auth
128
+ """
129
+ return self.options is not None and len(self.options) > 0
130
+
131
+ def get_single_option(self) -> AuthOption:
132
+ """Get single auth option (for backwards compatibility).
133
+
134
+ Converts single-auth config to AuthOption format for uniform handling.
135
+
136
+ Returns:
137
+ AuthOption containing the single auth configuration
138
+
139
+ Raises:
140
+ ValueError: If this is a multi-auth config or invalid
141
+ """
142
+ if self.is_multi_auth():
143
+ raise ValueError("Cannot call get_single_option() on multi-auth config. " "Use options list instead.")
144
+
145
+ if self.type is None:
146
+ raise ValueError("Invalid AuthConfig: neither single-auth nor multi-auth")
147
+
148
+ return AuthOption(
149
+ scheme_name="default",
150
+ type=self.type,
151
+ config=self.config,
152
+ user_config_spec=self.user_config_spec,
153
+ )
154
+
155
+
156
+ # Executor types (used by executor.py)
157
+ class EndpointDefinition(BaseModel):
158
+ """Definition of an API endpoint."""
159
+
160
+ method: str # GET, POST, PUT, DELETE, etc.
161
+ path: str # e.g., /v1/customers/{id} (OpenAPI path)
162
+ path_override: PathOverrideConfig | None = Field(
163
+ None,
164
+ description=("Path override config from x-airbyte-path-override. " "When set, overrides the path for actual HTTP requests."),
165
+ )
166
+ action: Action | None = None # Semantic action (get, list, create, update, delete)
167
+ description: str | None = None
168
+ body_fields: list[str] = Field(default_factory=list) # For POST/PUT
169
+ query_params: list[str] = Field(default_factory=list) # For GET
170
+ query_params_schema: dict[str, dict[str, Any]] = Field(
171
+ default_factory=dict,
172
+ description="Schema for query params including defaults: {name: {type, default, required}}",
173
+ )
174
+ deep_object_params: list[str] = Field(
175
+ default_factory=list,
176
+ description="Query parameters using deepObject style (e.g., filter[key]=value)",
177
+ ) # For GET with deepObject query params
178
+ path_params: list[str] = Field(default_factory=list) # Extracted from path
179
+ path_params_schema: dict[str, dict[str, Any]] = Field(
180
+ default_factory=dict,
181
+ description="Schema for path params including defaults: {name: {type, default, required}}",
182
+ )
183
+ content_type: ContentType = ContentType.JSON
184
+ request_schema: dict[str, Any] | None = None
185
+ response_schema: dict[str, Any] | None = None
186
+
187
+ # GraphQL support (Airbyte extension)
188
+ graphql_body: dict[str, Any] | None = Field(
189
+ None,
190
+ description="GraphQL body configuration from x-airbyte-body-type extension",
191
+ )
192
+
193
+ # Record extractor support (Airbyte extension)
194
+ record_extractor: str | None = Field(
195
+ None,
196
+ description="JSONPath expression to extract records from response envelopes",
197
+ )
198
+
199
+ # Metadata extractor support (Airbyte extension)
200
+ meta_extractor: dict[str, str] | None = Field(
201
+ None,
202
+ description="Dictionary mapping field names to JSONPath expressions for extracting metadata from response envelopes",
203
+ )
204
+
205
+ # Download support (Airbyte extension)
206
+ file_field: str | None = Field(
207
+ None,
208
+ description="Field in metadata response containing download URL (from x-airbyte-file-url extension)",
209
+ )
210
+
211
+ # Test validation support (Airbyte extension)
212
+ untested: bool = Field(
213
+ False,
214
+ description="Mark operation as untested to skip cassette validation (from x-airbyte-untested extension)",
215
+ )
216
+
217
+
218
+ class EntityDefinition(BaseModel):
219
+ """Definition of an API entity."""
220
+
221
+ model_config = {"populate_by_name": True}
222
+
223
+ name: str
224
+ stream_name: str | None = Field(
225
+ default=None,
226
+ description="Airbyte stream name for cache lookup (from x-airbyte-stream-name schema extension)",
227
+ )
228
+ actions: list[Action]
229
+ endpoints: dict[Action, EndpointDefinition]
230
+ entity_schema: dict[str, Any] | None = Field(default=None, alias="schema")
231
+
232
+
233
+ class ConnectorModel(BaseModel):
234
+ """Complete connector model loaded from YAML definition."""
235
+
236
+ model_config = ConfigDict(use_enum_values=True)
237
+
238
+ id: UUID
239
+ name: str
240
+ version: str = OPENAPI_DEFAULT_VERSION
241
+ base_url: str
242
+ auth: AuthConfig
243
+ entities: list[EntityDefinition]
244
+ openapi_spec: Any | None = None # Optional reference to OpenAPIConnector
245
+ retry_config: RetryConfig | None = None # Optional retry configuration
@@ -0,0 +1,60 @@
1
+ """Utility functions for working with connectors."""
2
+
3
+ from collections.abc import AsyncIterator
4
+ from pathlib import Path
5
+
6
+
7
+ async def save_download(
8
+ download_iterator: AsyncIterator[bytes],
9
+ path: str | Path,
10
+ *,
11
+ overwrite: bool = False,
12
+ ) -> Path:
13
+ """Save a download iterator to a file.
14
+
15
+ Args:
16
+ download_iterator: AsyncIterator[bytes] from a download operation
17
+ path: File path where content should be saved
18
+ overwrite: Whether to overwrite existing file (default: False)
19
+
20
+ Returns:
21
+ Absolute Path to the saved file
22
+
23
+ Raises:
24
+ FileExistsError: If file exists and overwrite=False
25
+ OSError: If file cannot be written
26
+
27
+ Example:
28
+ >>> from .utils import save_download
29
+ >>>
30
+ >>> # Download and save a file
31
+ >>> result = await connector.download_article_attachment(id="123")
32
+ >>> file_path = await save_download(result, "./downloads/attachment.pdf")
33
+ >>> print(f"Downloaded to {file_path}")
34
+ Downloaded to /absolute/path/to/downloads/attachment.pdf
35
+ >>>
36
+ >>> # Overwrite existing file
37
+ >>> file_path = await save_download(result, "./downloads/attachment.pdf", overwrite=True)
38
+ """
39
+ # Convert to Path object
40
+ file_path = Path(path).expanduser().resolve()
41
+
42
+ # Check if file exists
43
+ if file_path.exists() and not overwrite:
44
+ raise FileExistsError(f"File already exists: {file_path}. Use overwrite=True to replace it.")
45
+
46
+ # Create parent directories if needed
47
+ file_path.parent.mkdir(parents=True, exist_ok=True)
48
+
49
+ # Stream content to file
50
+ try:
51
+ with open(file_path, "wb") as f:
52
+ async for chunk in download_iterator:
53
+ f.write(chunk)
54
+ except Exception as e:
55
+ # Clean up partial file on error
56
+ if file_path.exists():
57
+ file_path.unlink()
58
+ raise OSError(f"Failed to write file {file_path}: {e}") from e
59
+
60
+ return file_path