airbyte-agent-stripe 0.5.25__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.
Potentially problematic release.
This version of airbyte-agent-stripe might be problematic. Click here for more details.
- airbyte_agent_stripe/__init__.py +237 -0
- airbyte_agent_stripe/_vendored/__init__.py +1 -0
- airbyte_agent_stripe/_vendored/connector_sdk/__init__.py +82 -0
- airbyte_agent_stripe/_vendored/connector_sdk/auth_strategies.py +1123 -0
- airbyte_agent_stripe/_vendored/connector_sdk/auth_template.py +135 -0
- airbyte_agent_stripe/_vendored/connector_sdk/cloud_utils/__init__.py +5 -0
- airbyte_agent_stripe/_vendored/connector_sdk/cloud_utils/client.py +213 -0
- airbyte_agent_stripe/_vendored/connector_sdk/connector_model_loader.py +957 -0
- airbyte_agent_stripe/_vendored/connector_sdk/constants.py +78 -0
- airbyte_agent_stripe/_vendored/connector_sdk/exceptions.py +23 -0
- airbyte_agent_stripe/_vendored/connector_sdk/executor/__init__.py +31 -0
- airbyte_agent_stripe/_vendored/connector_sdk/executor/hosted_executor.py +197 -0
- airbyte_agent_stripe/_vendored/connector_sdk/executor/local_executor.py +1504 -0
- airbyte_agent_stripe/_vendored/connector_sdk/executor/models.py +190 -0
- airbyte_agent_stripe/_vendored/connector_sdk/extensions.py +655 -0
- airbyte_agent_stripe/_vendored/connector_sdk/http/__init__.py +37 -0
- airbyte_agent_stripe/_vendored/connector_sdk/http/adapters/__init__.py +9 -0
- airbyte_agent_stripe/_vendored/connector_sdk/http/adapters/httpx_adapter.py +251 -0
- airbyte_agent_stripe/_vendored/connector_sdk/http/config.py +98 -0
- airbyte_agent_stripe/_vendored/connector_sdk/http/exceptions.py +119 -0
- airbyte_agent_stripe/_vendored/connector_sdk/http/protocols.py +114 -0
- airbyte_agent_stripe/_vendored/connector_sdk/http/response.py +102 -0
- airbyte_agent_stripe/_vendored/connector_sdk/http_client.py +686 -0
- airbyte_agent_stripe/_vendored/connector_sdk/logging/__init__.py +11 -0
- airbyte_agent_stripe/_vendored/connector_sdk/logging/logger.py +264 -0
- airbyte_agent_stripe/_vendored/connector_sdk/logging/types.py +92 -0
- airbyte_agent_stripe/_vendored/connector_sdk/observability/__init__.py +11 -0
- airbyte_agent_stripe/_vendored/connector_sdk/observability/models.py +19 -0
- airbyte_agent_stripe/_vendored/connector_sdk/observability/redactor.py +81 -0
- airbyte_agent_stripe/_vendored/connector_sdk/observability/session.py +94 -0
- airbyte_agent_stripe/_vendored/connector_sdk/performance/__init__.py +6 -0
- airbyte_agent_stripe/_vendored/connector_sdk/performance/instrumentation.py +57 -0
- airbyte_agent_stripe/_vendored/connector_sdk/performance/metrics.py +93 -0
- airbyte_agent_stripe/_vendored/connector_sdk/schema/__init__.py +75 -0
- airbyte_agent_stripe/_vendored/connector_sdk/schema/base.py +161 -0
- airbyte_agent_stripe/_vendored/connector_sdk/schema/components.py +238 -0
- airbyte_agent_stripe/_vendored/connector_sdk/schema/connector.py +131 -0
- airbyte_agent_stripe/_vendored/connector_sdk/schema/extensions.py +109 -0
- airbyte_agent_stripe/_vendored/connector_sdk/schema/operations.py +146 -0
- airbyte_agent_stripe/_vendored/connector_sdk/schema/security.py +213 -0
- airbyte_agent_stripe/_vendored/connector_sdk/secrets.py +182 -0
- airbyte_agent_stripe/_vendored/connector_sdk/telemetry/__init__.py +10 -0
- airbyte_agent_stripe/_vendored/connector_sdk/telemetry/config.py +32 -0
- airbyte_agent_stripe/_vendored/connector_sdk/telemetry/events.py +58 -0
- airbyte_agent_stripe/_vendored/connector_sdk/telemetry/tracker.py +151 -0
- airbyte_agent_stripe/_vendored/connector_sdk/types.py +241 -0
- airbyte_agent_stripe/_vendored/connector_sdk/utils.py +60 -0
- airbyte_agent_stripe/_vendored/connector_sdk/validation.py +822 -0
- airbyte_agent_stripe/connector.py +1579 -0
- airbyte_agent_stripe/connector_model.py +14869 -0
- airbyte_agent_stripe/models.py +2353 -0
- airbyte_agent_stripe/types.py +295 -0
- airbyte_agent_stripe-0.5.25.dist-info/METADATA +110 -0
- airbyte_agent_stripe-0.5.25.dist-info/RECORD +55 -0
- airbyte_agent_stripe-0.5.25.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,655 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Airbyte OpenAPI Extensions - Single Source of Truth
|
|
3
|
+
|
|
4
|
+
This module defines all custom Airbyte extensions to the OpenAPI 3.0 specification.
|
|
5
|
+
These extensions are prefixed with 'x-airbyte-' to follow OpenAPI vendor extension
|
|
6
|
+
conventions and avoid conflicts with other extensions.
|
|
7
|
+
|
|
8
|
+
All extension names, valid values, and related types are centralized here to ensure
|
|
9
|
+
consistency across the codebase.
|
|
10
|
+
|
|
11
|
+
Usage:
|
|
12
|
+
from .extensions import AIRBYTE_CONNECTOR_NAME, AIRBYTE_ENTITY, ActionType
|
|
13
|
+
|
|
14
|
+
# In Pydantic models
|
|
15
|
+
x_entity: Optional[str] = Field(None, alias=AIRBYTE_ENTITY)
|
|
16
|
+
|
|
17
|
+
# In tests and validation
|
|
18
|
+
assert operation.get(AIRBYTE_ACTION) in ActionType.__members__.values()
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from enum import Enum
|
|
22
|
+
from typing import Literal
|
|
23
|
+
|
|
24
|
+
# =============================================================================
|
|
25
|
+
# Extension Name Constants
|
|
26
|
+
# =============================================================================
|
|
27
|
+
|
|
28
|
+
AIRBYTE_CONNECTOR_NAME = "x-airbyte-connector-name"
|
|
29
|
+
"""
|
|
30
|
+
Extension: x-airbyte-connector-name
|
|
31
|
+
Location: OpenAPI Info object
|
|
32
|
+
Type: string
|
|
33
|
+
Required: No (but recommended)
|
|
34
|
+
|
|
35
|
+
Description:
|
|
36
|
+
Specifies the unique identifier/name for this connector. This is used to identify
|
|
37
|
+
the connector in Airbyte's catalog and runtime systems.
|
|
38
|
+
|
|
39
|
+
Example:
|
|
40
|
+
```yaml
|
|
41
|
+
info:
|
|
42
|
+
title: Stripe API
|
|
43
|
+
version: 1.0.0
|
|
44
|
+
x-airbyte-connector-name: stripe
|
|
45
|
+
```
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
AIRBYTE_EXTERNAL_DOCUMENTATION_URLS = "x-airbyte-external-documentation-urls"
|
|
49
|
+
"""
|
|
50
|
+
Extension: x-airbyte-external-documentation-urls
|
|
51
|
+
Location: OpenAPI Info object
|
|
52
|
+
Type: list
|
|
53
|
+
Required: Yes
|
|
54
|
+
|
|
55
|
+
Description:
|
|
56
|
+
List of objects that contain external documentation URLs relevant to the connector. Each object includes:
|
|
57
|
+
- type: Type of documentation (e.g., "api_reference", "other", etc.)
|
|
58
|
+
- title: Human-readable title for the documentation link
|
|
59
|
+
- url: The actual URL to the external documentation
|
|
60
|
+
|
|
61
|
+
Example:
|
|
62
|
+
```yaml
|
|
63
|
+
info:
|
|
64
|
+
title: Stripe API
|
|
65
|
+
version: 1.0.0
|
|
66
|
+
x-airbyte-external-documentation-urls:
|
|
67
|
+
- type: api_reference
|
|
68
|
+
title: Stripe API Reference
|
|
69
|
+
url: https://stripe.com/docs/api
|
|
70
|
+
- type: authentication_guide
|
|
71
|
+
title: Stripe APIN Authentication Guide
|
|
72
|
+
url: https://docs.stripe.com/api/authentication
|
|
73
|
+
```
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
AIRBYTE_ENTITY = "x-airbyte-entity"
|
|
77
|
+
"""
|
|
78
|
+
Extension: x-airbyte-entity
|
|
79
|
+
Location: Operation object (on individual HTTP operations)
|
|
80
|
+
Type: string
|
|
81
|
+
Required: Yes (for operations that should be exposed as Airbyte streams)
|
|
82
|
+
|
|
83
|
+
Description:
|
|
84
|
+
Identifies which logical entity/stream this operation belongs to. Operations
|
|
85
|
+
with the same x-airbyte-entity value are grouped together to form a single
|
|
86
|
+
Airbyte stream. The entity name is used as the stream name.
|
|
87
|
+
|
|
88
|
+
Example:
|
|
89
|
+
```yaml
|
|
90
|
+
paths:
|
|
91
|
+
/customers:
|
|
92
|
+
get:
|
|
93
|
+
x-airbyte-entity: customers
|
|
94
|
+
x-airbyte-action: list
|
|
95
|
+
```
|
|
96
|
+
"""
|
|
97
|
+
|
|
98
|
+
AIRBYTE_ACTION = "x-airbyte-action"
|
|
99
|
+
"""
|
|
100
|
+
Extension: x-airbyte-action
|
|
101
|
+
Location: Operation object (on individual HTTP operations)
|
|
102
|
+
Type: string (enum - see ActionType)
|
|
103
|
+
Required: Yes (for operations that should be exposed as Airbyte streams)
|
|
104
|
+
Valid Values: get, list, create, update, delete
|
|
105
|
+
|
|
106
|
+
Description:
|
|
107
|
+
Specifies the semantic intent of this operation within its entity. This helps
|
|
108
|
+
Airbyte understand how to map REST operations to stream operations and determine
|
|
109
|
+
which operation to use for syncing data.
|
|
110
|
+
|
|
111
|
+
Action Semantics:
|
|
112
|
+
- list: Fetch multiple records (paginated, used for syncing)
|
|
113
|
+
- get: Fetch a single record by ID
|
|
114
|
+
- create: Create a new record
|
|
115
|
+
- update: Update an existing record
|
|
116
|
+
- delete: Delete a record
|
|
117
|
+
|
|
118
|
+
Example:
|
|
119
|
+
```yaml
|
|
120
|
+
paths:
|
|
121
|
+
/customers:
|
|
122
|
+
get:
|
|
123
|
+
x-airbyte-entity: customers
|
|
124
|
+
x-airbyte-action: list
|
|
125
|
+
post:
|
|
126
|
+
x-airbyte-entity: customers
|
|
127
|
+
x-airbyte-action: create
|
|
128
|
+
/customers/{id}:
|
|
129
|
+
get:
|
|
130
|
+
x-airbyte-entity: customers
|
|
131
|
+
x-airbyte-action: get
|
|
132
|
+
```
|
|
133
|
+
"""
|
|
134
|
+
|
|
135
|
+
AIRBYTE_ENTITY_NAME = "x-airbyte-entity-name"
|
|
136
|
+
"""
|
|
137
|
+
Extension: x-airbyte-entity-name
|
|
138
|
+
Location: Schema object (in components.schemas)
|
|
139
|
+
Type: string
|
|
140
|
+
Required: No (but recommended for entity schemas)
|
|
141
|
+
|
|
142
|
+
Description:
|
|
143
|
+
Links a schema definition to a logical entity/stream. This helps identify which
|
|
144
|
+
schema represents the main data model for a particular entity, especially when
|
|
145
|
+
multiple schemas might reference the same entity.
|
|
146
|
+
|
|
147
|
+
Example:
|
|
148
|
+
```yaml
|
|
149
|
+
components:
|
|
150
|
+
schemas:
|
|
151
|
+
Customer:
|
|
152
|
+
type: object
|
|
153
|
+
x-airbyte-entity-name: customers
|
|
154
|
+
properties:
|
|
155
|
+
id:
|
|
156
|
+
type: string
|
|
157
|
+
name:
|
|
158
|
+
type: string
|
|
159
|
+
```
|
|
160
|
+
"""
|
|
161
|
+
|
|
162
|
+
AIRBYTE_TOKEN_PATH = "x-airbyte-token-path"
|
|
163
|
+
"""
|
|
164
|
+
Extension: x-airbyte-token-path
|
|
165
|
+
Location: SecurityScheme object (in components.securitySchemes)
|
|
166
|
+
Type: string
|
|
167
|
+
Required: No
|
|
168
|
+
|
|
169
|
+
Description:
|
|
170
|
+
JSON path expression to extract the authentication token from the auth response.
|
|
171
|
+
Used for complex authentication flows where the token is nested in the response.
|
|
172
|
+
|
|
173
|
+
Example:
|
|
174
|
+
```yaml
|
|
175
|
+
components:
|
|
176
|
+
securitySchemes:
|
|
177
|
+
oauth2Auth:
|
|
178
|
+
type: oauth2
|
|
179
|
+
flows:
|
|
180
|
+
clientCredentials:
|
|
181
|
+
tokenUrl: https://api.example.com/oauth/token
|
|
182
|
+
x-airbyte-token-path: $.access_token
|
|
183
|
+
```
|
|
184
|
+
"""
|
|
185
|
+
|
|
186
|
+
AIRBYTE_BODY_TYPE = "x-airbyte-body-type"
|
|
187
|
+
"""
|
|
188
|
+
Extension: x-airbyte-body-type
|
|
189
|
+
Location: RequestBody object (in components.requestBodies or operation.requestBody)
|
|
190
|
+
Type: BodyTypeConfig (Union of typed Pydantic models: GraphQLBodyConfig)
|
|
191
|
+
Required: No
|
|
192
|
+
Validation: Strict - enforced at Pydantic model level
|
|
193
|
+
|
|
194
|
+
Description:
|
|
195
|
+
Specifies the type and configuration of request body format. Currently supports
|
|
196
|
+
"graphql" for GraphQL queries/mutations. The extension uses strongly-typed Pydantic
|
|
197
|
+
models for validation and contains both the type and type-specific configuration
|
|
198
|
+
in a nested structure. Designed to be extensible to support other body types in
|
|
199
|
+
the future (ie XML/SOAP, MessagePack).
|
|
200
|
+
|
|
201
|
+
Structure:
|
|
202
|
+
- type: Body type (currently "graphql")
|
|
203
|
+
- For type="graphql":
|
|
204
|
+
- query: GraphQL query/mutation string (required)
|
|
205
|
+
- variables: Variables dict with template placeholders (optional)
|
|
206
|
+
- operationName: Operation name for multi-operation queries (optional)
|
|
207
|
+
- default_fields: Default fields to select if not provided in params (optional)
|
|
208
|
+
|
|
209
|
+
Example:
|
|
210
|
+
```yaml
|
|
211
|
+
paths:
|
|
212
|
+
/graphql:
|
|
213
|
+
post:
|
|
214
|
+
requestBody:
|
|
215
|
+
x-airbyte-body-type:
|
|
216
|
+
type: graphql
|
|
217
|
+
query: "query($owner: String!) { repository(owner: $owner) { name } }"
|
|
218
|
+
variables:
|
|
219
|
+
owner: "{{ owner }}"
|
|
220
|
+
```
|
|
221
|
+
"""
|
|
222
|
+
|
|
223
|
+
AIRBYTE_PATH_OVERRIDE = "x-airbyte-path-override"
|
|
224
|
+
"""
|
|
225
|
+
Extension: x-airbyte-path-override
|
|
226
|
+
Location: Operation object (on individual HTTP operations)
|
|
227
|
+
Type: PathOverrideConfig (strongly-typed Pydantic model)
|
|
228
|
+
Required: No
|
|
229
|
+
Validation: Strict - enforced at Pydantic model level
|
|
230
|
+
|
|
231
|
+
Description:
|
|
232
|
+
Overrides the HTTP path used for actual requests when the OpenAPI path differs
|
|
233
|
+
from the real API endpoint. Common for GraphQL APIs where multiple entities
|
|
234
|
+
need unique OpenAPI paths but query the same HTTP endpoint.
|
|
235
|
+
|
|
236
|
+
This allows multiple operations (e.g., repositories→search, issues→search) to
|
|
237
|
+
have distinct entity-action mappings in the OpenAPI spec while all sending
|
|
238
|
+
requests to the same physical endpoint (e.g., /graphql).
|
|
239
|
+
|
|
240
|
+
Structure:
|
|
241
|
+
- path: Actual HTTP path to use (required, must start with '/')
|
|
242
|
+
|
|
243
|
+
Example:
|
|
244
|
+
```yaml
|
|
245
|
+
paths:
|
|
246
|
+
/graphql:repositories: # OpenAPI path (for uniqueness)
|
|
247
|
+
post:
|
|
248
|
+
x-airbyte-entity: repositories
|
|
249
|
+
x-airbyte-action: search
|
|
250
|
+
x-airbyte-path-override:
|
|
251
|
+
path: /graphql # Actual HTTP endpoint
|
|
252
|
+
/graphql:issues: # Different OpenAPI path
|
|
253
|
+
post:
|
|
254
|
+
x-airbyte-entity: issues
|
|
255
|
+
x-airbyte-action: search
|
|
256
|
+
x-airbyte-path-override:
|
|
257
|
+
path: /graphql # Same actual endpoint
|
|
258
|
+
```
|
|
259
|
+
"""
|
|
260
|
+
|
|
261
|
+
AIRBYTE_RECORD_EXTRACTOR = "x-airbyte-record-extractor"
|
|
262
|
+
"""
|
|
263
|
+
Extension: x-airbyte-record-extractor
|
|
264
|
+
Location: Operation object (on individual HTTP operations)
|
|
265
|
+
Type: string (JSONPath expression)
|
|
266
|
+
Required: No
|
|
267
|
+
|
|
268
|
+
Description:
|
|
269
|
+
Specifies a JSONPath expression to extract actual record data from API
|
|
270
|
+
response envelopes. Many APIs wrap responses in metadata structures
|
|
271
|
+
(pagination info, request IDs, etc.). This extension tells the executor
|
|
272
|
+
where to find the actual records.
|
|
273
|
+
|
|
274
|
+
Return type is automatically inferred from x-airbyte-action:
|
|
275
|
+
- list, search actions: Returns array ([] if path not found)
|
|
276
|
+
- get, create, update, delete actions: Returns single record (None if path not found)
|
|
277
|
+
|
|
278
|
+
Example:
|
|
279
|
+
```yaml
|
|
280
|
+
paths:
|
|
281
|
+
/v2/users:
|
|
282
|
+
get:
|
|
283
|
+
x-airbyte-entity: users
|
|
284
|
+
x-airbyte-action: list
|
|
285
|
+
x-airbyte-record-extractor: $.users
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
API Response:
|
|
289
|
+
```json
|
|
290
|
+
{
|
|
291
|
+
"requestId": "abc123",
|
|
292
|
+
"users": [{"id": "1"}, {"id": "2"}]
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
Executor Returns: [{"id": "1"}, {"id": "2"}]
|
|
297
|
+
"""
|
|
298
|
+
|
|
299
|
+
AIRBYTE_META_EXTRACTOR = "x-airbyte-meta-extractor"
|
|
300
|
+
"""
|
|
301
|
+
Extension: x-airbyte-meta-extractor
|
|
302
|
+
Location: Operation object (on individual HTTP operations)
|
|
303
|
+
Type: dict[str, str] (field name → JSONPath expression)
|
|
304
|
+
Required: No
|
|
305
|
+
|
|
306
|
+
Description:
|
|
307
|
+
Extracts metadata (pagination info, request IDs, etc.) from API responses.
|
|
308
|
+
Each key in the dict becomes a field in ExecutionResult.meta, with its value
|
|
309
|
+
being a JSONPath expression that extracts data from the original response.
|
|
310
|
+
|
|
311
|
+
Supports two usage patterns:
|
|
312
|
+
|
|
313
|
+
Pattern 1: Extract entire nested object (when all fields are grouped together)
|
|
314
|
+
Pattern 2: Extract individual fields (when fields are scattered across response)
|
|
315
|
+
|
|
316
|
+
Metadata is extracted from the original full response before record extraction,
|
|
317
|
+
ensuring access to envelope metadata that may be removed during record extraction.
|
|
318
|
+
|
|
319
|
+
Usage Pattern 1 (Extract nested object):
|
|
320
|
+
```yaml
|
|
321
|
+
paths:
|
|
322
|
+
/v2/users:
|
|
323
|
+
get:
|
|
324
|
+
x-airbyte-resource: users
|
|
325
|
+
x-airbyte-verb: list
|
|
326
|
+
x-airbyte-record-extractor: $.users
|
|
327
|
+
x-airbyte-meta-extractor:
|
|
328
|
+
pagination: $.records # Extracts entire nested object
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
API Response:
|
|
332
|
+
```json
|
|
333
|
+
{
|
|
334
|
+
"requestId": "abc123",
|
|
335
|
+
"records": {
|
|
336
|
+
"cursor": "next_page_token",
|
|
337
|
+
"totalRecords": 100,
|
|
338
|
+
"currentPageSize": 20
|
|
339
|
+
},
|
|
340
|
+
"users": [{"id": "1"}, {"id": "2"}]
|
|
341
|
+
}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
Executor Returns:
|
|
345
|
+
- data: [{"id": "1"}, {"id": "2"}]
|
|
346
|
+
- meta: {"pagination": {"cursor": "next_page_token", "totalRecords": 100, "currentPageSize": 20}}
|
|
347
|
+
|
|
348
|
+
Usage Pattern 2 (Extract individual fields):
|
|
349
|
+
```yaml
|
|
350
|
+
paths:
|
|
351
|
+
/v1/customers:
|
|
352
|
+
get:
|
|
353
|
+
x-airbyte-resource: customers
|
|
354
|
+
x-airbyte-verb: list
|
|
355
|
+
x-airbyte-record-extractor: $.data
|
|
356
|
+
x-airbyte-meta-extractor:
|
|
357
|
+
cursor: $.records.cursor
|
|
358
|
+
total_count: $.records.totalRecords
|
|
359
|
+
request_id: $.requestId
|
|
360
|
+
has_more: $.has_more
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
API Response:
|
|
364
|
+
```json
|
|
365
|
+
{
|
|
366
|
+
"requestId": "xyz789",
|
|
367
|
+
"records": {"cursor": "abc", "totalRecords": 50},
|
|
368
|
+
"has_more": true,
|
|
369
|
+
"data": [{"id": "cus_1"}, {"id": "cus_2"}]
|
|
370
|
+
}
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
Executor Returns:
|
|
374
|
+
- data: [{"id": "cus_1"}, {"id": "cus_2"}]
|
|
375
|
+
- meta: {"cursor": "abc", "total_count": 50, "request_id": "xyz789", "has_more": true}
|
|
376
|
+
|
|
377
|
+
Behavior:
|
|
378
|
+
- Missing paths return None for that field (does not crash)
|
|
379
|
+
- Invalid JSONPath logs warning and returns None for that field
|
|
380
|
+
- Extraction happens before record extraction to access full response envelope
|
|
381
|
+
"""
|
|
382
|
+
|
|
383
|
+
AIRBYTE_FILE_URL = "x-airbyte-file-url"
|
|
384
|
+
"""
|
|
385
|
+
Extension: x-airbyte-file-url
|
|
386
|
+
Location: Operation object (on individual HTTP operations with x-airbyte-action: download)
|
|
387
|
+
Type: string
|
|
388
|
+
Required: Yes (when x-airbyte-action is "download")
|
|
389
|
+
|
|
390
|
+
Description:
|
|
391
|
+
Specifies which field in the metadata response contains the download URL. Used with
|
|
392
|
+
the 'download' action to perform a two-step file retrieval: first fetch metadata,
|
|
393
|
+
then extract and download from the URL field specified here.
|
|
394
|
+
|
|
395
|
+
The field path can be a simple field name (e.g., "content_url") or a nested path
|
|
396
|
+
using dot notation (e.g., "data.download_link"). The URL must be absolute.
|
|
397
|
+
|
|
398
|
+
Example:
|
|
399
|
+
```yaml
|
|
400
|
+
paths:
|
|
401
|
+
/articles/{article_id}/attachments/{attachment_id}:
|
|
402
|
+
get:
|
|
403
|
+
x-airbyte-entity: article_attachments
|
|
404
|
+
x-airbyte-action: download
|
|
405
|
+
x-airbyte-file-url: content_url
|
|
406
|
+
responses:
|
|
407
|
+
"200":
|
|
408
|
+
content:
|
|
409
|
+
application/json:
|
|
410
|
+
schema:
|
|
411
|
+
type: object
|
|
412
|
+
properties:
|
|
413
|
+
id:
|
|
414
|
+
type: integer
|
|
415
|
+
content_url:
|
|
416
|
+
type: string
|
|
417
|
+
description: URL to download the file
|
|
418
|
+
```
|
|
419
|
+
"""
|
|
420
|
+
|
|
421
|
+
AIRBYTE_TOKEN_EXTRACT = "x-airbyte-token-extract"
|
|
422
|
+
"""
|
|
423
|
+
Extension: x-airbyte-token-extract
|
|
424
|
+
Location: SecurityScheme object (in components.securitySchemes, under oauth2)
|
|
425
|
+
Type: list[str]
|
|
426
|
+
Required: No
|
|
427
|
+
|
|
428
|
+
Description:
|
|
429
|
+
Specifies which fields to extract from OAuth2 token responses and use as server
|
|
430
|
+
variables. This is useful for APIs like Salesforce where the token response includes
|
|
431
|
+
dynamic values (e.g., instance_url) needed to construct API URLs.
|
|
432
|
+
|
|
433
|
+
When token refresh occurs, the SDK:
|
|
434
|
+
1. Extracts the specified fields from the token response
|
|
435
|
+
2. Updates config_values with extracted values
|
|
436
|
+
3. Re-renders the base_url with updated server variables
|
|
437
|
+
4. Includes extracted fields in on_token_refresh callback for persistence
|
|
438
|
+
|
|
439
|
+
Precedence rules (highest wins):
|
|
440
|
+
1. Server variable `default` in YAML (lowest)
|
|
441
|
+
2. User-provided `config_values` at init (optional, may be unset)
|
|
442
|
+
3. Token-extracted values via `x-airbyte-token-extract` (highest)
|
|
443
|
+
|
|
444
|
+
Validation (at connector load time):
|
|
445
|
+
- Error if extracted field doesn't match a defined server variable
|
|
446
|
+
- Error if duplicate fields in x-airbyte-token-extract
|
|
447
|
+
|
|
448
|
+
Example:
|
|
449
|
+
```yaml
|
|
450
|
+
servers:
|
|
451
|
+
- url: "{instance_url}/services/data/v59.0"
|
|
452
|
+
variables:
|
|
453
|
+
instance_url:
|
|
454
|
+
default: "https://login.salesforce.com"
|
|
455
|
+
|
|
456
|
+
components:
|
|
457
|
+
securitySchemes:
|
|
458
|
+
oauth2:
|
|
459
|
+
type: oauth2
|
|
460
|
+
flows:
|
|
461
|
+
authorizationCode:
|
|
462
|
+
tokenUrl: https://login.salesforce.com/services/oauth2/token
|
|
463
|
+
refreshUrl: https://login.salesforce.com/services/oauth2/token
|
|
464
|
+
scopes: {}
|
|
465
|
+
x-airbyte-token-extract:
|
|
466
|
+
- instance_url # Extract from token response → updates {instance_url}
|
|
467
|
+
```
|
|
468
|
+
"""
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
# =============================================================================
|
|
472
|
+
# Enums and Type Definitions
|
|
473
|
+
# =============================================================================
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
class ActionType(str, Enum):
|
|
477
|
+
"""
|
|
478
|
+
Valid values for x-airbyte-action extension.
|
|
479
|
+
|
|
480
|
+
These actions represent the semantic operations that can be performed on an entity.
|
|
481
|
+
"""
|
|
482
|
+
|
|
483
|
+
GET = "get"
|
|
484
|
+
"""Fetch a single record by identifier"""
|
|
485
|
+
|
|
486
|
+
LIST = "list"
|
|
487
|
+
"""Fetch multiple records (typically paginated, used for data syncing)"""
|
|
488
|
+
|
|
489
|
+
CREATE = "create"
|
|
490
|
+
"""Create a new record"""
|
|
491
|
+
|
|
492
|
+
UPDATE = "update"
|
|
493
|
+
"""Update an existing record"""
|
|
494
|
+
|
|
495
|
+
DELETE = "delete"
|
|
496
|
+
"""Delete a record"""
|
|
497
|
+
|
|
498
|
+
SEARCH = "search"
|
|
499
|
+
"""Search for records matching specific query criteria"""
|
|
500
|
+
|
|
501
|
+
DOWNLOAD = "download"
|
|
502
|
+
"""Download file content from a URL specified in the metadata response"""
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
class BodyType(str, Enum):
|
|
506
|
+
"""
|
|
507
|
+
Valid values for x-airbyte-body-type extension.
|
|
508
|
+
|
|
509
|
+
These types represent the supported request body formats.
|
|
510
|
+
"""
|
|
511
|
+
|
|
512
|
+
GRAPHQL = "graphql"
|
|
513
|
+
"""GraphQL query/mutation format"""
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
# Type alias for use in Pydantic models
|
|
517
|
+
ActionTypeLiteral = Literal["get", "list", "create", "update", "delete", "search", "download"]
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
# =============================================================================
|
|
521
|
+
# Validation Helpers
|
|
522
|
+
# =============================================================================
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
def is_valid_action(action: str) -> bool:
|
|
526
|
+
"""
|
|
527
|
+
Check if a string is a valid Airbyte action.
|
|
528
|
+
|
|
529
|
+
Args:
|
|
530
|
+
action: The action string to validate
|
|
531
|
+
|
|
532
|
+
Returns:
|
|
533
|
+
True if the action is valid, False otherwise
|
|
534
|
+
"""
|
|
535
|
+
return action in [a.value for a in ActionType]
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
def get_all_extension_names() -> list[str]:
|
|
539
|
+
"""
|
|
540
|
+
Get a list of all defined Airbyte extension names.
|
|
541
|
+
|
|
542
|
+
Returns:
|
|
543
|
+
List of extension name constants
|
|
544
|
+
"""
|
|
545
|
+
return [
|
|
546
|
+
AIRBYTE_CONNECTOR_NAME,
|
|
547
|
+
AIRBYTE_EXTERNAL_DOCUMENTATION_URLS,
|
|
548
|
+
AIRBYTE_ENTITY,
|
|
549
|
+
AIRBYTE_ACTION,
|
|
550
|
+
AIRBYTE_ENTITY_NAME,
|
|
551
|
+
AIRBYTE_TOKEN_PATH,
|
|
552
|
+
AIRBYTE_BODY_TYPE,
|
|
553
|
+
AIRBYTE_PATH_OVERRIDE,
|
|
554
|
+
AIRBYTE_RECORD_EXTRACTOR,
|
|
555
|
+
AIRBYTE_META_EXTRACTOR,
|
|
556
|
+
AIRBYTE_FILE_URL,
|
|
557
|
+
AIRBYTE_TOKEN_EXTRACT,
|
|
558
|
+
]
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
# =============================================================================
|
|
562
|
+
# Extension Registry
|
|
563
|
+
# =============================================================================
|
|
564
|
+
|
|
565
|
+
EXTENSION_REGISTRY = {
|
|
566
|
+
AIRBYTE_CONNECTOR_NAME: {
|
|
567
|
+
"location": "info",
|
|
568
|
+
"type": "string",
|
|
569
|
+
"required": False,
|
|
570
|
+
"description": "Unique identifier for the connector",
|
|
571
|
+
},
|
|
572
|
+
AIRBYTE_EXTERNAL_DOCUMENTATION_URLS: {
|
|
573
|
+
"location": "info",
|
|
574
|
+
"type": "list",
|
|
575
|
+
"required": True,
|
|
576
|
+
"description": "List of external documentation URLs relevant to the connector",
|
|
577
|
+
},
|
|
578
|
+
AIRBYTE_ENTITY: {
|
|
579
|
+
"location": "operation",
|
|
580
|
+
"type": "string",
|
|
581
|
+
"required": True,
|
|
582
|
+
"description": "Entity/stream name this operation belongs to",
|
|
583
|
+
},
|
|
584
|
+
AIRBYTE_ACTION: {
|
|
585
|
+
"location": "operation",
|
|
586
|
+
"type": "string",
|
|
587
|
+
"required": True,
|
|
588
|
+
"enum": [a.value for a in ActionType],
|
|
589
|
+
"description": "Semantic operation type",
|
|
590
|
+
},
|
|
591
|
+
AIRBYTE_ENTITY_NAME: {
|
|
592
|
+
"location": "schema",
|
|
593
|
+
"type": "string",
|
|
594
|
+
"required": False,
|
|
595
|
+
"description": "Links schema to an entity/stream",
|
|
596
|
+
},
|
|
597
|
+
AIRBYTE_TOKEN_PATH: {
|
|
598
|
+
"location": "securityScheme",
|
|
599
|
+
"type": "string",
|
|
600
|
+
"required": False,
|
|
601
|
+
"description": "JSON path to extract token from auth response",
|
|
602
|
+
},
|
|
603
|
+
AIRBYTE_BODY_TYPE: {
|
|
604
|
+
"location": "requestBody",
|
|
605
|
+
"type": "BodyTypeConfig",
|
|
606
|
+
"model": "Union[GraphQLBodyConfig]",
|
|
607
|
+
"required": False,
|
|
608
|
+
"validation": "strict",
|
|
609
|
+
"description": "Body type and configuration (strongly-typed Pydantic models, extensible for future body types)",
|
|
610
|
+
},
|
|
611
|
+
AIRBYTE_PATH_OVERRIDE: {
|
|
612
|
+
"location": "operation",
|
|
613
|
+
"type": "PathOverrideConfig",
|
|
614
|
+
"model": "PathOverrideConfig",
|
|
615
|
+
"required": False,
|
|
616
|
+
"validation": "strict",
|
|
617
|
+
"description": "Override actual HTTP path when OpenAPI path differs from real endpoint (strongly-typed Pydantic model)",
|
|
618
|
+
},
|
|
619
|
+
AIRBYTE_RECORD_EXTRACTOR: {
|
|
620
|
+
"location": "operation",
|
|
621
|
+
"type": "string",
|
|
622
|
+
"required": False,
|
|
623
|
+
"description": "JSONPath expression to extract records from response envelopes",
|
|
624
|
+
},
|
|
625
|
+
AIRBYTE_META_EXTRACTOR: {
|
|
626
|
+
"location": "operation",
|
|
627
|
+
"type": "dict[str, str]",
|
|
628
|
+
"required": False,
|
|
629
|
+
"description": (
|
|
630
|
+
"Dictionary mapping field names to JSONPath expressions for extracting metadata "
|
|
631
|
+
"(pagination, request IDs, etc.) from response envelopes"
|
|
632
|
+
),
|
|
633
|
+
},
|
|
634
|
+
AIRBYTE_FILE_URL: {
|
|
635
|
+
"location": "operation",
|
|
636
|
+
"type": "string",
|
|
637
|
+
"required": "conditional", # Required when action is 'download'
|
|
638
|
+
"description": "Field in metadata response containing download URL (required for download action)",
|
|
639
|
+
},
|
|
640
|
+
AIRBYTE_TOKEN_EXTRACT: {
|
|
641
|
+
"location": "securityScheme",
|
|
642
|
+
"type": "list[str]",
|
|
643
|
+
"required": False,
|
|
644
|
+
"description": "List of fields to extract from OAuth2 token responses and use as server variables",
|
|
645
|
+
},
|
|
646
|
+
}
|
|
647
|
+
"""
|
|
648
|
+
Complete registry of all Airbyte extensions with metadata.
|
|
649
|
+
|
|
650
|
+
This can be used for:
|
|
651
|
+
- Validation
|
|
652
|
+
- Documentation generation
|
|
653
|
+
- Runtime introspection
|
|
654
|
+
- Tool development
|
|
655
|
+
"""
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""HTTP abstraction layer for the Airbyte SDK.
|
|
2
|
+
|
|
3
|
+
This package provides a client-agnostic HTTP interface that allows the SDK to work
|
|
4
|
+
with different HTTP client implementations (httpx, aiohttp, etc.) while maintaining
|
|
5
|
+
a consistent API.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .config import ClientConfig, ConnectionLimits, TimeoutConfig
|
|
9
|
+
from .exceptions import (
|
|
10
|
+
AuthenticationError,
|
|
11
|
+
HTTPClientError,
|
|
12
|
+
HTTPStatusError,
|
|
13
|
+
NetworkError,
|
|
14
|
+
RateLimitError,
|
|
15
|
+
TimeoutError,
|
|
16
|
+
)
|
|
17
|
+
from .protocols import HTTPClientProtocol, HTTPResponseProtocol
|
|
18
|
+
from .response import HTTPResponse
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
# Configuration
|
|
22
|
+
"ClientConfig",
|
|
23
|
+
"ConnectionLimits",
|
|
24
|
+
"TimeoutConfig",
|
|
25
|
+
# Protocols
|
|
26
|
+
"HTTPClientProtocol",
|
|
27
|
+
"HTTPResponseProtocol",
|
|
28
|
+
# Response
|
|
29
|
+
"HTTPResponse",
|
|
30
|
+
# Exceptions
|
|
31
|
+
"HTTPClientError",
|
|
32
|
+
"HTTPStatusError",
|
|
33
|
+
"AuthenticationError",
|
|
34
|
+
"RateLimitError",
|
|
35
|
+
"NetworkError",
|
|
36
|
+
"TimeoutError",
|
|
37
|
+
]
|