airbyte-agent-amazon-ads 0.1.9__py3-none-any.whl → 0.1.15__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.
@@ -62,6 +62,53 @@ class TokenExtractValidationError(ConnectorModelLoaderError):
62
62
  pass
63
63
 
64
64
 
65
+ # Expected auth_mapping keys for each auth type.
66
+ # These are the auth parameters that each security scheme expects, NOT the user's credential field names.
67
+ EXPECTED_AUTH_MAPPING_KEYS: dict[AuthType, set[str]] = {
68
+ AuthType.BEARER: {"token"},
69
+ AuthType.BASIC: {"username", "password"},
70
+ AuthType.API_KEY: {"api_key"},
71
+ AuthType.OAUTH2: {"access_token", "refresh_token", "client_id", "client_secret"},
72
+ }
73
+
74
+
75
+ def _validate_auth_mapping_keys(
76
+ auth_type: AuthType,
77
+ auth_config: AirbyteAuthConfig | None,
78
+ scheme_name: str = "default",
79
+ ) -> None:
80
+ """Validate that auth_mapping keys match expected parameters for the auth type.
81
+
82
+ The auth_mapping keys must be the parameters expected by the security scheme
83
+ (e.g., "token" for bearer), not the user's credential field names.
84
+
85
+ Args:
86
+ auth_type: The authentication type
87
+ auth_config: The x-airbyte-auth-config containing auth_mapping
88
+ scheme_name: Name of the security scheme for error messages
89
+
90
+ Raises:
91
+ InvalidOpenAPIError: If auth_mapping keys don't match expected parameters
92
+ """
93
+ if auth_config is None or auth_config.auth_mapping is None:
94
+ return # No explicit auth_mapping, will use defaults
95
+
96
+ expected_keys = EXPECTED_AUTH_MAPPING_KEYS.get(auth_type)
97
+ if expected_keys is None:
98
+ return # Unknown auth type, skip validation
99
+
100
+ actual_keys = set(auth_config.auth_mapping.keys())
101
+ invalid_keys = actual_keys - expected_keys
102
+
103
+ if invalid_keys:
104
+ raise InvalidOpenAPIError(
105
+ f"Invalid auth_mapping keys for {auth_type.value} auth in scheme '{scheme_name}': {invalid_keys}. "
106
+ f"Expected keys for {auth_type.value}: {sorted(expected_keys)}. "
107
+ f"Note: auth_mapping keys must be the auth parameters (e.g., 'token' for bearer), "
108
+ f'not your credential field names. Use template syntax to map: token: "${{your_field}}"'
109
+ )
110
+
111
+
65
112
  def extract_path_params(path: str) -> list[str]:
66
113
  """Extract parameter names from path template.
67
114
 
@@ -711,7 +758,6 @@ def _generate_default_auth_config(auth_type: AuthType) -> AirbyteAuthConfig:
711
758
  description="Authentication bearer token",
712
759
  format=None,
713
760
  pattern=None,
714
- airbyte_secret=False,
715
761
  default=None,
716
762
  )
717
763
  },
@@ -731,7 +777,6 @@ def _generate_default_auth_config(auth_type: AuthType) -> AirbyteAuthConfig:
731
777
  description="Authentication username",
732
778
  format=None,
733
779
  pattern=None,
734
- airbyte_secret=False,
735
780
  default=None,
736
781
  ),
737
782
  "password": AuthConfigFieldSpec(
@@ -740,7 +785,6 @@ def _generate_default_auth_config(auth_type: AuthType) -> AirbyteAuthConfig:
740
785
  description="Authentication password",
741
786
  format=None,
742
787
  pattern=None,
743
- airbyte_secret=False,
744
788
  default=None,
745
789
  ),
746
790
  },
@@ -760,7 +804,6 @@ def _generate_default_auth_config(auth_type: AuthType) -> AirbyteAuthConfig:
760
804
  description="API authentication key",
761
805
  format=None,
762
806
  pattern=None,
763
- airbyte_secret=False,
764
807
  default=None,
765
808
  )
766
809
  },
@@ -785,7 +828,6 @@ def _generate_default_auth_config(auth_type: AuthType) -> AirbyteAuthConfig:
785
828
  description="OAuth2 access token",
786
829
  format=None,
787
830
  pattern=None,
788
- airbyte_secret=False,
789
831
  default=None,
790
832
  ),
791
833
  "refresh_token": AuthConfigFieldSpec(
@@ -794,7 +836,6 @@ def _generate_default_auth_config(auth_type: AuthType) -> AirbyteAuthConfig:
794
836
  description="OAuth2 refresh token (optional)",
795
837
  format=None,
796
838
  pattern=None,
797
- airbyte_secret=False,
798
839
  default=None,
799
840
  ),
800
841
  "client_id": AuthConfigFieldSpec(
@@ -803,7 +844,6 @@ def _generate_default_auth_config(auth_type: AuthType) -> AirbyteAuthConfig:
803
844
  description="OAuth2 client ID (optional)",
804
845
  format=None,
805
846
  pattern=None,
806
- airbyte_secret=False,
807
847
  default=None,
808
848
  ),
809
849
  "client_secret": AuthConfigFieldSpec(
@@ -812,7 +852,6 @@ def _generate_default_auth_config(auth_type: AuthType) -> AirbyteAuthConfig:
812
852
  description="OAuth2 client secret (optional)",
813
853
  format=None,
814
854
  pattern=None,
815
- airbyte_secret=False,
816
855
  default=None,
817
856
  ),
818
857
  },
@@ -924,6 +963,9 @@ def _parse_single_security_scheme(scheme: Any) -> AuthConfig:
924
963
  oauth2_config = _parse_oauth2_config(scheme)
925
964
  # Use explicit x-airbyte-auth-config if present, otherwise generate default
926
965
  auth_config_obj = scheme.x_airbyte_auth_config or _generate_default_auth_config(AuthType.OAUTH2)
966
+ # Validate auth_mapping keys if explicitly provided
967
+ if scheme.x_airbyte_auth_config:
968
+ _validate_auth_mapping_keys(AuthType.OAUTH2, scheme.x_airbyte_auth_config)
927
969
  return AuthConfig(
928
970
  type=AuthType.OAUTH2,
929
971
  config=oauth2_config,
@@ -934,6 +976,10 @@ def _parse_single_security_scheme(scheme: Any) -> AuthConfig:
934
976
  # Use explicit x-airbyte-auth-config if present, otherwise generate default
935
977
  auth_config_obj = scheme.x_airbyte_auth_config or _generate_default_auth_config(auth_type)
936
978
 
979
+ # Validate auth_mapping keys if explicitly provided
980
+ if scheme.x_airbyte_auth_config:
981
+ _validate_auth_mapping_keys(auth_type, scheme.x_airbyte_auth_config)
982
+
937
983
  return AuthConfig(
938
984
  type=auth_type,
939
985
  config=auth_config,
@@ -490,7 +490,7 @@ class HTTPClient:
490
490
 
491
491
  if not response_text.strip():
492
492
  response_data = {}
493
- elif "application/json" in content_type or not content_type:
493
+ elif "application/json" in content_type or "+json" in content_type or not content_type:
494
494
  response_data = await response.json()
495
495
  else:
496
496
  error_msg = f"Expected JSON response for {method.upper()} {url}, got content-type: {content_type}"
@@ -55,7 +55,6 @@ class AuthConfigFieldSpec(BaseModel):
55
55
  description: str | None = None
56
56
  format: str | None = None # e.g., "email", "uri"
57
57
  pattern: str | None = None # Regex validation
58
- airbyte_secret: bool = Field(False, alias="airbyte_secret")
59
58
  default: Any | None = None
60
59
 
61
60
 
@@ -91,7 +91,7 @@ class AmazonAdsConnector:
91
91
  """
92
92
 
93
93
  connector_name = "amazon-ads"
94
- connector_version = "1.0.3"
94
+ connector_version = "1.0.4"
95
95
  vendored_sdk_version = "0.1.0" # Version of vendored connector-sdk
96
96
 
97
97
  # Map of (entity, action) -> needs_envelope for envelope wrapping decision
@@ -26,7 +26,7 @@ from uuid import (
26
26
  AmazonAdsConnectorModel: ConnectorModel = ConnectorModel(
27
27
  id=UUID('c6b0a29e-1da9-4512-9002-7bfd0cba2246'),
28
28
  name='amazon-ads',
29
- version='1.0.3',
29
+ version='1.0.4',
30
30
  base_url='{region}',
31
31
  auth=AuthConfig(
32
32
  type=AuthType.OAUTH2,
@@ -44,17 +44,14 @@ AmazonAdsConnectorModel: ConnectorModel = ConnectorModel(
44
44
  'client_id': AuthConfigFieldSpec(
45
45
  title='Client ID',
46
46
  description='The client ID of your Amazon Ads API application',
47
- airbyte_secret=True,
48
47
  ),
49
48
  'client_secret': AuthConfigFieldSpec(
50
49
  title='Client Secret',
51
50
  description='The client secret of your Amazon Ads API application',
52
- airbyte_secret=True,
53
51
  ),
54
52
  'refresh_token': AuthConfigFieldSpec(
55
53
  title='Refresh Token',
56
54
  description='The refresh token obtained from the OAuth authorization flow',
57
- airbyte_secret=True,
58
55
  ),
59
56
  },
60
57
  auth_mapping={
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: airbyte-agent-amazon-ads
3
- Version: 0.1.9
3
+ Version: 0.1.15
4
4
  Summary: Airbyte Amazon-Ads 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/
@@ -101,7 +101,7 @@ This example assumes you've already authenticated your connector with Airbyte. S
101
101
  from airbyte_agent_amazon-ads import AmazonAdsConnector
102
102
 
103
103
  connector = AmazonAdsConnector(
104
- external_user_id="<your-scoped-token>",
104
+ external_user_id="<your_external_user_id>",
105
105
  airbyte_client_id="<your-client-id>",
106
106
  airbyte_client_secret="<your-client-secret>"
107
107
  )
@@ -132,6 +132,6 @@ For the service's official API docs, see the [Amazon-Ads API reference](https://
132
132
 
133
133
  ## Version information
134
134
 
135
- - **Package version:** 0.1.9
136
- - **Connector version:** 1.0.3
137
- - **Generated with Connector SDK commit SHA:** 609c1d86c76b36ff699b57123a5a8c2050d958c3
135
+ - **Package version:** 0.1.15
136
+ - **Connector version:** 1.0.4
137
+ - **Generated with Connector SDK commit SHA:** 0f5e1914fa0d7d52de7bc0018afab712184a0847
@@ -1,17 +1,17 @@
1
1
  airbyte_agent_amazon_ads/__init__.py,sha256=f883U_4eSRjMLgjqpi5rGcKZ0U44ME_Z0IY-XZhwlPc,1896
2
- airbyte_agent_amazon_ads/connector.py,sha256=LUhUhLTmj2oF8J7-0jO4I8KfPK4L082yTzwUyz_DKL0,23895
3
- airbyte_agent_amazon_ads/connector_model.py,sha256=lOTUqeFdrTtnW2GLh5hBwxp9Xwg0lTPTAE5EcOaQteE,98118
2
+ airbyte_agent_amazon_ads/connector.py,sha256=YrDIUHrjMpBc2fj91SETviF1q5zZVdLLwEHSJUMO8P4,23895
3
+ airbyte_agent_amazon_ads/connector_model.py,sha256=EBw-dpn0Vf5NpZCxGI-pHxaB52h4e1ApHfOXKGPPuCQ,97995
4
4
  airbyte_agent_amazon_ads/models.py,sha256=TOHCY0p3cE0rWVv3YfYvyvL-lmdYBcoGRTXtFNNBztc,9182
5
5
  airbyte_agent_amazon_ads/types.py,sha256=EW-jvOmXyJQqe2ESiDCs7nCIIsFreDCIZBlA6aplxpA,6728
6
6
  airbyte_agent_amazon_ads/_vendored/__init__.py,sha256=ILl7AHXMui__swyrjxrh9yRa4dLiwBvV6axPWFWty80,38
7
7
  airbyte_agent_amazon_ads/_vendored/connector_sdk/__init__.py,sha256=T5o7roU6NSpH-lCAGZ338sE5dlh4ZU6i6IkeG1zpems,1949
8
8
  airbyte_agent_amazon_ads/_vendored/connector_sdk/auth_strategies.py,sha256=5Sb9moUp623o67Q2wMa8iZldJH08y4gQdoutoO_75Iw,42088
9
9
  airbyte_agent_amazon_ads/_vendored/connector_sdk/auth_template.py,sha256=nju4jqlFC_KI82ILNumNIyiUtRJcy7J94INIZ0QraI4,4454
10
- airbyte_agent_amazon_ads/_vendored/connector_sdk/connector_model_loader.py,sha256=nCu6oym6LoKrS94NTivU1vyQE_qnU-rhx8ExpuOX_LU,39544
10
+ airbyte_agent_amazon_ads/_vendored/connector_sdk/connector_model_loader.py,sha256=AW9bsdggzuc3ydy2bYYF33L6LxLKLQer9Wm47IOuQw0,41492
11
11
  airbyte_agent_amazon_ads/_vendored/connector_sdk/constants.py,sha256=AtzOvhDMWbRJgpsQNWl5tkogHD6mWgEY668PgRmgtOY,2737
12
12
  airbyte_agent_amazon_ads/_vendored/connector_sdk/exceptions.py,sha256=ss5MGv9eVPmsbLcLWetuu3sDmvturwfo6Pw3M37Oq5k,481
13
13
  airbyte_agent_amazon_ads/_vendored/connector_sdk/extensions.py,sha256=XWRRoJOOrwUHSKbuQt5DU7CCu8ePzhd_HuP7c_uD77w,21376
14
- airbyte_agent_amazon_ads/_vendored/connector_sdk/http_client.py,sha256=yucwu3OvJh5wLQa1mk-gTKjtqjKKucMw5ltmlE7mk1c,28000
14
+ airbyte_agent_amazon_ads/_vendored/connector_sdk/http_client.py,sha256=09Fclbq4wrg38EM2Yh2kHiykQVXqdAGby024elcEz8E,28027
15
15
  airbyte_agent_amazon_ads/_vendored/connector_sdk/introspection.py,sha256=kRVI4TDQDLdcCnTBUML8ycAtdqAQufVh-027sMkb4i8,19165
16
16
  airbyte_agent_amazon_ads/_vendored/connector_sdk/secrets.py,sha256=J9ezMu4xNnLW11xY5RCre6DHP7YMKZCqwGJfk7ufHAM,6855
17
17
  airbyte_agent_amazon_ads/_vendored/connector_sdk/types.py,sha256=in8gHsn5nsScujOfHZmkOgNmqmJKiPyNNjg59m5fGWc,8807
@@ -47,11 +47,11 @@ airbyte_agent_amazon_ads/_vendored/connector_sdk/schema/components.py,sha256=nJI
47
47
  airbyte_agent_amazon_ads/_vendored/connector_sdk/schema/connector.py,sha256=mSZk1wr2YSdRj9tTRsPAuIlCzd_xZLw-Bzl1sMwE0rE,3731
48
48
  airbyte_agent_amazon_ads/_vendored/connector_sdk/schema/extensions.py,sha256=5hgpFHK7fzpzegCkJk882DeIP79bCx_qairKJhvPMZ8,9590
49
49
  airbyte_agent_amazon_ads/_vendored/connector_sdk/schema/operations.py,sha256=RpzGtAI4yvAtMHAfMUMcUwgHv_qJojnKlNb75_agUF8,5729
50
- airbyte_agent_amazon_ads/_vendored/connector_sdk/schema/security.py,sha256=6ljzf_JHs4amnQX9AhePcEsT8P3ZnTSC4xeg7-cvsNQ,9100
50
+ airbyte_agent_amazon_ads/_vendored/connector_sdk/schema/security.py,sha256=1CVCavrPdHHyk7B6JtUD75yRS_hWLCemZF1zwGbdqxg,9036
51
51
  airbyte_agent_amazon_ads/_vendored/connector_sdk/telemetry/__init__.py,sha256=RaLgkBU4dfxn1LC5Y0Q9rr2PJbrwjxvPgBLmq8_WafE,211
52
52
  airbyte_agent_amazon_ads/_vendored/connector_sdk/telemetry/config.py,sha256=tLmQwAFD0kP1WyBGWBS3ysaudN9H3e-3EopKZi6cGKg,885
53
53
  airbyte_agent_amazon_ads/_vendored/connector_sdk/telemetry/events.py,sha256=8Y1NbXiwISX-V_wRofY7PqcwEXD0dLMnntKkY6XFU2s,1328
54
54
  airbyte_agent_amazon_ads/_vendored/connector_sdk/telemetry/tracker.py,sha256=Ftrk0_ddfM7dZG8hF9xBuPwhbc9D6JZ7Q9qs5o3LEyA,5579
55
- airbyte_agent_amazon_ads-0.1.9.dist-info/METADATA,sha256=_RbZLdC2MqkaarpWQu6NQfNnfDXX2PhXwCFm6dxsf-0,5157
56
- airbyte_agent_amazon_ads-0.1.9.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
57
- airbyte_agent_amazon_ads-0.1.9.dist-info/RECORD,,
55
+ airbyte_agent_amazon_ads-0.1.15.dist-info/METADATA,sha256=n7_0YW3uvFU8L3v8xkzxrmbTTMIBSNSYsshxvM_RnqY,5163
56
+ airbyte_agent_amazon_ads-0.1.15.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
57
+ airbyte_agent_amazon_ads-0.1.15.dist-info/RECORD,,