airbyte-cdk 6.56.2__py3-none-any.whl → 6.56.3.post9.dev15860651667__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.
@@ -4355,6 +4355,7 @@ definitions:
4355
4355
  description: The condition that the specified config value will be evaluated against
4356
4356
  anyOf:
4357
4357
  - "$ref": "#/definitions/ValidateAdheresToSchema"
4358
+ - "$ref": "#/definitions/ValidateInLineCondition"
4358
4359
  PredicateValidator:
4359
4360
  title: Predicate Validator
4360
4361
  description: Validator that applies a validation strategy to a specified value.
@@ -4383,12 +4384,24 @@ definitions:
4383
4384
  - "test-value"
4384
4385
  - "{{ config['api_version'] }}"
4385
4386
  - "{{ config['tenant_id'] }}"
4387
+ - "{{ config['start_date'] < now_utc() }}"
4386
4388
  - 123
4387
4389
  validation_strategy:
4388
4390
  title: Validation Strategy
4389
4391
  description: The validation strategy to apply to the value.
4390
4392
  anyOf:
4391
4393
  - "$ref": "#/definitions/ValidateAdheresToSchema"
4394
+ - "$ref": "#/definitions/ValidateInLineCondition"
4395
+ ValidateInLineCondition:
4396
+ title: Validate In Line Condition
4397
+ description: Validation strategy that evaluates the value as an InterpolatedBoolean.
4398
+ type: object
4399
+ required:
4400
+ - type
4401
+ properties:
4402
+ type:
4403
+ type: string
4404
+ enum: [ValidateInLineCondition]
4392
4405
  ValidateAdheresToSchema:
4393
4406
  title: Validate Adheres To Schema
4394
4407
  description: Validates that a user-provided schema adheres to a specified JSON schema.
@@ -448,8 +448,14 @@ class ConcurrentPerPartitionCursor(Cursor):
448
448
  "Invalid state as stream slices that are emitted should refer to an existing cursor"
449
449
  )
450
450
 
451
+ # if the current record has no cursor value, we cannot meaningfully update the state based on it, so there is nothing more to do
452
+ try:
453
+ record_cursor_value = self._cursor_field.extract_value(record)
454
+ except ValueError:
455
+ return
456
+
451
457
  record_cursor = self._connector_state_converter.output_format(
452
- self._connector_state_converter.parse_value(self._cursor_field.extract_value(record))
458
+ self._connector_state_converter.parse_value(record_cursor_value)
453
459
  )
454
460
  self._update_global_cursor(record_cursor)
455
461
  if not self._use_global_cursor:
@@ -1559,6 +1559,10 @@ class RequestBodyGraphQlQuery(BaseModel):
1559
1559
  query: Dict[str, Any] = Field(..., description="The GraphQL query to be executed")
1560
1560
 
1561
1561
 
1562
+ class ValidateInLineCondition(BaseModel):
1563
+ type: Literal["ValidateInLineCondition"]
1564
+
1565
+
1562
1566
  class ValidateAdheresToSchema(BaseModel):
1563
1567
  type: Literal["ValidateAdheresToSchema"]
1564
1568
  base_schema: Union[str, Dict[str, Any]] = Field(
@@ -2030,7 +2034,7 @@ class DpathValidator(BaseModel):
2030
2034
  ],
2031
2035
  title="Field Path",
2032
2036
  )
2033
- validation_strategy: ValidateAdheresToSchema = Field(
2037
+ validation_strategy: Union[ValidateAdheresToSchema, ValidateInLineCondition] = Field(
2034
2038
  ...,
2035
2039
  description="The condition that the specified config value will be evaluated against",
2036
2040
  title="Validation Strategy",
@@ -2046,11 +2050,12 @@ class PredicateValidator(BaseModel):
2046
2050
  "test-value",
2047
2051
  "{{ config['api_version'] }}",
2048
2052
  "{{ config['tenant_id'] }}",
2053
+ "{{ config['start_date'] < now_utc() }}",
2049
2054
  123,
2050
2055
  ],
2051
2056
  title="Value",
2052
2057
  )
2053
- validation_strategy: ValidateAdheresToSchema = Field(
2058
+ validation_strategy: Union[ValidateAdheresToSchema, ValidateInLineCondition] = Field(
2054
2059
  ...,
2055
2060
  description="The validation strategy to apply to the value.",
2056
2061
  title="Validation Strategy",
@@ -427,6 +427,9 @@ from airbyte_cdk.sources.declarative.models.declarative_component_schema import
427
427
  from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
428
428
  ValidateAdheresToSchema as ValidateAdheresToSchemaModel,
429
429
  )
430
+ from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
431
+ ValidateInLineCondition as ValidateInLineConditionModel,
432
+ )
430
433
  from airbyte_cdk.sources.declarative.models.declarative_component_schema import ValueType
431
434
  from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
432
435
  WaitTimeFromHeader as WaitTimeFromHeaderModel,
@@ -572,6 +575,7 @@ from airbyte_cdk.sources.declarative.validators import (
572
575
  DpathValidator,
573
576
  PredicateValidator,
574
577
  ValidateAdheresToSchema,
578
+ ValidateInLineCondition,
575
579
  )
576
580
  from airbyte_cdk.sources.http_logger import format_http_message
577
581
  from airbyte_cdk.sources.message import (
@@ -738,6 +742,7 @@ class ModelToComponentFactory:
738
742
  SpecModel: self.create_spec,
739
743
  SubstreamPartitionRouterModel: self.create_substream_partition_router,
740
744
  ValidateAdheresToSchemaModel: self.create_validate_adheres_to_schema,
745
+ ValidateInLineConditionModel: self.create_validate_in_line_condition,
741
746
  WaitTimeFromHeaderModel: self.create_wait_time_from_header,
742
747
  WaitUntilTimeFromHeaderModel: self.create_wait_until_time_from_header,
743
748
  AsyncRetrieverModel: self.create_async_retriever,
@@ -900,6 +905,12 @@ class ModelToComponentFactory:
900
905
  schema=base_schema,
901
906
  )
902
907
 
908
+ @staticmethod
909
+ def create_validate_in_line_condition(
910
+ model: ValidateInLineConditionModel, config: Config, **kwargs: Any
911
+ ) -> ValidateInLineCondition:
912
+ return ValidateInLineCondition(config=config)
913
+
903
914
  @staticmethod
904
915
  def create_added_field_definition(
905
916
  model: AddedFieldDefinitionModel, config: Config, **kwargs: Any
@@ -7,6 +7,9 @@ from airbyte_cdk.sources.declarative.validators.predicate_validator import Predi
7
7
  from airbyte_cdk.sources.declarative.validators.validate_adheres_to_schema import (
8
8
  ValidateAdheresToSchema,
9
9
  )
10
+ from airbyte_cdk.sources.declarative.validators.validate_in_line_condition import (
11
+ ValidateInLineCondition,
12
+ )
10
13
  from airbyte_cdk.sources.declarative.validators.validation_strategy import ValidationStrategy
11
14
  from airbyte_cdk.sources.declarative.validators.validator import Validator
12
15
 
@@ -16,4 +19,5 @@ __all__ = [
16
19
  "ValidationStrategy",
17
20
  "ValidateAdheresToSchema",
18
21
  "PredicateValidator",
22
+ "ValidateInLineCondition",
19
23
  ]
@@ -0,0 +1,43 @@
1
+ #
2
+ # Copyright (c) 2025 Airbyte, Inc., all rights reserved.
3
+ #
4
+
5
+ from dataclasses import dataclass
6
+ from typing import Any
7
+
8
+ from jinja2.exceptions import TemplateError
9
+
10
+ from airbyte_cdk.sources.declarative.interpolation.interpolated_boolean import InterpolatedBoolean
11
+ from airbyte_cdk.sources.declarative.validators.validation_strategy import ValidationStrategy
12
+ from airbyte_cdk.sources.types import Config
13
+
14
+
15
+ @dataclass
16
+ class ValidateInLineCondition(ValidationStrategy):
17
+ """
18
+ Validation strategy that evaluates the argument as an InterpolatedBoolean.
19
+ """
20
+
21
+ config: Config
22
+
23
+ def validate(self, value: Any) -> None:
24
+ """
25
+ Validates the argument as an InterpolatedBoolean.
26
+
27
+ :param value: The value to validate
28
+ :raises ValueError: If the condition is not a string or evaluates to False
29
+ """
30
+
31
+ if isinstance(value, str):
32
+ interpolated_condition = InterpolatedBoolean(value, parameters={})
33
+ try:
34
+ result = interpolated_condition.eval(self.config)
35
+ except TemplateError as e:
36
+ raise ValueError(f"Invalid jinja expression: {value}.") from e
37
+ except Exception as e:
38
+ raise ValueError(f"Unexpected error evaluating condition: {value}.") from e
39
+
40
+ if not result:
41
+ raise ValueError(f"Condition evaluated to False: {value}.")
42
+ else:
43
+ raise ValueError(f"Invalid condition argument: {value}. Should be a string.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: airbyte-cdk
3
- Version: 6.56.2
3
+ Version: 6.56.3.post9.dev15860651667
4
4
  Summary: A framework for writing Airbyte Connectors.
5
5
  Home-page: https://airbyte.com
6
6
  License: MIT
@@ -89,7 +89,7 @@ airbyte_cdk/sources/declarative/concurrent_declarative_source.py,sha256=rQz9gXp3
89
89
  airbyte_cdk/sources/declarative/datetime/__init__.py,sha256=4Hw-PX1-VgESLF16cDdvuYCzGJtHntThLF4qIiULWeo,61
90
90
  airbyte_cdk/sources/declarative/datetime/datetime_parser.py,sha256=_zGNGq31RNy_0QBLt_EcTvgPyhj7urPdx6oA3M5-r3o,3150
91
91
  airbyte_cdk/sources/declarative/datetime/min_max_datetime.py,sha256=0BHBtDNQZfvwM45-tY5pNlTcKAFSGGNxemoi0Jic-0E,5785
92
- airbyte_cdk/sources/declarative/declarative_component_schema.yaml,sha256=JwWxM_QAIC7jAOYQMpo9fWa1aULtGhMn9Tg0bntoM58,180321
92
+ airbyte_cdk/sources/declarative/declarative_component_schema.yaml,sha256=n82Jh6U98fYAk6WLa1EYJofH7EjgD7Zmb2pnGpbNm3k,180781
93
93
  airbyte_cdk/sources/declarative/declarative_source.py,sha256=qmyMnnet92eGc3C22yBtpvD5UZjqdhsAafP_zxI5wp8,1814
94
94
  airbyte_cdk/sources/declarative/declarative_stream.py,sha256=dCRlddBUSaJmBNBz1pSO1r2rTw8AP5d2_vlmIeGs2gg,10767
95
95
  airbyte_cdk/sources/declarative/decoders/__init__.py,sha256=JHb_0d3SE6kNY10mxA5YBEKPeSbsWYjByq1gUQxepoE,953
@@ -111,7 +111,7 @@ airbyte_cdk/sources/declarative/extractors/record_selector.py,sha256=vCpwX1PVRFP
111
111
  airbyte_cdk/sources/declarative/extractors/response_to_file_extractor.py,sha256=WJyA2OYIEgFpVP5Y3o0tIj69AV6IKkn9B16MeXaEItI,6513
112
112
  airbyte_cdk/sources/declarative/extractors/type_transformer.py,sha256=d6Y2Rfg8pMVEEnHllfVksWZdNVOU55yk34O03dP9muY,1626
113
113
  airbyte_cdk/sources/declarative/incremental/__init__.py,sha256=U1oZKtBaEC6IACmvziY9Wzg7Z8EgF4ZuR7NwvjlB_Sk,1255
114
- airbyte_cdk/sources/declarative/incremental/concurrent_partition_cursor.py,sha256=araWk039M89c6lQHEUltfM1VI_xGw9gZIDXRWWF6SkM,22591
114
+ airbyte_cdk/sources/declarative/incremental/concurrent_partition_cursor.py,sha256=cmv_nV1G3HMf-YUKtm6Pb2pbisx3R0ZnP_B-8cTnn0I,22842
115
115
  airbyte_cdk/sources/declarative/incremental/datetime_based_cursor.py,sha256=Rbe6lJLTtZ5en33MwZiB9-H9-AwDMNHgwBZs8EqhYqk,22172
116
116
  airbyte_cdk/sources/declarative/incremental/declarative_cursor.py,sha256=5Bhw9VRPyIuCaD0wmmq_L3DZsa-rJgtKSEUzSd8YYD0,536
117
117
  airbyte_cdk/sources/declarative/incremental/global_substream_cursor.py,sha256=2tsE6FgXzemf4fZZ4uGtd8QpRBl9GJ2CRqSNJE5p0EI,16077
@@ -133,14 +133,14 @@ airbyte_cdk/sources/declarative/migrations/legacy_to_per_partition_state_migrati
133
133
  airbyte_cdk/sources/declarative/migrations/state_migration.py,sha256=KWPjealMLKSMtajXgkdGgKg7EmTLR-CqqD7UIh0-eDU,794
134
134
  airbyte_cdk/sources/declarative/models/__init__.py,sha256=nUFxNCiKeYRVXuZEKA7GD-lTHxsiKcQ8FitZjKhPIvE,100
135
135
  airbyte_cdk/sources/declarative/models/base_model_with_deprecations.py,sha256=Imnj3yef0aqRdLfaUxkIYISUb8YkiPrRH_wBd-x8HjM,5999
136
- airbyte_cdk/sources/declarative/models/declarative_component_schema.py,sha256=jipvV9xV_BB4-IGjdUolbY3IoaB0VPubWoCtnr1Ick0,127459
136
+ airbyte_cdk/sources/declarative/models/declarative_component_schema.py,sha256=-eXB2MMtk5YUoXTaKMsfcWjLvE8kdlJG_S389gvHamI,127666
137
137
  airbyte_cdk/sources/declarative/parsers/__init__.py,sha256=ZnqYNxHsKCgO38IwB34RQyRMXTs4GTvlRi3ImKnIioo,61
138
138
  airbyte_cdk/sources/declarative/parsers/custom_code_compiler.py,sha256=nlVvHC511NUyDEEIRBkoeDTAvLqKNp-hRy8D19z8tdk,5941
139
139
  airbyte_cdk/sources/declarative/parsers/custom_exceptions.py,sha256=wnRUP0Xeru9Rbu5OexXSDN9QWDo8YU4tT9M2LDVOgGA,802
140
140
  airbyte_cdk/sources/declarative/parsers/manifest_component_transformer.py,sha256=2UdpCz3yi7ISZTyqkQXSSy3dMxeyOWqV7OlAS5b9GVg,11568
141
141
  airbyte_cdk/sources/declarative/parsers/manifest_normalizer.py,sha256=laBy7ebjA-PiNwc-50U4FHvMqS_mmHvnabxgFs4CjGw,17069
142
142
  airbyte_cdk/sources/declarative/parsers/manifest_reference_resolver.py,sha256=pJmg78vqE5VfUrF_KJnWjucQ4k9IWFULeAxHCowrHXE,6806
143
- airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=Sr8LrlLl61eQTsJ5b8eWt3ESCPDEpJRd6DXS4P53hVE,176635
143
+ airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=zIe-z9WLd97A8iz-z21RFcSoMT4T-xd-7zKyhJbnzd8,177116
144
144
  airbyte_cdk/sources/declarative/partition_routers/__init__.py,sha256=TBC9AkGaUqHm2IKHMPN6punBIcY5tWGULowcLoAVkfw,1109
145
145
  airbyte_cdk/sources/declarative/partition_routers/async_job_partition_router.py,sha256=VelO7zKqKtzMJ35jyFeg0ypJLQC0plqqIBNXoBW1G2E,3001
146
146
  airbyte_cdk/sources/declarative/partition_routers/cartesian_product_stream_slicer.py,sha256=c5cuVFM6NFkuQqG8Z5IwkBuwDrvXZN1CunUOM_L0ezg,6892
@@ -237,10 +237,11 @@ airbyte_cdk/sources/declarative/transformations/keys_to_snake_transformation.py,
237
237
  airbyte_cdk/sources/declarative/transformations/remove_fields.py,sha256=EwUP0SZ2p4GRJ6Q8CUzlz9dcUeEidEFDlI2IBye2tlc,2745
238
238
  airbyte_cdk/sources/declarative/transformations/transformation.py,sha256=4sXtx9cNY2EHUPq-xHvDs8GQEBUy3Eo6TkRLKHPXx68,1161
239
239
  airbyte_cdk/sources/declarative/types.py,sha256=yqx0xlZv_76tkC7fqJKefmvl4GJJ8mXbeddwVV8XRJU,778
240
- airbyte_cdk/sources/declarative/validators/__init__.py,sha256=_xccLn4QKQqR3CAwmCVOA7l6QuJd_Isoh6NsR8crM2U,663
240
+ airbyte_cdk/sources/declarative/validators/__init__.py,sha256=9vpthOMv7BZ7Juic-C4W8l12XPWIm0OPweWMNIA4gbc,809
241
241
  airbyte_cdk/sources/declarative/validators/dpath_validator.py,sha256=MEehshc7YiqUhTNm7qN6mN6JBdkQcYsoLPqAQYIE_-0,2179
242
242
  airbyte_cdk/sources/declarative/validators/predicate_validator.py,sha256=Q4eVnclk1vYPvVF7XROG4MFEVkPYbYKEF8SUKs7P7-k,582
243
243
  airbyte_cdk/sources/declarative/validators/validate_adheres_to_schema.py,sha256=kjcuKxWMJEzpF4GiESITGMxBAXw6YZCAsgOQMgeBo4g,1085
244
+ airbyte_cdk/sources/declarative/validators/validate_in_line_condition.py,sha256=2TExLLDnp2qStLfQRtvteO2EO9doVqPbxjY8wzKSDEA,1488
244
245
  airbyte_cdk/sources/declarative/validators/validation_strategy.py,sha256=LwqUX89cFdHTM1-h6c8vebBA9WC38HYoGBvJfCZHr0g,467
245
246
  airbyte_cdk/sources/declarative/validators/validator.py,sha256=MAwo8OievUsuzBuPxI9pbPu87yq0tJZkGbydcrHZyQc,382
246
247
  airbyte_cdk/sources/declarative/yaml_declarative_source.py,sha256=-pHwGO7ZW-x8lmsqSpbrN0pOgIyjJhFDGUNwB3kQWWc,2794
@@ -423,9 +424,9 @@ airbyte_cdk/utils/slice_hasher.py,sha256=EDxgROHDbfG-QKQb59m7h_7crN1tRiawdf5uU7G
423
424
  airbyte_cdk/utils/spec_schema_transformations.py,sha256=-5HTuNsnDBAhj-oLeQXwpTGA0HdcjFOf2zTEMUTTg_Y,816
424
425
  airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
425
426
  airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
426
- airbyte_cdk-6.56.2.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
427
- airbyte_cdk-6.56.2.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
428
- airbyte_cdk-6.56.2.dist-info/METADATA,sha256=-gFkOwpGpcuhV8yuB1wcNV6rKVZKrvspWWdFKRGJgmk,6392
429
- airbyte_cdk-6.56.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
430
- airbyte_cdk-6.56.2.dist-info/entry_points.txt,sha256=AKWbEkHfpzzk9nF9tqBUaw1MbvTM4mGtEzmZQm0ZWvM,139
431
- airbyte_cdk-6.56.2.dist-info/RECORD,,
427
+ airbyte_cdk-6.56.3.post9.dev15860651667.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
428
+ airbyte_cdk-6.56.3.post9.dev15860651667.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
429
+ airbyte_cdk-6.56.3.post9.dev15860651667.dist-info/METADATA,sha256=TTqDnPoT2r1peY7X3wPWgCp3wZgIUxJVvO3-p0E2Oo4,6413
430
+ airbyte_cdk-6.56.3.post9.dev15860651667.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
431
+ airbyte_cdk-6.56.3.post9.dev15860651667.dist-info/entry_points.txt,sha256=AKWbEkHfpzzk9nF9tqBUaw1MbvTM4mGtEzmZQm0ZWvM,139
432
+ airbyte_cdk-6.56.3.post9.dev15860651667.dist-info/RECORD,,