From 2593ef8ca6a50223337084a145ae574fc59c8ef7 Mon Sep 17 00:00:00 2001 From: Josef Kudera <46950237+kudj@users.noreply.github.com> Date: Tue, 9 Sep 2025 11:38:36 +0200 Subject: [PATCH 1/5] fix test 10 --- .../tests/calls/010-default-header/config.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/python-sync-actions/tests/calls/010-default-header/config.json b/python-sync-actions/tests/calls/010-default-header/config.json index 9b5af2e..b0354b1 100644 --- a/python-sync-actions/tests/calls/010-default-header/config.json +++ b/python-sync-actions/tests/calls/010-default-header/config.json @@ -31,7 +31,13 @@ "http": { "headers": { "Authorization": { - "attr": "#BEARER_TOKEN" + "function": "concat", + "args": [ + "Bearer ", + { + "attr": "#BEARER_TOKEN" + } + ] } } } From eda9915f8206e9260d6cce7c16c0649e4ff46018 Mon Sep 17 00:00:00 2001 From: Josef Kudera <46950237+kudj@users.noreply.github.com> Date: Tue, 9 Sep 2025 14:10:38 +0200 Subject: [PATCH 2/5] fix function evaluation in params --- python-sync-actions/src/component.py | 8 +++++++- python-sync-actions/src/configuration.py | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/python-sync-actions/src/component.py b/python-sync-actions/src/component.py index 0e57206..e1b92c3 100644 --- a/python-sync-actions/src/component.py +++ b/python-sync-actions/src/component.py @@ -217,6 +217,12 @@ def _build_url(self, base_url: str, endpoints: list[dict], selected_job: str) -> endpoint = ep.get("endpoint", "").lstrip("/") placeholders = ep.get("placeholders", {}) params = ep.get("params", {}) + user_params = self._configuration.user_parameters if self._configuration else {} + params = self._conf_helpers.fill_in_user_parameters( + params, + user_params, + evaluate_conf_objects_functions=True + ) try: formatted_path = endpoint.format(**placeholders) @@ -238,7 +244,7 @@ def _get_values_to_hide(self) -> list[str]: Get values to hide Args: """ - user_params = self._configuration.user_parameters + user_params = self._configuration.user_parameters if self._configuration else {} secrets = [value for key, value in user_params.items() if key.startswith("#") or key.startswith("__")] # get secrets from the auth method diff --git a/python-sync-actions/src/configuration.py b/python-sync-actions/src/configuration.py index b366a8a..1a63685 100644 --- a/python-sync-actions/src/configuration.py +++ b/python-sync-actions/src/configuration.py @@ -336,7 +336,12 @@ def build_api_request(configuration: dict) -> List[Tuple[ApiRequest, RequestCont method = endpoint_config.get("method", "GET") - request_content = build_request_content(method, endpoint_config.get("params", {})) + # evaluate functions inside the params + user_parameters = configuration.get("parameters", {}).get("config", {}) + params = endpoint_config.get("params", {}) + params = ConfigHelpers().fill_in_user_parameters(params, user_parameters, evaluate_conf_objects_functions=True) + request_content = build_request_content(method, params) + # use real method if method.upper() == "FORM": method = "POST" From 110bbfc9340b79e232aeb5735d119ae66855595b Mon Sep 17 00:00:00 2001 From: Josef Kudera <46950237+kudj@users.noreply.github.com> Date: Tue, 9 Sep 2025 14:10:51 +0200 Subject: [PATCH 3/5] update node.js --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e1f49fe..d7a8414 100644 --- a/Dockerfile +++ b/Dockerfile @@ -98,7 +98,7 @@ RUN pip install -r /tmp/requirements.txt # Install Node.js and set up symlinks RUN set -eux; \ - NODE_VERSION="v22.10.0" \ + NODE_VERSION="v22.19.0" \ ARCH= && dpkgArch="$(dpkg --print-architecture)"; \ case "${dpkgArch##*-}" in \ amd64) ARCH='x64';; \ From 883fb47831c74eeaa651f02232a659c1592063fd Mon Sep 17 00:00:00 2001 From: Josef Kudera <46950237+kudj@users.noreply.github.com> Date: Tue, 9 Sep 2025 14:11:10 +0200 Subject: [PATCH 4/5] add test for function evaluation --- .../calls/011-params-func-eval/config.json | 69 ++++++++++++++++ .../calls/011-params-func-eval/orders.request | 3 + .../orders.requestHeaders | 4 + .../011-params-func-eval/orders.response | 82 +++++++++++++++++++ 4 files changed, 158 insertions(+) create mode 100644 python-sync-actions/tests/calls/011-params-func-eval/config.json create mode 100644 python-sync-actions/tests/calls/011-params-func-eval/orders.request create mode 100644 python-sync-actions/tests/calls/011-params-func-eval/orders.requestHeaders create mode 100644 python-sync-actions/tests/calls/011-params-func-eval/orders.response diff --git a/python-sync-actions/tests/calls/011-params-func-eval/config.json b/python-sync-actions/tests/calls/011-params-func-eval/config.json new file mode 100644 index 0000000..593cd78 --- /dev/null +++ b/python-sync-actions/tests/calls/011-params-func-eval/config.json @@ -0,0 +1,69 @@ +{ + "storage": {}, + "parameters": { + "__SELECTED_JOB": "0", + "config": { + "jobs": [ + { + "endpoint": "011-params-func-eval/orders", + "dataType": "orders", + "method": "POST", + "params": { + "greeting": { + "value": + { + "hi": { + "function": "concat", + "args": [ + "hello", + "-world" + ] + } + } + + } + } + } + ], + "test": "test-value", + "concat": { + "function": "concat", + "args": [ + "hello", + "-world" + ] + }, + "debug": false, + "outputBucket": "in.c-", + "incrementalOutput": false, + "#BEARER_TOKEN": "token" + }, + "api": { + "baseUrl": "http://mock-server:80/", + "http": { + "headers": { + "Authorization": { + "attr": "#BEARER_TOKEN" + } + } + } + }, + "http": { + "maxRetries": 10, + "codes": [ + 500, + 502, + 503, + 504, + 408, + 420, + 429 + ] + } + }, + "action": "test_request", + "image_parameters": { + }, + "authorization": { + } +} diff --git a/python-sync-actions/tests/calls/011-params-func-eval/orders.request b/python-sync-actions/tests/calls/011-params-func-eval/orders.request new file mode 100644 index 0000000..e259a10 --- /dev/null +++ b/python-sync-actions/tests/calls/011-params-func-eval/orders.request @@ -0,0 +1,3 @@ +POST /011-params-func-eval/orders + +{"greeting": {"value": {"hi": "hello-world"}}} \ No newline at end of file diff --git a/python-sync-actions/tests/calls/011-params-func-eval/orders.requestHeaders b/python-sync-actions/tests/calls/011-params-func-eval/orders.requestHeaders new file mode 100644 index 0000000..68862da --- /dev/null +++ b/python-sync-actions/tests/calls/011-params-func-eval/orders.requestHeaders @@ -0,0 +1,4 @@ +accept: */* +authorization: token +content-length: 46 +content-type: application/json diff --git a/python-sync-actions/tests/calls/011-params-func-eval/orders.response b/python-sync-actions/tests/calls/011-params-func-eval/orders.response new file mode 100644 index 0000000..71d78ff --- /dev/null +++ b/python-sync-actions/tests/calls/011-params-func-eval/orders.response @@ -0,0 +1,82 @@ +{ + "nested": { + "orders": [ + { + "id": 1, + "customer": "John Doe", + "address": "123 Main St", + "items": [ + { + "id": 1, + "name": "Widget", + "price": 9.99, + "quantity": 2 + }, + { + "id": 2, + "name": "Thing", + "price": 5.99, + "quantity": 5 + } + ] + }, + { + "id": 2, + "customer": "Jan Novak", + "address": "123 Main St", + "items": [ + { + "id": 1, + "name": "Widget", + "price": 9.99, + "quantity": 2 + }, + { + "id": 2, + "name": "Thing", + "price": 5.99, + "quantity": 5 + } + ] + }, + { + "id": 3, + "customer": "Jana Novakova", + "address": "123 Main St", + "items": [ + { + "id": 1, + "name": "Widget", + "price": 9.99, + "quantity": 2 + }, + { + "id": 2, + "name": "Thing", + "price": 5.99, + "quantity": 5 + } + ] + }, + { + "id": 4, + "customer": "Bob Smith", + "address": "123 Main St", + "items": [ + { + "id": 1, + "name": "Widget", + "price": 9.99, + "quantity": 2 + }, + { + "id": 2, + "name": "Thing", + "price": 5.99, + "quantity": 5 + } + ] + } + ] + } +} \ No newline at end of file From 67f8e644bab952de5827e8100979388b56969679 Mon Sep 17 00:00:00 2001 From: Josef Kudera <46950237+kudj@users.noreply.github.com> Date: Wed, 10 Sep 2025 13:12:24 +0200 Subject: [PATCH 5/5] clean config in test --- .../tests/calls/011-params-func-eval/config.json | 8 -------- 1 file changed, 8 deletions(-) diff --git a/python-sync-actions/tests/calls/011-params-func-eval/config.json b/python-sync-actions/tests/calls/011-params-func-eval/config.json index 593cd78..abe17f3 100644 --- a/python-sync-actions/tests/calls/011-params-func-eval/config.json +++ b/python-sync-actions/tests/calls/011-params-func-eval/config.json @@ -25,14 +25,6 @@ } } ], - "test": "test-value", - "concat": { - "function": "concat", - "args": [ - "hello", - "-world" - ] - }, "debug": false, "outputBucket": "in.c-", "incrementalOutput": false,