airbyte-agent-slack 0.1.33__tar.gz → 0.1.38__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_slack-0.1.33 → airbyte_agent_slack-0.1.38}/CHANGELOG.md +25 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/PKG-INFO +5 -4
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/README.md +4 -3
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/__init__.py +2 -2
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/connector_model_loader.py +1 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/executor/local_executor.py +9 -15
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/http/adapters/httpx_adapter.py +10 -1
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/schema/base.py +11 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/schema/security.py +5 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/telemetry/tracker.py +4 -4
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/types.py +4 -0
- airbyte_agent_slack-0.1.38/airbyte_agent_slack/_vendored/connector_sdk/utils.py +127 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/validation.py +151 -2
- airbyte_agent_slack-0.1.38/airbyte_agent_slack/_vendored/connector_sdk/validation_replication.py +970 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/connector.py +1 -1
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/connector_model.py +2 -1
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/pyproject.toml +1 -1
- airbyte_agent_slack-0.1.33/airbyte_agent_slack/_vendored/connector_sdk/utils.py +0 -60
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/.gitignore +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/AUTH.md +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/REFERENCE.md +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/__init__.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/__init__.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/auth_strategies.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/auth_template.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/cloud_utils/__init__.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/cloud_utils/client.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/constants.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/exceptions.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/executor/__init__.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/executor/hosted_executor.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/executor/models.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/extensions.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/http/__init__.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/http/adapters/__init__.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/http/config.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/http/exceptions.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/http/protocols.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/http/response.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/http_client.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/introspection.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/logging/__init__.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/logging/logger.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/logging/types.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/observability/__init__.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/observability/config.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/observability/models.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/observability/redactor.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/observability/session.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/performance/__init__.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/performance/instrumentation.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/performance/metrics.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/schema/__init__.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/schema/components.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/schema/connector.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/schema/extensions.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/schema/operations.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/secrets.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/telemetry/__init__.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/telemetry/config.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/_vendored/connector_sdk/telemetry/events.py +0 -0
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/models.py +21 -21
- {airbyte_agent_slack-0.1.33 → airbyte_agent_slack-0.1.38}/airbyte_agent_slack/types.py +0 -0
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Slack changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.38] - 2026-01-30
|
|
4
|
+
- Updated connector definition (YAML version 0.1.12)
|
|
5
|
+
- Source commit: 40765c71
|
|
6
|
+
- SDK version: 0.1.0
|
|
7
|
+
|
|
8
|
+
## [0.1.37] - 2026-01-30
|
|
9
|
+
- Updated connector definition (YAML version 0.1.11)
|
|
10
|
+
- Source commit: 5f65d643
|
|
11
|
+
- SDK version: 0.1.0
|
|
12
|
+
|
|
13
|
+
## [0.1.36] - 2026-01-30
|
|
14
|
+
- Updated connector definition (YAML version 0.1.10)
|
|
15
|
+
- Source commit: 5b20f488
|
|
16
|
+
- SDK version: 0.1.0
|
|
17
|
+
|
|
18
|
+
## [0.1.35] - 2026-01-30
|
|
19
|
+
- Updated connector definition (YAML version 0.1.10)
|
|
20
|
+
- Source commit: a3729d85
|
|
21
|
+
- SDK version: 0.1.0
|
|
22
|
+
|
|
23
|
+
## [0.1.34] - 2026-01-29
|
|
24
|
+
- Updated connector definition (YAML version 0.1.10)
|
|
25
|
+
- Source commit: 43200eed
|
|
26
|
+
- SDK version: 0.1.0
|
|
27
|
+
|
|
3
28
|
## [0.1.33] - 2026-01-29
|
|
4
29
|
- Updated connector definition (YAML version 0.1.10)
|
|
5
30
|
- Source commit: c718c683
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: airbyte-agent-slack
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.38
|
|
4
4
|
Summary: Airbyte Slack 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/
|
|
@@ -158,6 +158,7 @@ See the official [Slack API reference](https://api.slack.com/methods).
|
|
|
158
158
|
|
|
159
159
|
## Version information
|
|
160
160
|
|
|
161
|
-
- **Package version:** 0.1.
|
|
162
|
-
- **Connector version:** 0.1.
|
|
163
|
-
- **Generated with Connector SDK commit SHA:**
|
|
161
|
+
- **Package version:** 0.1.38
|
|
162
|
+
- **Connector version:** 0.1.12
|
|
163
|
+
- **Generated with Connector SDK commit SHA:** 40765c717093dffed8c5e9ed8d5b3a6fbbe9b181
|
|
164
|
+
- **Changelog:** [View changelog](https://github.com/airbytehq/airbyte-agent-connectors/blob/main/connectors/slack/CHANGELOG.md)
|
|
@@ -125,6 +125,7 @@ See the official [Slack API reference](https://api.slack.com/methods).
|
|
|
125
125
|
|
|
126
126
|
## Version information
|
|
127
127
|
|
|
128
|
-
- **Package version:** 0.1.
|
|
129
|
-
- **Connector version:** 0.1.
|
|
130
|
-
- **Generated with Connector SDK commit SHA:**
|
|
128
|
+
- **Package version:** 0.1.38
|
|
129
|
+
- **Connector version:** 0.1.12
|
|
130
|
+
- **Generated with Connector SDK commit SHA:** 40765c717093dffed8c5e9ed8d5b3a6fbbe9b181
|
|
131
|
+
- **Changelog:** [View changelog](https://github.com/airbytehq/airbyte-agent-connectors/blob/main/connectors/slack/CHANGELOG.md)
|
|
@@ -18,8 +18,8 @@ from .models import (
|
|
|
18
18
|
ChannelsListResponse,
|
|
19
19
|
ChannelResponse,
|
|
20
20
|
Reaction,
|
|
21
|
-
File,
|
|
22
21
|
Attachment,
|
|
22
|
+
File,
|
|
23
23
|
Message,
|
|
24
24
|
Thread,
|
|
25
25
|
EditedInfo,
|
|
@@ -97,8 +97,8 @@ __all__ = [
|
|
|
97
97
|
"ChannelsListResponse",
|
|
98
98
|
"ChannelResponse",
|
|
99
99
|
"Reaction",
|
|
100
|
-
"File",
|
|
101
100
|
"Attachment",
|
|
101
|
+
"File",
|
|
102
102
|
"Message",
|
|
103
103
|
"Thread",
|
|
104
104
|
"EditedInfo",
|
|
@@ -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
|
|
|
@@ -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:
|
|
@@ -584,7 +577,7 @@ class LocalExecutor:
|
|
|
584
577
|
return ExecutionResult(
|
|
585
578
|
success=True,
|
|
586
579
|
data={
|
|
587
|
-
"status": "
|
|
580
|
+
"status": "skipped",
|
|
588
581
|
"error": "No list operation available for health check",
|
|
589
582
|
},
|
|
590
583
|
)
|
|
@@ -599,7 +592,7 @@ class LocalExecutor:
|
|
|
599
592
|
return ExecutionResult(
|
|
600
593
|
success=True,
|
|
601
594
|
data={
|
|
602
|
-
"status": "
|
|
595
|
+
"status": "skipped",
|
|
603
596
|
"error": "No standard handler available",
|
|
604
597
|
},
|
|
605
598
|
)
|
|
@@ -616,13 +609,14 @@ class LocalExecutor:
|
|
|
616
609
|
)
|
|
617
610
|
except Exception as e:
|
|
618
611
|
return ExecutionResult(
|
|
619
|
-
success=
|
|
612
|
+
success=False,
|
|
620
613
|
data={
|
|
621
614
|
"status": "unhealthy",
|
|
622
615
|
"error": str(e),
|
|
623
616
|
"checked_entity": check_entity,
|
|
624
617
|
"checked_action": "list",
|
|
625
618
|
},
|
|
619
|
+
error=str(e),
|
|
626
620
|
)
|
|
627
621
|
|
|
628
622
|
async def _execute_operation(
|
|
@@ -186,7 +186,16 @@ class HTTPXClient:
|
|
|
186
186
|
# Try to get error message from response
|
|
187
187
|
try:
|
|
188
188
|
error_data = httpx_response.json()
|
|
189
|
-
|
|
189
|
+
errors_list = error_data.get("errors")
|
|
190
|
+
if isinstance(errors_list, list):
|
|
191
|
+
|
|
192
|
+
def _extract_error(e: object) -> str:
|
|
193
|
+
if isinstance(e, dict):
|
|
194
|
+
return str(e.get("userPresentableMessage") or e.get("message") or e.get("error") or e)
|
|
195
|
+
return str(e)
|
|
196
|
+
|
|
197
|
+
errors_list = ", ".join(_extract_error(e) for e in errors_list)
|
|
198
|
+
error_message = errors_list or error_data.get("message") or error_data.get("error") or str(error_data)
|
|
190
199
|
except Exception:
|
|
191
200
|
error_message = httpx_response.text or f"HTTP {status_code} error"
|
|
192
201
|
|
|
@@ -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
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import logging
|
|
4
4
|
import platform
|
|
5
5
|
import sys
|
|
6
|
-
from datetime import datetime
|
|
6
|
+
from datetime import UTC, datetime
|
|
7
7
|
|
|
8
8
|
from ..observability import ObservabilitySession
|
|
9
9
|
|
|
@@ -56,7 +56,7 @@ class SegmentTracker:
|
|
|
56
56
|
|
|
57
57
|
try:
|
|
58
58
|
event = ConnectorInitEvent(
|
|
59
|
-
timestamp=datetime.
|
|
59
|
+
timestamp=datetime.now(UTC),
|
|
60
60
|
session_id=self.session.session_id,
|
|
61
61
|
user_id=self.session.user_id,
|
|
62
62
|
execution_context=self.session.execution_context,
|
|
@@ -99,7 +99,7 @@ class SegmentTracker:
|
|
|
99
99
|
|
|
100
100
|
try:
|
|
101
101
|
event = OperationEvent(
|
|
102
|
-
timestamp=datetime.
|
|
102
|
+
timestamp=datetime.now(UTC),
|
|
103
103
|
session_id=self.session.session_id,
|
|
104
104
|
user_id=self.session.user_id,
|
|
105
105
|
execution_context=self.session.execution_context,
|
|
@@ -129,7 +129,7 @@ class SegmentTracker:
|
|
|
129
129
|
|
|
130
130
|
try:
|
|
131
131
|
event = SessionEndEvent(
|
|
132
|
-
timestamp=datetime.
|
|
132
|
+
timestamp=datetime.now(UTC),
|
|
133
133
|
session_id=self.session.session_id,
|
|
134
134
|
user_id=self.session.user_id,
|
|
135
135
|
execution_context=self.session.execution_context,
|
|
@@ -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
|
|
@@ -5,6 +5,7 @@ These tools help ensure that connectors are ready to ship by:
|
|
|
5
5
|
- Checking that all entity/action operations have corresponding test cassettes
|
|
6
6
|
- Validating that response schemas match the actual cassette responses
|
|
7
7
|
- Detecting fields present in responses but not declared in schemas
|
|
8
|
+
- Validating replication compatibility with Airbyte source connectors
|
|
8
9
|
"""
|
|
9
10
|
|
|
10
11
|
from collections import defaultdict
|
|
@@ -20,7 +21,9 @@ from .connector_model_loader import (
|
|
|
20
21
|
load_connector_model,
|
|
21
22
|
)
|
|
22
23
|
from .testing.spec_loader import load_test_spec
|
|
23
|
-
from .types import Action, EndpointDefinition
|
|
24
|
+
from .types import Action, ConnectorModel, EndpointDefinition
|
|
25
|
+
from .utils import infer_auth_scheme_name
|
|
26
|
+
from .validation_replication import validate_replication_compatibility
|
|
24
27
|
|
|
25
28
|
|
|
26
29
|
def build_cassette_map(cassettes_dir: Path) -> Dict[Tuple[str, str], List[Path]]:
|
|
@@ -51,6 +54,112 @@ def build_cassette_map(cassettes_dir: Path) -> Dict[Tuple[str, str], List[Path]]
|
|
|
51
54
|
return dict(cassette_map)
|
|
52
55
|
|
|
53
56
|
|
|
57
|
+
def build_auth_scheme_coverage(
|
|
58
|
+
cassettes_dir: Path,
|
|
59
|
+
auth_options: list | None = None,
|
|
60
|
+
) -> Tuple[Dict[str | None, List[Path]], List[Tuple[Path, set[str]]]]:
|
|
61
|
+
"""Build a map of auth_scheme -> list of cassette paths.
|
|
62
|
+
|
|
63
|
+
For multi-auth connectors, infers the auth scheme from the cassette's auth_config
|
|
64
|
+
keys using the same matching logic as the executor.
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
cassettes_dir: Directory containing cassette YAML files
|
|
68
|
+
auth_options: List of AuthOption from the connector model (for inference)
|
|
69
|
+
|
|
70
|
+
Returns:
|
|
71
|
+
Tuple of:
|
|
72
|
+
- Dictionary mapping auth_scheme names (or None for single-auth) to cassette paths
|
|
73
|
+
- List of (cassette_path, auth_config_keys) for cassettes that couldn't be matched
|
|
74
|
+
"""
|
|
75
|
+
auth_scheme_map: Dict[str | None, List[Path]] = defaultdict(list)
|
|
76
|
+
unmatched_cassettes: List[Tuple[Path, set[str]]] = []
|
|
77
|
+
|
|
78
|
+
if not cassettes_dir.exists() or not cassettes_dir.is_dir():
|
|
79
|
+
return {}, []
|
|
80
|
+
|
|
81
|
+
for cassette_file in cassettes_dir.glob("*.yaml"):
|
|
82
|
+
try:
|
|
83
|
+
spec = load_test_spec(cassette_file, auth_config={})
|
|
84
|
+
|
|
85
|
+
# First, check if auth_scheme is explicitly set in the cassette
|
|
86
|
+
if spec.auth_scheme:
|
|
87
|
+
auth_scheme_map[spec.auth_scheme].append(cassette_file)
|
|
88
|
+
# Otherwise, try to infer from auth_config keys
|
|
89
|
+
elif spec.auth_config and auth_options:
|
|
90
|
+
auth_config_keys = set(spec.auth_config.keys())
|
|
91
|
+
inferred_scheme = infer_auth_scheme_name(auth_config_keys, auth_options)
|
|
92
|
+
if inferred_scheme is not None:
|
|
93
|
+
auth_scheme_map[inferred_scheme].append(cassette_file)
|
|
94
|
+
else:
|
|
95
|
+
# Couldn't infer - track as unmatched
|
|
96
|
+
unmatched_cassettes.append((cassette_file, auth_config_keys))
|
|
97
|
+
else:
|
|
98
|
+
# No auth_scheme and no auth_config - treat as None
|
|
99
|
+
auth_scheme_map[None].append(cassette_file)
|
|
100
|
+
except Exception:
|
|
101
|
+
continue
|
|
102
|
+
|
|
103
|
+
return dict(auth_scheme_map), unmatched_cassettes
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def validate_auth_scheme_coverage(
|
|
107
|
+
config: ConnectorModel,
|
|
108
|
+
cassettes_dir: Path,
|
|
109
|
+
) -> Tuple[bool, List[str], List[str], List[str], List[Tuple[Path, set[str]]]]:
|
|
110
|
+
"""Validate that each auth scheme has at least one cassette.
|
|
111
|
+
|
|
112
|
+
For multi-auth connectors, every defined auth scheme must have coverage
|
|
113
|
+
unless marked with x-airbyte-untested: true.
|
|
114
|
+
For single-auth connectors, this check is skipped (existing cassette checks suffice).
|
|
115
|
+
|
|
116
|
+
Args:
|
|
117
|
+
config: Loaded connector model
|
|
118
|
+
cassettes_dir: Directory containing cassette files
|
|
119
|
+
|
|
120
|
+
Returns:
|
|
121
|
+
Tuple of (is_valid, errors, warnings, covered_schemes, unmatched_cassettes)
|
|
122
|
+
"""
|
|
123
|
+
errors: List[str] = []
|
|
124
|
+
warnings: List[str] = []
|
|
125
|
+
|
|
126
|
+
# Skip check for single-auth connectors
|
|
127
|
+
if not config.auth.is_multi_auth():
|
|
128
|
+
return True, errors, warnings, [], []
|
|
129
|
+
|
|
130
|
+
# Get all defined auth schemes, separating tested from untested
|
|
131
|
+
options = config.auth.options or []
|
|
132
|
+
|
|
133
|
+
# Build auth scheme coverage from cassettes (pass options for inference)
|
|
134
|
+
auth_scheme_coverage, unmatched_cassettes = build_auth_scheme_coverage(cassettes_dir, options)
|
|
135
|
+
tested_schemes = {opt.scheme_name for opt in options if not opt.untested}
|
|
136
|
+
untested_schemes = {opt.scheme_name for opt in options if opt.untested}
|
|
137
|
+
covered_schemes = {scheme for scheme in auth_scheme_coverage.keys() if scheme is not None}
|
|
138
|
+
|
|
139
|
+
# Find missing tested schemes (errors)
|
|
140
|
+
missing_tested = tested_schemes - covered_schemes
|
|
141
|
+
for scheme in sorted(missing_tested):
|
|
142
|
+
errors.append(
|
|
143
|
+
f"Auth scheme '{scheme}' has no cassette coverage. "
|
|
144
|
+
f"Record at least one cassette using this authentication method, "
|
|
145
|
+
f"or add 'x-airbyte-untested: true' to skip this check."
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
# Warn about untested schemes without coverage
|
|
149
|
+
missing_untested = untested_schemes - covered_schemes
|
|
150
|
+
for scheme in sorted(missing_untested):
|
|
151
|
+
warnings.append(
|
|
152
|
+
f"Auth scheme '{scheme}' is marked as untested (x-airbyte-untested: true) " f"and has no cassette coverage. Validation skipped."
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
# Warn about cassettes that couldn't be matched to any auth scheme
|
|
156
|
+
for cassette_path, auth_config_keys in unmatched_cassettes:
|
|
157
|
+
warnings.append(f"Cassette '{cassette_path.name}' could not be matched to any auth scheme. " f"auth_config keys: {sorted(auth_config_keys)}")
|
|
158
|
+
|
|
159
|
+
is_valid = len(missing_tested) == 0
|
|
160
|
+
return is_valid, errors, warnings, sorted(covered_schemes), unmatched_cassettes
|
|
161
|
+
|
|
162
|
+
|
|
54
163
|
def validate_response_against_schema(response_body: Any, schema: Dict[str, Any]) -> Tuple[bool, List[str]]:
|
|
55
164
|
"""Validate a response body against a JSON schema.
|
|
56
165
|
|
|
@@ -586,6 +695,9 @@ def validate_connector_readiness(connector_dir: str | Path) -> Dict[str, Any]:
|
|
|
586
695
|
cassettes_dir = connector_path / "tests" / "cassettes"
|
|
587
696
|
cassette_map = build_cassette_map(cassettes_dir)
|
|
588
697
|
|
|
698
|
+
# Validate auth scheme coverage for multi-auth connectors
|
|
699
|
+
auth_valid, auth_errors, auth_warnings, auth_covered_schemes, auth_unmatched_cassettes = validate_auth_scheme_coverage(config, cassettes_dir)
|
|
700
|
+
|
|
589
701
|
validation_results = []
|
|
590
702
|
total_operations = 0
|
|
591
703
|
operations_with_cassettes = 0
|
|
@@ -808,7 +920,29 @@ def validate_connector_readiness(connector_dir: str | Path) -> Dict[str, Any]:
|
|
|
808
920
|
}
|
|
809
921
|
)
|
|
810
922
|
|
|
811
|
-
|
|
923
|
+
# Validate replication compatibility with Airbyte
|
|
924
|
+
replication_result = validate_replication_compatibility(
|
|
925
|
+
connector_yaml_path=config_file,
|
|
926
|
+
raw_spec=raw_spec,
|
|
927
|
+
)
|
|
928
|
+
|
|
929
|
+
# Merge replication errors/warnings into totals
|
|
930
|
+
# Note: If connector is not in registry, we don't count warnings since this is expected for test connectors
|
|
931
|
+
replication_errors = replication_result.get("errors", [])
|
|
932
|
+
replication_warnings = replication_result.get("warnings", [])
|
|
933
|
+
total_errors += len(replication_errors)
|
|
934
|
+
|
|
935
|
+
# Only count replication warnings if the connector was found in the registry
|
|
936
|
+
# (i.e., there are actual validation issues, not just "not found in registry")
|
|
937
|
+
if replication_result.get("registry_found", False):
|
|
938
|
+
total_warnings += len(replication_warnings)
|
|
939
|
+
|
|
940
|
+
# Merge auth scheme validation errors/warnings into totals
|
|
941
|
+
total_errors += len(auth_errors)
|
|
942
|
+
total_warnings += len(auth_warnings)
|
|
943
|
+
|
|
944
|
+
# Update success criteria to include replication and auth scheme validation
|
|
945
|
+
success = operations_missing_cassettes == 0 and cassettes_invalid == 0 and total_operations > 0 and len(replication_errors) == 0 and auth_valid
|
|
812
946
|
|
|
813
947
|
# Check for preferred_for_check on at least one list operation
|
|
814
948
|
has_preferred_check = False
|
|
@@ -829,11 +963,26 @@ def validate_connector_readiness(connector_dir: str | Path) -> Dict[str, Any]:
|
|
|
829
963
|
"to enable reliable health checks."
|
|
830
964
|
)
|
|
831
965
|
|
|
966
|
+
# Build auth scheme validation result
|
|
967
|
+
options = config.auth.options or []
|
|
968
|
+
tested_schemes = [opt.scheme_name for opt in options if not opt.untested]
|
|
969
|
+
untested_schemes_list = [opt.scheme_name for opt in options if opt.untested]
|
|
970
|
+
missing_tested = [s for s in tested_schemes if s not in auth_covered_schemes]
|
|
971
|
+
|
|
832
972
|
return {
|
|
833
973
|
"success": success,
|
|
834
974
|
"connector_name": config.name,
|
|
835
975
|
"connector_path": str(connector_path),
|
|
836
976
|
"validation_results": validation_results,
|
|
977
|
+
"replication_validation": replication_result,
|
|
978
|
+
"auth_scheme_validation": {
|
|
979
|
+
"valid": auth_valid,
|
|
980
|
+
"errors": auth_errors,
|
|
981
|
+
"warnings": auth_warnings,
|
|
982
|
+
"covered_schemes": auth_covered_schemes,
|
|
983
|
+
"missing_schemes": missing_tested,
|
|
984
|
+
"untested_schemes": untested_schemes_list,
|
|
985
|
+
},
|
|
837
986
|
"readiness_warnings": readiness_warnings,
|
|
838
987
|
"summary": {
|
|
839
988
|
"total_operations": total_operations,
|