Commit Graph

2818 Commits

Author SHA1 Message Date
Gil Mizrahi
7a3c1489ad set omit_request_id to true by default
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7978
GitOrigin-RevId: 7e359979b304ff63b8e582e460c7668f8207fe75
2023-02-15 09:53:19 +00:00
awjchen
2df8589097 server: fix race condition in metadata update
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7984
GitOrigin-RevId: edd4a581a5b785e7a09b2d4c8b2a5c6ccc7f8b63
2023-02-15 06:12:59 +00:00
Vijay Prasanna
9900027a8e feature (console): remove the GDC experimental feature flag
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7942
Co-authored-by: Nicolas Beaussart <7281023+beaussan@users.noreply.github.com>
Co-authored-by: Julian <843342+okjulian@users.noreply.github.com>
Co-authored-by: Brandon Martin <40686+codedmart@users.noreply.github.com>
GitOrigin-RevId: 643c02d36f71b3e25060ddbb723bf57f31dd4318
2023-02-15 04:52:54 +00:00
Gil Mizrahi
20e72ddb29 reject untrack naqi when naqi does not exist
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7975
GitOrigin-RevId: e56385e7396c3980d78b53acc6e9b3656fd9909d
2023-02-14 14:40:15 +00:00
Philip Lykke Carlsen
fed36dadc7 Fix: Unable to use environment variable for CockroachDB connection string in Cloud
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7883
GitOrigin-RevId: b1f515c4de3b5f345991a0fad1152f42169f9d0d
2023-02-14 12:15:58 +00:00
Lyndon Maydwell
630bf277c1 SQLite Mutations
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7573
Co-authored-by: Daniel Chambers <1214352+daniel-chambers@users.noreply.github.com>
GitOrigin-RevId: 7807368faaa4bac5c0726c2dab041f8180a3fc31
2023-02-14 11:20:36 +00:00
Samir Talwar
2df5b80063 server/tests-py: Run in parallel on all PostgreSQL versions in CI.
If this works, we can start knocking out running in the old, sequential mode.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7909
GitOrigin-RevId: 4cda5b52b3c385dd3286ba1f58d5cd7c62b87314
2023-02-13 23:39:28 +00:00
Auke Booij
334660d906 server: refactor FromJSON FromIntrospection instances
- Inline a few instances to avoid code duplication
- Use `(<$>)` to avoid `let`
- Improve error reporting when types of invalid kind are specified in `possibleTypes` or `interfaces`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7540
GitOrigin-RevId: 954fb710f94a275daff938b9a6e58765c4286d0c
2023-02-13 07:50:12 +00:00
Karthikeyan Chinnakonda
958a5e1a33 Include cron trigger's name in the error message
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7914
GitOrigin-RevId: 7bce2788ac154e7673402022414ab1fff653340d
2023-02-13 07:11:57 +00:00
Daniel Chambers
2ced1f2676 More tests for insert mutations for Data Connector agents
[GDC-719]: https://hasurahq.atlassian.net/browse/GDC-719?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7901
GitOrigin-RevId: b7f28c4b9604c0ca78c528deb2923e8519fae56a
2023-02-13 01:03:18 +00:00
Lyndon Maydwell
5a3f10363d Fixing omit_tracked argument to suggest_relationships API to be more granular
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7900
GitOrigin-RevId: 2116875b866ffc79ce5e3604751c62b8ac9c37e3
2023-02-10 01:53:30 +00:00
Antoine Leblanc
dec8579db8 Allow backend execution to happen on the base app monad.
### Description

Each Backend executes queries against the database in a slightly different stack: Postgres uses its own `TXeT`, MSSQL uses a variant of it, BigQuery is simply in `ExceptT QErr IO`... To accommodate those variations, we had originally introduced an `ExecutionMonad b` type family in `BackendExecute`, allowing each backend to describe its own stack. It was then up to that backend's `BackendTransport` instance to implement running said stack, and converting the result back into our main app monad.

However, this was not without complications: `TraceT` is one of them: as it usually needs to be on the top of the stack, converting from one stack to the other implies the use `interpTraceT`, which is quite monstrous. Furthermore, as part of the Entitlement Services work, we're trying to move to a "Services" architecture in which the entire engine runs in one base monad, that delegates features and dependencies to monad constraints; and as a result we'd like to minimize the number of different monad stacks we have to maintain and translate from and to in the codebase.

To improve things, this PR changes `ExecutionMonad b` from an _absolute_ stack to a _relative_ one: i.e.: what needs to be stacked on top of our base monad for the execution. In `Transport`, we then only need to pop the top of the stack, and voila. This greatly simplifies the implementation of the backends, as there's no longer any need to do any stack transformation: MySQL's implementation becomes a `runIdentityT`! This also removes most mentions of `TraceT` from the execution code since it's no longer required: we can rely on the base monad's existing `MonadTrace` constraint.

To continue encapsulating monadic actions in `DBStepInfo` and avoid threading a bunch of `forall` all over the place, this PR introduces a small local helper: `OnBaseMonad`. One only downside of all this is that this requires adding `MonadBaseControl IO m` constraint all over the place: previously, we would run directly on `IO` and lift, and would therefore not need to bring that constraint all the way.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7789
GitOrigin-RevId: e9b2e431c5c47fa9851abf87545c0415ff6d1a12
2023-02-09 14:40:04 +00:00
ananya-2410
c681771192 ci: tag release v2.19.0-beta.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7911
GitOrigin-RevId: 154a508058b5f3dc8c4901fb6a22ab00009adc19
2023-02-09 12:24:28 +00:00
Auke Booij
8e0e778cd5 server/tests: ensure that all responses have a Content-Type header
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7850
GitOrigin-RevId: 5e3ec3907177bd35974d5dd9a990dca399904139
2023-02-09 10:28:19 +00:00
kodiakhq[bot]
b01d3a45de server: dev build modes
Add some configurations for modern profiling modes, and integration into dev.sh

These require cabal 3.8 due to the use of `import`

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7671
GitOrigin-RevId: f793f64105cfd99fb51b247fa8bc050f6d4bd23e
2023-02-08 22:43:00 +00:00
Tom Harding
89bbb24c54 Monomorphise NativeQueryName
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7865
GitOrigin-RevId: 6c26edeb40f3b523053ffc45220a3c1046585de3
2023-02-08 15:48:12 +00:00
Samir Talwar
23f78a05b1 server/tests-py: Enable TLS tests in parallel mode on CI.
Part of [NDAT-257](https://hasurahq.atlassian.net/browse/NDAT-257).

* Run the TLS tests on CI.
* Run non-TLS tests even when a TLS certificate is provided; just ignore it.

[NDAT-257]: https://hasurahq.atlassian.net/browse/NDAT-257?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7806
GitOrigin-RevId: d705e2e5131a674070a98a893323a7b98a92f688
2023-02-08 14:42:27 +00:00
Samir Talwar
fa53a70631 server/tests-py: Run TestSubscriptionBasicNoAuth in the new mode.
This test _cannot_ run without an admin secret, so we need a new marker just for that.

This also fixes the Docker Compose file so that _run.sh_ works again. Apparently it was not used much.

[NDAT-257]: https://hasurahq.atlassian.net/browse/NDAT-257?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7831
GitOrigin-RevId: 1cb9449a20c7cbe56fbd1ba0f12337f056683624
2023-02-08 11:51:54 +00:00
Daniel Chambers
0d5badba09 Initial tests for insert mutations for Data Connector agents
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7875
GitOrigin-RevId: 793501685124e41edfd83c6be4a2a9c7ae7f9267
2023-02-08 08:36:58 +00:00
Anon Ray
85a7e03526 docs: add explanation of livequery-poller-log (GS-284)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7372
Co-authored-by: Rob Dominguez <24390149+robertjdominguez@users.noreply.github.com>
GitOrigin-RevId: 75fd9300749417695941fe552f3f06bb08c55c10
2023-02-08 07:23:49 +00:00
Solomon
4d3e80a0b5 [Gardening] Eliminate boolean blindness in rsoWebSocketCompression
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7818
GitOrigin-RevId: cb3b8b8ebf7bd296c88c782c8bc457397a88f8ea
2023-02-08 04:15:01 +00:00
Solomon
9b6b44c888 [Gardening] Eliminate boolean blindness in soAllowList
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7815
GitOrigin-RevId: 6768abb39e7ab6b12be8989702223500119169de
2023-02-08 03:36:45 +00:00
Solomon
97dc0408d1 [Gardening] Eliminate boolean blindness in soDevMode
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7814
GitOrigin-RevId: 593b8e764a8dca5aa9b4a9008d341a5d814f28fc
2023-02-08 02:58:32 +00:00
Solomon
807be5f2bf [Gardening] Eliminate Boolean Blindness in soEnableTelemetry option
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7812
GitOrigin-RevId: 0b25624cb600a6d9976737b524c8cd60d160f174
2023-02-08 01:47:56 +00:00
Solomon
caad80ab7f [Gardening] Eliminate boolean blindness in so soWsReadCookie
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7813
GitOrigin-RevId: 6aae2eda1765e302a08c676988b6a7f9432e9977
2023-02-08 00:57:41 +00:00
pranshi06
12e276cbc6 server: fix nullable field omitted from action response when omitted in the webhook response
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7795
GitOrigin-RevId: d0c3dc7e092af3b8dc8ad18a97462d0fea4e74f3
2023-02-07 15:34:07 +00:00
Rakesh Emmadi
e6c5a9505b server: log when cron triggers are fetched from database for generating events
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7725
Co-authored-by: Rob Dominguez <24390149+robertjdominguez@users.noreply.github.com>
GitOrigin-RevId: 8dd2b07c769392e057400c5e60e40e7fc56ac26f
2023-02-07 12:23:42 +00:00
Auke Booij
36a9de5215 server: reintroduce Content-Type header for errors
Fix regression introduced by hasura/graphql-engine-mono#7444.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7827
GitOrigin-RevId: 468f2a53f44b732c09f09ca71a3a2c4b38e4e360
2023-02-07 11:27:28 +00:00
Vishnu Bharathi
5f9e70a527 ci: tag release v2.18.0
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7853
GitOrigin-RevId: 02d56a41be3a521fdaba3b959f9bba1969ad72b2
2023-02-07 10:11:24 +00:00
Solomon
7027af5a05 [Gardening] Eliminate Boolean Blindness in soEnableConsole option
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7810
GitOrigin-RevId: 69f84d52e5f61e88b668abb3898344ccfbc0d26d
2023-02-07 05:59:45 +00:00
Jesse Hallett
2d513ace63 server: codecs for CustomTypes
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7838
GitOrigin-RevId: 09a9be0cee748226321f0cf09401b18c2f31e930
2023-02-07 03:47:35 +00:00
David Overton
98af923df5 MongoDB Data Connector prototype agent
Basic MongoDB agent. This is intended as a starting point for playing with nested documents in a MongoDB back end. Currently supports basic queries with projections, where expressions, limit and offset. No support for joins, aggregates or mutations.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7840
GitOrigin-RevId: 3f03b8416c95acf2b68da1db56cbe36a513a4bde
2023-02-07 02:57:06 +00:00
Daniel Chambers
2e8fc69394 Adds an agent test for ordering by a single column aggregate function
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7820
GitOrigin-RevId: 8455c2ba032173ade474f2744b43d1259f88c9b2
2023-02-06 23:45:56 +00:00
Solomon
d8ff0329a0 Eliminate Template Haskell from Hasura.RQL.Types.Common
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7819
GitOrigin-RevId: bf5d1616a90a771e1c72321b64b38d9c153b0e94
2023-02-06 22:03:02 +00:00
Solomon
bf4e514ebf [Gardening] Remove where clause from mkServeOptions and add haddocks.
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7809
GitOrigin-RevId: 3a440eaa397045c95fcff4316ef3c0438a754c7c
2023-02-06 19:15:06 +00:00
Auke Booij
bc9bafbecf server: delete unused benchmarking code
As far as I know, and the people who touched this, this is dead code.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7830
GitOrigin-RevId: 2530783951af97033545faf65ad282fd9cdbc3b3
2023-02-06 15:11:10 +00:00
Daniel Chambers
7a4bde9652 Added result_type property to SingleColumnAggregate
[GDC-756]: https://hasurahq.atlassian.net/browse/GDC-756?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7793
GitOrigin-RevId: b8201615984a71a9f41bed4195e2435e362cf383
2023-02-06 04:20:17 +00:00
Gil Mizrahi
f90373b1ca NaQI - validate against the database - infra and check syntax
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7778
GitOrigin-RevId: c8366ad7261d9c120dc0612bedb96fa5ae59eda3
2023-02-03 16:29:22 +00:00
Daniel Harvey
d3d2d967d2 [server/tests] test server health with /healthz endpoint
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7759
GitOrigin-RevId: 952b64b258a0566a8c393f70e8341e8eccb8d7a4
2023-02-03 15:20:42 +00:00
Samir Talwar
710a33bf45 CI: Run the Python tests in the "new" mode, one HGE per test class.
Part of [NDAT-257](https://hasurahq.atlassian.net/browse/NDAT-257).

This runs the Python tests in parallel, all at once, with each test class spinning up HGE and configuring it appropriately. Once we are confident this works, we can remove most of the old jobs, drastically reducing the number of machines we need to run the Python tests.

For now we are only running on PostgreSQL 15. Once this is merged, we can expand to all supported PostgreSQL versions, and then Citus, MS SQL Server, and BigQuery.

[NDAT-257]: https://hasurahq.atlassian.net/browse/NDAT-257?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7780
GitOrigin-RevId: 174511fc3e3bcd4ea968e3ade6c867c3aa84096a
2023-02-03 14:09:29 +00:00
Auke Booij
e6db044ecc server: fix some hspec tests
- One test suite wasn't getting picked up due to it not satisfying the [criteria](https://hspec.github.io/hspec-discover.html) for `hspec-discover`
- One test was broken ever since it was introduced in hasura/graphql-engine-mono#5181. This wasn't picked up due to the module not satisfying `hspec-discover`'s criteria until more recently.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7801
GitOrigin-RevId: fd5c31ccf12d6d0c4be0dc7bf99f14d63caccc83
2023-02-03 14:09:19 +00:00
paritosh-08
775bdc8026 server: move event trigger schedule cleanup logic
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7606
Co-authored-by: Krushan Bauva <31391329+krushanbauva@users.noreply.github.com>
GitOrigin-RevId: 95819347aff4e6a86b2bc9acf214222e05dba496
2023-02-03 12:30:00 +00:00
Daniel Harvey
d32e734310 [server] Pass parameters to native queries
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7727
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: ddca3d962c05024913ce6ec4c6b4ea4a0f4a6a8c
2023-02-03 11:16:29 +00:00
Samir Talwar
416f4e8f1e server/api-tests: Port a test for empty roots from the Python tests.
More for practice than anything else.

[NDAT-459]: https://hasurahq.atlassian.net/browse/NDAT-459?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7760
GitOrigin-RevId: 3af769e704b25e5cc97ab5905b6f5311f731bbce
2023-02-03 10:00:21 +00:00
Solomon
621a346ca7 Simplify SourceKindInfo ToJSON instance
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7787
GitOrigin-RevId: f481c7b3dadbbd9b97655187a486954e0e17ae4f
2023-02-03 01:47:02 +00:00
Antoine Leblanc
e99f9a2f57 Remove MetadataStorageT, clean up error handling.
## Description

This PR removes `MetadataStorageT`, and cleans up all top-level error handling. In short: this PR changes `MonadMetadataStorage` to explicitly return a bunch of `Either QErr a`, instead of relying on the stack providing a `MonadError QErr`. Since we implement that class on the base monad *below any ExceptT*, this removes a lot of very complicated instances that make assumptions about the shape of the stack.

On the back of this, we can remove several layers of ExceptT from the core of the code, including the one in `RunT`, which allows us to remove several instances of `liftEitherM . runExceptT`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7689
GitOrigin-RevId: 97d600154d690f58c0b93fb4cc2d30fd383fd8b8
2023-02-03 01:05:09 +00:00
Solomon
29a75e36f9 Reorganize Hasura.Prelude module and add haddocks.
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7790
GitOrigin-RevId: 9ad68061d58c7d8763fefeba3f3fe9ddd29d443c
2023-02-02 23:38:01 +00:00
Auke Booij
aeff6e162a server: fix cabal and warnings for arrows related packages
#7730 added `package` stanzas for all our internal Haskell libraries, so that `-Werror` was switched on for all of them. However, #7534 was developed simultaneously, and merged shortly after, so that we missed `package` stanzas for `hasura-incremental` and `arrows-extra`. Then #7761 added one for `hasura-incremental`. This PR fixes one warning for a test suite there, and adds the missing `package` stanza for `arrows-extra`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7770
GitOrigin-RevId: 5f5c3fb5d4852c88ed2e14a3fa83fe264aec895b
2023-02-02 19:53:13 +00:00
Daniel Harvey
e953efeb40 [ci] test the libraries in server/lib
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7758
Co-authored-by: Tom Harding <6302310+i-am-tom@users.noreply.github.com>
GitOrigin-RevId: 311f6c4a5c629c18a55d75a5d5a74f826078e86d
2023-02-02 17:32:48 +00:00
Tom Harding
64f79daa3f Allow pg_run_sql as well as run_sql to remove some string-bodging
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7465
GitOrigin-RevId: 754866121fbd631273ae00a2305c8ddbba286596
2023-02-02 14:04:52 +00:00
Lyndon Maydwell
9a54849985 Fixing issues with SQLite FKs in Schema and Suggest Relationships API Docs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7729
GitOrigin-RevId: 4ae48019ce71f6ceb3f6d06524302bdd11ca1ed4
2023-02-02 11:37:32 +00:00
Philip Lykke Carlsen
69ae616ae5 Bump autodocodec to 0.2.0.3, ditch Data.Voidable
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7753
GitOrigin-RevId: c5dce6cf125b6bc53fd5ac7b689d1ed71fd6257b
2023-02-02 10:54:59 +00:00
Samir Talwar
5dbca897c6 api-tests: If a GET request fails with the wrong status code, print the response.
It's pretty frustrating to see an error in CI and not know the actual cause, because we just dropped the information.

This adds the actual status code and body to the error message.

Previously, `getWithStatus` was only used by the `healthCheck'` function. This also refactors `get_` to use the same function, so we don't have to duplicate the error-handling logic.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7752
GitOrigin-RevId: 474e4c02ad6c5b676abc311b90b21998b4a93d94
2023-02-02 09:18:27 +00:00
Daniel Chambers
67bc017cf3 Gardening: Enable and fix warnings in dc-api package
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7765
GitOrigin-RevId: 7dd6b1c065cc68ab413736ca49e5957a7697566b
2023-02-02 05:48:25 +00:00
Daniel Chambers
b012f2ebc7 Use Dataset Clones for all SQLite tests
[GDC-718]: https://hasurahq.atlassian.net/browse/GDC-718?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7743
GitOrigin-RevId: 6c3577c1d4ffd2212a72b6e1a24e0e384f2db046
2023-02-02 04:27:57 +00:00
Antoine Leblanc
1fe7fe43b8 Fix all warnings in internal libraries and enable -WError everywhere
### Description

This PR:
- fixes the package names in dev-sh.project.local (the config was using the names of the folders, not the names of the packages)
- adds similar options to CI: we also want to build with CI and in parallel there
- fixes all warnings

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7761
GitOrigin-RevId: ef1d78db8c94f5e74c18443aa517544f6a6f5a10
2023-02-01 23:32:19 +00:00
Antoine Leblanc
30e772d3fa add content-length header.
## Description

Adds a content-length response header to all endpoints. This PR tests this feature by checking the content-length of every request we send in the tests.

## Changelog ✍️

__Component__ : server

__Type__: enhancement

__Product__: community-edition

### Short Changelog

add a content-length response header to all endpoints

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7444
Co-authored-by: Manas Agarwal <5352361+manasag@users.noreply.github.com>
GitOrigin-RevId: a0a811852053c5dde4b11b71ba11a7d456c84d76
2023-02-01 21:32:50 +00:00
Tom Harding
a425c97e1e Remove redundant Backend constraints
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7757
GitOrigin-RevId: b5bc017b0ee3a9daeca78437278525be17a33f4f
2023-02-01 19:48:21 +00:00
Tom Harding
e41654b133 Reject MonadUnique, embrace IO
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7751
GitOrigin-RevId: 3edc4dee10d58afac911c9862e3b55a4c458a293
2023-02-01 18:57:46 +00:00
Samir Talwar
ac985c2235 server/api-tests: Move tests that test errors into their own directory.
Named "Test.Queries.Errors".

This also sorts the test list in _api-tests.cabal_.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7755
GitOrigin-RevId: 3b015a50e6de54c6573444b460b7977897f59738
2023-02-01 16:19:52 +00:00
Daniel Harvey
52317930fe Fix make ghcid-api-tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7738
GitOrigin-RevId: 1576bfb51b20cdc8a67924533e4da03ec2f1f3af
2023-02-01 12:34:59 +00:00
Tom Harding
18b346bf44 Extract Hasura.Incremental into lib/hasura-incremental
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7534
GitOrigin-RevId: 85863cee836d348e8e314f8af1b50bb5cd912b46
2023-02-01 12:25:33 +00:00
Daniel Harvey
4418d294f9 [server] parse native query in metadata call
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7731
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 96d60c72da05970f5b34f310f9fe71d9f67387a1
2023-02-01 08:46:19 +00:00
Auke Booij
a5325d6aea server: fix cabal files; apply ghc warnings more strictly
- In a previous PR we made more use of `common` stanzas, but these require `cabal-version: 2.2` (so some of those stanzas were not functional before this PR). This just bumps the `cabal-version`s straight to 3.6, which is the latest version we support in CI, where we build with cabal 3.6.
- This `cabal-version` upgrade required fixing a few `license` fields, from `BSD3` to `BSD-3-Clause`. I've also added `default-language` fields where appropriate, although this is perhaps optional.
- Using cabal's [syntax for applying options to all _local_ packages](https://cabal.readthedocs.io/en/3.8/cabal-project.html#package-configuration-options), we unify the cabal configuration, and apply `-Werror` to all local packages, which wasn't the case until now.
- Applying `-Werror` to all local packages required a few additional exceptions to the warnings that were switched on in hasura/graphql-engine-mono#7614.
- Deleted SCM links to the original pool library.

Overall, the effect of this PR is:
- more warnings
- stricter compilation
- ~~less cabal configuration~~

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7730
GitOrigin-RevId: 592e9e46d103bcc8726df5b745306bd9f77f7efc
2023-01-31 18:25:42 +00:00
Karthikeyan Chinnakonda
0406cd2ef0 server: refactor the clear_metadata and the replace_metadata API handler
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7631
GitOrigin-RevId: 69a05f175f7fda1ed6a2dfb311b3f331b209a5aa
2023-01-31 17:41:09 +00:00
Daniel Harvey
17dbc7bc32 [server] parser for interpolated SQL queries
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7726
GitOrigin-RevId: 4b6ad28aa8a4d75bfcf6ce1ec4d89324f7f1ae74
2023-01-31 12:54:11 +00:00
Gil Mizrahi
cabb6ada1c naqi arguments field is optional
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7712
GitOrigin-RevId: c45a94c16fd9b7b0f3d40085949c4571ac31ca09
2023-01-31 10:55:02 +00:00
Auke Booij
cdd0ea7236 server: improve phrasing for "conflicting type definitions" error
Typo (repeated "the the"). Also emphasize that this is about GraphQL types.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7553
GitOrigin-RevId: 60a75a11c66d470217d132df5be50e49c87dee7f
2023-01-31 09:07:03 +00:00
Solomon
59a1fc2102 Re-enable Optimizations in Hasura.Server.Init Module
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5306
GitOrigin-RevId: 8ae8184abbaabc06a25c4977f19f2fd19cf12bf4
2023-01-31 00:28:58 +00:00
Gil Mizrahi
e7d5b989ab add omit_request_id flag
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7697
GitOrigin-RevId: 6716b263526fd97609f33cd78ec254a24c14b679
2023-01-31 00:28:50 +00:00
Philip Lykke Carlsen
70c8bc8700 Integrating Native Query metadata and schema
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7657
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
GitOrigin-RevId: d5047559e3560f5d7870eac6e07c89704146ccab
2023-01-30 16:06:34 +00:00
Vishnu Bharathi
54d5039180 ci: tag release v2.18.0-beta.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7709
GitOrigin-RevId: 7a8397078d0d65f416214cff9c508c9ea0627ea0
2023-01-30 13:45:59 +00:00
Samir Talwar
3c470211fc test-harness: Use the default PostgreSQL port if none is specified.
This means we don't need to include the port in the connection string.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7683
Co-authored-by: Vishnu Bharathi <4211715+scriptnull@users.noreply.github.com>
GitOrigin-RevId: 3f6fb3fe4cb246a2fc593a2aea3820cf2c0e0e2c
2023-01-30 12:49:55 +00:00
Auke Booij
c36c085016 server: enable all the warnings (that we can)
See [Enable all the warnings](https://medium.com/mercury-bank/enable-all-the-warnings-a0517bc081c3). This PR follows that approach, except that it re-disables those warnings that would prevent a successful build.

There are some newer warning flags that older GHC versions don't recognize. So this also updates some of our CI routines to the GHC version that we're currently using for `graphql-engine` itself, namely 9.2.5. I don't see a reason to keep testing those libraries against older GHC versions.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7614
GitOrigin-RevId: d48a6db09dab29616e273549d0045f98ecb4586f
2023-01-30 11:24:49 +00:00
Daniel Chambers
0abfc97df7 Implemented datasets support in Data Connector agent test suite
[GDC-718]: https://hasurahq.atlassian.net/browse/GDC-718?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7654
GitOrigin-RevId: 1d036cd39f717fce1ce0176103e40a1309ded3af
2023-01-30 07:00:26 +00:00
Rakesh Emmadi
ab99215828 server: log when events of scheduled & event triggers are fetched from database for delivery
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7651
Co-authored-by: Sean Park-Ross <94021366+seanparkross@users.noreply.github.com>
GitOrigin-RevId: 3149dae41c6a8a16caa1d44fbc0606451d6d2cfa
2023-01-30 06:08:08 +00:00
Solomon
7842bc34ee Refactor/move namingcase default into arg merging
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5289
GitOrigin-RevId: 39c5a5b839534dc5416d62ca20c5051ae4d8ef57
2023-01-30 05:00:54 +00:00
Jesse Hallett
b5e6f48d99 server: codecs for query collections
This is the complete set of codecs to cover the top-level `query_collections` field of `Metadata`.

Ticket: https://hasurahq.atlassian.net/browse/GDC-523

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7351
GitOrigin-RevId: 7a1a46e5006e1c5e25fba6ea4775270c70bc2785
2023-01-28 00:07:20 +00:00
Antoine Leblanc
503fc6d7ae Fix libs' test config.
### Description

This fixes the libs' test config: without that line, hspec fails to run at build time. I haven't tried actually running the tests now that they build, fwiw.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7694
GitOrigin-RevId: 03d7bc969c4bd195e84080d50f1f6441a1d8d50f
2023-01-27 16:32:45 +00:00
Daniel Harvey
4b0c737f0b [server] re-add native sql output
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7692
GitOrigin-RevId: c4e8d6ff2defe6c0ecd96a7233636fe0ebae1a85
2023-01-27 14:38:07 +00:00
Samir Talwar
cf3da2cec7 test-harness: Remove unnecessary indentation in runApp.
Not sure why there was so much nesting, but I did not like it.

Just a bit of cleanup while I was nosing around.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7684
GitOrigin-RevId: a17c94561fe1688d35a51afa5dfda37a7ea35d25
2023-01-27 11:15:11 +00:00
Daniel Harvey
4c20c46bdd [server]: revert native sql output
Reverts hasura/graphql-engine-mono#7617 whilst we look at server upgrade / downgrade tests.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7690
GitOrigin-RevId: e6e48f1bd90a8db36f372bf9f09c26e43d123ce5
2023-01-27 10:05:16 +00:00
Vishnu Bharathi
e20925850f ci: tag release v2.17.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7688
GitOrigin-RevId: 247e9b8e4299114064497be429f62aecbb20e747
2023-01-27 09:00:09 +00:00
Daniel Harvey
b80113912c server: generate native access sql
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7617
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 48e0ccdda50a09bcbad1a86b7015a02f883889ab
2023-01-26 18:02:44 +00:00
Daniel Harvey
ab9c56b343 [server] allow feature flags to be overwritten by env vars
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7659
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 2a64ff09118aa0b5cbf494c45e4b178de366236b
2023-01-26 09:41:39 +00:00
Abby Sassel
221af57e53 server: add troubleshooting advice for make test-sqlserver failure
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7663
GitOrigin-RevId: dfdfbcc0d36e67b6cb3b3b859d03c87f1153a980
2023-01-25 17:02:31 +00:00
Nicolas Beaussart
2c3d91b033 frontend: switch cli and server to use the new nx assets
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7533
GitOrigin-RevId: 8adde90a90115c2782dc77b9f30297499f22acab
2023-01-25 12:07:01 +00:00
Rakesh Emmadi
f2a5d7cef3 server/pro/multitenant: Postgres connection routing using kriti templates
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6822
Co-authored-by: paritosh-08 <85472423+paritosh-08@users.noreply.github.com>
Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com>
Co-authored-by: Sooraj <8408875+soorajshankar@users.noreply.github.com>
Co-authored-by: Varun Choudhary <68095256+Varun-Choudhary@users.noreply.github.com>
Co-authored-by: Sean Park-Ross <94021366+seanparkross@users.noreply.github.com>
GitOrigin-RevId: 61cfc00a97de88df1ede3f26829a0d78ec9c0bc5
2023-01-25 07:14:31 +00:00
Solomon
6c7882aa3e GDC Snowflake Integration Tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7528
GitOrigin-RevId: f90ee61899349735dc2fc0fbe6ed499614630a0f
2023-01-25 05:54:31 +00:00
awjchen
12fdac004f server: fix tracing bug where some errors prevent spans from being emitted
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7450
GitOrigin-RevId: 23f6c9cfea8e7ca64b39866d15d2e6187aaaa0d9
2023-01-25 03:38:21 +00:00
Lyndon Maydwell
615fd64c04 Add constraint_name key to *_suggest_relationships Metadata API and increase sensitivity of tables argument
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7625
GitOrigin-RevId: d764f1664b63abbe4a4ff166e0bc7224bcb0dc57
2023-01-24 10:27:35 +00:00
Daniel Chambers
b3a4855fbb Data Connectors Delete Mutations Support [GDC-714]
[GDC-714]: https://hasurahq.atlassian.net/browse/GDC-714?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7623
GitOrigin-RevId: 676682343bc9aa54e1ed6553ebdf39756cfd7b5d
2023-01-24 04:18:47 +00:00
Abby Sassel
85cda65261 server: introduce Native Query Interface prototype feature flag
[NDAT-490]: https://hasurahq.atlassian.net/browse/NDAT-490?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[NDAT-491]: https://hasurahq.atlassian.net/browse/NDAT-491?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[NDAT-468]: https://hasurahq.atlassian.net/browse/NDAT-468?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7487
Co-authored-by: Solomon <24038+solomon-b@users.noreply.github.com>
GitOrigin-RevId: ba679fc69df4b669fc7936cd359b8268e8e1a23a
2023-01-23 13:37:13 +00:00
Daniel Chambers
0b35798fa7 Fix get_source_tables integration data connector config transformation test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7605
GitOrigin-RevId: 02b33784375888854c3f663c3cf0a84b049682a6
2023-01-23 01:06:56 +00:00
awjchen
cc5ee8474a server: always validate the open telemetry metadata configuration
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7446
GitOrigin-RevId: a66bcf654f3b973da0ab1a6f4b956446cd7a10d0
2023-01-22 03:42:20 +00:00
Auke Booij
83ea4a254d server: plumb StoredIntrospection while building the Schema Cache
We'd like to be able to build a Schema Cache from only serializable data. We already have Metadata. The data that's missing to build a Schema Cache is referred to as "stored introspection", and this includes:
- DB introspection
- User-defined enum values (i.e. contents of specific DB tables)
- Remote schema introspection

This PR introduces a new `StoredIntrospection` container that holds that data, and plumbs it through to the right parts of the schema cache building process, so that stored introspection can be used as a substitute for fresh introspection requests against live data sources.

The serialization of `StoredIntrospection` is intended to be straightforward: just take the serialized source introspection results, and put them in an appropriate JSON object. Though I don't think that this PR achieves that entirely.

In order for `StoredIntrospection` to be deserializable (through `aeson` instances), while keeping the required code changes low, this piggy-backs off of the `ResolvedSource` data type. `ResolvedSource` is _almost_ exactly what we want, and _almost_ deserializable, so this PR brings it across the finish line by moving a few things out of that type, and adding a `FromJSON (RawFunctionInfo b)` context to the `Backend` type class.

[PLAT-270]: https://hasurahq.atlassian.net/browse/PLAT-270?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[PLAT-270]: https://hasurahq.atlassian.net/browse/PLAT-270?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[PLAT-276]: https://hasurahq.atlassian.net/browse/PLAT-276?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[PLAT-276]: https://hasurahq.atlassian.net/browse/PLAT-276?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7053
GitOrigin-RevId: 5001b4ea086195cb5e65886747eac2a0a657b64c
2023-01-20 14:52:36 +00:00
pranshi06
ae5f3fe593 server: fix next_retry_at for MSSQL event triggers
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7376
Co-authored-by: Karthikeyan Chinnakonda <15602904+codingkarthik@users.noreply.github.com>
GitOrigin-RevId: 3a287271320fbb489dbabcd163b1b474fa5132b6
2023-01-20 11:16:30 +00:00
Daniel Harvey
0270dbf4b4 [server/tests] use fresh HGE for stringify numeric types tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7582
GitOrigin-RevId: 7c7832d322024b01987f1568a87793a7c0a969db
2023-01-20 10:40:01 +00:00
Daniel Chambers
d6cbbe3e49 Data Connectors update mutations support [GDC-713]
[GDC-713]: https://hasurahq.atlassian.net/browse/GDC-713?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7604
GitOrigin-RevId: e0d496b425bed48f2d53a66584f4c7ecd40b485e
2023-01-20 06:17:59 +00:00
Rikin Kachhia
ded69b361e server: serve local console assets even if console is disabled
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7568
GitOrigin-RevId: ef1548c80280f91aabd94075b658de7d04b8b7a3
2023-01-19 20:08:44 +00:00
Philip Lykke Carlsen
cd5186be90 Implement Schema Parsers for Native Query Interface
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7574
GitOrigin-RevId: 0cb4638a7dd79abf6ccb05092c0c663c84675bbd
2023-01-19 11:27:24 +00:00
Daniel Harvey
0dfeea2c5a [server/tests] de-dupe Postgres harness code
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7581
GitOrigin-RevId: 09f83190e0095d471d7aca6025c43026270d7b58
2023-01-19 10:09:30 +00:00
Lyndon Maydwell
f1328393b9 Return availability information with agents in list_source_kinds API
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7564
GitOrigin-RevId: f05400faab4a261a2992bb4baef39e209db49edb
2023-01-19 05:20:31 +00:00
Daniel Chambers
354f7593d9 Custom update column operator support for Data Connectors [GDC-688]
[GDC-688]: https://hasurahq.atlassian.net/browse/GDC-688?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7548
GitOrigin-RevId: 861638d6cc69803776640b50ffe1646b3cf0a7db
2023-01-19 04:22:58 +00:00
Daniel Harvey
40bcd5545b [server/tests] make useHge work with Fixtures
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7560
GitOrigin-RevId: 370e5b3ee4d508e7ca5eea426886bf6c82d0cde9
2023-01-18 15:53:01 +00:00
Vishnu Bharathi
6133f1c1da ci: tag release v2.17.0
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7567
GitOrigin-RevId: b3eaf2fc506fb1b1bbb06c3a829915d56b47409f
2023-01-18 07:59:39 +00:00
Daniel Chambers
c104ffdb51 Fix SQLite agent including built-in comparison operators as custom operators
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7565
GitOrigin-RevId: 83a8868a80a124aee05b8dd42a4ffa15489891ae
2023-01-18 07:36:00 +00:00
Daniel Harvey
611bd0363f [server] make Custom SQL metadata commands admin-only
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7549
GitOrigin-RevId: a87f4e083b3e3dfeb51fd6e1fbb3158fb4ac2edf
2023-01-17 16:09:58 +00:00
Anon Ray
139aca3a25 server: add kind field to livequery-poller-log (GS-329)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7394
GitOrigin-RevId: 34663eb7c0c312b735c77e1855de32dd3a3fba5f
2023-01-17 13:55:16 +00:00
Tom Harding
9052208b6c Add a "roles and permissions" deep dive
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7467
GitOrigin-RevId: 915a963d3a237a7f95bed757e3cc5a5bf6c8134b
2023-01-17 09:41:36 +00:00
Daniel Chambers
308d310d62 Refactor Mock Data Connector Agent Integration Tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7531
GitOrigin-RevId: b5111a46ba42c22b110a021b8d0404b114edaba7
2023-01-17 06:44:48 +00:00
Lyndon Maydwell
8d6b9f70f1 Datasets implementation for dataconnectors
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7502
GitOrigin-RevId: 7ca9a16aa2b27f4efb1263c6415e5a718ca8ced8
2023-01-17 05:49:10 +00:00
Daniel Chambers
bfdeaf0334 Data Connectors insert mutations support [GDC-609]
[GDC-609]: https://hasurahq.atlassian.net/browse/GDC-609?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7513
GitOrigin-RevId: cb401e3ed84c5b60ec59b63dc478a1162b360135
2023-01-17 00:35:22 +00:00
Daniel Harvey
06b284cf33 [server] metadata API for native access
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7476
Co-authored-by: Tom Harding <6302310+i-am-tom@users.noreply.github.com>
GitOrigin-RevId: 781c29666e92004dc82918c2292fdacc27fded4c
2023-01-16 17:21:22 +00:00
Samir Talwar
4175b53395 server/api-tests: Add a Docker Compose file for the API tests.
We were previously using the Docker Compose file in the root directory
for manual testing _and_ the server API tests.

This splits them so we can e.g. add Yugabyte for easy manual testing.

In the future, this will also allow us to use ephemeral ports for API
test databases, while keeping the fixed ports for manual testing.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7524
GitOrigin-RevId: 7244e296b0ed0ace9782b6f44f321933a9d9a49d
2023-01-16 16:44:10 +00:00
Jesse Hallett
d6a354b71d server: codec for SourceCustomization
Small PR with a few easy codecs

Ticket: https://hasurahq.atlassian.net/browse/GDC-585

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7325
GitOrigin-RevId: 2495ad1a17e86625ac037a681beebb99f377eb03
2023-01-12 20:57:20 +00:00
Solomon
f786101922 Gardening: Code cleanup around config transformations for dataconnector backends
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7481
GitOrigin-RevId: d1605b8a03e65cd16fc98aa4bc046c0b21b370cc
2023-01-11 23:13:26 +00:00
David Overton
a9f77acb32 Remove builtin scalar types from Data Connector backend
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7167
Co-authored-by: Daniel Chambers <1214352+daniel-chambers@users.noreply.github.com>
GitOrigin-RevId: 926e7282b908e3a9669ac39d625aa54971e11c37
2023-01-11 02:37:26 +00:00
Gil Mizrahi
7393c152e3 add a temporary static flag for pqnp
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7485
GitOrigin-RevId: 482b0f11f21acb67c9fa95a93b88ac2e45df9430
2023-01-10 13:00:32 +00:00
Naveen Naidu
99fb6ac22f server/mssql: fix handling of special language characters in event trigger payload
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7448
GitOrigin-RevId: d87357fe2a54d755c893938db5fb6193316b0b79
2023-01-10 08:50:52 +00:00
ananya-2410
cccc0dc309 ci: update catalog version for v2.17.0-beta.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7483
GitOrigin-RevId: af9a79e69a7a679ee4eea0756e58ec770bf7d7df
2023-01-10 07:28:40 +00:00
Daniel Chambers
57607f5295 Refactor Update IR to generalize Update vs Update Many across backends - compositional approach [GDC-687]
[GDC-687]: https://hasurahq.atlassian.net/browse/GDC-687?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[GDC-687]: https://hasurahq.atlassian.net/browse/GDC-687?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7355
GitOrigin-RevId: fa02a83c0c594abe05c1071d0de5054478c32e56
2023-01-10 01:56:14 +00:00
Auke Booij
d96203f602 server: bring graphql-parser-hs GHC options in line with main code
This is mainly about removing `StandaloneKindSignatures`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7428
GitOrigin-RevId: 9b28c9b119f50c49a1b5c48391d537f1575700b4
2023-01-09 15:31:20 +00:00
Abby Sassel
62eafe26b6 server: replace note about ignored _stringifyNumbers in MSSQL remote relationships plan
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7463
GitOrigin-RevId: d6be472f13cd30da3a5f0ace05190698c94e3347
2023-01-09 10:52:18 +00:00
Lyndon Maydwell
d34bea3e97 Metadata API for Suggesting Relationships from HGE
[GDC-629]: https://hasurahq.atlassian.net/browse/GDC-629?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7420
GitOrigin-RevId: 0bf69f8409d5141783f9cf5d8d54f798d9e05e65
2023-01-09 07:26:55 +00:00
Daniel Harvey
e58ebb10e0 [server/test] Postgres cross-schema tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7437
GitOrigin-RevId: f324fd4ede516238ec4904dd19c0094e21b69b7d
2023-01-06 15:36:19 +00:00
Puru Gupta
bf201e534c server: refactor serverctx data types
## Description
This PR merges the data type `ServeCtx` into `ServerCtx` to create a single data type which has all the required context to run HGE.

## Motivation
This consolidated data type will be easier to update/maintain in case of any changes to the user config.

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

[GS-301]: https://hasurahq.atlassian.net/browse/GS-301?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7396
GitOrigin-RevId: f37594d15855bb50e556a4b11a58609af3f9f312
2023-01-06 09:34:44 +00:00
Puru Gupta
f047b7dd17 server: update the jwt refresh thread to poll
## Description
This PR updates the JWK refresh thread to poll every second instead of the previous behaviour where the thread used to sleep based on the expiry time in `Cache-Control`/`Expires` response headers.

## Motivation
As a part of dynamically updating environment variables on cloud without restart the user projects, we want to implement a mechanism which makes HGE aware of any changes in the user configuration by updating a shared variable data type which can be accessed by relevant threads/core functionality before their execution.

The above updates requires us to make the threads polling in nature such that before executing their code, any change in the user config is captured and the appropriate behaviour is channelised. In the case of JWK updating thread, the thread used to sleep for the time as mentioned in the `Cache-Control` or `Expires` headers which make the thread unware of any new changes in the user config in that period of time, hence requiring a restart to propogate the new changes.

To solve this problem we have now updated the JWK update thread to poll every second for change in `AuthMode`(from a shared variable in subsequent changes to implement the dynamic env var update feature) and update the JWK accordingly such that it does not use any stale configurations and works without HGE restart.

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

### Solution and Design
- We store the expiry time in the `JWTCtx`
- On every poll check whether the current time exceeds the expiry time, in which case we call the JWK url to fetch the new JWK and expiry.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7177
Co-authored-by: Krushan Bauva <31391329+krushanbauva@users.noreply.github.com>
Co-authored-by: Anon Ray <616387+ecthiender@users.noreply.github.com>
GitOrigin-RevId: bc1e44a8c3823d7554167a7f01c3ce085646cedb
2023-01-06 06:40:40 +00:00
Gil Mizrahi
09d053c7ad Show RQL IR Select
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7423
GitOrigin-RevId: 0bd669c49bf27b409787f168be5c2778d74bceda
2023-01-04 08:29:43 +00:00
Philip Lykke Carlsen
b1f065447f server/tests: Update README.md files
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7426
GitOrigin-RevId: b16cbe61c5274146c9adc1434a48dc95c964dd8c
2023-01-03 14:27:22 +00:00
Philip Lykke Carlsen
67280023a2 server/tests: Ability to run HGE via external process.
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7329
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
GitOrigin-RevId: 74b293a1d5fb7de52a85e42cfcb0314af0006822
2023-01-03 14:05:02 +00:00
paritosh-08
9309d2512a server: quote object names for MSSQL event triggers
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7398
GitOrigin-RevId: 47565981e0b5b5a198e2cd06e29b58d16693d75e
2023-01-03 06:47:38 +00:00
paritosh-08
0b7ed96c46 server/telemetry: add experimental feature list
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7395
GitOrigin-RevId: f6a8c847c42c65616e816175135f0002e5f8c684
2022-12-28 07:16:35 +00:00
awjchen
1ec5efd5d3 server: replicate log-based data transfer metrics as prometheus metrics
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7354
GitOrigin-RevId: 3f49b8ebba515b42a9d7b22e83e6f39d9d6087c6
2022-12-28 03:49:33 +00:00
Jesse Hallett
4f996fcb2f server: codecs for some health check types
Small PR with codecs for a few health check types. This adds a `HasCodec` implementation for `Seconds` to `hasura-prelude`.

Ticket: https://hasurahq.atlassian.net/browse/GDC-585

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7328
GitOrigin-RevId: 8da2d9115d76be7177e5cc72a333c5a9cf6f759a
2022-12-23 18:16:58 +00:00
paritosh-08
825e256523 server: respect custom column name for graphql-default
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7289
GitOrigin-RevId: a1d0174034c9f2ee3577b05932db6a159aca4220
2022-12-23 11:03:48 +00:00
awjchen
ee78e32c6e server: implement trace sampling
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7300
GitOrigin-RevId: d96d7fa5aaf0c1e71d1c4c0fa8f0162abce39e18
2022-12-22 19:48:51 +00:00
Rakesh Emmadi
e1bf220b37 fix the issue with multiplexed queries, where a run-time exception caused by one subscription causes all subscriptions to fail (fix #9281)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7230
GitOrigin-RevId: e94764a4652e7ee99e0e39d64436aa05620086cb
2022-12-22 17:09:30 +00:00
Tom Harding
8490874eab Show instance for GlobalTestEnvironment
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7370
GitOrigin-RevId: 77dbcfb686219ce23e4d751c8d934f81c04a222d
2022-12-22 13:19:34 +00:00
Tom Harding
8325c03500 Update the fixture repl macro
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7366
GitOrigin-RevId: f34a42c4dfd2dc257ffe39f4a0db12beb2630629
2022-12-22 11:26:48 +00:00
Jesse Hallett
f4fa960ec6 server: safely signal backend support for event triggers
Hooks up event trigger codecs from #7237. This required fixing a problem where some backend types implemented `defaultTriggerOnReplication` with `error` which caused the server to crash when evaluating those for default values in codecs. The changes here add a type family to `Backend` called `XEventTriggers` that signals backend support for event triggers, and changes the type of `defaultTriggerOnReplication` to from `TriggerOnReplication` to `Maybe (XEventTriggers b, TriggerOnReplication)` so that it can only be implemented with a `Just` value if `XEventTriggers b` is inhabited. This emulates some existing type families in `Backend`. (Thanks to @daniel-chambers for this suggestion!)

I used the implementation of `defaultTriggerOnReplication` as a signal for event triggers support to prune the Metadata API so that event trigger fields will not appear in the OpenAPI spec for backend types that do not support event triggers. The codec version of the API will also not emit or accept those fields for those backend types. I think I could use `Typeable` to test whether `XEventTriggers` is `Void` instead of testing whether `defaultTriggerOnReplication` is `Nothing`. But the codec implementation will crash anyway if `defaultTriggerOnReplication` is `Nothing`.

I checked to make sure that graphql-engine-pro still compiles.

Ticket: https://hasurahq.atlassian.net/browse/GDC-521

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7295
GitOrigin-RevId: 2b2dd44291513266107ca25cf330319bf53a8b66
2022-12-21 17:15:31 +00:00
Samir Talwar
204ec89c61 server/tests-py: Get all tests passing with separate HGE binaries.
This rewrites the last couple of Python tests that were failing when run with a separate HGE binary per test class. The changes are as follows:

1. The event triggers tests, naming conventions tests, and subscriptions tests all generate a new source DB per test, so can run in parallel.
2. The scheduled triggers tests use the correct URL for the trigger service when the port is generated randomly.
3. Whitespace and trailing commas are added to the scheduled triggers tests.
4. Support for SQL Server is added to _hge.py_ so the naming conventions test that runs on SQL Server passes. (The other SQL Server tests do not pass and we're not going to bother with them for now.)
5. Container names are fixed in _run.sh_.
6. _run.sh_ and _run-new.sh_ don't pull images explicitly as it's annoying when running tests a lot. If you want to pull the latest versions, just run `docker compose pull` from the _server/tests-py_ directory, or the root directory. (If you don't have the images at all, they'll still be pulled automatically.)

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7350
GitOrigin-RevId: db58f310f017b2a0884fcf61ccc56d15583f99bd
2022-12-21 15:56:41 +00:00
Daniel Harvey
9a59204525 [server/tests] Round trip tests for BigQuery types
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7310
GitOrigin-RevId: aaff93e6288ca933770d9ecfa6c5350ebf8177b3
2022-12-21 13:58:58 +00:00
Daniel Harvey
dc99e919d9 server/tests: search for 'things containing db name' not just 'db name'
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7343
GitOrigin-RevId: 2c8be65c71eec1ada4a0ca716d0b95ba21325a0d
2022-12-21 11:58:32 +00:00
Tom Harding
aa63e58d79 Fix regression test for Yugabyte
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7347
GitOrigin-RevId: 073a5a121440b822b0b393ee3bf3fea640ffb47f
2022-12-21 10:32:58 +00:00
Samir Talwar
8625228ab3 pool: Add test coverage to the resource pool.
Adds a bunch of tests to the _resource-pool_ code to try and track down a bug.

Not surprisingly, all tests pass, which means that this didn't help. I still think it's worth keeping them.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7330
GitOrigin-RevId: 6d4deb9af5b192b3a0aa34ac0751d28e12b22b48
2022-12-21 09:45:58 +00:00
Solomon
c081f6ac6e Fix integration test for get_table_info
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7353
GitOrigin-RevId: 91fa4e8be2d022f29d17985fa241f4ff14421462
2022-12-21 04:41:07 +00:00
Solomon
d4700283e7 Applies template transform in get_table_info metadata call
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7349
GitOrigin-RevId: c9e7dd70bf7ff27807028f99254ce8973acdc468
2022-12-20 23:39:49 +00:00
Solomon
ca6a46790c [GDC] Add Athena Test Fixture
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6934
GitOrigin-RevId: 31c9071b9e904fbe31034157d83605e0a625bef1
2022-12-20 18:47:07 +00:00
Abby Sassel
d0f31e59e8 server/tests: cleanup RemoteRelationshipStringifyNum8387Spec
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7333
GitOrigin-RevId: 91a1d4726523033e7b3018d18b45aa98babac7a7
2022-12-20 08:45:38 +00:00
Brandon Martin
5aa1385644 Revert catalog version and migrations from #7034
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7306
GitOrigin-RevId: bf5461ed3127052d7f2b2d0521d5f59a3ec90d04
2022-12-19 18:39:58 +00:00
Abby Sassel
a8500b44ed server/fix: stringify-numeric-types option in remote database relationships (fix #8387)
Fix bug where `stringify-numeric-types` option is not respected in remote database relationships

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7302
GitOrigin-RevId: a649b00b45ca0f67dc84ad893d3d98529b064c77
2022-12-19 14:04:58 +00:00
Samir Talwar
07be94c4eb server: Destroy metadata database connection pools on shutdown.
We currently let the garbage collector and/or the operating system clean up our mess. This is mostly fine in production (kind of) but a problem when we want to start many HGE servers in parallel for testing purposes.

Shutting them down should, in theory, ease the load.

There is more work to be done in the API test suite before this is very helpful. Right now the test suite actually runs the finalizers on the server context straight away and then uses the leaked resources. As there's no way to actually "close" a connection pool, it keeps working regardless. If we wanted to be strict about this we might want to add a "closed" flag to `Data.Pool` which would cause an exception on `withResource` after closing it.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7299
GitOrigin-RevId: ba02f96c7b5b06ba3ba7080a5583a56cb0efcfa7
2022-12-19 12:46:42 +00:00
Daniel Harvey
2bfca9941d [server] newtypes for BigQuery projectId and dataset
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7279
GitOrigin-RevId: 878367c073280111f381eec75c5b53e9e02bd3cd
2022-12-16 13:19:05 +00:00
Karthikeyan Chinnakonda
0a68d00422 server: remove a redundant argument passed to replaceMetadataV2
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7291
GitOrigin-RevId: 841144cdf9e70fb682cd27ea5f918b168f2a3bbd
2022-12-16 10:21:04 +00:00
Jesse Hallett
4d6604ba08 server: event trigger codecs
Codecs for event triggers, including webhook transforms. These are not hooked into the higher-up table metadata codec yet because some backend implementations implement event triggers with `error` which causes an error when codecs are evaluated. I plan to follow up with another PR to resolve that.

Ticket: https://hasurahq.atlassian.net/browse/GDC-585

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7237
GitOrigin-RevId: 8ce40fe6fedcf8b109d6ca50a505333df855a8ce
2022-12-15 20:38:21 +00:00
Tom Harding
1d0b466954 Run the DefaultRootFieldSpec tests on all backends.
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7293
GitOrigin-RevId: f7c22212badc11016e87a491bb0017642b3ac7c0
2022-12-15 18:18:29 +00:00
Jesse Hallett
c265e303f6 server: codecs for remote schemas metadata
These codecs should fully cover the `remote_schemas` property of the Metadata type.

Ticket: [GDC-522](https://hasurahq.atlassian.net/browse/GDC-522)

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6812
GitOrigin-RevId: 1b256f6829486295957c232b92ff184bd9a86469
2022-12-15 17:39:22 +00:00
Philip Lykke Carlsen
bd2e2080f8 server/tests: Port TestGraphQLQueryFunctions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7158
GitOrigin-RevId: a4b3ca8565df37905665303f96fd40ec4b9e76dd
2022-12-15 16:42:55 +00:00
Tom Harding
ae33e34e2d Implement permission checks in the API tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7264
GitOrigin-RevId: 55ff8ff31609b7598d2382ded5dd96f5825ee4fd
2022-12-15 16:02:31 +00:00
paritosh-08
9f99a40f2d Revert "server: fix MSSQL event trigger next_retry_at"
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7290
GitOrigin-RevId: 4cb461dd6f25e55ba1c9bd587d98a56f71ff8223
2022-12-15 15:31:40 +00:00
Naveen Naidu
282e94b2de pro/server: add user_id of the collaborator in http_log
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7154
GitOrigin-RevId: 6f60a7c7be5b083e6adf6c3ab9991142f62434df
2022-12-15 07:49:37 +00:00
Tom Harding
f2dd4a5eb7 Remove *Source fields from API test permissions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7275
GitOrigin-RevId: 44345ec361fdbb93f2c166825e5d78983759b5b0
2022-12-14 18:43:44 +00:00
Samir Talwar
beb20c7dab server/tests-py: Remove a check for PostgreSQL 10.
We no longer support this and therefore don't run tests against it.

This also refactors the code a little so it doesn't have to skip running a PostgreSQL-specific test against MS SQL Server.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7201
GitOrigin-RevId: 307c2ab0052162c012f7b1c55866b57f2fa6d9a6
2022-12-14 16:57:28 +00:00
Abby Sassel
57f456a4cf add run-new.sh docs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7278
GitOrigin-RevId: 6c17cc846b39a4236f65dd5ab6baac4529b38f4c
2022-12-14 16:11:00 +00:00
Divi
62708ca6bd ci: update catalog version for v2.16.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7271
GitOrigin-RevId: a7978ae1c0dd4d402f6293a74cf45acba560a456
2022-12-14 07:14:24 +00:00
Brandon Simmons
3b0ad30757 server: don't compress small responses
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7216
GitOrigin-RevId: 20a94267eca42edf8e79470711766a3fecac0f50
2022-12-13 17:50:01 +00:00
paritosh-08
3397c041bc server: fix MSSQL event trigger next_retry_at
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7173
GitOrigin-RevId: 862ab4136e0df6b7fa1e2db2c3edfffa318452de
2022-12-13 15:18:23 +00:00
Gil Mizrahi
570e16efe7 Revert "[server/test] create new HGE per test"
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7255
GitOrigin-RevId: c971e9e227263b0956069c0687acacf4d3ff90a9
2022-12-13 12:37:27 +00:00
Auke Booij
51fc104793 server: don't let query collection validation prevent engine startup
Generate more Metadata Inconsistencies instead of startup failures. Specifically this means that
- errors retrieving the main query of an executable GraphQL document, and
- errors during fragment inlining

no longer fail irrecoverably.

This also makes more parts of `buildSchemaCacheRule` into pure code, which is always nice.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7234
GitOrigin-RevId: aebf636c2fb1aad1c2df9a37f7d0b67c1ee40c42
2022-12-13 09:56:27 +00:00
Daniel Harvey
ed190d6cb6 [server/tests] drop old postgres database better, and use less connections
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7227
GitOrigin-RevId: d7b3b313440d3f3c91d4ecb550513b53cbf2e92e
2022-12-12 17:46:12 +00:00
kodiakhq[bot]
3ad81d18c8 [tooling] import hasura/pool into monorepo
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7226
Co-authored-by: Bryan O'Sullivan <23374+bos@users.noreply.github.com>
Co-authored-by: Falko Peters <41595+informatikr@users.noreply.github.com>
Co-authored-by: Bas van Dijk <576355+basvandijk@users.noreply.github.com>
Co-authored-by: Ozgun Ataman <13820+ozataman@users.noreply.github.com>
Co-authored-by: Michael Snoyman <49415+snoyberg@users.noreply.github.com>
Co-authored-by: Kim Altintop <6163+kim@users.noreply.github.com>
Co-authored-by: Vamshi Surabhi <6562944+0x777@users.noreply.github.com>
Co-authored-by: Evie Ciobanu <1017953+eviefp@users.noreply.github.com>
Co-authored-by: Robert <132113+robx@users.noreply.github.com>
Co-authored-by: Auke Booij <164426+abooij@users.noreply.github.com>
GitOrigin-RevId: c99a93563f9b1aa25e69ecc030f8dc526df4fb6b
2022-12-12 16:10:25 +00:00
Daniel Chambers
a26ecbc2b0 Enable mutations root field parsing for Data Connectors [GDC-665]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7221
GitOrigin-RevId: 88da78cd758bc8c2273b0d71a79d5fe46a4bc565
2022-12-12 04:42:56 +00:00
Brandon Simmons
6451d9c9ce server: refactor Hasura.Server.Compression for clarity/correctness
context: This is  foundation work, before we change how the server chooses to compress or not
part of effort: #5518

-----

Prior to this change it was difficult to understand how the functionality in this module related to the semantics of Accept-Encoding. We also didn't correctly handle directives with qvalues.

After this change certain technical infelicities are called out without modifying the behavior of the server; for instance we continue to fall back to identity (no compression) in the case where technically we're supposed to return 406, and we also  continue to treat `*` conservatively as meaning “use no compression”.

The only external change here is `gzip;q=x.y` now results in a zipped response.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7213
GitOrigin-RevId: 1910ffd70d29f1ab8825c601f1bd998be70ceeeb
2022-12-09 06:08:27 +00:00
pranshi06
8dab7df169 server: fix error in metadata APIs with inconsistency
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6669
Co-authored-by: Tirumarai Selvan <8663570+tirumaraiselvan@users.noreply.github.com>
Co-authored-by: Sean Park-Ross <94021366+seanparkross@users.noreply.github.com>
GitOrigin-RevId: 1b004074b41ccb6512123cdb1707b39792e97927
2022-12-08 16:04:55 +00:00
Daniel Harvey
e37b91a25a [server/tests] limit capabilities in matrix tester using RTS opts
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7202
GitOrigin-RevId: c2b6ff37a0b5839726d02c04c69fadeff4465022
2022-12-08 08:45:34 +00:00
Samir Talwar
2ee0dbf8eb server: Fix permissions when running an update_table_many query.
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6969
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 4c6f6959dd69ff861a0333619f7ad90a013ed6ef
2022-12-08 08:04:08 +00:00
Lyndon Maydwell
e9dcbf6491 Adding custom scalar types to SQLite DC Agent - GDC-610
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6783
Co-authored-by: David Overton <7734777+dmoverton@users.noreply.github.com>
Co-authored-by: Daniel Chambers <1214352+daniel-chambers@users.noreply.github.com>
GitOrigin-RevId: ee53c20b0090b6b3c88792ddc98b8287872fe0f3
2022-12-08 06:50:08 +00:00
Daniel Chambers
c14fd3ba4c Add mutability properties to the Data Connector schema API [GDC-664]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7190
GitOrigin-RevId: ce602b5e5cc5aee8716ff3f7a036b18b3bf47188
2022-12-08 02:07:01 +00:00
Daniel Harvey
1dd9e19b69 [server/test] create new HGE per test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7111
GitOrigin-RevId: 6d3e88cb29ca3e98cbd16141c9f924aa36fa6b43
2022-12-07 17:06:42 +00:00
Krushan Bauva
c540f803a6 server: add server_type information to version API
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7141
GitOrigin-RevId: e1d1c780e6b588f0868003eb6d40019960246aba
2022-12-07 11:30:20 +00:00
kodiakhq[bot]
3f3b19c565 server: tune builder runners, for ByteStrings we're about to send
`toLazyByteString` is a little deficient in two ways:

- It allocates relatively large chunks (4KB + 32KB +32KB, etc…) which is wasteful for small ByteStrings
- It shrinks each chunk (Copying the data to a new chunk of exactly the right size) if it's not more than half filled. If we're running the builder right before we send it over the wire, this copy is totally extraneous (we simply end up with more work for the next GC)

part of the effort: https://github.com/hasura/graphql-engine-mono/issues/5518

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7187
GitOrigin-RevId: b499cd49c33da6cfee96be629a36b5c812486e39
2022-12-07 06:01:08 +00:00
Lyndon Maydwell
3d5fb984b0 Fix metadata defaults bug - Defaults serialised into metadata table - GDC-647
## Description

There is a bug in the metadata defaults code, see [the original PR](https://github.com/hasura/graphql-engine-mono/pull/6286).

Steps to reproduce this issue:

* Start a new HGE project
* Start HGE with a defaults argument: `HASURA_GRAPHQL_LOG_LEVEL=debug cabal run exe:graphql-engine -- serve --enable-console --console-assets-dir=./console/static/dist --metadata-defaults='{"backend_configs": {"dataconnector": {"mongo": {"display_name": "BONGOBB", "uri": "http://localhost:8123"}}}}'`
* Add a source (doesn't need to be related to the defaults)
* Export metadata
* See that the defaults are present in the exported metadata

## Related Issues

* Github Issue: https://github.com/hasura/graphql-engine/issues/9237
* Jira: https://hasurahq.atlassian.net/browse/GDC-647
* Original PR: https://github.com/hasura/graphql-engine-mono/pull/6286

## Solution

* The test for if defaults should be included for metadata api operations has been extended to check for updates
* Metadata inconsistencies have been hidden for `/capabilities` calls on startup

## TODO

* [x] Fix bug
* [x] Write tests
* [x] OSS Metadata Migration to correct persisted data - `server/src-rsr/migrations/47_to_48.sql`
* [x] Cloud Metadata Migration - `pro/server/res/cloud/migrations/6_to_7.sql`
* [x] Bump Catalog Version - `server/src-rsr/catalog_version.txt`
* [x] Update Catalog Versions - `server/src-rsr/catalog_versions.txt` (This will be done by Infra when creating a release)
* [x] Log connection error as it occurs *(Already being logged. Requires `--enabled-log-types startup,webhook-log,websocket-log,http-log,data-connector-log`)
* [x] Don't mark metadata inconsistencies for this call.

## Questions

* [ ] Does the `pro/server/res/cloud/migrations/6_to_7.sql` cover the cloud scenarios?
* [ ] Should we have `SET search_path` in migrations?
* [x] What should be in `server/src-rsr/catalog_versions.txt`?

## Testing

To test the solution locally run:

> docker compose up -d

and

> cabal run  -- exe:api-tests --skip BigQuery --skip SQLServer --skip '/Test.API.Explain/Postgres/'

## Solution

In `runMetadataQuery` in `server/src-lib/Hasura/Server/API/Metadata.hs`:

```diff
-        if (exportsMetadata _rqlMetadata)
+        if (exportsMetadata _rqlMetadata || queryModifiesMetadata _rqlMetadata)
```

This ensures that defaults aren't present in operations that serialise metadata.

Note: You might think that `X_add_source` would need the defaults to be present to add a source that references the defaults, but since the resolution occurs in the schema-cache building phase, the defaults can be excluded for the metadata modifications required for `X_add_source`.

In addition to the code-change, a metadata migration has been introduced in order to clean up serialised defaults.

The following scenarios need to be considered for both OSS and Cloud:

* The user has not had defaults serialised
* The user has had the defaults serialised and no other backends configured
* The user has had the defaults serialised and has also configured other backends

We want to remove as much of the metadata as possible without any user-specified data and this should be reflected in migration `server/src-rsr/migrations/47_to_48.sql`.

## Server checklist

### Catalog upgrade

Does this PR change Hasura Catalog version?
-  Yes

### Metadata
Does this PR add a new Metadata feature?
-  No

### GraphQL
-  No new GraphQL schema is generated

### Breaking changes
-  No Breaking changes

## Changelog

__Component__ : server
__Type__: bugfix
__Product__: community-edition

### Short Changelog

Fixes a metadata defaults serialization bug and introduces a metadata migration to correct data that has been persisted due to the bug.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7034
GitOrigin-RevId: ad7d4f748397a1a607f2c0c886bf0fbbc3f873f2
2022-12-06 22:35:19 +00:00
Gil Mizrahi
a948e3460a add ci scripts for produce-feature-matrix
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7144
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
GitOrigin-RevId: ab4e2e62ee2e347dfbbe08c16688b2ddfa3a1b1c
2022-12-06 16:42:39 +00:00
paritosh-08
3d4c66041f server: add event_processing_time metric
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6987
GitOrigin-RevId: 4f5948a225b18e2db59572482d2a608117fbb7d0
2022-12-06 15:11:04 +00:00
Solomon
599d9fd602 Dynamic Dispatch For Test Harness BackendType Metadata
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6982
GitOrigin-RevId: faeec9ba0dfcb641c13cdc3f88244237fb370c66
2022-12-06 00:06:53 +00:00
Gil Mizrahi
f45c379866 add concurrent_bulk api for parallel processing of read-only queries
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7087
Co-authored-by: Tom Harding <6302310+i-am-tom@users.noreply.github.com>
Co-authored-by: Luca Restagno <59067245+lucarestagno@users.noreply.github.com>
GitOrigin-RevId: 0d7a212d004908bc014def9d3828647545c9e062
2022-12-05 13:50:19 +00:00
Daniel Harvey
ba800ec978 [pg-client] test cancelled queries actually stop running queries
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7091
GitOrigin-RevId: 71cc1291d45a90a2c4f3519e12e365e968368dca
2022-12-05 12:19:11 +00:00
Daniel Harvey
aa9499ee0e [server/tests] remove unnecessary cleanup
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7157
GitOrigin-RevId: 93dc285c8629586336e56bb1622d94af0faa3e0e
2022-12-05 11:41:38 +00:00
Philip Lykke Carlsen
392ecf72b3 server: Improve modelling of function metadata and schema diffing
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7140
GitOrigin-RevId: 83f54308d002391903d3c3d421e589949e7d4dc4
2022-12-05 10:22:15 +00:00
Gil Mizrahi
1970785970 fix api-tests warnings and enable -Wall
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7137
GitOrigin-RevId: 1c06f99ef94e1343d33c79e59e844c0470ba71aa
2022-12-05 08:31:00 +00:00
Vishnu Bharathi
73ad0275f3 ci: tag release v2.16.0
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7148
GitOrigin-RevId: 25adaa09c57471ed96d3d131abfa6c6c4225d6fd
2022-12-05 07:37:26 +00:00
Daniel Chambers
354ab2f7aa Use Sandwich test framework for Data Connector agent test suite
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7133
GitOrigin-RevId: 625dde70d1c594dcdfd377efac78710174a74efc
2022-12-05 02:16:01 +00:00
Philip Lykke Carlsen
886302fd7e server/tests: Introuce pytest-to-haskell porting script
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7054
GitOrigin-RevId: 2c4597465da28d26993b347693813ce7d42962d3
2022-12-02 15:59:19 +00:00
Gil Mizrahi
2f83899979 Fix mssql aggregation test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7142
GitOrigin-RevId: 66447f0bd7859b3fc5203d87cba5ea2c6d5f054e
2022-12-02 12:53:32 +00:00
Daniel Harvey
ef5e983aee [server/tests] simplify TestEnvironment
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7123
GitOrigin-RevId: 0a7313dab729de08e273ba06e47f656d766ff82a
2022-12-02 11:36:57 +00:00
Daniel Harvey
16ecd63b01 [server/tests] don't do detailed teardown
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7128
GitOrigin-RevId: cbc52dadaca8ef7d4affb43528e8dcec0c8ec62e
2022-12-02 09:00:07 +00:00
Solomon
6c106c9e35 [GDC] Transform SourceConnConfig in runGetSourceTables
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7112
GitOrigin-RevId: d6ab09ba001fa8d4d33cc8f669b588459360f910
2022-12-02 08:02:20 +00:00
Gil Mizrahi
e752010a83 Gil/fix feature matrix test and apply css
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7125
GitOrigin-RevId: fa051a4942a882efe6e3d673eab084b94ec8dd90
2022-12-01 19:26:39 +00:00
Abby Sassel
13eb1122ed server/tests: Table Computed Fields > Postgres
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7122
GitOrigin-RevId: e8c191a87465c1810908e8851bcc4b6919873bd8
2022-12-01 16:43:54 +00:00
Gil Mizrahi
9ce6fe7197 Feature matrix standalone tester tool
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7120
Co-authored-by: Samir Talwar <47582+SamirTalwar@users.noreply.github.com>
GitOrigin-RevId: 5db7f8e24f22414805b10143248bfacfb5b7a03a
2022-12-01 14:48:55 +00:00
Anon Ray
b398001c87 server/gardening: drop an unnecessary field from 'ServeCtx'
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7108
GitOrigin-RevId: 50caff9e60d53261ce15870338bc3aa97c479190
2022-12-01 07:48:58 +00:00
David Overton
a18c6976f8 Map scalar types to GraphQL built-in types for parsing [GDC-587]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6818
GitOrigin-RevId: 6d1887fb7865fe8ec24a73c77da291c7ecf8dfd2
2022-12-01 00:08:40 +00:00
Jesse Hallett
d6b8f29383 server: implement codecs for table permissions
This PR implements the remaining codecs for table permissions. However the codec for boolean expressions delegates to Aeson instances because Autodocodec doesn't currently have the necessary feature to write a codec for boolean expressions that will reliably parse valid data.

Boolean expressions are objects with keys like `_and`, `_or`, `_exists`, or `<field name>`. The parsing rules for each value depend on the key, so we need to be able to select different codecs for each key. We could do that with an `object` codec, but that doesn't account for the arbitrary field name keys that can be provided. OpenAPI supports object types with "additional properties", but I don't know if we can declare a specific type for those properties. There might or might not be a reasonable path to extending Autodocodec to handle this case.

Ticket: [GDC-585](https://hasurahq.atlassian.net/browse/GDC-585)

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6978
GitOrigin-RevId: 0b0dcfd59ebd1d5022ff2ab86dd8d4c6f93bd039
2022-11-30 19:33:16 +00:00
Auke Booij
512340b864 Collect Metadata dependencies in a Sequence rather than a list
Dependencies seem to get concatenated very often, so let's use a data structure that supports efficient concatenation.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7050
GitOrigin-RevId: 6331963f99f17d1b908a6038318d8c4834cf4dd7
2022-11-30 18:13:31 +00:00
kodiakhq[bot]
26ce8ff768 server: -O1 + -funfolding-use-threshold=640, for memory residency
...and keep binary size down using `--gc-sections` (supported by all major linkers). Stripped size after this PR is `85.3 Mb` down from `121 Mb` on `main`.

This compliments Auke's recent work (though there is some overlap). See: https://github.com/hasura/graphql-engine-mono/pull/7033#issuecomment-1326673632

Old experiments, for reference:
https://github.com/hasura/graphql-engine-mono/pull/6605
https://github.com/hasura/graphql-engine-mono/pull/6606
https://github.com/hasura/graphql-engine-mono/pull/6589

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7079
GitOrigin-RevId: 0b0d86730fb959d6249bd17a87e39af12ef71261
2022-11-30 17:05:15 +00:00
Philip Lykke Carlsen
9bc1ff1d8e Structured logging in test-harness
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7092
GitOrigin-RevId: 201ee3ddc205bfc9d55c167e0b70b6606dbe4aa7
2022-11-30 12:12:21 +00:00
Philip Lykke Carlsen
3d1c663f51 server/tests: Remove pytest version of TestGraphQLQueryBasicCitus
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7073
GitOrigin-RevId: 17c6f4848d3c8dfb268a04442ec3a95f117fef89
2022-11-30 11:08:07 +00:00
Abby Sassel
74e30b8b0b Server/tests: Scalar Computed Fields > Postgres
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7094
GitOrigin-RevId: f5e632adc99ffa628a09d6703d2fdba9d2ade53e
2022-11-30 11:02:53 +00:00
Auke Booij
cfc9d7d219 server: build even more parts of the Schema Cache monadically
Rewrites the schema cache building code monadically for the following features as well:
- REST endpoints
- Cron triggers
- OpenTelemetry config
- Remote schema cache (post-introspection only), mainly remote schema relationships
- Actions
- Inherited roles

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7049
GitOrigin-RevId: c0727c6a170a27f722cc173973658ad201ebedb5
2022-11-30 09:12:15 +00:00
Vishnu Bharathi
3c9e914931 ci: tag release v2.16.0-beta.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7103
GitOrigin-RevId: 52de369fc4bd35a92884706df4c0ec7c889d516c
2022-11-30 08:11:23 +00:00
paritosh-08
4e4f31de23 server: fix streaming subscription input type names
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7077
GitOrigin-RevId: dbc07b0c6e3d1c5721d15310623f27e74e1a6082
2022-11-30 06:48:58 +00:00
awjchen
04871c8a41 pro-server: add unit tests for the opentelemetry exporter
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6981
GitOrigin-RevId: 965fd2c4907c20407af9a987e9ea2e29f7e87349
2022-11-30 04:49:18 +00:00
awjchen
b1cb73e964 server: add another log line for metadata sync
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7102
GitOrigin-RevId: 0b18d4a07470c0c785db1b250d6d9c5e2b65676c
2022-11-30 04:03:18 +00:00
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
Karthikeyan Chinnakonda
32a316aef7 server: provide an option to enable event triggers on logically replicated tables
## Description ✍️
This PR introduces a new feature to enable/disable event triggers during logical replication of table data for PostgreSQL and MS-SQL data sources. We introduce a new field `trigger_on_replication` in the `*_create_event_trigger` metadata API. By default the event triggers will not fire for logical data replication.

## Changelog ✍️

__Component__ : server

__Type__: feature

__Product__: community-edition

### Short Changelog

Add option to enable/disable event triggers on logically replicated tables

### Related Issues ✍

https://github.com/hasura/graphql-engine/issues/8814
https://hasurahq.atlassian.net/browse/GS-252

### Solution and Design
- By default, triggers do **not** fire when the session mode is `replica` in Postgres, so if the `triggerOnReplication` is set to `true` for an event trigger we run the query `ALTER TABLE #{tableTxt} ENABLE ALWAYS TRIGGER #{triggerNameTxt};` so that the trigger fires always irrespective of the `session_replication_role`
- By default, triggers do fire in case of replication in MS-SQL, so if the `triggerOnReplication` is set to `false` for an event trigger we add a clause `NOT FOR REPLICATION` to the the SQL when the trigger is created/altered, which sets the `is_not_for_replication` for the trigger as `true` and it does not fire during logical replication.

### Steps to test and verify ✍
- Run hspec integration tests for HGE

## Server checklist ✍

### Metadata ✍

Does this PR add a new Metadata feature?
-  Yes
  - Does `export_metadata`/`replace_metadata` supports the new metadata added?
    - 

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6953
Co-authored-by: Puru Gupta <32328846+purugupta99@users.noreply.github.com>
Co-authored-by: Sean Park-Ross <94021366+seanparkross@users.noreply.github.com>
GitOrigin-RevId: 92731328a2bbdcad2302c829f26f9acb33c36135
2022-11-29 17:43:13 +00:00
Abby Sassel
7089b9de64 server/tests: Subscriptions > Value of Derived Field > Citus
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7065
GitOrigin-RevId: a14aa4e37971817b84e321dd6872cb17c12524a3
2022-11-29 11:17:21 +00:00
awjchen
41b64e8a9e server: clean up query variables hotfix
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6916
GitOrigin-RevId: ace6e625e70930d36e019be910a26101cb6eed5b
2022-11-29 10:06:14 +00:00
awjchen
badad573f6 server: implement resource attributes for the OpenTelemetry exporter
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6891
GitOrigin-RevId: 2c7b4767160e9fb976be4b5e656ef70cd19e4e0e
2022-11-29 07:35:09 +00:00
Daniel Chambers
ed79049637 Mutation Data Connector API types [GDC-594]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6893
GitOrigin-RevId: edf0f72027197ae61bfa8d27d53eabf6ca626112
2022-11-29 03:37:13 +00:00
Auke Booij
cca0b6e81a Further schema cache cleanups
Mostly trying to avoid tricky `Arrows` syntax, and unnecessary use of the `Hasura.Incremental` framework.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6997
GitOrigin-RevId: 9a2f5883e7e29af164e1581049ae003afec2cbe4
2022-11-29 01:02:09 +00:00
Auke Booij
7928179024 Delete SourceM type class
I encountered this dead code while doing other things: it's a type class with a single method which is never called. Deleting the type class allows us to simplify `TableCoreCacheRT` and `TableCacheRT`

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7075
GitOrigin-RevId: 121320349c478a93717b0706037553d8406cbfa9
2022-11-28 20:20:32 +00:00
Brandon Simmons
1b7602a2a5 server: define instance Functor InputFieldsParser by hand to lower memory usage slightly
fwiw: I was looking here because ghc-debug showed many closures associated with the Applicative instance,
but defining Monoid/Semigroup by hand and inlining didn't seem to have any effect

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7026
GitOrigin-RevId: 4ad2fd26519da98b2380658d89942c700de4ffa2
2022-11-28 15:58:11 +00:00
Philip Lykke Carlsen
a6e25a9e01 server/tests: Re-enable ObjectRelationshipsSpec for Citus
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7074
GitOrigin-RevId: 72592a29d6ea7897f93718b656fce4ac7179f4cc
2022-11-28 13:58:35 +00:00
Auke Booij
b0d4493b5c Replace non-canonical Select instance with a canonical one
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7066
GitOrigin-RevId: ef65253ad816d669d109cf45662817b3115b37c3
2022-11-28 09:50:18 +00:00
Abby Sassel
37e7480822 server/tests: refactor XToDBArrayRelationshipSpec setup/teardown
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7055
GitOrigin-RevId: 71d631165e4364d9cc22c303becf75fef5d01497
2022-11-25 17:59:19 +00:00
Philip Lykke Carlsen
afa1e2fc02 server/tests: Port Citus table relationship tests from pytest
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7047
GitOrigin-RevId: 1ddcc656a43adc2c34f36fa4cf220eebb91f09ae
2022-11-25 15:40:49 +00:00
Daniel Harvey
9dc863e479 [server/tests] allow api-tests to be filtered by backend type
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7056
GitOrigin-RevId: 84618c3d5a0c2273b51584831287968b4df73fba
2022-11-25 15:40:41 +00:00
Tom Harding
b85a6572bf Make fixtureRepl work again
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6906
Co-authored-by: Philip Lykke Carlsen <358550+plcplc@users.noreply.github.com>
GitOrigin-RevId: cf00c31f610ad65305a007d8fbc6b7971ce9b7a9
2022-11-25 13:15:43 +00:00
Philip Lykke Carlsen
88af86e21a server/tests: Add ghci macros to ease working with fixtureRepl
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7046
GitOrigin-RevId: 6a3f4780cfd86646bfdd933839ca0dfb865fd32c
2022-11-25 12:34:37 +00:00
Daniel Harvey
5ab101acd5 [server/tests] Re-add Citus views test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7043
GitOrigin-RevId: f737af39d5f6b46b29587400f53e2c6e2a772706
2022-11-25 10:33:25 +00:00
Philip Lykke Carlsen
375aa28c4e server/tests: Improve details in feature matrix tool
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7041
GitOrigin-RevId: ba0c6a28ac507d5d57fa1faf37f6e69deaba3a61
2022-11-24 17:54:40 +00:00
Samir Talwar
a0dc296ede Document and automate spinning up AlloyDB for testing.
We sometimes need to test against cloud databases. Here, we add a Terraform module to start a new AlloyDB cluster and instance, which we can then use for testing purposes.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7002
GitOrigin-RevId: 2d661b5cc6d60e47485ea68b781e13426ed4f097
2022-11-24 14:16:21 +00:00
Abby Sassel
eebeb5cc3b Server/tests: Remote Relationships > Citus
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7040
GitOrigin-RevId: 1a177e2d8a903144576990d047addcef70c69544
2022-11-24 13:31:04 +00:00
Karthikeyan Chinnakonda
e9794a6639 server: fix bug with customized remote schema enum variables
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6993
GitOrigin-RevId: 0458c806176e752aea5a848e68246744c3e5b38a
2022-11-24 08:47:46 +00:00
Daniel Harvey
79b50add5e [server] regularly ping selected sources
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6945
GitOrigin-RevId: cad67b121090d4100330067d3d50f575292b4584
2022-11-23 16:41:46 +00:00
Abby Sassel
4598e1e008 NDAT-300: skip fewer CockroachDB tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7016
GitOrigin-RevId: 0fbbfd9fed46301759ee4d62827c9ab7989617b6
2022-11-23 15:22:19 +00:00
Samir Talwar
43779ff0c1 server/tests-py: Fix test_inconsistent_meta.py for split databases.
This test did not work when splitting the metadata and source backends. Fixed mostly by running the relevant SQL using `source_backend.engine`, but I also took the time to clean it up a little, and broke up _test.yaml_ into 3 files.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6957
GitOrigin-RevId: bbca60a8906caba2d0cffd834b3b8595fca058fd
2022-11-23 14:14:01 +00:00
awjchen
339e19048b server: update metadata api for the OpenTelemetry exporter
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6844
GitOrigin-RevId: 3d808215fc46a79caf85a1c4d964ac874f905029
2022-11-23 07:54:53 +00:00
Samir Talwar
c6557ced13 server/test-harness: Do not fail if the database cannot be dropped.
Sometimes this happens, especially in CI. It's alright. We can just leave it lying around and it will be destroyed when the container and associated volume are removed.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7003
GitOrigin-RevId: dcb74920c12341d7a15f9b6ebfe52d0864de4738
2022-11-23 07:54:44 +00:00
Abby Sassel
9c4aaccdb2 Server/test: fix enum test for CosmosDB: cleanup types in teardown
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6992
GitOrigin-RevId: 4c872e5837367b1449c9c0eeb085b708560d9bbd
2022-11-23 07:54:36 +00:00
Daniel Harvey
80c3846aaa [server/tests] run setup for each set of tests again
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7000
GitOrigin-RevId: 2e85870c970144dbd417cf555b14b63c18f495ab
2022-11-23 07:54:28 +00:00
Daniel Harvey
bc2d173161 [server/tests] New SQLServer DB per test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6834
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 3ee30313e47ba64d5b50ff46345ce507735c4d1f
2022-11-23 07:54:10 +00:00
Auke Booij
67b922bac1 Avoid GraphQL schema rebuild when changing irrelevant Metadata
This increases the speed of `create_query_collection` and `add_collection_to_allowlist` by a factor ~~10~~ 65, by caching the in-memory GraphQL schema. This speedup also applies more broadly to Metadata changes relating to:
- allowlists
- query collections
- cron triggers
- REST endpoints
- API limits
- metrics config
- GraphQL introspection options
- TLS allow lists
- OpenTelemetry

When is construction of the in-memory GraphQL schema cached between Metadata operations?

Before this PR, **never**! It's rebuilt fully, for every role, on every Metadata operation.

However, there are many Metadata operations that don't influence the GraphQL schema. So we should be caching its construction.

The `Hasura.Incremental` framework allows us to cache such constructions: whenever we have an arrow `Rule m a b`, where `a` is the input to the arrow and `b` the output, we can use the `Inc.cache` combinator to obtain a new arrow which is only re-executed when the input `a` changes in a material way. To test this, `a` needs an `Eq` instance. (Before hasura/graphql-engine-mono#6877, this was a `Cacheable` type class which has now been removed.)

We can't simply apply `Inc.cache` to the "Steps 3 and 4" in `buildSchemaCacheRule`, because the inputs (components of `BuildOutputs` such as `SourceCache`) don't have an `Eq` instance.

So the changes to `buildSchemaCacheRule` restructure the code so that the input to "Step 1", namely the Metadata, can be used as a caching key instead, so that `Inc.cache` can be applied to the whole sequence of steps.

That works to cache construction of the GraphQL schema, but it means that now only those Metadata operations that _don't_ influence any of the products of steps 1-4 can use a cached build of the GraphQL schema. The most important intermediate product is `BuildOutputs`. So now the exercise becomes to minimize the amount of stuff stored in `BuildOutputs`, so that as many Metadata operations as possible can be handled outside of the codepath that produces a GraphQL schema.

Per hasura/graphql-engine-mono#6609, the `BuildOutputs` structure is too big, and stores things unnecessarily. Refer to the PR description there for reasoning - the same logic applies to this PR, and simply goes a few steps further. In doing so, it can benefit from hasura/graphql-engine-mono#6765, which allows us to verify at compile time that certain Schema Cache building steps _don't_ generate "Metadata dependencies". If a certain Metadata dependency is never generated, we don't need to handle that case in `deleteMetadataObject`. Thus such intermediate products don't need to be passed through `resolveDependencies`, and thus they don't need to be stored in `BuildOutputs`, and thus their rebuild won't trigger a GraphQL schema rebuild.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6613
GitOrigin-RevId: 27d2e69d3461bd4c32f08febef9995c0369fab3a
2022-11-23 07:54:01 +00:00
Gil Mizrahi
b213907671 use schemaName in postgres event triggers tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6964
GitOrigin-RevId: b05a1333583d59684b5fbd33b43544080d542696
2022-11-23 07:53:53 +00:00
Vishnu Bharathi
5d7f4fa1a9 ci: tag multiple releases
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6983
GitOrigin-RevId: 5e118b498d95cdcd5141a171a6e61e122181e093
2022-11-23 07:53:27 +00:00
awjchen
329f3f0a39 multitenant: make shutdown logic more abstract
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5836
GitOrigin-RevId: 2f94cdee01702e49ff130f6a40f6be26fa69ec88
2022-11-23 07:53:19 +00:00
Brandon Simmons
378817d05a server: memoize in tableSelectColumnsEnum and mkNumericAggFields for more sharing
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6789
GitOrigin-RevId: 744600d42b497b77f2eca5fc46715e0df3e1fc8e
2022-11-23 07:53:11 +00:00
Vishnu Bharathi
c89e31b253 ci: tag release v2.15.2
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6980
GitOrigin-RevId: 662897f76160eeaa6a5b88d8e6b9381362c4df07
2022-11-23 07:52:59 +00:00
Auke Booij
cdac24c79f server: delete the Cacheable type class in favor of Eq
What is the `Cacheable` type class about?
```haskell
class Eq a => Cacheable a where
  unchanged :: Accesses -> a -> a -> Bool
  default unchanged :: (Generic a, GCacheable (Rep a)) => Accesses -> a -> a -> Bool
  unchanged accesses a b = gunchanged (from a) (from b) accesses
```
Its only method is an alternative to `(==)`. The added value of `unchanged` (and the additional `Accesses` argument) arises _only_ for one type, namely `Dependency`. Indeed, the `Cacheable (Dependency a)` instance is non-trivial, whereas every other `Cacheable` instance is completely boilerplate (and indeed either generated from `Generic`, or simply `unchanged _ = (==)`). The `Cacheable (Dependency a)` instance is the only one where the `Accesses` argument is not just passed onwards.

The only callsite of the `unchanged` method is in the `ArrowCache (Rule m)` method. That is to say that the `Cacheable` type class is used to decide when we can re-use parts of the schema cache between Metadata operations.

So what is the `Cacheable (Dependency a)` instance about? Normally, the output of a `Rule m a b` is re-used when the new input (of type `a`) is equal to the old one. But sometimes, that's too coarse: it might be that a certain `Rule m a b` only depends on a small part of its input of type `a`. A `Dependency` allows us to spell out what parts of `a` are being depended on, and these parts are recorded as values of types `Access a` in the state `Accesses`.

If the input `a` changes, but not in a way that touches the recorded `Accesses`, then the output `b` of that rule can be re-used without recomputing.

So now you understand _why_ we're passing `Accesses` to the `unchanged` method: `unchanged` is an equality check in disguise that just needs some additional context.

But we don't need to pass `Accesses` as a function argument. We can use the `reflection` package to pass it as type-level context. So the core of this PR is that we change the instance declaration from
```haskell
instance (Cacheable a) => Cacheable (Dependency a) where
```
to
```haskell
 instance (Given Accesses, Eq a) => Eq (Dependency a) where
```
and use `(==)` instead of `unchanged`.

If you haven't seen `reflection` before: it's like a `MonadReader`, but it doesn't require a `Monad`.

In order to pass the current `Accesses` value, instead of simply passing the `Accesses` as a function argument, we need to instantiate the `Given Accesses` context. We use the `give` method from the `reflection` package for that.
```haskell
give :: forall r. Accesses -> (Given Accesses => r) -> r

unchanged :: (Given Accesses => Eq a) => Accesses -> a -> a -> Bool
unchanged accesses a b = give accesses (a == b)
```
With these three components in place, we can delete the `Cacheable` type class entirely.

The remainder of this PR is just to remove the `Cacheable` type class and its instances.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6877
GitOrigin-RevId: 7125f5e11d856e7672ab810a23d5bf5ad176e77f
2022-11-21 16:35:37 +00:00