airbyte-cdk 6.34.1.dev0__py3-none-any.whl → 6.35.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. airbyte_cdk/connector_builder/connector_builder_handler.py +16 -12
  2. airbyte_cdk/connector_builder/test_reader/__init__.py +7 -0
  3. airbyte_cdk/connector_builder/test_reader/helpers.py +591 -0
  4. airbyte_cdk/connector_builder/test_reader/message_grouper.py +160 -0
  5. airbyte_cdk/connector_builder/test_reader/reader.py +441 -0
  6. airbyte_cdk/connector_builder/test_reader/types.py +75 -0
  7. airbyte_cdk/sources/declarative/async_job/job_orchestrator.py +7 -7
  8. airbyte_cdk/sources/declarative/auth/jwt.py +17 -11
  9. airbyte_cdk/sources/declarative/auth/oauth.py +6 -1
  10. airbyte_cdk/sources/declarative/auth/token.py +3 -8
  11. airbyte_cdk/sources/declarative/concurrent_declarative_source.py +30 -79
  12. airbyte_cdk/sources/declarative/declarative_component_schema.yaml +213 -100
  13. airbyte_cdk/sources/declarative/declarative_stream.py +3 -1
  14. airbyte_cdk/sources/declarative/decoders/__init__.py +0 -4
  15. airbyte_cdk/sources/declarative/decoders/composite_raw_decoder.py +18 -3
  16. airbyte_cdk/sources/declarative/decoders/json_decoder.py +12 -58
  17. airbyte_cdk/sources/declarative/extractors/record_selector.py +12 -3
  18. airbyte_cdk/sources/declarative/incremental/concurrent_partition_cursor.py +56 -25
  19. airbyte_cdk/sources/declarative/incremental/datetime_based_cursor.py +12 -6
  20. airbyte_cdk/sources/declarative/incremental/global_substream_cursor.py +6 -2
  21. airbyte_cdk/sources/declarative/interpolation/__init__.py +1 -1
  22. airbyte_cdk/sources/declarative/interpolation/filters.py +2 -1
  23. airbyte_cdk/sources/declarative/interpolation/interpolated_boolean.py +1 -1
  24. airbyte_cdk/sources/declarative/interpolation/interpolated_mapping.py +1 -1
  25. airbyte_cdk/sources/declarative/interpolation/interpolated_nested_mapping.py +1 -1
  26. airbyte_cdk/sources/declarative/interpolation/interpolated_string.py +1 -1
  27. airbyte_cdk/sources/declarative/interpolation/interpolation.py +2 -1
  28. airbyte_cdk/sources/declarative/interpolation/jinja.py +14 -1
  29. airbyte_cdk/sources/declarative/interpolation/macros.py +19 -4
  30. airbyte_cdk/sources/declarative/manifest_declarative_source.py +9 -0
  31. airbyte_cdk/sources/declarative/models/declarative_component_schema.py +150 -41
  32. airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py +234 -84
  33. airbyte_cdk/sources/declarative/partition_routers/async_job_partition_router.py +5 -5
  34. airbyte_cdk/sources/declarative/partition_routers/list_partition_router.py +4 -2
  35. airbyte_cdk/sources/declarative/partition_routers/substream_partition_router.py +26 -18
  36. airbyte_cdk/sources/declarative/requesters/http_requester.py +8 -2
  37. airbyte_cdk/sources/declarative/requesters/paginators/default_paginator.py +16 -5
  38. airbyte_cdk/sources/declarative/requesters/request_option.py +83 -4
  39. airbyte_cdk/sources/declarative/requesters/request_options/datetime_based_request_options_provider.py +7 -6
  40. airbyte_cdk/sources/declarative/requesters/request_options/interpolated_nested_request_input_provider.py +1 -4
  41. airbyte_cdk/sources/declarative/requesters/request_options/interpolated_request_input_provider.py +0 -3
  42. airbyte_cdk/sources/declarative/requesters/request_options/interpolated_request_options_provider.py +2 -47
  43. airbyte_cdk/sources/declarative/retrievers/async_retriever.py +6 -12
  44. airbyte_cdk/sources/declarative/retrievers/simple_retriever.py +4 -3
  45. airbyte_cdk/sources/declarative/transformations/add_fields.py +4 -4
  46. airbyte_cdk/sources/file_based/config/abstract_file_based_spec.py +2 -1
  47. airbyte_cdk/sources/file_based/config/validate_config_transfer_modes.py +81 -0
  48. airbyte_cdk/sources/file_based/file_based_source.py +70 -37
  49. airbyte_cdk/sources/file_based/file_based_stream_reader.py +107 -12
  50. airbyte_cdk/sources/file_based/stream/__init__.py +10 -1
  51. airbyte_cdk/sources/file_based/stream/identities_stream.py +47 -0
  52. airbyte_cdk/sources/file_based/stream/permissions_file_based_stream.py +85 -0
  53. airbyte_cdk/sources/specs/transfer_modes.py +26 -0
  54. airbyte_cdk/sources/streams/call_rate.py +185 -47
  55. airbyte_cdk/sources/streams/http/http.py +1 -2
  56. airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py +217 -56
  57. airbyte_cdk/sources/streams/http/requests_native_auth/oauth.py +144 -73
  58. airbyte_cdk/sources/streams/permissions/identities_stream.py +75 -0
  59. airbyte_cdk/test/mock_http/mocker.py +9 -1
  60. airbyte_cdk/test/mock_http/response.py +6 -3
  61. airbyte_cdk/utils/datetime_helpers.py +48 -66
  62. airbyte_cdk/utils/mapping_helpers.py +126 -26
  63. {airbyte_cdk-6.34.1.dev0.dist-info → airbyte_cdk-6.35.0.dist-info}/METADATA +1 -1
  64. {airbyte_cdk-6.34.1.dev0.dist-info → airbyte_cdk-6.35.0.dist-info}/RECORD +68 -59
  65. airbyte_cdk/connector_builder/message_grouper.py +0 -448
  66. {airbyte_cdk-6.34.1.dev0.dist-info → airbyte_cdk-6.35.0.dist-info}/LICENSE.txt +0 -0
  67. {airbyte_cdk-6.34.1.dev0.dist-info → airbyte_cdk-6.35.0.dist-info}/LICENSE_SHORT +0 -0
  68. {airbyte_cdk-6.34.1.dev0.dist-info → airbyte_cdk-6.35.0.dist-info}/WHEEL +0 -0
  69. {airbyte_cdk-6.34.1.dev0.dist-info → airbyte_cdk-6.35.0.dist-info}/entry_points.txt +0 -0
@@ -642,6 +642,48 @@ class OAuthAuthenticator(BaseModel):
642
642
  parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
643
643
 
644
644
 
645
+ class Rate(BaseModel):
646
+ class Config:
647
+ extra = Extra.allow
648
+
649
+ limit: int = Field(
650
+ ...,
651
+ description="The maximum number of calls allowed within the interval.",
652
+ title="Limit",
653
+ )
654
+ interval: str = Field(
655
+ ...,
656
+ description="The time interval for the rate limit.",
657
+ examples=["PT1H", "P1D"],
658
+ title="Interval",
659
+ )
660
+
661
+
662
+ class HttpRequestRegexMatcher(BaseModel):
663
+ class Config:
664
+ extra = Extra.allow
665
+
666
+ method: Optional[str] = Field(
667
+ None, description="The HTTP method to match (e.g., GET, POST).", title="Method"
668
+ )
669
+ url_base: Optional[str] = Field(
670
+ None,
671
+ description='The base URL (scheme and host, e.g. "https://api.example.com") to match.',
672
+ title="URL Base",
673
+ )
674
+ url_path_pattern: Optional[str] = Field(
675
+ None,
676
+ description="A regular expression pattern to match the URL path.",
677
+ title="URL Path Pattern",
678
+ )
679
+ params: Optional[Dict[str, Any]] = Field(
680
+ None, description="The query parameters to match.", title="Parameters"
681
+ )
682
+ headers: Optional[Dict[str, Any]] = Field(
683
+ None, description="The headers to match.", title="Headers"
684
+ )
685
+
686
+
645
687
  class DpathExtractor(BaseModel):
646
688
  type: Literal["DpathExtractor"]
647
689
  field_path: List[str] = Field(
@@ -887,15 +929,6 @@ class CustomDecoder(BaseModel):
887
929
  parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
888
930
 
889
931
 
890
- class GzipJsonDecoder(BaseModel):
891
- class Config:
892
- extra = Extra.allow
893
-
894
- type: Literal["GzipJsonDecoder"]
895
- encoding: Optional[str] = "utf-8"
896
- parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
897
-
898
-
899
932
  class MinMaxDatetime(BaseModel):
900
933
  type: Literal["MinMaxDatetime"]
901
934
  datetime: str = Field(
@@ -1200,11 +1233,17 @@ class InjectInto(Enum):
1200
1233
 
1201
1234
  class RequestOption(BaseModel):
1202
1235
  type: Literal["RequestOption"]
1203
- field_name: str = Field(
1204
- ...,
1205
- description="Configures which key should be used in the location that the descriptor is being injected into",
1236
+ field_name: Optional[str] = Field(
1237
+ None,
1238
+ description="Configures which key should be used in the location that the descriptor is being injected into. We hope to eventually deprecate this field in favor of `field_path` for all request_options, but must currently maintain it for backwards compatibility in the Builder.",
1206
1239
  examples=["segment_id"],
1207
- title="Request Option",
1240
+ title="Field Name",
1241
+ )
1242
+ field_path: Optional[List[str]] = Field(
1243
+ None,
1244
+ description="Configures a path to be used for nested structures in JSON body requests (e.g. GraphQL queries)",
1245
+ examples=[["data", "viewer", "id"]],
1246
+ title="Field Path",
1208
1247
  )
1209
1248
  inject_into: InjectInto = Field(
1210
1249
  ...,
@@ -1268,18 +1307,8 @@ class LegacySessionTokenAuthenticator(BaseModel):
1268
1307
  parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
1269
1308
 
1270
1309
 
1271
- class JsonParser(BaseModel):
1272
- type: Literal["JsonParser"]
1273
- encoding: Optional[str] = "utf-8"
1274
-
1275
-
1276
- class JsonLineParser(BaseModel):
1277
- type: Literal["JsonLineParser"]
1278
- encoding: Optional[str] = "utf-8"
1279
-
1280
-
1281
- class CsvParser(BaseModel):
1282
- type: Literal["CsvParser"]
1310
+ class CsvDecoder(BaseModel):
1311
+ type: Literal["CsvDecoder"]
1283
1312
  encoding: Optional[str] = "utf-8"
1284
1313
  delimiter: Optional[str] = ","
1285
1314
 
@@ -1578,6 +1607,55 @@ class DatetimeBasedCursor(BaseModel):
1578
1607
  parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
1579
1608
 
1580
1609
 
1610
+ class FixedWindowCallRatePolicy(BaseModel):
1611
+ class Config:
1612
+ extra = Extra.allow
1613
+
1614
+ type: Literal["FixedWindowCallRatePolicy"]
1615
+ period: str = Field(
1616
+ ..., description="The time interval for the rate limit window.", title="Period"
1617
+ )
1618
+ call_limit: int = Field(
1619
+ ...,
1620
+ description="The maximum number of calls allowed within the period.",
1621
+ title="Call Limit",
1622
+ )
1623
+ matchers: List[HttpRequestRegexMatcher] = Field(
1624
+ ...,
1625
+ description="List of matchers that define which requests this policy applies to.",
1626
+ title="Matchers",
1627
+ )
1628
+
1629
+
1630
+ class MovingWindowCallRatePolicy(BaseModel):
1631
+ class Config:
1632
+ extra = Extra.allow
1633
+
1634
+ type: Literal["MovingWindowCallRatePolicy"]
1635
+ rates: List[Rate] = Field(
1636
+ ...,
1637
+ description="List of rates that define the call limits for different time intervals.",
1638
+ title="Rates",
1639
+ )
1640
+ matchers: List[HttpRequestRegexMatcher] = Field(
1641
+ ...,
1642
+ description="List of matchers that define which requests this policy applies to.",
1643
+ title="Matchers",
1644
+ )
1645
+
1646
+
1647
+ class UnlimitedCallRatePolicy(BaseModel):
1648
+ class Config:
1649
+ extra = Extra.allow
1650
+
1651
+ type: Literal["UnlimitedCallRatePolicy"]
1652
+ matchers: List[HttpRequestRegexMatcher] = Field(
1653
+ ...,
1654
+ description="List of matchers that define which requests this policy applies to.",
1655
+ title="Matchers",
1656
+ )
1657
+
1658
+
1581
1659
  class DefaultErrorHandler(BaseModel):
1582
1660
  type: Literal["DefaultErrorHandler"]
1583
1661
  backoff_strategies: Optional[
@@ -1674,9 +1752,9 @@ class RecordSelector(BaseModel):
1674
1752
  parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
1675
1753
 
1676
1754
 
1677
- class GzipParser(BaseModel):
1678
- type: Literal["GzipParser"]
1679
- inner_parser: Union[JsonLineParser, CsvParser, JsonParser]
1755
+ class GzipDecoder(BaseModel):
1756
+ type: Literal["GzipDecoder"]
1757
+ decoder: Union[CsvDecoder, GzipDecoder, JsonDecoder, JsonlDecoder]
1680
1758
 
1681
1759
 
1682
1760
  class Spec(BaseModel):
@@ -1709,23 +1787,51 @@ class CompositeErrorHandler(BaseModel):
1709
1787
  parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
1710
1788
 
1711
1789
 
1790
+ class HTTPAPIBudget(BaseModel):
1791
+ class Config:
1792
+ extra = Extra.allow
1793
+
1794
+ type: Literal["HTTPAPIBudget"]
1795
+ policies: List[
1796
+ Union[
1797
+ FixedWindowCallRatePolicy,
1798
+ MovingWindowCallRatePolicy,
1799
+ UnlimitedCallRatePolicy,
1800
+ ]
1801
+ ] = Field(
1802
+ ...,
1803
+ description="List of call rate policies that define how many calls are allowed.",
1804
+ title="Policies",
1805
+ )
1806
+ ratelimit_reset_header: Optional[str] = Field(
1807
+ "ratelimit-reset",
1808
+ description="The HTTP response header name that indicates when the rate limit resets.",
1809
+ title="Rate Limit Reset Header",
1810
+ )
1811
+ ratelimit_remaining_header: Optional[str] = Field(
1812
+ "ratelimit-remaining",
1813
+ description="The HTTP response header name that indicates the number of remaining allowed calls.",
1814
+ title="Rate Limit Remaining Header",
1815
+ )
1816
+ status_codes_for_ratelimit_hit: Optional[List[int]] = Field(
1817
+ [429],
1818
+ description="List of HTTP status codes that indicate a rate limit has been hit.",
1819
+ title="Status Codes for Rate Limit Hit",
1820
+ )
1821
+
1822
+
1712
1823
  class ZipfileDecoder(BaseModel):
1713
1824
  class Config:
1714
1825
  extra = Extra.allow
1715
1826
 
1716
1827
  type: Literal["ZipfileDecoder"]
1717
- parser: Union[GzipParser, JsonParser, JsonLineParser, CsvParser] = Field(
1828
+ decoder: Union[CsvDecoder, GzipDecoder, JsonDecoder, JsonlDecoder] = Field(
1718
1829
  ...,
1719
1830
  description="Parser to parse the decompressed data from the zipfile(s).",
1720
1831
  title="Parser",
1721
1832
  )
1722
1833
 
1723
1834
 
1724
- class CompositeRawDecoder(BaseModel):
1725
- type: Literal["CompositeRawDecoder"]
1726
- parser: Union[GzipParser, JsonParser, JsonLineParser, CsvParser]
1727
-
1728
-
1729
1835
  class DeclarativeSource1(BaseModel):
1730
1836
  class Config:
1731
1837
  extra = Extra.forbid
@@ -1742,6 +1848,7 @@ class DeclarativeSource1(BaseModel):
1742
1848
  definitions: Optional[Dict[str, Any]] = None
1743
1849
  spec: Optional[Spec] = None
1744
1850
  concurrency_level: Optional[ConcurrencyLevel] = None
1851
+ api_budget: Optional[HTTPAPIBudget] = None
1745
1852
  metadata: Optional[Dict[str, Any]] = Field(
1746
1853
  None,
1747
1854
  description="For internal Airbyte use only - DO NOT modify manually. Used by consumers of declarative manifests for storing related metadata.",
@@ -1768,6 +1875,7 @@ class DeclarativeSource2(BaseModel):
1768
1875
  definitions: Optional[Dict[str, Any]] = None
1769
1876
  spec: Optional[Spec] = None
1770
1877
  concurrency_level: Optional[ConcurrencyLevel] = None
1878
+ api_budget: Optional[HTTPAPIBudget] = None
1771
1879
  metadata: Optional[Dict[str, Any]] = Field(
1772
1880
  None,
1773
1881
  description="For internal Airbyte use only - DO NOT modify manually. Used by consumers of declarative manifests for storing related metadata.",
@@ -1927,7 +2035,7 @@ class SessionTokenAuthenticator(BaseModel):
1927
2035
  description="Authentication method to use for requests sent to the API, specifying how to inject the session token.",
1928
2036
  title="Data Request Authentication",
1929
2037
  )
1930
- decoder: Optional[Union[JsonDecoder, XmlDecoder, CompositeRawDecoder]] = Field(
2038
+ decoder: Optional[Union[JsonDecoder, XmlDecoder]] = Field(
1931
2039
  None, description="Component used to decode the response.", title="Decoder"
1932
2040
  )
1933
2041
  parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
@@ -2127,12 +2235,12 @@ class SimpleRetriever(BaseModel):
2127
2235
  decoder: Optional[
2128
2236
  Union[
2129
2237
  CustomDecoder,
2238
+ CsvDecoder,
2239
+ GzipDecoder,
2130
2240
  JsonDecoder,
2131
2241
  JsonlDecoder,
2132
2242
  IterableDecoder,
2133
2243
  XmlDecoder,
2134
- GzipJsonDecoder,
2135
- CompositeRawDecoder,
2136
2244
  ZipfileDecoder,
2137
2245
  ]
2138
2246
  ] = Field(
@@ -2205,12 +2313,12 @@ class AsyncRetriever(BaseModel):
2205
2313
  decoder: Optional[
2206
2314
  Union[
2207
2315
  CustomDecoder,
2316
+ CsvDecoder,
2317
+ GzipDecoder,
2208
2318
  JsonDecoder,
2209
2319
  JsonlDecoder,
2210
2320
  IterableDecoder,
2211
2321
  XmlDecoder,
2212
- GzipJsonDecoder,
2213
- CompositeRawDecoder,
2214
2322
  ZipfileDecoder,
2215
2323
  ]
2216
2324
  ] = Field(
@@ -2221,12 +2329,12 @@ class AsyncRetriever(BaseModel):
2221
2329
  download_decoder: Optional[
2222
2330
  Union[
2223
2331
  CustomDecoder,
2332
+ CsvDecoder,
2333
+ GzipDecoder,
2224
2334
  JsonDecoder,
2225
2335
  JsonlDecoder,
2226
2336
  IterableDecoder,
2227
2337
  XmlDecoder,
2228
- GzipJsonDecoder,
2229
- CompositeRawDecoder,
2230
2338
  ZipfileDecoder,
2231
2339
  ]
2232
2340
  ] = Field(
@@ -2271,6 +2379,7 @@ class DynamicDeclarativeStream(BaseModel):
2271
2379
 
2272
2380
 
2273
2381
  ComplexFieldType.update_forward_refs()
2382
+ GzipDecoder.update_forward_refs()
2274
2383
  CompositeErrorHandler.update_forward_refs()
2275
2384
  DeclarativeSource1.update_forward_refs()
2276
2385
  DeclarativeSource2.update_forward_refs()