airbyte-cdk 6.45.0.dev4107__py3-none-any.whl → 6.45.0.post20.dev14369762306__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.
- airbyte_cdk/connector_builder/connector_builder_handler.py +45 -6
- airbyte_cdk/connector_builder/main.py +5 -2
- airbyte_cdk/models/__init__.py +0 -1
- airbyte_cdk/models/airbyte_protocol.py +3 -1
- airbyte_cdk/models/file_transfer_record_message.py +13 -0
- airbyte_cdk/sources/concurrent_source/concurrent_read_processor.py +1 -1
- airbyte_cdk/sources/declarative/async_job/job.py +6 -0
- airbyte_cdk/sources/declarative/async_job/job_orchestrator.py +18 -18
- airbyte_cdk/sources/declarative/async_job/job_tracker.py +22 -6
- airbyte_cdk/sources/declarative/checks/__init__.py +5 -2
- airbyte_cdk/sources/declarative/checks/check_stream.py +113 -11
- airbyte_cdk/sources/declarative/concurrent_declarative_source.py +0 -8
- airbyte_cdk/sources/declarative/declarative_component_schema.yaml +210 -50
- airbyte_cdk/sources/declarative/extractors/record_selector.py +1 -6
- airbyte_cdk/sources/declarative/incremental/concurrent_partition_cursor.py +2 -1
- airbyte_cdk/sources/declarative/interpolation/macros.py +10 -4
- airbyte_cdk/sources/declarative/manifest_declarative_source.py +23 -2
- airbyte_cdk/sources/declarative/models/declarative_component_schema.py +142 -43
- airbyte_cdk/sources/declarative/parsers/manifest_component_transformer.py +16 -4
- airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py +263 -50
- airbyte_cdk/sources/declarative/partition_routers/__init__.py +4 -0
- airbyte_cdk/sources/declarative/partition_routers/grouping_partition_router.py +150 -0
- airbyte_cdk/sources/declarative/partition_routers/substream_partition_router.py +5 -1
- airbyte_cdk/sources/declarative/requesters/query_properties/__init__.py +13 -0
- airbyte_cdk/sources/declarative/requesters/query_properties/properties_from_endpoint.py +40 -0
- airbyte_cdk/sources/declarative/requesters/query_properties/property_chunking.py +69 -0
- airbyte_cdk/sources/declarative/requesters/query_properties/query_properties.py +58 -0
- airbyte_cdk/sources/declarative/requesters/query_properties/strategies/__init__.py +10 -0
- airbyte_cdk/sources/declarative/requesters/query_properties/strategies/group_by_key.py +33 -0
- airbyte_cdk/sources/declarative/requesters/query_properties/strategies/merge_strategy.py +19 -0
- airbyte_cdk/sources/declarative/requesters/request_options/interpolated_request_options_provider.py +25 -2
- airbyte_cdk/sources/declarative/retrievers/simple_retriever.py +101 -30
- airbyte_cdk/sources/declarative/schema/default_schema_loader.py +1 -1
- airbyte_cdk/sources/declarative/stream_slicers/declarative_partition_generator.py +4 -9
- airbyte_cdk/sources/declarative/transformations/add_fields.py +3 -1
- airbyte_cdk/sources/file_based/file_based_stream_reader.py +15 -38
- airbyte_cdk/sources/file_based/file_types/file_transfer.py +15 -8
- airbyte_cdk/sources/file_based/schema_helpers.py +1 -9
- airbyte_cdk/sources/file_based/stream/concurrent/adapters.py +12 -3
- airbyte_cdk/sources/file_based/stream/default_file_based_stream.py +31 -16
- airbyte_cdk/sources/file_based/stream/permissions_file_based_stream.py +3 -1
- airbyte_cdk/sources/streams/concurrent/default_stream.py +0 -3
- airbyte_cdk/sources/streams/concurrent/state_converters/abstract_stream_state_converter.py +4 -0
- airbyte_cdk/sources/types.py +2 -11
- airbyte_cdk/sources/utils/record_helper.py +8 -8
- airbyte_cdk/test/declarative/__init__.py +6 -0
- airbyte_cdk/test/declarative/models/__init__.py +7 -0
- airbyte_cdk/test/declarative/models/scenario.py +74 -0
- airbyte_cdk/test/declarative/test_suites/__init__.py +24 -0
- airbyte_cdk/test/declarative/test_suites/connector_base.py +197 -0
- airbyte_cdk/test/declarative/test_suites/declarative_sources.py +47 -0
- airbyte_cdk/test/declarative/test_suites/destination_base.py +12 -0
- airbyte_cdk/test/declarative/test_suites/source_base.py +129 -0
- airbyte_cdk/test/declarative/utils/__init__.py +0 -0
- airbyte_cdk/test/declarative/utils/job_runner.py +128 -0
- airbyte_cdk/test/entrypoint_wrapper.py +4 -0
- airbyte_cdk/test/fixtures/__init__.py +0 -0
- airbyte_cdk/test/fixtures/auto.py +14 -0
- airbyte_cdk/test/fixtures/general.py +15 -0
- airbyte_cdk/test/mock_http/response_builder.py +0 -8
- airbyte_cdk/test/pytest_config/plugin.py +40 -0
- {airbyte_cdk-6.45.0.dev4107.dist-info → airbyte_cdk-6.45.0.post20.dev14369762306.dist-info}/METADATA +2 -2
- {airbyte_cdk-6.45.0.dev4107.dist-info → airbyte_cdk-6.45.0.post20.dev14369762306.dist-info}/RECORD +67 -47
- airbyte_cdk/sources/declarative/retrievers/file_uploader.py +0 -89
- airbyte_cdk/sources/file_based/file_record_data.py +0 -22
- airbyte_cdk/sources/utils/files_directory.py +0 -15
- {airbyte_cdk-6.45.0.dev4107.dist-info → airbyte_cdk-6.45.0.post20.dev14369762306.dist-info}/LICENSE.txt +0 -0
- {airbyte_cdk-6.45.0.dev4107.dist-info → airbyte_cdk-6.45.0.post20.dev14369762306.dist-info}/LICENSE_SHORT +0 -0
- {airbyte_cdk-6.45.0.dev4107.dist-info → airbyte_cdk-6.45.0.post20.dev14369762306.dist-info}/WHEEL +0 -0
- {airbyte_cdk-6.45.0.dev4107.dist-info → airbyte_cdk-6.45.0.post20.dev14369762306.dist-info}/entry_points.txt +0 -0
@@ -1,3 +1,5 @@
|
|
1
|
+
# Copyright (c) 2025 Airbyte, Inc., all rights reserved.
|
2
|
+
|
1
3
|
# generated by datamodel-codegen:
|
2
4
|
# filename: declarative_component_schema.yaml
|
3
5
|
|
@@ -42,13 +44,15 @@ class BearerAuthenticator(BaseModel):
|
|
42
44
|
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
43
45
|
|
44
46
|
|
45
|
-
class
|
46
|
-
type: Literal["
|
47
|
-
|
48
|
-
...,
|
49
|
-
|
50
|
-
|
51
|
-
|
47
|
+
class DynamicStreamCheckConfig(BaseModel):
|
48
|
+
type: Literal["DynamicStreamCheckConfig"]
|
49
|
+
dynamic_stream_name: str = Field(
|
50
|
+
..., description="The dynamic stream name.", title="Dynamic Stream Name"
|
51
|
+
)
|
52
|
+
stream_count: Optional[int] = Field(
|
53
|
+
0,
|
54
|
+
description="The number of streams to attempt reading from during a check operation. If `stream_count` exceeds the total number of available streams, the minimum of the two values will be used.",
|
55
|
+
title="Stream Count",
|
52
56
|
)
|
53
57
|
|
54
58
|
|
@@ -716,6 +720,17 @@ class ExponentialBackoffStrategy(BaseModel):
|
|
716
720
|
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
717
721
|
|
718
722
|
|
723
|
+
class GroupByKeyMergeStrategy(BaseModel):
|
724
|
+
type: Literal["GroupByKeyMergeStrategy"]
|
725
|
+
key: Union[str, List[str]] = Field(
|
726
|
+
...,
|
727
|
+
description="The name of the field on the record whose value will be used to group properties that were retrieved through multiple API requests.",
|
728
|
+
examples=["id", ["parent_id", "end_date"]],
|
729
|
+
title="Key",
|
730
|
+
)
|
731
|
+
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
732
|
+
|
733
|
+
|
719
734
|
class SessionTokenRequestBearerAuthenticator(BaseModel):
|
720
735
|
type: Literal["Bearer"]
|
721
736
|
|
@@ -1187,6 +1202,31 @@ class PrimaryKey(BaseModel):
|
|
1187
1202
|
)
|
1188
1203
|
|
1189
1204
|
|
1205
|
+
class PropertyLimitType(Enum):
|
1206
|
+
characters = "characters"
|
1207
|
+
property_count = "property_count"
|
1208
|
+
|
1209
|
+
|
1210
|
+
class PropertyChunking(BaseModel):
|
1211
|
+
type: Literal["PropertyChunking"]
|
1212
|
+
property_limit_type: PropertyLimitType = Field(
|
1213
|
+
...,
|
1214
|
+
description="The type used to determine the maximum number of properties per chunk",
|
1215
|
+
title="Property Limit Type",
|
1216
|
+
)
|
1217
|
+
property_limit: Optional[int] = Field(
|
1218
|
+
None,
|
1219
|
+
description="The maximum amount of properties that can be retrieved per request according to the limit type.",
|
1220
|
+
title="Property Limit",
|
1221
|
+
)
|
1222
|
+
record_merge_strategy: Optional[GroupByKeyMergeStrategy] = Field(
|
1223
|
+
None,
|
1224
|
+
description="Dictates how to records that require multiple requests to get all properties should be emitted to the destination",
|
1225
|
+
title="Record Merge Strategy",
|
1226
|
+
)
|
1227
|
+
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
1228
|
+
|
1229
|
+
|
1190
1230
|
class RecordFilter(BaseModel):
|
1191
1231
|
type: Literal["RecordFilter"]
|
1192
1232
|
condition: Optional[str] = Field(
|
@@ -1523,6 +1563,17 @@ class AuthFlow(BaseModel):
|
|
1523
1563
|
oauth_config_specification: Optional[OAuthConfigSpecification] = None
|
1524
1564
|
|
1525
1565
|
|
1566
|
+
class CheckStream(BaseModel):
|
1567
|
+
type: Literal["CheckStream"]
|
1568
|
+
stream_names: Optional[List[str]] = Field(
|
1569
|
+
None,
|
1570
|
+
description="Names of the streams to try reading from when running a check operation.",
|
1571
|
+
examples=[["users"], ["users", "contacts"]],
|
1572
|
+
title="Stream Names",
|
1573
|
+
)
|
1574
|
+
dynamic_streams_check_configs: Optional[List[DynamicStreamCheckConfig]] = None
|
1575
|
+
|
1576
|
+
|
1526
1577
|
class IncrementingCountCursor(BaseModel):
|
1527
1578
|
type: Literal["IncrementingCountCursor"]
|
1528
1579
|
cursor_field: str = Field(
|
@@ -1890,9 +1941,10 @@ class DeclarativeSource1(BaseModel):
|
|
1890
1941
|
spec: Optional[Spec] = None
|
1891
1942
|
concurrency_level: Optional[ConcurrencyLevel] = None
|
1892
1943
|
api_budget: Optional[HTTPAPIBudget] = None
|
1893
|
-
max_concurrent_async_job_count: Optional[int] = Field(
|
1944
|
+
max_concurrent_async_job_count: Optional[Union[int, str]] = Field(
|
1894
1945
|
None,
|
1895
1946
|
description="Maximum number of concurrent asynchronous jobs to run. This property is only relevant for sources/streams that support asynchronous job execution through the AsyncRetriever (e.g. a report-based stream that initiates a job, polls the job status, and then fetches the job results). This is often set by the API's maximum number of concurrent jobs on the account level. Refer to the API's documentation for this information.",
|
1947
|
+
examples=[3, "{{ config['max_concurrent_async_job_count'] }}"],
|
1896
1948
|
title="Maximum Concurrent Asynchronous Jobs",
|
1897
1949
|
)
|
1898
1950
|
metadata: Optional[Dict[str, Any]] = Field(
|
@@ -1922,9 +1974,10 @@ class DeclarativeSource2(BaseModel):
|
|
1922
1974
|
spec: Optional[Spec] = None
|
1923
1975
|
concurrency_level: Optional[ConcurrencyLevel] = None
|
1924
1976
|
api_budget: Optional[HTTPAPIBudget] = None
|
1925
|
-
max_concurrent_async_job_count: Optional[int] = Field(
|
1977
|
+
max_concurrent_async_job_count: Optional[Union[int, str]] = Field(
|
1926
1978
|
None,
|
1927
1979
|
description="Maximum number of concurrent asynchronous jobs to run. This property is only relevant for sources/streams that support asynchronous job execution through the AsyncRetriever (e.g. a report-based stream that initiates a job, polls the job status, and then fetches the job results). This is often set by the API's maximum number of concurrent jobs on the account level. Refer to the API's documentation for this information.",
|
1980
|
+
examples=[3, "{{ config['max_concurrent_async_job_count'] }}"],
|
1928
1981
|
title="Maximum Concurrent Asynchronous Jobs",
|
1929
1982
|
)
|
1930
1983
|
metadata: Optional[Dict[str, Any]] = Field(
|
@@ -1989,31 +2042,6 @@ class SelectiveAuthenticator(BaseModel):
|
|
1989
2042
|
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
1990
2043
|
|
1991
2044
|
|
1992
|
-
class FileUploader(BaseModel):
|
1993
|
-
type: Literal["FileUploader"]
|
1994
|
-
requester: Union[CustomRequester, HttpRequester] = Field(
|
1995
|
-
...,
|
1996
|
-
description="Requester component that describes how to prepare HTTP requests to send to the source API.",
|
1997
|
-
)
|
1998
|
-
download_target_extractor: Union[CustomRecordExtractor, DpathExtractor] = Field(
|
1999
|
-
...,
|
2000
|
-
description="Responsible for fetching the url where the file is located. This is applied on each records and not on the HTTP response",
|
2001
|
-
)
|
2002
|
-
file_extractor: Optional[Union[CustomRecordExtractor, DpathExtractor]] = Field(
|
2003
|
-
None,
|
2004
|
-
description="Responsible for fetching the content of the file. If not defined, the assumption is that the whole response body is the file content",
|
2005
|
-
)
|
2006
|
-
filename_extractor: Optional[str] = Field(
|
2007
|
-
None,
|
2008
|
-
description="Defines the name to store the file. Stream name is automatically added to the file path. File unique ID can be used to avoid overwriting files. Random UUID will be used if the extractor is not provided.",
|
2009
|
-
examples=[
|
2010
|
-
"{{ record.id }}/{{ record.file_name }}/",
|
2011
|
-
"{{ record.id }}_{{ record.file_name }}/",
|
2012
|
-
],
|
2013
|
-
)
|
2014
|
-
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
2015
|
-
|
2016
|
-
|
2017
2045
|
class DeclarativeStream(BaseModel):
|
2018
2046
|
class Config:
|
2019
2047
|
extra = Extra.allow
|
@@ -2072,11 +2100,6 @@ class DeclarativeStream(BaseModel):
|
|
2072
2100
|
description="Array of state migrations to be applied on the input state",
|
2073
2101
|
title="State Migrations",
|
2074
2102
|
)
|
2075
|
-
file_uploader: Optional[FileUploader] = Field(
|
2076
|
-
None,
|
2077
|
-
description="(experimental) Describes how to fetch a file",
|
2078
|
-
title="File Uploader",
|
2079
|
-
)
|
2080
2103
|
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
2081
2104
|
|
2082
2105
|
|
@@ -2202,7 +2225,7 @@ class HttpRequester(BaseModel):
|
|
2202
2225
|
examples=[{"Output-Format": "JSON"}, {"Version": "{{ config['version'] }}"}],
|
2203
2226
|
title="Request Headers",
|
2204
2227
|
)
|
2205
|
-
request_parameters: Optional[Union[str, Dict[str, str]]] = Field(
|
2228
|
+
request_parameters: Optional[Union[str, Dict[str, Union[str, Any]]]] = Field(
|
2206
2229
|
None,
|
2207
2230
|
description="Specifies the query parameters that should be set on an outgoing HTTP request given the inputs.",
|
2208
2231
|
examples=[
|
@@ -2292,6 +2315,40 @@ class ParentStreamConfig(BaseModel):
|
|
2292
2315
|
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
2293
2316
|
|
2294
2317
|
|
2318
|
+
class PropertiesFromEndpoint(BaseModel):
|
2319
|
+
type: Literal["PropertiesFromEndpoint"]
|
2320
|
+
property_field_path: List[str] = Field(
|
2321
|
+
...,
|
2322
|
+
description="Describes the path to the field that should be extracted",
|
2323
|
+
examples=[["name"]],
|
2324
|
+
)
|
2325
|
+
retriever: Union[CustomRetriever, SimpleRetriever] = Field(
|
2326
|
+
...,
|
2327
|
+
description="Requester component that describes how to fetch the properties to query from a remote API endpoint.",
|
2328
|
+
)
|
2329
|
+
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
2330
|
+
|
2331
|
+
|
2332
|
+
class QueryProperties(BaseModel):
|
2333
|
+
type: Literal["QueryProperties"]
|
2334
|
+
property_list: Union[List[str], PropertiesFromEndpoint] = Field(
|
2335
|
+
...,
|
2336
|
+
description="The set of properties that will be queried for in the outbound request. This can either be statically defined or dynamic based on an API endpoint",
|
2337
|
+
title="Property List",
|
2338
|
+
)
|
2339
|
+
always_include_properties: Optional[List[str]] = Field(
|
2340
|
+
None,
|
2341
|
+
description="The list of properties that should be included in every set of properties when multiple chunks of properties are being requested.",
|
2342
|
+
title="Always Include Properties",
|
2343
|
+
)
|
2344
|
+
property_chunking: Optional[PropertyChunking] = Field(
|
2345
|
+
None,
|
2346
|
+
description="Defines how query properties will be grouped into smaller sets for APIs with limitations on the number of properties fetched per API request.",
|
2347
|
+
title="Property Chunking",
|
2348
|
+
)
|
2349
|
+
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
2350
|
+
|
2351
|
+
|
2295
2352
|
class StateDelegatingStream(BaseModel):
|
2296
2353
|
type: Literal["StateDelegatingStream"]
|
2297
2354
|
name: str = Field(..., description="The stream name.", example=["Users"], title="Name")
|
@@ -2331,7 +2388,15 @@ class SimpleRetriever(BaseModel):
|
|
2331
2388
|
CustomPartitionRouter,
|
2332
2389
|
ListPartitionRouter,
|
2333
2390
|
SubstreamPartitionRouter,
|
2334
|
-
|
2391
|
+
GroupingPartitionRouter,
|
2392
|
+
List[
|
2393
|
+
Union[
|
2394
|
+
CustomPartitionRouter,
|
2395
|
+
ListPartitionRouter,
|
2396
|
+
SubstreamPartitionRouter,
|
2397
|
+
GroupingPartitionRouter,
|
2398
|
+
]
|
2399
|
+
],
|
2335
2400
|
]
|
2336
2401
|
] = Field(
|
2337
2402
|
[],
|
@@ -2413,7 +2478,15 @@ class AsyncRetriever(BaseModel):
|
|
2413
2478
|
CustomPartitionRouter,
|
2414
2479
|
ListPartitionRouter,
|
2415
2480
|
SubstreamPartitionRouter,
|
2416
|
-
|
2481
|
+
GroupingPartitionRouter,
|
2482
|
+
List[
|
2483
|
+
Union[
|
2484
|
+
CustomPartitionRouter,
|
2485
|
+
ListPartitionRouter,
|
2486
|
+
SubstreamPartitionRouter,
|
2487
|
+
GroupingPartitionRouter,
|
2488
|
+
]
|
2489
|
+
],
|
2417
2490
|
]
|
2418
2491
|
] = Field(
|
2419
2492
|
[],
|
@@ -2465,6 +2538,29 @@ class SubstreamPartitionRouter(BaseModel):
|
|
2465
2538
|
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
2466
2539
|
|
2467
2540
|
|
2541
|
+
class GroupingPartitionRouter(BaseModel):
|
2542
|
+
type: Literal["GroupingPartitionRouter"]
|
2543
|
+
group_size: int = Field(
|
2544
|
+
...,
|
2545
|
+
description="The number of partitions to include in each group. This determines how many partition values are batched together in a single slice.",
|
2546
|
+
examples=[10, 50],
|
2547
|
+
title="Group Size",
|
2548
|
+
)
|
2549
|
+
underlying_partition_router: Union[
|
2550
|
+
CustomPartitionRouter, ListPartitionRouter, SubstreamPartitionRouter
|
2551
|
+
] = Field(
|
2552
|
+
...,
|
2553
|
+
description="The partition router whose output will be grouped. This can be any valid partition router component.",
|
2554
|
+
title="Underlying Partition Router",
|
2555
|
+
)
|
2556
|
+
deduplicate: Optional[bool] = Field(
|
2557
|
+
True,
|
2558
|
+
description="If true, ensures that partitions are unique within each group by removing duplicates based on the partition key.",
|
2559
|
+
title="Deduplicate Partitions",
|
2560
|
+
)
|
2561
|
+
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
2562
|
+
|
2563
|
+
|
2468
2564
|
class HttpComponentsResolver(BaseModel):
|
2469
2565
|
type: Literal["HttpComponentsResolver"]
|
2470
2566
|
retriever: Union[AsyncRetriever, CustomRetriever, SimpleRetriever] = Field(
|
@@ -2478,6 +2574,9 @@ class HttpComponentsResolver(BaseModel):
|
|
2478
2574
|
|
2479
2575
|
class DynamicDeclarativeStream(BaseModel):
|
2480
2576
|
type: Literal["DynamicDeclarativeStream"]
|
2577
|
+
name: Optional[str] = Field(
|
2578
|
+
"", description="The dynamic stream name.", example=["Tables"], title="Name"
|
2579
|
+
)
|
2481
2580
|
stream_template: DeclarativeStream = Field(
|
2482
2581
|
..., description="Reference to the stream template.", title="Stream Template"
|
2483
2582
|
)
|
@@ -2494,10 +2593,10 @@ CompositeErrorHandler.update_forward_refs()
|
|
2494
2593
|
DeclarativeSource1.update_forward_refs()
|
2495
2594
|
DeclarativeSource2.update_forward_refs()
|
2496
2595
|
SelectiveAuthenticator.update_forward_refs()
|
2497
|
-
FileUploader.update_forward_refs()
|
2498
2596
|
DeclarativeStream.update_forward_refs()
|
2499
2597
|
SessionTokenAuthenticator.update_forward_refs()
|
2500
2598
|
DynamicSchemaLoader.update_forward_refs()
|
2501
2599
|
ParentStreamConfig.update_forward_refs()
|
2600
|
+
PropertiesFromEndpoint.update_forward_refs()
|
2502
2601
|
SimpleRetriever.update_forward_refs()
|
2503
2602
|
AsyncRetriever.update_forward_refs()
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
import copy
|
6
6
|
import typing
|
7
|
-
from typing import Any, Mapping
|
7
|
+
from typing import Any, Mapping, Optional
|
8
8
|
|
9
9
|
PARAMETERS_STR = "$parameters"
|
10
10
|
|
@@ -94,6 +94,7 @@ class ManifestComponentTransformer:
|
|
94
94
|
parent_field_identifier: str,
|
95
95
|
declarative_component: Mapping[str, Any],
|
96
96
|
parent_parameters: Mapping[str, Any],
|
97
|
+
use_parent_parameters: Optional[bool] = None,
|
97
98
|
) -> Mapping[str, Any]:
|
98
99
|
"""
|
99
100
|
Recursively transforms the specified declarative component and subcomponents to propagate parameters and insert the
|
@@ -103,6 +104,7 @@ class ManifestComponentTransformer:
|
|
103
104
|
:param declarative_component: The current component that is having type and parameters added
|
104
105
|
:param parent_field_identifier: The name of the field of the current component coming from the parent component
|
105
106
|
:param parent_parameters: The parameters set on parent components defined before the current component
|
107
|
+
:param use_parent_parameters: If set, parent parameters will be used as the source of truth when key names are the same
|
106
108
|
:return: A deep copy of the transformed component with types and parameters persisted to it
|
107
109
|
"""
|
108
110
|
propagated_component = dict(copy.deepcopy(declarative_component))
|
@@ -130,7 +132,11 @@ class ManifestComponentTransformer:
|
|
130
132
|
# level take precedence
|
131
133
|
current_parameters = dict(copy.deepcopy(parent_parameters))
|
132
134
|
component_parameters = propagated_component.pop(PARAMETERS_STR, {})
|
133
|
-
current_parameters =
|
135
|
+
current_parameters = (
|
136
|
+
{**component_parameters, **current_parameters}
|
137
|
+
if use_parent_parameters
|
138
|
+
else {**current_parameters, **component_parameters}
|
139
|
+
)
|
134
140
|
|
135
141
|
# Parameters should be applied to the current component fields with the existing field taking precedence over parameters if
|
136
142
|
# both exist
|
@@ -145,7 +151,10 @@ class ManifestComponentTransformer:
|
|
145
151
|
excluded_parameter = current_parameters.pop(field_name, None)
|
146
152
|
parent_type_field_identifier = f"{propagated_component.get('type')}.{field_name}"
|
147
153
|
propagated_component[field_name] = self.propagate_types_and_parameters(
|
148
|
-
parent_type_field_identifier,
|
154
|
+
parent_type_field_identifier,
|
155
|
+
field_value,
|
156
|
+
current_parameters,
|
157
|
+
use_parent_parameters=use_parent_parameters,
|
149
158
|
)
|
150
159
|
if excluded_parameter:
|
151
160
|
current_parameters[field_name] = excluded_parameter
|
@@ -158,7 +167,10 @@ class ManifestComponentTransformer:
|
|
158
167
|
f"{propagated_component.get('type')}.{field_name}"
|
159
168
|
)
|
160
169
|
field_value[i] = self.propagate_types_and_parameters(
|
161
|
-
parent_type_field_identifier,
|
170
|
+
parent_type_field_identifier,
|
171
|
+
element,
|
172
|
+
current_parameters,
|
173
|
+
use_parent_parameters=use_parent_parameters,
|
162
174
|
)
|
163
175
|
if excluded_parameter:
|
164
176
|
current_parameters[field_name] = excluded_parameter
|