Commit Graph

1968 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
paritosh-08
00005020a6 server: rename event trigger metric hasura_event_processing_time_seconds to hasura_event_webhook_processing_time_seconds
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6950
GitOrigin-RevId: a32ce3f167eb6bb5c48645a614288c043c252d26
2022-11-21 07:49:28 +00:00
paritosh-08
e74ba68230 server: add default naming convention to ServerConfig
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6918
GitOrigin-RevId: 6c97f566d50f633c3ae7b8cec65ce76a36a4c088
2022-11-21 05:05:14 +00:00
Lyndon Maydwell
7228d0327f Add display_name, release_name fields to MD Agent APIs - GDC-626
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6849
GitOrigin-RevId: 0ab90aaf281cc1c043f73fd6d63c4c18d58c7c92
2022-11-18 04:19:08 +00:00
Antoine Leblanc
42e5205eb5 server: reduce schema contexts to the bare minimum
### Description

This monster of a PR took way too long. As the title suggests, it reduces the schema context carried in the readers to the very strict minimum. In practice, that means that to build a source, we only require:
  - the global `SchemaContext`
  - the global `SchemaOptions` (soon to be renamed `SchemaSourceOptions`)
  - that source's `SourceInfo`

Furthermore, _we no longer carry "default" customization options throughout the schema_. All customization information is extracted from the `SourceInfo`, when required. This prevents an entire category of bugs we had previously encountered, such as parts of the code using uninitialized / unupdated customization info.

In turn, this meant that we could remove the explicit threading of the `SourceInfo` throughout the schema, since it is now always available through the reader context.

Finally, this meant making a few adjustments to relay and actions as well, such as the introduction of a new separate "context" for actions, and a change to how we create some of the action-specific postgres scalar parsers.

I'll highlight with review comments the areas of interest.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6709
GitOrigin-RevId: ea80fddcb24e2513779dd04b0b700a55f0028dd1
2022-11-17 10:35:54 +00:00
paritosh-08
5be4d37240 server,pro: add metrics related to event trigger runtime
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6825
GitOrigin-RevId: 913e1bd21912db781d69f579aee943faf6ce3a11
2022-11-16 17:12:48 +00:00
paritosh-08
3a79fdbfcc server: fix template validation behaviour
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6870
GitOrigin-RevId: e55ec0a39c68e960665d59f6c1824f5ba115f84d
2022-11-16 16:37:34 +00:00
Gil Mizrahi
12dea92a92 CockroachDB version check
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6900
GitOrigin-RevId: 07d417c7bb49b7f41900d24f543ff531362f9741
2022-11-16 15:42:30 +00:00
Auke Booij
5b93014ee8 Make Schema Cache building code slightly more readable
- Avoid a few banana brackets `(| ... |)`, often by just using local `let` bindings
- Use proper `Arrows` syntax rather than helpers like `>->`
- Use monadic `do` syntax instead of `Arrows` syntax where possible
- Avoid `traverseA @Maybe`, in favor of a `case`

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6751
GitOrigin-RevId: c07b22a1a259db6d135486ec71a716705e280717
2022-11-15 20:14:22 +00:00
Auke Booij
6ac67a5566 Allow collecting metadata dependencies and inconsistencies separately
`CollectedInfo` was just an awkward sum type. By using an explicit `Either` instead, we can guarantee at the type level that certain methods only write inconsistencies, or only write dependencies. This is useful, because if we can guarantee that no dependencies are written, then we don't need to run `resolveDependencies` on that part of the Metadata. In other words, we can keep it out of `BuildOutputs`, which greatly benefits performance - see e.g. hasura/graphql-engine-mono#6613.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6765
GitOrigin-RevId: 9ce099d2eee2278dbb6e5bea72063e4b6e064b35
2022-11-15 17:00:11 +00:00
Auke Booij
2d055df2a4 server: Simplify BuildOutputs
A bunch of configurations are retrieved from the Metadata, then stored in the `BuildOutputs` structure, only to then be forwarded to the `SchemaCache`, with extremely little processing in between.

So this simplifies the build pipeline for some parts of the metadata: just construct those things from `Metadata` directly, and store them in the `SchemaCache` without any intermediate container.

Why did we have the detour via `BuildOutputs` in the first place? Parts of the Metadata (codified by `MetadataObjId`) can generate _metadata inconsistencies_ and/or _schema dependencies_, which are related.

- Metadata inconsistencies are warnings that we show to the user, indicating that there's something wrong with their configuration, and they have to fix it.
- Schema dependencies are an internal mechanism that allow us to build a consistent view of the world. For instance, if we have a relationship from DB tables `books` to `authors`, but the `authors` table is inconsistent (e.g. it doesn't exist in the DB), then we have schema dependencies indicating that. The job of `resolveDependencies` is to then drop the relationship, so that we can at least generate a legal GraphQL schema for `books`.

If we never generate a schema dependency for a certain fragment of Metadata, then there is no reason to call `resolveDependencies` on it, and so there is no reason to store it in `BuildOutputs`.

---

The starting point that allows this refactor is to apply Metadata defaults before it reaches `buildAndCollectInfo`, so that metadata-with-defaults can be used elsewhere.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6609
GitOrigin-RevId: df0c4a7ff9451e10e02a40bf26304b26584ba483
2022-11-15 12:04:13 +00:00
Gil Mizrahi
15b3ac0aee ghc 9.2.5
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6777
Co-authored-by: Samir Talwar <47582+SamirTalwar@users.noreply.github.com>
GitOrigin-RevId: 916abab76446cf7c4e1e63dc112ba4994ab4d23d
2022-11-15 11:26:42 +00:00
Tom Harding
502115f969 Bump aeson to v2.1, drop the Extended module
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6869
GitOrigin-RevId: ecb2f7dfe7d00c0a01999c12b0264be7850e0f42
2022-11-15 10:44:36 +00:00
Solomon
d0a77a9f28 Prevents creation of duplicate GDC agent source kinds.
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6865
GitOrigin-RevId: e3b3c68e91b22307ef4a9f215e34234b875d802f
2022-11-15 00:40:56 +00:00
paritosh-08
ec13a55fd5 server: add validation for response transforms
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6821
GitOrigin-RevId: 88abcc408d0a1b73024356d9b32881bc3d4d746c
2022-11-14 15:19:23 +00:00
Lyndon Maydwell
6f9f44a441 Data Connectors API 400 error response - GDC-619
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6839
GitOrigin-RevId: 813ea5e976ff41754e7500abf6bcd0c8b70c960e
2022-11-14 05:26:16 +00:00
Abby Sassel
8726236a9d NDAT-316 Improve askSourceInfo error reporting _even more_
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6835
GitOrigin-RevId: c15bea414176878c6ec96674376858294e48255b
2022-11-10 19:24:34 +00:00
paritosh-08
0b827fae66 server: remove built-in scalars from graphql schema printer
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6541
Co-authored-by: Auke Booij <164426+abooij@users.noreply.github.com>
GitOrigin-RevId: 5a2e35da2cf8718ee452429c56986066a3dc0c54
2022-11-10 18:53:05 +00:00
Jesse Hallett
31e402e767 server: remaining codecs for function metadata
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6654
GitOrigin-RevId: a9d24c72078d2a2b0c8a62a6084d5ab86518fdeb
2022-11-10 16:17:13 +00:00
Abby Sassel
63ec04493a NDAT-316 Improve askSourceInfo error reporting
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6807
GitOrigin-RevId: b27e642079915c3f0ca85d88195fe323e18800c1
2022-11-10 11:48:02 +00:00
awjchen
7d6e713d9f pro-server: hotfix: respect analyze_query_variables in logs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6754
GitOrigin-RevId: 3f1b0000d2962bd02708786331595828cf99b38c
2022-11-09 23:31:59 +00:00
Gil Mizrahi
75ffa94b17 enable citus and cockroach streaming subscriptions and extend test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6711
GitOrigin-RevId: 10e012132bcef27b1ed35a654f349c6d74d72e1d
2022-11-09 07:23:37 +00:00
pranshi06
7b7845f697 server: add jwk-refresh-log type to default enabled logs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6775
GitOrigin-RevId: 23fbeceb91e51380ccf0bb5830a4471d8964a3f5
2022-11-08 16:48:44 +00:00
pranshi06
fd6aa0a266 server: add jwk-refresh-log as configurable log type
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6705
GitOrigin-RevId: 1f6f45ce555cefc24836a2fc5363660e351fa13b
2022-11-08 07:37:50 +00:00
kodiakhq[bot]
3a76c57adf Some inlining and bang patterns to improve memory residency
Just forcing some of the most numerous thunks (with -hi profiling), it
seems some of these were retaining significant amount of data

this can follow merge of, or supersede #6679

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6710
GitOrigin-RevId: d0566ee288841e264637231a7f238946aa2e3564
2022-11-08 03:55:38 +00:00
Puru Gupta
a4eb5ad95d server: improve DX for heroku integration
## Description ✍️
This PR aims to improve the developer experience when using a heroku postgres instance as source database. Better error messages and relevant documentation are added as a part of this PR.

## Changelog ✍️

__Component__ : server

__Type__: enhancement

__Product__: community-edition

### Short Changelog

Improve DX for heroku integration

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

### Steps to test and verify ✍
- Add a new heroku postgres instance as DB source in Hasura
- Try adding an event trigger
- Improved error message will be emitted:
```json
{
    "arguments": [],
    "error": {
        "description": null,
        "exec_status": "FatalError",
        "hint": null,
        "message": "pgcrypto can only be created in heroku_ext schema. Hint: You can set \"extensions_schema\" to provide the schema to install the extensions. Refer to the documentation here: https://hasura.io/docs/latest/deployment/postgres-requirements/#pgcrypto-in-pg-search-path",
        "status_code": "P0001"
    },
    "prepared": false,
    "statement": "CREATE EXTENSION IF NOT EXISTS pgcrypto SCHEMA public"
}
```

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6630
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Sean Park-Ross <94021366+seanparkross@users.noreply.github.com>
GitOrigin-RevId: a46d7c129a4e0378b7f33445f9bda11e0bddbd74
2022-11-08 03:55:30 +00:00
awjchen
ebb28ad4c9 pro-server: add support for exporting traces over OTLP
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5862
GitOrigin-RevId: fd80a59a1459095716f94cea7b2e54f9b5d19a98
2022-11-07 06:56:08 +00:00
awjchen
3e6840e4fa server: more adjustments to metadata sync logging
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6718
GitOrigin-RevId: 8cab5e6b39b1fa85e42fa176f3fb589c5da2c081
2022-11-05 22:38:22 +00:00
Jesse Hallett
de6e5d71b0 server: codecs for table, function, and remote relationship types
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6608
GitOrigin-RevId: 9c91edec06e49b8d44960e322459ba7a05f26b5a
2022-11-04 21:44:41 +00:00
awjchen
8d6b39602a server: remove excessive metadata sync log line
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6715
GitOrigin-RevId: 564ae127b20638b15a6a0e407976ed4d90c81b4a
2022-11-04 19:42:17 +00:00
Daniel Harvey
e6c3113a43 [server]: feature flag to remove _stream fields from schema
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6698
GitOrigin-RevId: d2b80900d06353647505256fc351a07e6f7cd5f7
2022-11-04 13:10:35 +00:00
Lyndon Maydwell
4db9941b32 Prohibit underscores in dataconnector names [GDC-586]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6681
GitOrigin-RevId: 5335208fc4c8f0d1b16a45415329ef390a269b4c
2022-11-03 14:00:52 +00:00
Karthikeyan Chinnakonda
d7609233c4 Rename get_event_invocations to get_scheduled_event_invocations
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6513
Co-authored-by: Varun Choudhary <68095256+Varun-Choudhary@users.noreply.github.com>
GitOrigin-RevId: 172ba6152ed77b90eeec9183a3fb4c6f177e45b3
2022-11-03 10:23:11 +00:00
awjchen
700d4616cb server: add logging for debugging metadata sync issues
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6657
GitOrigin-RevId: ab7b8015010d20a641606fad8cd1cc8563466d0c
2022-11-02 23:24:23 +00:00
Samir Talwar
342391f39d Upgrade Ormolu to v0.5.
This upgrades the version of Ormolu required by the HGE repository to v0.5.0.1, and reformats all code accordingly.

Ormolu v0.5 reformats code that uses infix operators. This is mostly useful, adding newlines and indentation to make it clear which operators are applied first, but in some cases, it's unpleasant. To make this easier on the eyes, I had to do the following:

* Add a few fixity declarations (search for `infix`)
* Add parentheses to make precedence clear, allowing Ormolu to keep everything on one line
* Rename `relevantEq` to `(==~)` in #6651 and set it to `infix 4`
* Add a few _.ormolu_ files (thanks to @hallettj for helping me get started), mostly for Autodocodec operators that don't have explicit fixity declarations

In general, I think these changes are quite reasonable. They mostly affect indentation.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6675
GitOrigin-RevId: cd47d87f1d089fb0bc9dcbbe7798dbceedcd7d83
2022-11-02 20:55:13 +00:00
Daniel Harvey
11ff01f3e9 [server] Fix CockroachDB live queries
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6551
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: e78ce17d3ff5c677360b2927dca04a91e144952e
2022-11-02 11:41:02 +00:00
Samir Talwar
dbc027424b Rename relevantEq to (==~) for Ormolu's sake.
Ormolu v0.5 tries to reformat code using operators according to fixity. Unfortunately, it doesn't really understand backticked functions (even when they have an associated `infix` declaration), and so messes up the formatting.

This is probably a bug in Ormolu, but we can work around it by using a symbol operator.

Happy to bikeshed on `==~` (which I am reading as "pretty much equal to"). Please yell at me if you prefer something else.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6651
GitOrigin-RevId: 79af427422194460200b2b48339cdb9ee9b33c33
2022-11-02 10:43:48 +00:00
Karthikeyan Chinnakonda
9177335c31 Source catalog migrations minor enhancements
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6531
Co-authored-by: paritosh-08 <85472423+paritosh-08@users.noreply.github.com>
GitOrigin-RevId: 51dd55692f59d6ad0fd54674fb7d3ce00d5d83dd
2022-11-01 22:42:40 +00:00
hasura-bot
3ca779797d server: deduplicate Postgres function names with HashSet (close #8888)
GITHUB_PR_NUMBER: 9112
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/9112

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6353
Co-authored-by: Daniel Shuy <17351764+daniel-shuy@users.noreply.github.com>
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: ebfb57b98fe93b86d5319dc78ac1308e00941a2e
2022-10-28 08:24:25 +00:00
David Overton
87bcdb97c7 Use JSON instead of GraphQL for comparison operators
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6563
GitOrigin-RevId: 0819414df199292e0146ce3009295ce3e49f2439
2022-10-28 01:14:09 +00:00
Daniel Harvey
b3471f27b8 [server] enable Cockroach subscriptions and re-add CustomFieldsSpec test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6568
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 678c4fcb55a576d52cdb8f40dcfe2bf7948e8863
2022-10-27 17:27:32 +00:00
Naveen Naidu
938a0a66cc server: do not apply default tenant time limits to Hasura EE
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6552
Co-authored-by: Anon Ray <616387+ecthiender@users.noreply.github.com>
GitOrigin-RevId: 2e4466308c3a9b5aba6dd55a79dae7de096a0f27
2022-10-27 15:37:00 +00:00
Tom Harding
78f3754953 Add Cockroach and Postgres to DataValidation tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6343
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 9f5d98e180721eaf12fd4c4e60a42b6dee6b5cca
2022-10-27 12:20:41 +00:00
David Overton
9921823915 GDC-189 custom aggregations
>

## Description
->

This PR allows DC agents to define custom aggregate functions for their scalar types.

### Related Issues
->

GDC-189

### Solution and Design
>

We added a new property `aggregate_functions` to the scalar types capabilities. This allows the agent author to specify a set of aggregate functions supported by each scalar type, along with the function's result type.

During GraphQL schema generation, the custom aggregate functions are available via a new method `getCustomAggregateOperators` on the `Backend` type class.
Custom functions are merged with the builtin aggregate functions when building GraphQL schemas for table aggregate fields and for `order_by` operators on array relations.

### Steps to test and verify
>

• Codec tests for aggregate function capabilities have been added to the unit tests.
• Some custom aggregate operators have been added to the reference agent and are used in a new test in `api-tests`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6199
GitOrigin-RevId: e9c0d1617af93847c1493671fdbb794f573bde0c
2022-10-27 00:44:06 +00:00
Philip Lykke Carlsen
8cb14a592d server: Add an ExperimentalFeatureFlag for Aggregation Predicates
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6523
GitOrigin-RevId: 76861a1bf0d9895901564935b0778e7bda75c6a9
2022-10-25 13:21:40 +00:00
Vamshi Surabhi
c2a1d30765 simplify type collection for introspection
No user facing changes. Minor cleanup.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6519
GitOrigin-RevId: 7d9b6077a609175642059895800e9c540cf62790
2022-10-25 11:13:38 +00:00
Daniel Harvey
daf55101f4 tests: force remove BigQuery datasets and don't bother manually removing tables
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6473
GitOrigin-RevId: 15cefa76cfd472f4197ae965970dfbc203f694a4
2022-10-24 16:54:35 +00:00
Abby Sassel
3427488c68 NDAT-206 Disable the relay schema for cockroach sources
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6468
GitOrigin-RevId: 9c7735c2318580f1b853d6a8d2d586cffef72c59
2022-10-21 19:11:41 +00:00
paritosh-08
b8bbb8a621 server: optional query params in REST connector
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6381
Co-authored-by: Rob Dominguez <24390149+robertjdominguez@users.noreply.github.com>
GitOrigin-RevId: b777b373b2fbe19ceb32f812d4eaba45ef0a5a58
2022-10-21 18:40:48 +00:00
Gil Mizrahi
9c3bd2f0d0 server/postgres: fix the schema types conflict between aggregation predicates and table selection aggregates
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6452
GitOrigin-RevId: ed43442c7ade298659bdc42ff76e8e229825f0f1
2022-10-21 13:28:43 +00:00
Vamshi Surabhi
a01d1188f2 scaffolding for remote-schemas module
The main aim of the PR is:

1. To set up a module structure for 'remote-schemas' package.
2. Move parts by the remote schema codebase into the new module structure to validate it.

## Notes to the reviewer

Why a PR with large-ish diff?

1. We've been making progress on the MM project but we don't yet know long it is going to take us to get to the first milestone. To understand this better, we need to figure out the unknowns as soon as possible. Hence I've taken a stab at the first two items in the [end-state](https://gist.github.com/0x777/ca2bdc4284d21c3eec153b51dea255c9) document to figure out the unknowns. Unsurprisingly, there are a bunch of issues that we haven't discussed earlier. These are documented in the 'open questions' section.

1. The diff is large but that is only code moved around and I've added a section that documents how things are moved. In addition, there are fair number of PR comments to help with the review process.

## Changes in the PR

### Module structure

Sets up the module structure as follows:

```
Hasura/
  RemoteSchema/
    Metadata/
      Types.hs
    SchemaCache/
      Types.hs
      Permission.hs
      RemoteRelationship.hs
      Build.hs
    MetadataAPI/
      Types.hs
      Execute.hs
```

### 1. Types representing metadata are moved

Types that capture metadata information (currently scattered across several RQL modules) are moved into `Hasura.RemoteSchema.Metadata.Types`.

- This new module only depends on very 'core' modules such as
  `Hasura.Session` for the notion of roles and `Hasura.Incremental` for `Cacheable` typeclass.

- The requirement on database modules is avoided by generalizing the remote schemas metadata to accept an arbitrary 'r' for a remote relationship
  definition.

### 2. SchemaCache related types and build logic have been moved

Types that represent remote schemas information in SchemaCache are moved into `Hasura.RemoteSchema.SchemaCache.Types`.

Similar to `H.RS.Metadata.Types`, this module depends on 'core' modules except for `Hasura.GraphQL.Parser.Variable`. It has something to do with remote relationships but I haven't spent time looking into it. The validation of 'remote relationships to remote schema' is also something that needs to be looked at.

Rips out the logic that builds remote schema's SchemaCache information from the monolithic `buildSchemaCacheRule` and moves it into `Hasura.RemoteSchema.SchemaCache.Build`. Further, the `.SchemaCache.Permission` and `.SchemaCache.RemoteRelationship` have been created from existing modules that capture schema cache building logic for those two components.

This was a fair amount of work. On main, currently remote schema's SchemaCache information is built in two phases - in the first phase, 'permissions' and 'remote relationships' are ignored and in the second phase they are filled in.

While remote relationships can only be resolved after partially resolving sources and other remote schemas, the same isn't true for permissions. Further, most of the work that is done to resolve remote relationships can be moved to the first phase so that the second phase can be a very simple traversal.

This is the approach that was taken - resolve permissions and as much as remote relationships information in the first phase.

### 3. Metadata APIs related types and build logic have been moved

The types that represent remote schema related metadata APIs and the execution logic have been moved to `Hasura.RemoteSchema.MetadataAPI.Types` and `.Execute` modules respectively.

## Open questions:

1. `Hasura.RemoteSchema.Metadata.Types` is so called because I was hoping that all of the metadata related APIs of remote schema can be brought in at `Hasura.RemoteSchema.Metadata.API`. However, as metadata APIs depended on functions from `SchemaCache` module (see [1](ceba6d6226/server/src-lib/Hasura/RQL/DDL/RemoteSchema.hs (L55)) and [2](ceba6d6226/server/src-lib/Hasura/RQL/DDL/RemoteSchema.hs (L91)), it made more sense to create a separate top-level module for `MetadataAPI`s.

   Maybe we can just have `Hasura.RemoteSchema.Metadata` and get rid of the extra nesting or have `Hasura.RemoteSchema.Metadata.{Core,Permission,RemoteRelationship}` if we want to break them down further.

1. `buildRemoteSchemas` in `H.RS.SchemaCache.Build` has the following type:

   ```haskell
   buildRemoteSchemas ::
     ( ArrowChoice arr,
       Inc.ArrowDistribute arr,
       ArrowWriter (Seq CollectedInfo) arr,
       Inc.ArrowCache m arr,
       MonadIO m,
       HasHttpManagerM m,
       Inc.Cacheable remoteRelationshipDefinition,
       ToJSON remoteRelationshipDefinition,
       MonadError QErr m
     ) =>
     Env.Environment ->
     ( (Inc.Dependency (HashMap RemoteSchemaName Inc.InvalidationKey), OrderedRoles),
       [RemoteSchemaMetadataG remoteRelationshipDefinition]
     )
       `arr` HashMap RemoteSchemaName (PartiallyResolvedRemoteSchemaCtxG remoteRelationshipDefinition, MetadataObject)
   ```

   Note the dependence on `CollectedInfo` which is defined as

   ```haskell
   data CollectedInfo
     = CIInconsistency InconsistentMetadata
     | CIDependency
         MetadataObject
         -- ^ for error reporting on missing dependencies
         SchemaObjId
         SchemaDependency
     deriving (Eq)
   ```

   this pretty much means that remote schemas is dependent on types from databases, actions, ....

   How do we fix this? Maybe introduce a typeclass such as `ArrowCollectRemoteSchemaDependencies` which is defined in `Hasura.RemoteSchema` and then implemented in graphql-engine?

1. The dependency on `buildSchemaCacheFor` in `.MetadataAPI.Execute` which has the following signature:

   ```haskell
   buildSchemaCacheFor ::
     (QErrM m, CacheRWM m, MetadataM m) =>
     MetadataObjId ->
     MetadataModifier ->
   ```

   This can be easily resolved if we restrict what the metadata APIs are allowed to do. Currently, they operate in an unfettered access to modify SchemaCache (the `CacheRWM` constraint):

   ```haskell
   runAddRemoteSchema ::
     ( QErrM m,
       CacheRWM m,
       MonadIO m,
       HasHttpManagerM m,
       MetadataM m,
       Tracing.MonadTrace m
     ) =>
     Env.Environment ->
     AddRemoteSchemaQuery ->
     m EncJSON
   ```

   This should instead be changed to restrict remote schema APIs to only modify remote schema metadata (but has access to the remote schemas part of the schema cache), this dependency is completely removed.

   ```haskell
   runAddRemoteSchema ::
     ( QErrM m,
       MonadIO m,
       HasHttpManagerM m,
       MonadReader RemoteSchemasSchemaCache m,
       MonadState RemoteSchemaMetadata m,
       Tracing.MonadTrace m
     ) =>
     Env.Environment ->
     AddRemoteSchemaQuery ->
     m RemoteSchemeMetadataObjId
   ```

   The idea is that the core graphql-engine would call these functions and then call
   `buildSchemaCacheFor`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6291
GitOrigin-RevId: 51357148c6404afe70219afa71bd1d59bdf4ffc6
2022-10-21 03:15:04 +00:00
Lyndon Maydwell
37c65d4395 Support MetadataDefaults Options - GDC-108
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6286
GitOrigin-RevId: ef861e6070e667322fb2657166d3d343d6cab4bc
2022-10-20 12:46:45 +00:00
Anon Ray
e22b3816d9 server: fix the 'starting API server' log to be in correct place
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5198
GitOrigin-RevId: a70477086778697d04042a779e77a8fd74220d2d
2022-10-20 08:30:36 +00:00
Daniel Chambers
84b84a78e1 Add column scalar type information Data Connector query API request [GDC-493]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6433
GitOrigin-RevId: c5f5e0c2e25c6820d9f73a1e90699cf18dc4cd47
2022-10-20 03:24:53 +00:00
Rakesh Emmadi
1c745959b9 relocate 'ServerReplicas' and 'ResizePoolStrategy' types
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6448
GitOrigin-RevId: 2d317fd004db63e2830dfb8def92acb51bb576a0
2022-10-20 01:34:17 +00:00
Antoine Leblanc
49d0594759 [server] prune join fields of remote relationships to remote schema (close hasura/graphql-engine#8345)
## Description

This PR fixes hasura/graphql-engine#8345: when creating the final representation of a remote relationship to a remote schema (a `RemoteJoin`), we would mistakenly label ALL join fields in the selection set as being relevant to that one relationship: if there are more than one remote relationship to process in that selection set, that would be the union of all their join fields. The problem with this error is that, when processing remote relationships, we correctly ignore all the ones for which at least one join key is null. Consequently, this error would result in us ignoring remote relationships for which an _unrelated_ join key was null, resulting in that data missing in the final JSON result.

This PR simply ensures that the aggregation of fields that are passed to `createRemoteJoin` is pruned to only contain the fields relevant to the join being created. This is a very small change, and the bulk of this PR is the regression tests.

## Changelog

__Component__ : server
__Type__: bugfix
__Product__: community-edition

### Short Changelog

fix remote relationship to remote schema sometimes being erroneously null when multiple relationships are defined on the same table / graphql object ([#8345](https://github.com/hasura/graphql-engine/issues/8345))

### Long Changelog

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6420
GitOrigin-RevId: eb54462724b007f80b674dcf234adf6d9cfaaf79
2022-10-20 00:11:51 +00:00
Brandon Simmons
cc6f1c3b69 multitenant: make ourIdleGC parameters tunable, and with better defaults (SRE-191)
Context: https://hasurahq.atlassian.net/browse/SRE-10

Also remove an overlapping instance.

-----

The new flags if this needs to be tweaked on production by SRE are:

- --idleGCIdleInterval : "When the system has been idle for idleGCIdleInterval we may opportunistically try a major GC to run finalizers"
-  --idleGCMinGCInterval : "We never run an opportunistic GC unless it has been at least idleGCMinGCInterval seconds since the last major GC"
-  --idleGCMaxNoGCInterval : "If it has been longer than idleGCMaxNoGCInterval since the last major GC, force a GC to run finalizers"

Be aware: we may see memory usage grow to higher peaks than before, especially when under load

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6449
GitOrigin-RevId: 662d2f968f0d73b3b6eebb857c49aaede3312705
2022-10-19 21:36:56 +00:00
Philip Lykke Carlsen
d81571f928 Add support for explain in CockroachDB
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6415
GitOrigin-RevId: d60363d6f466a764b79c887631f9e3f094946440
2022-10-18 16:49:03 +00:00
Philip Lykke Carlsen
032c25240b fix: Disable subscriptions in CockroachDB
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6368
GitOrigin-RevId: b1434b830d3ef84e13c7abb64ecb6ef3c1878a55
2022-10-18 08:44:34 +00:00
Daniel Chambers
5c51ff4288 Fix conflicting data connector comparison exp GraphQL types
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6394
GitOrigin-RevId: c272e8aad426a18ccadfec005e03d5b2669e035c
2022-10-18 04:19:12 +00:00
Rakesh Emmadi
5666161ac9 server/multitenant: resize sources' connection pools when a cloud project is scaled, global connection pooling
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5708
Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com>
Co-authored-by: pranshi06 <85474619+pranshi06@users.noreply.github.com>
Co-authored-by: Puru Gupta <32328846+purugupta99@users.noreply.github.com>
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
Co-authored-by: Anon Ray <616387+ecthiender@users.noreply.github.com>
GitOrigin-RevId: 513d497548d89b397d4a299355b11607daec3c7e
2022-10-17 08:06:12 +00:00
Solomon
4700ac44fb Webhook Transforms: Move RequestCtx into a type family
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5975
GitOrigin-RevId: 08ad528b2600379deb4cef9d39968126c7c745d8
2022-10-16 03:55:06 +00:00
Jesse Hallett
c6bcf1cd76 server: codecs for object & array relationships, and computed fields
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5923
GitOrigin-RevId: e0c7584539998f5af16795f023640aa5c659b783
2022-10-13 17:57:23 +00:00
Krushan Bauva
63f90cc93c server: add api limit - batch limit
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6183
Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com>
Co-authored-by: Sean Park-Ross <94021366+seanparkross@users.noreply.github.com>
GitOrigin-RevId: 517766e10a3e94a54b754df69c47c61232d8dbb2
2022-10-13 16:54:26 +00:00
pranshi06
dccc2cea03 server: unauthenticated behaviour with Apollo ws
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4862
GitOrigin-RevId: 14db3fa732c7d6430795193e425769b63a221f19
2022-10-13 09:33:53 +00:00
Samir Talwar
96a768e526 Upgrade HLint to v3.4.1.
This upgrades CI and anyone using Nix to HLint v3.4.1.

If you're not using Nix, this doesn't actually _do_ anything on your
local machine; it's just a suggestion.

It also applies a bunch of simple HLint refactors, using
`make lint-hs-fix`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6324
GitOrigin-RevId: de8267e4909d6dcd3f83543188517f3aaeebc5f3
2022-10-12 19:14:56 +00:00
Jesse Hallett
332faabc24 server: codecs for remaining database configuration types
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6062
GitOrigin-RevId: f1ba9fa30267d1825ba36480103cd973616f3079
2022-10-12 16:30:05 +00:00
Brandon Martin
59820c5db5 server: Add tablePermissionsCommands to DataConnector API
Adding tablePermissionsCommands metadata api commands to dataconnector api

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5877
GitOrigin-RevId: feda63a963c6059a9ad72c0f1e13ed2dbb8e0d9b
2022-10-12 01:44:36 +00:00
paritosh-08
5c774cf839 server,pro: fix batch_size behaviour for auto event trigger log cleanup
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6279
GitOrigin-RevId: 20b8e6a22a26d97cd78655027aa2f30b7838462d
2022-10-11 19:27:53 +00:00
Philip Lykke Carlsen
ee34921d0d refactor: QualifiedIdentifier to use TableIdentifier
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6210
GitOrigin-RevId: 1fa24321396bbb68dd5f8516aab76850ebeebfa4
2022-10-11 10:43:43 +00:00
Tom Harding
4fdbda05ec Enable Postgres enums for Cockroach
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6232
GitOrigin-RevId: cc29e4932c3a24039efaf28f890a3dad97b51c3e
2022-10-11 09:09:26 +00:00
Lyndon Maydwell
d54bb30d3b Structured Error Protocol for Data Connectors Agents - GDW-137
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6061
Co-authored-by: Vishnu Bharathi <4211715+scriptnull@users.noreply.github.com>
GitOrigin-RevId: 855d96378030f4e01b0c74b00e20e592e51e7a49
2022-10-11 00:26:24 +00:00
Daniel Chambers
c862c64b33 Break down Data Connector agent schema tests into finer grained, more accurate, tests [GDC-479]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6225
GitOrigin-RevId: 8eaadcc14cf4bc90a22450e924daf8cc340ed2ea
2022-10-10 02:25:09 +00:00
Auke Booij
6f6177db38 Remove some unnecessary OPTIONS_GHC pragmas
I didn't track why these were left behind. Presumably GHC 9.2 has an improved redundant constraint checker, so that explains a few. Otherwise, perhaps code got refactored along the way.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6256
GitOrigin-RevId: b6275edf3e867f8e33bdec533ce9932381d36bbb
2022-10-07 17:27:08 +00:00
Auke Booij
4c016b4c42 Clean up pg-client-hs
- Remove a few unnecessary helper functions
- Delete kind annotations
- Bring GHC warnings and language extensions more in line with those of the `graphql-engine` library
- Constrain unconstrained dependency on `hasql-pool`

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6251
GitOrigin-RevId: 10c2530f007f70cf1464cec36566ee2264589881
2022-10-07 11:56:55 +00:00
Tom Harding
1d1ab15b47 Remove parsing for functions in Cockroach
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6250
GitOrigin-RevId: 389f58a327096ef9586c7a0f35df243955f73a5d
2022-10-07 09:51:07 +00:00
Brandon Simmons
823babe885 server: switch to ghc 9.2 (2nd try)
## Migrating, for server devs

You will need the fork of 9.2.4 that we're using (for now):

```
ghcup -c -n install ghc --force -u "https://storage.googleapis.com/graphql-engine-cdn.hasura.io/ghc-bindists/ghc-x86_64-deb10-linux-9.2.4-hasura-fix.tar.xz" 9.2.4
```

or for m1 mac:

```
ghcup -c -n install ghc --force -u  "https://storage.googleapis.com/graphql-engine-cdn.hasura.io/ghc-bindists/ghc-arm64-apple-darwin-9.2.4-hasura-fix.tar.xz"
```

Samir is working on a nix build for nix folx

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6154
GitOrigin-RevId: 6716e3f2ee19f0281c8ad25383a1241fc362d616
2022-10-06 09:09:01 +00:00
Daniel Chambers
d713cad315 Add support for lowercase table and column names in the Data Connector agent tests [GDC-463]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6179
GitOrigin-RevId: 6455e5809ea06b86dfbcddf781ee105088ca78f9
2022-10-05 23:25:00 +00:00
Philip Lykke Carlsen
3fea9ce4fc Refactor FromItem to use TableIdentifier
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6166
GitOrigin-RevId: 97d4fb0bec6d1c60e168f2503328ad5ef38915b2
2022-10-05 10:04:57 +00:00
Auke Booij
05b3a64e8f Clean up Hasura.Prelude a bit
- Remove `onJust` in favor of the more general `for_`
- Remove `withJust` which was used only once
- Remove `hashNub` in favor of `Ord`-based `uniques`
- Simplify some of the implementations in `Hasura.Prelude`
- Add `hlint` hint from `maybe True` to `all`, and `maybe False` to `any`

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6173
GitOrigin-RevId: 2c6ebbe2d04f60071d2a53a2d43c6d62dbc4b84e
2022-10-03 21:50:53 +00:00
Auke Booij
3efabe99b3 Memoize column parsers (within roles)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6036
GitOrigin-RevId: 225698f6db02b16599d9f157c9fe4c03b16fb71b
2022-10-03 20:11:44 +00:00
Auke Booij
6515ae8dbe Improve description for table select columns enum type
Before:
```
select Name {unName = "upeopoeklplxfaa"}columns of table "exbiovdrgjqskdr"
```
After:
```
select "upeopoeklplxfaa" columns of table "exbiovdrgjqskdr"
```

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6143
GitOrigin-RevId: 80a4075057c6d7361a000cb5c1e9b7a166a4f125
2022-10-03 11:00:10 +00:00
Auke Booij
b03ed983f1 Remove spaces before colons in error messages and descriptions
This PR is the result of running the following commands:
```bash
$ git grep -l '".* : "' -- '*.hs' | xargs sed -i -E 's/(".*) : "/\1: "/'
$ scripts/dev.sh test --integration --accept
```

Also manually fixed a few tests and docs

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6148
GitOrigin-RevId: cf8b87605d41d9ce86613a41ac5fd18691f5a641
2022-10-01 14:48:58 +00:00
Philip Lykke Carlsen
7739f8e4a0 server: Permit strings for numerical input fields
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5996
GitOrigin-RevId: 2ed36898aa0286618f3dafe3513ef4e01c58aaba
2022-09-30 13:25:57 +00:00
Gil Mizrahi
8c725acac8 fix type name generation for aggregation predicate functions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6138
GitOrigin-RevId: bfb77f97bb30c43bca698a1c405f75abd3eaffb9
2022-09-30 09:36:34 +00:00
Jesse Hallett
d32dc881e3 server: fix MySQL connection pool settings getting swapped on parse
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6063
GitOrigin-RevId: 90f6f8485aa6a9d073edc56dcba5530f5cf787c4
2022-09-28 21:11:26 +00:00
Samir Talwar
93e8803d3e Reload sources when applying metadata.
If we don't do this, we might end up applying metadata with a stale schema cache.

Following the principle of least surprise, replacing the metadata should probably compute inconsistencies with regards to the actual state of the database.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6026
GitOrigin-RevId: ff7469d7d9857c8a9f517d5d0b6f1ecf463621b3
2022-09-28 13:48:25 +00:00
paritosh-08
fabbd134b2 server: add metadata origin in streaming subscription field parser
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6075
GitOrigin-RevId: 901ba21dbcbf9bee4ca38cba21a5440ca10f3407
2022-09-27 15:56:46 +00:00
Daniel Harvey
3fadeeb5f9 server: Console Sentry DSN support
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5899
GitOrigin-RevId: 941647350def3ef21979c091e562c374ad562016
2022-09-27 14:51:52 +00:00
Abby Sassel
629f60eb55 server/postgres: address translateTableRelationship feedback
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6073
GitOrigin-RevId: 6316d64256d4fd34936e1d8c6afffb0db15f2fe7
2022-09-27 14:16:52 +00:00
paritosh-08
a88e6cfa9d server, pro: make http manager with allowlist in migrateCatalogSchema
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6045
GitOrigin-RevId: 34d67615b5a9e6b7f59760ecf89977764fcb1868
2022-09-27 09:25:28 +00:00
awjchen
8e05e51f1b server: report metrics API status from config API
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5599
GitOrigin-RevId: b66eb5c3a0034fe5ab7c764b34f7def77edd3fc0
2022-09-27 06:49:45 +00:00
Daniel Harvey
f42bc4b816 server: feature flag for disabling TABLE_updates fields
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6039
GitOrigin-RevId: fcbafe2e4b8cf72d739033b372b536d59c398c4e
2022-09-26 13:25:37 +00:00
Auke Booij
7e10ff4e13 server: don't export the backend_only permissions flag if it is set to false while exporting metadata
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6006
GitOrigin-RevId: 60207193b654407bffdbf8436f5be36f46c6d8c6
2022-09-26 06:11:57 +00:00
Philip Lykke Carlsen
46ef2e5d2a feat: Document aggregation predicates
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5894
GitOrigin-RevId: 2a06f7afdec6741aca7464eee42617aca920b9ad
2022-09-23 13:49:49 +00:00
Lyndon Maydwell
4d2e37b3e6 Raw Query Support for Data Connectors - GDW-394
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5890
Co-authored-by: Vijay Prasanna <11921040+vijayprasanna13@users.noreply.github.com>
GitOrigin-RevId: f6bd2ed5fe170bcce262564cf4f45c95c9bdff94
2022-09-22 21:09:06 +00:00
Gil Mizrahi
dd37456949 replace SELECT FROM with SELECT 1 FROM to fix count aggregates for cockroachdb
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5787
GitOrigin-RevId: f5f01a64ccffa36c93a0a88228ac927fbd3aa168
2022-09-22 13:58:03 +00:00
Abby Sassel
37b846c28d server/postgres: aggregation predicate filters should respect aggregation queries permissions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5936
GitOrigin-RevId: ecb6d677873676ec2bcb7d0bedd1ec707f8e05a1
2022-09-22 12:53:05 +00:00
Abby Sassel
b59008c880 server/postgres: implement execution of aggregation predicates (permissions)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5959
GitOrigin-RevId: eebfe36d217c333b393a308a1db19271809b6a87
2022-09-22 11:15:04 +00:00
Karthikeyan Chinnakonda
3b167b7df1 server: fix bug when streaming subscription cursor has custom name
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6009
GitOrigin-RevId: ba69bbd3a2c8f44e717cb64c8195041edc80a2d6
2022-09-22 09:52:36 +00:00
Daniel Harvey
f80ec1d543 server: Rename AltJ to ViaJSON
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5911
GitOrigin-RevId: bd4dec9792f2137b2f4e3169e19109a3d3f63b50
2022-09-21 18:42:30 +00:00
Tom Harding
e71496efa5 Replace Hasura.RQL.Types.Numeric with refined
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5913
GitOrigin-RevId: 96e218229a08dfbc5a598d709be1ee2083d41ec6
2022-09-21 18:03:04 +00:00
paritosh-08
1c7e19c209 server/docs: event trigger log cleanup | remove default for clear_older_than
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5998
GitOrigin-RevId: 1376fd2192c7daaf73e8099cdb2f1aab4b8c3cd1
2022-09-21 17:29:55 +00:00
Daniel Harvey
e2ced4011d server: import local Postgres modules as Postgres
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5962
GitOrigin-RevId: 862862c34b6c633c94ee8ae1f075afca2799fd2b
2022-09-21 11:35:50 +00:00
paritosh-08
876c906660 server: event trigger log cleanup | rename start_event_trigger_cleanups API
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5976
GitOrigin-RevId: 752c905d31b3700aa49d816ec573df74715f6654
2022-09-21 06:00:39 +00:00
Daniel Chambers
dc9a86680c Gardening: Clean up Data Connector API types
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5977
GitOrigin-RevId: 1a6898d6416fff265a8add74d414c979f7fa3bc5
2022-09-21 05:13:03 +00:00
Auke Booij
4c8ea8e865 Import pg-client-hs as PG
Result of executing the following commands:
```shell
# replace "as Q" imports with "as PG" (in retrospect this didn't need a regex)
git grep -lE 'as Q($|[^a-zA-Z])' -- '*.hs' | xargs sed -i -E 's/as Q($|[^a-zA-Z])/as PG\1/'
# replace " Q." with " PG."
git grep -lE ' Q\.' -- '*.hs' | xargs sed -i 's/ Q\./ PG./g'
# replace "(Q." with "(PG."
git grep -lE '\(Q\.' -- '*.hs' | xargs sed -i 's/(Q\./(PG./g'
# ditto, but for [, |, { and !
git grep -lE '\[Q\.' -- '*.hs' | xargs sed -i 's/\[Q\./\[PG./g'
git grep -l '|Q\.' -- '*.hs' | xargs sed -i 's/|Q\./|PG./g'
git grep -l '{Q\.' -- '*.hs' | xargs sed -i 's/{Q\./{PG./g'
git grep -l '!Q\.' -- '*.hs' | xargs sed -i 's/!Q\./!PG./g'
```
(Doing the `grep -l` before the `sed`, instead of `sed` on the entire codebase, reduces the number of `mtime` updates, and so reduces how many times a file gets recompiled while checking intermediate results.)

Finally, I manually removed a broken and unused `Arbitrary` instance in `Hasura.RQL.Network`. (It used an `import Test.QuickCheck.Arbitrary as Q` statement, which was erroneously caught by the first find-replace command.)

After this PR, `Q` is no longer used as an import qualifier. That was not the goal of this PR, but perhaps it's a useful fact for future efforts.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5933
GitOrigin-RevId: 8c84c59d57789111d40f5d3322c5a885dcfbf40e
2022-09-20 19:55:51 +00:00
paritosh-08
f7115891f7 server: event trigger log cleanup | change metedata API field name
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5965
GitOrigin-RevId: aa50006946e79fe4d9c971568221dc436040b738
2022-09-20 16:33:11 +00:00
paritosh-08
607b26362d server: event trigger cleanup | fix query_timeout field name
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5953
GitOrigin-RevId: b80b6672db5a73cafca77ba06cf25f71c7dc8c10
2022-09-20 12:47:22 +00:00
Daniel Chambers
5c06eb7a3e Remove duplicated Data Connector API types
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5930
GitOrigin-RevId: 8c11387fa8556c3cdf8c92a0924ae53d31b953a5
2022-09-20 06:20:25 +00:00
Daniel Chambers
04ae6abf78 Exists support in filter expressions for Data Connector queries [GDW-133]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5904
GitOrigin-RevId: 6bad4c29a7d14d3881f9c57fe983d14cc41bdc4b
2022-09-20 04:01:33 +00:00
awjchen
dcca0c6275 server: support 128-bit trace ids
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5905
GitOrigin-RevId: 48a981a432b2e979bc7b42b32f9c7f53ab9e2598
2022-09-20 02:50:06 +00:00
hasura-bot
71bba3e3aa Add X-Forwarded-Origin header
GITHUB_PR_NUMBER: 8728
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/8728

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5246
Co-authored-by: Wsevolod <31807671+kraftwerk28@users.noreply.github.com>
GitOrigin-RevId: b8229786a2b14a8be49303f9a6da10231c8fb331
2022-09-19 14:55:23 +00:00
Abby Sassel
71597778c9 server/postgres: fix non-latin text elements in array literals (copy). close hasura/graphql-engine#8961
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5916
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 9063f7ff39f684c4ab43f093706b872021b67b13
2022-09-18 16:08:15 +00:00
Philip Lykke Carlsen
26cdc03aa4 fix(#8904): Make BigQuery Computed Fields arguments optional
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5909
GitOrigin-RevId: 0d7c7de273c27bbd2338f42253754be0a06ea66e
2022-09-17 22:41:19 +00:00
awjchen
c3840fe2d1 server: graphql-ws: stop sending pings in response to pongs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5882
GitOrigin-RevId: 07fad6a24bb6eed9807e785e8201517126f7c302
2022-09-17 00:01:53 +00:00
Abby Sassel
3056678e04 server/postgres: Implement execution of aggregation predicates
PR for the translation / execution step of [aggregation predicate filters](https://github.com/hasura/graphql-engine-mono/issues/5174).

[`translateAVAggregationPredicates`](translateAVAggregationPredicates) is the main change of note, everything else is a supporting or helper function. Please note this doesn't yet include [tests relating to permissions](https://hasurahq.slack.com/archives/C01RZPEPF0W/p1662560092197769); I decided to raise a PR without them for slightly faster feedback. I may include them in this PR or a separately if it's not trivial.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5724
GitOrigin-RevId: fcac258b64066e2bd45108372165a16fd957f5ab
2022-09-16 15:01:03 +00:00
Karthikeyan Chinnakonda
cb2349d5a0 server, pro server, console: provide an option to not include rows count while fetching scheduled events
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5650
Co-authored-by: Varun Choudhary <68095256+Varun-Choudhary@users.noreply.github.com>
Co-authored-by: Daniele Cammareri <5709409+dancamma@users.noreply.github.com>
GitOrigin-RevId: 8a55f3ca52cfbda4d4e75372b813b7acd421eabb
2022-09-15 19:12:04 +00:00
Stefano Magni
a0f4f00bfd console: Add Sentry
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5699
Co-authored-by: Rishichandra Wawhal <27274869+wawhal@users.noreply.github.com>
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
GitOrigin-RevId: 00f2c5d25012b21f4e8763ef578598a3a11896e4
2022-09-15 17:00:44 +00:00
paritosh-08
ab71adc3a0 server, pro: event trigger auto cleanup (increment 3)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5823
Co-authored-by: pranshi06 <85474619+pranshi06@users.noreply.github.com>
Co-authored-by: Puru Gupta <32328846+purugupta99@users.noreply.github.com>
Co-authored-by: Karthikeyan Chinnakonda <15602904+codingkarthik@users.noreply.github.com>
GitOrigin-RevId: 3d4af905d5df4c05107ad46ef29f4c0a567ff754
2022-09-15 11:46:22 +00:00
Anon Ray
1d9844ee4e server: use metadata DB ID as ProjectID for EE lite projects
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5874
GitOrigin-RevId: 63a4016227eeeceb0143cf84ed4c13b14f424d4b
2022-09-15 09:13:56 +00:00
Lyndon Maydwell
118b03e329 RMGetSourceKindCapabilities doesn't modify metadata
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5883
GitOrigin-RevId: dbf69fd3f6086eca0e9b2ed9b47d19ae56339e63
2022-09-15 07:35:09 +00:00
David Overton
cbddcce26b Data connector cache invalidations
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5820
GitOrigin-RevId: ded80e378901cc0c0ca12eb67d9264756a8d6ff4
2022-09-14 13:00:47 +00:00
Solomon
4a0446852c Adds configSchema to get_source_kind_capabilities
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5860
GitOrigin-RevId: 9bc13af5104251c509194d28ece81066643ab2a2
2022-09-14 07:07:04 +00:00
Samir Talwar
ee995aacc1 Extract out functions from columnParser in Backend.
The intent is to generalize `columnParser` to the point where it is the same across all backends, and then remove the interface in favor of a single implementation.

This extracts out `enumParser` and `possiblyNullable` as the two main areas that differ across backends. We may split `possiblyNullable` further so that we can extract some of that logic out into a common function too.

With these changes, the various `columnParser` implementations become semantically equivalent. They still do different things, and so reconciling them will require further changes.

Co-Authored-By: Antoine Leblanc <antoine@hasura.io>

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5841
GitOrigin-RevId: eec1770931eed5d72da70c97d7d0f00e33fa15d2
2022-09-13 21:22:25 +00:00
Brandon Simmons
82f129ff7c PLAT-75: Log uncompressed_response_size
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5827
GitOrigin-RevId: c98e5075f38737d9eb9cf467a62032ca5984304e
2022-09-13 15:37:14 +00:00
paritosh-08
db710d38b7 server, pro: event trigger auto cleanup (increment 2)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5746
Co-authored-by: pranshi06 <85474619+pranshi06@users.noreply.github.com>
Co-authored-by: Puru Gupta <32328846+purugupta99@users.noreply.github.com>
Co-authored-by: Karthikeyan Chinnakonda <15602904+codingkarthik@users.noreply.github.com>
GitOrigin-RevId: f4e5e06389ca57bdb5f7771f459c07418787111d
2022-09-13 08:34:52 +00:00
Naveen Naidu
005dbf43cb server: event triggers should be dropped when a previously present source is dropped in replace_metadata
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5739
Co-authored-by: paritosh-08 <85472423+paritosh-08@users.noreply.github.com>
GitOrigin-RevId: 772de8bb6a55a0002885e08a778c16f22ea0b113
2022-09-13 04:18:21 +00:00
Solomon
fb3ba23a44 get_source_tables API call, don't fold table names.
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5837
GitOrigin-RevId: 9f785793a279c4016d8ed88374d2442019489252
2022-09-13 02:06:24 +00:00
Jesse Hallett
8729301ad6 server: codecs for postgres connection configuration types
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5722
GitOrigin-RevId: 85de9a550229d3ac3304ec46fed81e97f2a150f6
2022-09-12 21:46:33 +00:00
Jesse Hallett
b094947239 server: codecs for TableMetadata, FunctionMetadata, and permissions
This PR expands the set of codecs for source metadata to include `TableMetadata`, `FunctionMetadata`, and various permission types. This fills out more detail in the generated OpenAPI document.

See the [generated OpenAPI spec](https://gist.github.com/hallettj/783d06a926cbc854eececa4964e8aa5b) based on this PR.

See also the
[generated TypeScript types](https://github.com/hasura/graphql-engine-mono/files/9448102/client-typescript.tar.gz) based on that spec.

Ticket: https://hasurahq.atlassian.net/browse/MM-66

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5664
GitOrigin-RevId: b6e1f32c669368cd6150e6f69fc36b78b748d9bb
2022-09-12 20:31:07 +00:00
Antoine Leblanc
40db3d7eab Resolve source customization at schema cache building time.
### Description

This PR attempts to fix several issues with source customization as it relates to remote relationships. There were several issues regarding casing: at the relationship border, we didn't properly set the target source's case, we didn't have access to the list of supported features to decide whether the feature was allowed or not, and we didn't have access to the global default.

However, all of that information is available when we build the schema cache, as we do resolve the case of some elements such as function names: we can therefore resolve source information at the same time, and simplify both the root of the schema and the remote relationship border.

To do this, this PR introduces a new type, `ResolvedSourceCustomization`, to be used in the Schema Cache, as opposed to the metadata's `SourceCustomization`, following a pattern established by a lot of other types.

### Remaining work and open questions

One major point of confusion: it seems to me that we didn't set the case at all across remote relationships, which would suggest we would use the case of the LHS source across the subset of the RHS one that is accessible through the remote relationship, which would in turn "corrupt" the parser cache and might result in the wrong case being used for that source later on. Is that assesment correct, and was I right to fix it?

Another one is that we seem not to be using the local case of the RHS to name the field in an object relationship; unless I'm mistaken we only use it for array relationships? Is that intentional?

This PR is also missing tests that would show-case the difference, and a changelog entry. To my knowledge, all the tests of this feature are in the python test suite; this could be the opportunity to move them to the hspec suite, but this might be a considerable amount of work?

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5619
GitOrigin-RevId: 51a81b713a74575e82d9f96b51633f158ce3a47b
2022-09-12 16:07:26 +00:00
Tom Harding
70515d94c7 Extract Hasura.Prelude from src-lib
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5776
GitOrigin-RevId: 0df263a4d800e694e68e31c189c360c88cf48abc
2022-09-09 13:58:48 +00:00
Jesse Hallett
977c624c9e server: prune health check from codecs for backends that don't support it
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5822
GitOrigin-RevId: 637a8c668299409385f340d62fc6a84df5c4aa0f
2022-09-09 13:07:33 +00:00
paritosh-08
d6970173c1 server, pro: event trigger auto cleanup (increment 1)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5612
Co-authored-by: pranshi06 <85474619+pranshi06@users.noreply.github.com>
Co-authored-by: Puru Gupta <32328846+purugupta99@users.noreply.github.com>
Co-authored-by: Karthikeyan Chinnakonda <15602904+codingkarthik@users.noreply.github.com>
GitOrigin-RevId: 6ce69ebb555e49439ae2b01fe42e39415ac53966
2022-09-09 08:28:31 +00:00
Samir Talwar
f48c882521 server: Share tests between CircularT and MemoizeT.
This abstracts `CircularT`'s test cases to work against "any" memoizer, and then runs them against `MemoizeT` as well.

Surprisingly (or not), this works without issue; `MemoizeT` passes all tests with a couple of extra instances.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5780
GitOrigin-RevId: 461880caf9220dc3f52d622a22e8b8bcd594e404
2022-09-08 19:38:49 +00:00