airbyte-agent-shopify 0.1.22__tar.gz → 0.1.24__tar.gz
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.
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/CHANGELOG.md +10 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/PKG-INFO +4 -4
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/README.md +3 -3
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/cloud_utils/client.py +62 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/connector_model_loader.py +1 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/executor/hosted_executor.py +54 -25
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/executor/local_executor.py +5 -12
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/schema/base.py +11 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/schema/security.py +5 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/types.py +4 -0
- airbyte_agent_shopify-0.1.24/airbyte_agent_shopify/_vendored/connector_sdk/utils.py +127 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/validation.py +151 -2
- airbyte_agent_shopify-0.1.24/airbyte_agent_shopify/_vendored/connector_sdk/validation_replication.py +970 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/connector.py +113 -10
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/connector_model.py +1 -1
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/pyproject.toml +1 -1
- airbyte_agent_shopify-0.1.22/airbyte_agent_shopify/_vendored/connector_sdk/utils.py +0 -60
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/.gitignore +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/AUTH.md +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/REFERENCE.md +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/__init__.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/__init__.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/__init__.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/auth_strategies.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/auth_template.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/cloud_utils/__init__.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/constants.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/exceptions.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/executor/__init__.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/executor/models.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/extensions.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/http/__init__.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/http/adapters/__init__.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/http/adapters/httpx_adapter.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/http/config.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/http/exceptions.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/http/protocols.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/http/response.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/http_client.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/introspection.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/logging/__init__.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/logging/logger.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/logging/types.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/observability/__init__.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/observability/config.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/observability/models.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/observability/redactor.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/observability/session.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/performance/__init__.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/performance/instrumentation.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/performance/metrics.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/schema/__init__.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/schema/components.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/schema/connector.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/schema/extensions.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/schema/operations.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/secrets.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/telemetry/__init__.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/telemetry/config.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/telemetry/events.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/_vendored/connector_sdk/telemetry/tracker.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/models.py +0 -0
- {airbyte_agent_shopify-0.1.22 → airbyte_agent_shopify-0.1.24}/airbyte_agent_shopify/types.py +0 -0
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Shopify changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.24] - 2026-01-30
|
|
4
|
+
- Updated connector definition (YAML version 0.1.3)
|
|
5
|
+
- Source commit: b184da3e
|
|
6
|
+
- SDK version: 0.1.0
|
|
7
|
+
|
|
8
|
+
## [0.1.23] - 2026-01-30
|
|
9
|
+
- Updated connector definition (YAML version 0.1.3)
|
|
10
|
+
- Source commit: 5f65d643
|
|
11
|
+
- SDK version: 0.1.0
|
|
12
|
+
|
|
3
13
|
## [0.1.22] - 2026-01-30
|
|
4
14
|
- Updated connector definition (YAML version 0.1.2)
|
|
5
15
|
- Source commit: 5b20f488
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: airbyte-agent-shopify
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.24
|
|
4
4
|
Summary: Airbyte Shopify Connector for AI platforms
|
|
5
5
|
Project-URL: Homepage, https://github.com/airbytehq/airbyte-agent-connectors
|
|
6
6
|
Project-URL: Documentation, https://docs.airbyte.com/ai-agents/
|
|
@@ -171,7 +171,7 @@ See the official [Shopify API reference](https://shopify.dev/docs/api/admin-rest
|
|
|
171
171
|
|
|
172
172
|
## Version information
|
|
173
173
|
|
|
174
|
-
- **Package version:** 0.1.
|
|
175
|
-
- **Connector version:** 0.1.
|
|
176
|
-
- **Generated with Connector SDK commit SHA:**
|
|
174
|
+
- **Package version:** 0.1.24
|
|
175
|
+
- **Connector version:** 0.1.3
|
|
176
|
+
- **Generated with Connector SDK commit SHA:** b184da3e22ef8521d2eeebf3c96a0fe8da2424f5
|
|
177
177
|
- **Changelog:** [View changelog](https://github.com/airbytehq/airbyte-agent-connectors/blob/main/connectors/shopify/CHANGELOG.md)
|
|
@@ -138,7 +138,7 @@ See the official [Shopify API reference](https://shopify.dev/docs/api/admin-rest
|
|
|
138
138
|
|
|
139
139
|
## Version information
|
|
140
140
|
|
|
141
|
-
- **Package version:** 0.1.
|
|
142
|
-
- **Connector version:** 0.1.
|
|
143
|
-
- **Generated with Connector SDK commit SHA:**
|
|
141
|
+
- **Package version:** 0.1.24
|
|
142
|
+
- **Connector version:** 0.1.3
|
|
143
|
+
- **Generated with Connector SDK commit SHA:** b184da3e22ef8521d2eeebf3c96a0fe8da2424f5
|
|
144
144
|
- **Changelog:** [View changelog](https://github.com/airbytehq/airbyte-agent-connectors/blob/main/connectors/shopify/CHANGELOG.md)
|
|
@@ -161,6 +161,68 @@ class AirbyteCloudClient:
|
|
|
161
161
|
connector_id = connectors[0]["id"]
|
|
162
162
|
return connector_id
|
|
163
163
|
|
|
164
|
+
async def create_source(
|
|
165
|
+
self,
|
|
166
|
+
name: str,
|
|
167
|
+
connector_definition_id: str,
|
|
168
|
+
external_user_id: str,
|
|
169
|
+
credentials: dict[str, Any],
|
|
170
|
+
replication_config: dict[str, Any] | None = None,
|
|
171
|
+
) -> str:
|
|
172
|
+
"""Create a new source on Airbyte Agent Platform.
|
|
173
|
+
|
|
174
|
+
Args:
|
|
175
|
+
name: Source name
|
|
176
|
+
connector_definition_id: UUID of the connector definition
|
|
177
|
+
external_user_id: User identifier
|
|
178
|
+
credentials: Connector auth config dict
|
|
179
|
+
replication_config: Optional replication settings (e.g., start_date for
|
|
180
|
+
connectors with x-airbyte-replication-config). Required for REPLICATION
|
|
181
|
+
mode sources like Intercom.
|
|
182
|
+
|
|
183
|
+
Returns:
|
|
184
|
+
The created source ID (UUID string)
|
|
185
|
+
|
|
186
|
+
Raises:
|
|
187
|
+
httpx.HTTPStatusError: If creation fails
|
|
188
|
+
|
|
189
|
+
Example:
|
|
190
|
+
source_id = await client.create_source(
|
|
191
|
+
name="My Gong Source",
|
|
192
|
+
connector_definition_id="32382e40-3b49-4b99-9c5c-4076501914e7",
|
|
193
|
+
external_user_id="my-workspace",
|
|
194
|
+
credentials={"access_key": "...", "access_key_secret": "..."}
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
# For REPLICATION mode sources (e.g., Intercom):
|
|
198
|
+
source_id = await client.create_source(
|
|
199
|
+
name="My Intercom Source",
|
|
200
|
+
connector_definition_id="d8313939-3782-41b0-be29-b3ca20d8dd3a",
|
|
201
|
+
external_user_id="my-workspace",
|
|
202
|
+
credentials={"access_token": "..."},
|
|
203
|
+
replication_config={"start_date": "2024-01-01T00:00:00Z"}
|
|
204
|
+
)
|
|
205
|
+
"""
|
|
206
|
+
token = await self.get_bearer_token()
|
|
207
|
+
url = f"{self.API_BASE_URL}/v1/integrations/connectors"
|
|
208
|
+
headers = {"Authorization": f"Bearer {token}"}
|
|
209
|
+
|
|
210
|
+
request_body: dict[str, Any] = {
|
|
211
|
+
"name": name,
|
|
212
|
+
"definition_id": connector_definition_id,
|
|
213
|
+
"external_user_id": external_user_id,
|
|
214
|
+
"credentials": credentials,
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if replication_config is not None:
|
|
218
|
+
request_body["replication_config"] = replication_config
|
|
219
|
+
|
|
220
|
+
response = await self._http_client.post(url, json=request_body, headers=headers)
|
|
221
|
+
response.raise_for_status()
|
|
222
|
+
|
|
223
|
+
data = response.json()
|
|
224
|
+
return data["id"]
|
|
225
|
+
|
|
164
226
|
async def execute_connector(
|
|
165
227
|
self,
|
|
166
228
|
connector_id: str,
|
|
@@ -1014,6 +1014,7 @@ def _parse_security_scheme_to_option(scheme_name: str, scheme: Any) -> AuthOptio
|
|
|
1014
1014
|
type=single_auth.type,
|
|
1015
1015
|
config=single_auth.config,
|
|
1016
1016
|
user_config_spec=single_auth.user_config_spec,
|
|
1017
|
+
untested=getattr(scheme, "x_airbyte_untested", False),
|
|
1017
1018
|
)
|
|
1018
1019
|
|
|
1019
1020
|
|
|
@@ -19,19 +19,26 @@ class HostedExecutor:
|
|
|
19
19
|
instead of directly calling external services. The cloud API handles all
|
|
20
20
|
connector logic, secrets management, and execution.
|
|
21
21
|
|
|
22
|
-
The executor
|
|
22
|
+
The executor uses the AirbyteCloudClient to:
|
|
23
23
|
1. Authenticate with the Airbyte Platform (bearer token with caching)
|
|
24
|
-
2. Look up the user's connector
|
|
24
|
+
2. Look up the user's connector (if connector_id not provided)
|
|
25
25
|
3. Execute the connector operation via the cloud API
|
|
26
26
|
|
|
27
27
|
Implements ExecutorProtocol.
|
|
28
28
|
|
|
29
29
|
Example:
|
|
30
|
-
# Create executor with
|
|
30
|
+
# Create executor with explicit connector_id (no lookup needed)
|
|
31
|
+
executor = HostedExecutor(
|
|
32
|
+
airbyte_client_id="client_abc123",
|
|
33
|
+
airbyte_client_secret="secret_xyz789",
|
|
34
|
+
connector_id="existing-source-uuid",
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
# Or create executor with user ID for lookup
|
|
31
38
|
executor = HostedExecutor(
|
|
32
|
-
external_user_id="user-123",
|
|
33
39
|
airbyte_client_id="client_abc123",
|
|
34
40
|
airbyte_client_secret="secret_xyz789",
|
|
41
|
+
external_user_id="user-123",
|
|
35
42
|
connector_definition_id="abc123-def456-ghi789",
|
|
36
43
|
)
|
|
37
44
|
|
|
@@ -51,28 +58,48 @@ class HostedExecutor:
|
|
|
51
58
|
|
|
52
59
|
def __init__(
|
|
53
60
|
self,
|
|
54
|
-
external_user_id: str,
|
|
55
61
|
airbyte_client_id: str,
|
|
56
62
|
airbyte_client_secret: str,
|
|
57
|
-
|
|
63
|
+
connector_id: str | None = None,
|
|
64
|
+
external_user_id: str | None = None,
|
|
65
|
+
connector_definition_id: str | None = None,
|
|
58
66
|
):
|
|
59
67
|
"""Initialize hosted executor.
|
|
60
68
|
|
|
69
|
+
Either provide connector_id directly OR (external_user_id + connector_definition_id)
|
|
70
|
+
for lookup.
|
|
71
|
+
|
|
61
72
|
Args:
|
|
62
|
-
external_user_id: User identifier in the Airbyte system
|
|
63
73
|
airbyte_client_id: Airbyte client ID for authentication
|
|
64
74
|
airbyte_client_secret: Airbyte client secret for authentication
|
|
65
|
-
|
|
66
|
-
|
|
75
|
+
connector_id: Direct connector/source ID (skips lookup if provided)
|
|
76
|
+
external_user_id: User identifier in the Airbyte system (for lookup)
|
|
77
|
+
connector_definition_id: Connector definition ID (for lookup)
|
|
78
|
+
|
|
79
|
+
Raises:
|
|
80
|
+
ValueError: If neither connector_id nor (external_user_id + connector_definition_id) provided
|
|
67
81
|
|
|
68
82
|
Example:
|
|
83
|
+
# With explicit connector_id (no lookup)
|
|
84
|
+
executor = HostedExecutor(
|
|
85
|
+
airbyte_client_id="client_abc123",
|
|
86
|
+
airbyte_client_secret="secret_xyz789",
|
|
87
|
+
connector_id="existing-source-uuid",
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
# With lookup by user + definition
|
|
69
91
|
executor = HostedExecutor(
|
|
70
|
-
external_user_id="user-123",
|
|
71
92
|
airbyte_client_id="client_abc123",
|
|
72
93
|
airbyte_client_secret="secret_xyz789",
|
|
94
|
+
external_user_id="user-123",
|
|
73
95
|
connector_definition_id="abc123-def456-ghi789",
|
|
74
96
|
)
|
|
75
97
|
"""
|
|
98
|
+
# Validate: either connector_id OR (external_user_id + connector_definition_id) required
|
|
99
|
+
if not connector_id and not (external_user_id and connector_definition_id):
|
|
100
|
+
raise ValueError("Either connector_id OR (external_user_id + connector_definition_id) must be provided")
|
|
101
|
+
|
|
102
|
+
self._connector_id = connector_id
|
|
76
103
|
self._external_user_id = external_user_id
|
|
77
104
|
self._connector_definition_id = connector_definition_id
|
|
78
105
|
|
|
@@ -86,10 +113,9 @@ class HostedExecutor:
|
|
|
86
113
|
"""Execute connector via cloud API (ExecutorProtocol implementation).
|
|
87
114
|
|
|
88
115
|
Flow:
|
|
89
|
-
1.
|
|
90
|
-
2.
|
|
91
|
-
3.
|
|
92
|
-
4. Parse the response into ExecutionResult
|
|
116
|
+
1. Use provided connector_id or look up from external_user_id + definition_id
|
|
117
|
+
2. Execute the connector operation via the cloud API
|
|
118
|
+
3. Parse the response into ExecutionResult
|
|
93
119
|
|
|
94
120
|
Args:
|
|
95
121
|
config: Execution configuration (entity, action, params)
|
|
@@ -98,7 +124,7 @@ class HostedExecutor:
|
|
|
98
124
|
ExecutionResult with success/failure status
|
|
99
125
|
|
|
100
126
|
Raises:
|
|
101
|
-
ValueError: If no connector or multiple connectors found for user
|
|
127
|
+
ValueError: If no connector or multiple connectors found for user (when doing lookup)
|
|
102
128
|
httpx.HTTPStatusError: If API returns 4xx/5xx status code
|
|
103
129
|
httpx.RequestError: If network request fails
|
|
104
130
|
|
|
@@ -114,23 +140,26 @@ class HostedExecutor:
|
|
|
114
140
|
|
|
115
141
|
with tracer.start_as_current_span("airbyte.hosted_executor.execute") as span:
|
|
116
142
|
# Add span attributes for observability
|
|
117
|
-
|
|
143
|
+
if self._connector_definition_id:
|
|
144
|
+
span.set_attribute("connector.definition_id", self._connector_definition_id)
|
|
118
145
|
span.set_attribute("connector.entity", config.entity)
|
|
119
146
|
span.set_attribute("connector.action", config.action)
|
|
120
|
-
|
|
147
|
+
if self._external_user_id:
|
|
148
|
+
span.set_attribute("user.external_id", self._external_user_id)
|
|
121
149
|
if config.params:
|
|
122
150
|
# Only add non-sensitive param keys
|
|
123
151
|
span.set_attribute("connector.param_keys", list(config.params.keys()))
|
|
124
152
|
|
|
125
153
|
try:
|
|
126
|
-
#
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
154
|
+
# Use provided connector_id or look it up
|
|
155
|
+
if self._connector_id:
|
|
156
|
+
connector_id = self._connector_id
|
|
157
|
+
else:
|
|
158
|
+
# Look up connector by external_user_id + definition_id
|
|
159
|
+
connector_id = await self._cloud_client.get_connector_id(
|
|
160
|
+
external_user_id=self._external_user_id, # type: ignore[arg-type]
|
|
161
|
+
connector_definition_id=self._connector_definition_id, # type: ignore[arg-type]
|
|
162
|
+
)
|
|
134
163
|
|
|
135
164
|
span.set_attribute("connector.connector_id", connector_id)
|
|
136
165
|
|
|
@@ -36,6 +36,7 @@ from ..types import (
|
|
|
36
36
|
EndpointDefinition,
|
|
37
37
|
EntityDefinition,
|
|
38
38
|
)
|
|
39
|
+
from ..utils import find_matching_auth_options
|
|
39
40
|
|
|
40
41
|
from .models import (
|
|
41
42
|
ActionNotSupportedError,
|
|
@@ -356,8 +357,8 @@ class LocalExecutor:
|
|
|
356
357
|
) -> tuple[AuthOption, dict[str, SecretStr]]:
|
|
357
358
|
"""Infer authentication scheme from provided credentials.
|
|
358
359
|
|
|
359
|
-
|
|
360
|
-
|
|
360
|
+
Uses shared utility find_matching_auth_options to match credentials
|
|
361
|
+
against each auth option's required fields.
|
|
361
362
|
|
|
362
363
|
Args:
|
|
363
364
|
user_credentials: User-provided credentials
|
|
@@ -375,16 +376,8 @@ class LocalExecutor:
|
|
|
375
376
|
# Get the credential keys provided by the user
|
|
376
377
|
provided_keys = set(user_credentials.keys())
|
|
377
378
|
|
|
378
|
-
#
|
|
379
|
-
matching_options
|
|
380
|
-
for option in options:
|
|
381
|
-
if option.user_config_spec and option.user_config_spec.required:
|
|
382
|
-
required_fields = set(option.user_config_spec.required)
|
|
383
|
-
if required_fields.issubset(provided_keys):
|
|
384
|
-
matching_options.append(option)
|
|
385
|
-
elif not option.user_config_spec or not option.user_config_spec.required:
|
|
386
|
-
# Option has no required fields - it matches any credentials
|
|
387
|
-
matching_options.append(option)
|
|
379
|
+
# Use shared utility to find matching options
|
|
380
|
+
matching_options = find_matching_auth_options(provided_keys, options)
|
|
388
381
|
|
|
389
382
|
# Handle matching results
|
|
390
383
|
if len(matching_options) == 0:
|
|
@@ -126,6 +126,17 @@ class Info(BaseModel):
|
|
|
126
126
|
x_airbyte_example_questions: ExampleQuestions | None = Field(None, alias="x-airbyte-example-questions")
|
|
127
127
|
x_airbyte_cache: CacheConfig | None = Field(None, alias="x-airbyte-cache")
|
|
128
128
|
x_airbyte_replication_config: ReplicationConfig | None = Field(None, alias="x-airbyte-replication-config")
|
|
129
|
+
x_airbyte_skip_suggested_streams: list[str] = Field(
|
|
130
|
+
default_factory=list,
|
|
131
|
+
alias="x-airbyte-skip-suggested-streams",
|
|
132
|
+
description="List of Airbyte suggested streams to skip when validating cache entity coverage",
|
|
133
|
+
)
|
|
134
|
+
x_airbyte_skip_auth_methods: list[str] = Field(
|
|
135
|
+
default_factory=list,
|
|
136
|
+
alias="x-airbyte-skip-auth-methods",
|
|
137
|
+
description="List of Airbyte auth methods to skip when validating auth compatibility. "
|
|
138
|
+
"Use the SelectiveAuthenticator option key (e.g., 'Private App Credentials', 'oauth2.0')",
|
|
139
|
+
)
|
|
129
140
|
|
|
130
141
|
|
|
131
142
|
class ServerVariable(BaseModel):
|
|
@@ -199,6 +199,11 @@ class SecurityScheme(BaseModel):
|
|
|
199
199
|
alias="x-airbyte-token-extract",
|
|
200
200
|
description="List of fields to extract from OAuth2 token responses and use as server variables",
|
|
201
201
|
)
|
|
202
|
+
x_airbyte_untested: bool = Field(
|
|
203
|
+
False,
|
|
204
|
+
alias="x-airbyte-untested",
|
|
205
|
+
description="Mark this auth scheme as untested to skip cassette coverage validation",
|
|
206
|
+
)
|
|
202
207
|
|
|
203
208
|
@field_validator("x_airbyte_token_extract", mode="after")
|
|
204
209
|
@classmethod
|
|
@@ -90,6 +90,10 @@ class AuthOption(BaseModel):
|
|
|
90
90
|
None,
|
|
91
91
|
description="User-facing credential specification from x-airbyte-auth-config",
|
|
92
92
|
)
|
|
93
|
+
untested: bool = Field(
|
|
94
|
+
False,
|
|
95
|
+
description="Mark this auth scheme as untested to skip cassette coverage validation",
|
|
96
|
+
)
|
|
93
97
|
|
|
94
98
|
|
|
95
99
|
class AuthConfig(BaseModel):
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"""Utility functions for working with connectors."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from collections.abc import AsyncIterator
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import TYPE_CHECKING
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from .types import AuthOption
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
async def save_download(
|
|
14
|
+
download_iterator: AsyncIterator[bytes],
|
|
15
|
+
path: str | Path,
|
|
16
|
+
*,
|
|
17
|
+
overwrite: bool = False,
|
|
18
|
+
) -> Path:
|
|
19
|
+
"""Save a download iterator to a file.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
download_iterator: AsyncIterator[bytes] from a download operation
|
|
23
|
+
path: File path where content should be saved
|
|
24
|
+
overwrite: Whether to overwrite existing file (default: False)
|
|
25
|
+
|
|
26
|
+
Returns:
|
|
27
|
+
Absolute Path to the saved file
|
|
28
|
+
|
|
29
|
+
Raises:
|
|
30
|
+
FileExistsError: If file exists and overwrite=False
|
|
31
|
+
OSError: If file cannot be written
|
|
32
|
+
|
|
33
|
+
Example:
|
|
34
|
+
>>> from .utils import save_download
|
|
35
|
+
>>>
|
|
36
|
+
>>> # Download and save a file
|
|
37
|
+
>>> result = await connector.download_article_attachment(id="123")
|
|
38
|
+
>>> file_path = await save_download(result, "./downloads/attachment.pdf")
|
|
39
|
+
>>> print(f"Downloaded to {file_path}")
|
|
40
|
+
Downloaded to /absolute/path/to/downloads/attachment.pdf
|
|
41
|
+
>>>
|
|
42
|
+
>>> # Overwrite existing file
|
|
43
|
+
>>> file_path = await save_download(result, "./downloads/attachment.pdf", overwrite=True)
|
|
44
|
+
"""
|
|
45
|
+
# Convert to Path object
|
|
46
|
+
file_path = Path(path).expanduser().resolve()
|
|
47
|
+
|
|
48
|
+
# Check if file exists
|
|
49
|
+
if file_path.exists() and not overwrite:
|
|
50
|
+
raise FileExistsError(f"File already exists: {file_path}. Use overwrite=True to replace it.")
|
|
51
|
+
|
|
52
|
+
# Create parent directories if needed
|
|
53
|
+
file_path.parent.mkdir(parents=True, exist_ok=True)
|
|
54
|
+
|
|
55
|
+
# Stream content to file
|
|
56
|
+
try:
|
|
57
|
+
with open(file_path, "wb") as f:
|
|
58
|
+
async for chunk in download_iterator:
|
|
59
|
+
f.write(chunk)
|
|
60
|
+
except Exception as e:
|
|
61
|
+
# Clean up partial file on error
|
|
62
|
+
if file_path.exists():
|
|
63
|
+
file_path.unlink()
|
|
64
|
+
raise OSError(f"Failed to write file {file_path}: {e}") from e
|
|
65
|
+
|
|
66
|
+
return file_path
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def find_matching_auth_options(
|
|
70
|
+
provided_keys: set[str],
|
|
71
|
+
auth_options: list[AuthOption],
|
|
72
|
+
) -> list[AuthOption]:
|
|
73
|
+
"""Find auth options that match the provided credential keys.
|
|
74
|
+
|
|
75
|
+
This is the single source of truth for auth scheme inference logic,
|
|
76
|
+
used by both the executor (at runtime) and validation (for cassettes).
|
|
77
|
+
|
|
78
|
+
Matching logic:
|
|
79
|
+
- An option matches if all its required fields are present in provided_keys
|
|
80
|
+
- Options with no required fields match any credentials
|
|
81
|
+
|
|
82
|
+
Args:
|
|
83
|
+
provided_keys: Set of credential/auth_config keys
|
|
84
|
+
auth_options: List of AuthOption from the connector model
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
List of AuthOption that match the provided keys
|
|
88
|
+
"""
|
|
89
|
+
matching_options: list[AuthOption] = []
|
|
90
|
+
|
|
91
|
+
for option in auth_options:
|
|
92
|
+
if option.user_config_spec and option.user_config_spec.required:
|
|
93
|
+
required_fields = set(option.user_config_spec.required)
|
|
94
|
+
if required_fields.issubset(provided_keys):
|
|
95
|
+
matching_options.append(option)
|
|
96
|
+
elif not option.user_config_spec or not option.user_config_spec.required:
|
|
97
|
+
# Option has no required fields - it matches any credentials
|
|
98
|
+
matching_options.append(option)
|
|
99
|
+
|
|
100
|
+
return matching_options
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def infer_auth_scheme_name(
|
|
104
|
+
provided_keys: set[str],
|
|
105
|
+
auth_options: list[AuthOption],
|
|
106
|
+
) -> str | None:
|
|
107
|
+
"""Infer the auth scheme name from provided credential keys.
|
|
108
|
+
|
|
109
|
+
Uses find_matching_auth_options to find matches, then returns
|
|
110
|
+
the scheme name only if exactly one option matches.
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
provided_keys: Set of credential/auth_config keys
|
|
114
|
+
auth_options: List of AuthOption from the connector model
|
|
115
|
+
|
|
116
|
+
Returns:
|
|
117
|
+
The scheme_name if exactly one match, None otherwise
|
|
118
|
+
"""
|
|
119
|
+
if not provided_keys or not auth_options:
|
|
120
|
+
return None
|
|
121
|
+
|
|
122
|
+
matching = find_matching_auth_options(provided_keys, auth_options)
|
|
123
|
+
|
|
124
|
+
if len(matching) == 1:
|
|
125
|
+
return matching[0].scheme_name
|
|
126
|
+
|
|
127
|
+
return None
|