graphql-engine/server/src-lib/Hasura
Puru Gupta 698190894f server: use kriti template to generate query param from list
## Description ✍️
This PR adds support to generate query params directly using a kriti template which can be used to flatten a list of parameter arguments as well.

### Changes in the Metadata API
Earlier the `query_params` key inside `request_transform` used to take in an object of key/value pairs where the `key` represents the query parameter name and `value` points to the value of the parameter or a kriti template which could be resolved to the value.

With this PR, we provide the user with more freedom to generate the complete query string using kriti template. The  `query_params` can now take in a string as well which will be a kriti template. This new change needs to be incorporated on the console and CLI metadata import/export as well.
- [x] CLI: Compatible, no changes required
- [ ] Console

## Changelog ✍️

__Component__ : server

__Type__: feature

__Product__: community-edition

### Short Changelog

use kriti template to generate query param from list of arguments

### Related Issues ✍
https://hasurahq.atlassian.net/browse/GS-243

### Solution and Design ✍
We use a kriti template to generate the complete query parameter string.

| Query Template | Output |
|---|---|
| `{{ concat ([concat({{ range _, x := [\"apple\", \"banana\"] }} \"tags={{x}}&\" {{ end }}), \"flag=smthng\"]) }}`| `tags=apple&tags=banana&flag=smthng`  |
| `{{ concat ([\"tags=\", concat({{ range _, x := $body.input }} \"{{x}},\" {{ end }})]) }}` | `tags=apple%2Cbanana%2C` |

### Steps to test and verify ✍
- start HGE and make the following request to `http://localhost:8080/v1/metadata`:
```json
{
    "type": "test_webhook_transform",
    "args": {
        "webhook_url": "http://localhost:3000",
        "body": {
            "action": {
                "name": "actionName"
            },
            "input": ["apple", "banana"]
        },
        "request_transform": {
            "version": 2,
            "url": "{{$base_url}}",
            "query_params": "{{ concat ([concat({{ range _, x := $body.input }} \"tags={{x}}&\" {{ end }}), \"flag=smthng\"]) }}",
            "template_engine": "Kriti"
        }
    }
}
```
- you should receive the following as output:
```json
{
    "body": {
        "action": {
            "name": "actionName"
        },
        "input": [
            "apple",
            "banana"
        ]
    },
    "headers": [],
    "method": "GET",
    "webhook_url": "http://localhost:3000?tags=apple&tags=banana&flag=smthng"
}
```

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6961
Co-authored-by: Tirumarai Selvan <8663570+tirumaraiselvan@users.noreply.github.com>
GitOrigin-RevId: 712ba038f03009edc3e8eb0435e723304943399a
2022-11-29 20:27:41 +00:00
..
Backends server: provide an option to enable event triggers on logically replicated tables 2022-11-29 17:43:13 +00:00
Base Upgrade Ormolu to v0.5. 2022-11-02 20:55:13 +00:00
Cache server, pro: actually reformat the code-base using ormolu 2021-09-23 22:57:37 +00:00
Eventing server: rename event trigger metric hasura_event_processing_time_seconds to hasura_event_webhook_processing_time_seconds 2022-11-21 07:49:28 +00:00
GraphQL server: clean up query variables hotfix 2022-11-29 10:06:14 +00:00
Incremental Further schema cache cleanups 2022-11-29 01:02:09 +00:00
Metadata pro-server: add support for exporting traces over OTLP 2022-11-07 06:56:08 +00:00
RemoteSchema Further schema cache cleanups 2022-11-29 01:02:09 +00:00
RQL server: use kriti template to generate query param from list 2022-11-29 20:27:41 +00:00
Server server: provide an option to enable event triggers on logically replicated tables 2022-11-29 17:43:13 +00:00
SQL server: delete the Cacheable type class in favor of Eq 2022-11-21 16:35:37 +00:00
Tracing server: support 128-bit trace ids 2022-09-20 02:50:06 +00:00
App.hs Further schema cache cleanups 2022-11-29 01:02:09 +00:00
EncJSON.hs [server] Fix CockroachDB live queries 2022-11-02 11:41:02 +00:00
GC.hs Upgrade Ormolu to v0.5. 2022-11-02 20:55:13 +00:00
HTTP.hs Add Data Connector agent request logging, improve error messages, and add tracing support [GDW-83] 2022-07-11 08:05:40 +00:00
Incremental.hs Further schema cache cleanups 2022-11-29 01:02:09 +00:00
Logging.hs server: add jwk-refresh-log type to default enabled logs 2022-11-08 16:48:44 +00:00
Name.hs server/postgres: fix the schema types conflict between aggregation predicates and table selection aggregates 2022-10-21 13:28:43 +00:00
PingSources.hs [server] regularly ping selected sources 2022-11-23 16:41:46 +00:00
QueryTags.hs server: support query tags for MSSQL data sources 2022-04-28 19:34:45 +00:00
Session.hs server: delete the Cacheable type class in favor of Eq 2022-11-21 16:35:37 +00:00
ShutdownLatch.hs multitenant: make shutdown logic more abstract 2022-11-23 07:53:19 +00:00
Tracing.hs Upgrade Ormolu to v0.5. 2022-11-02 20:55:13 +00:00