Commit Graph

2839 Commits

Author SHA1 Message Date
rikinsk
8f022a1008 Merge branch 'main' into stable
GitOrigin-RevId: 9eccd863f3285eba2352b685462f9a672c55274c
2023-04-27 06:53:17 +00:00
Puru Gupta
d9b77d9dae server: remove cache specific headers when response is not cached
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8637
Co-authored-by: Daniele Cammareri <5709409+dancamma@users.noreply.github.com>
GitOrigin-RevId: 0af8adbb638394fb65926165b09ff237d060ce85
2023-04-16 19:33:26 +00:00
Solomon
eada60b80d Add a Query Cache Max TTL, Bucket Size, and Bucket Rate Arg/Env options in HasuraPro
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6484
GitOrigin-RevId: 1a060ca8d81f123abaa54a64e905cc8e20b683c7
2023-04-13 20:04:24 +00:00
Tom Harding
4c25eafc52 bulk_keep_going
[NDAT-604]: https://hasurahq.atlassian.net/browse/NDAT-604?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8770
GitOrigin-RevId: 597dbb1448794c0ac25496d6b6f759d5aaccc2fb
2023-04-13 17:00:45 +00:00
Philip Lykke Carlsen
0346224444 Rename "Logical Models" → "Native Queries"
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8769
GitOrigin-RevId: 66f2cbfb620d641e672a4074554d9d324a18c591
2023-04-13 16:12:20 +00:00
Antoine Leblanc
e682868350 Remove app state reference in pro context
### Description

**This PR is on top of #8655. Its diff is [this commit](8dd6e8899e).**

This PR removes the app state reference in pro's context, allowing us to build the context _before_ building the firsts schema cache. It does so by introducing `MetricsConfigRef`, based on the very similar `TLSAllowListRef`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8665
Co-authored-by: Auke Booij <164426+abooij@users.noreply.github.com>
GitOrigin-RevId: d0a614f699f41cd50801b125c6b1e40bd2f629e2
2023-04-13 15:12:35 +00:00
Vishnu Bharathi
a043dadaf3 ci: tag release v2.23.0
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8768
GitOrigin-RevId: fd546695d77dc511613420fe7c0daf870279e4e7
2023-04-13 14:17:10 +00:00
Tom Harding
d60136b4fb Create a schema dependency from logical models to their types
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8746
GitOrigin-RevId: 969685c87e7fcd3458da87a37a0a4589d6f85bc5
2023-04-13 09:56:29 +00:00
Daniel Chambers
56db8ec358 Data Connectors: Fix track_table not working if the table was created after schema cache was built
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8732
GitOrigin-RevId: e11a0ef6979d1d58a0b39dcd8fff48d446d3420f
2023-04-13 01:30:50 +00:00
Solomon
7ce1093683 Allow CE users to attempt GDC requests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8754
GitOrigin-RevId: 26a364a6c9d5788d4b06a84942ba9953be104ab7
2023-04-12 22:04:13 +00:00
Daniel Harvey
cd024dcaa4 chore(server): logical models, remove unused arg
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8751
GitOrigin-RevId: fcef0a4b3974206bd0920bd8e4b46af9407b90c0
2023-04-12 17:00:44 +00:00
Samir Talwar
5677446ff3 server/tests-py: Run test_websocket_init_cookie.py in parallel.
This requires rewriting the test class to split it into 3, each specifying the correct environment variables for HGE.

It would be lovely to use parameterization rather than subclassing, but that doesn't work because of `hge_fixture_env`, which creates a "soft" dependency between the environment variables and `hge_server`. Parameterizing the former *should* force the latter to be recreated for each new set of environment variables, but `hge_server` isn't actually aware there's a dependency. See `TestParameterizedFixtures` in test_tests.py for more information.

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

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8747
GitOrigin-RevId: 878b2fc20f39f962a67cd950046a99c283cfc6fc
2023-04-12 16:26:22 +00:00
Auke Booij
6f78d25932 chore(server): simplify bindErrorA and use more broadly
The simplification will allow us to avoid a few `MonadError QErr m` constsraints in the future - this effect can be created locally instead of reusing a global one.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8729
GitOrigin-RevId: 851e28b1f5bfe4c47da43fa324714a941ef25c57
2023-04-12 15:51:37 +00:00
Samir Talwar
43f179688c server/tests-py: Run test_graphql_read_only_source.py in parallel.
This requires making it add its own source, rather than expecting one to be provided.

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

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8745
GitOrigin-RevId: 65c818e4f065e9f98e9cfd65c158eff5d768ae31
2023-04-12 14:37:21 +00:00
Naveen Naidu
a8b94120d1 server: close all websocket connection when sqlGenCtx and experimental features changes
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8736
GitOrigin-RevId: 20f3d6386c961020b5b93c857dfa0cd99a9838b5
2023-04-12 10:27:42 +00:00
Tom Harding
af0b56332d De-duplicate prepared logical model arguments
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8723
GitOrigin-RevId: 5df1a05c47852d7371ef323bb0df2ac9d1749243
2023-04-12 09:05:48 +00:00
Naveen Naidu
0720c6a66c server: always read latest appContext in v1alpha1/config endpoint
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8727
GitOrigin-RevId: 0139a3d98262bfdf0a39ad7fc986482fb1bfe156
2023-04-12 05:55:19 +00:00
Tom Harding
168037df02 Add a test for multiplexing logical models
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8720
GitOrigin-RevId: da435a5700929592eb95d49dbaa9b4531c10042e
2023-04-11 16:59:41 +00:00
Toan Nguyen
713b434aef server,frontend: generic EE SSO login for console with multiple identity providers
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8035
Co-authored-by: Vishnu Bharathi <4211715+scriptnull@users.noreply.github.com>
Co-authored-by: Stefano Magni <173663+NoriSte@users.noreply.github.com>
GitOrigin-RevId: 3c5d5d899578c2fe50af8569318e25495f380878
2023-04-11 13:15:27 +00:00
Gil Mizrahi
5d518f62a9 cleanup(tests): remove the type class in logimo typechecking test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8698
GitOrigin-RevId: 367cbc38ee7260c499a42b249b94463f2235ae0f
2023-04-11 10:29:39 +00:00
Gil Mizrahi
4696b60ec7 chore(debugging): convert trace ghc warnings to hlint warnings
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8700
GitOrigin-RevId: 29b1ee9172bb10823420de9555c3e22f9846facd
2023-04-11 09:06:56 +00:00
David Overton
346804fc67 Support nested object fields in DC API and use this to implement nest…
## Description

This change adds support for nested object fields in HGE IR and Schema Cache, the Data Connectors backend and API, and the MongoDB agent.

### Data Connector API changes

- The `/schema` endpoint response now includes an optional set of GraphQL type definitions. Table column types can refer to these definitions by name.
- Queries can now include a new field type `object` which contains a column name and a nested query. This allows querying into a nested object within a field.

### MongoDB agent changes

- Add support for querying into nested documents using the new `object` field type.

### HGE changes

- The `Backend` type class has a new type family `XNestedObjects b` which controls whether or not a backend supports querying into nested objects. This is currently enabled only for the `DataConnector` backend.
- For backends that support nested objects, the `FieldInfo` type gets a new constructor `FINestedObject`, and the `AnnFieldG` type gets a new constructor `AFNestedObject`.
- If the DC `/schema` endpoint returns any custom GraphQL type definitions they are stored in the `TableInfo` for each table in the source.
- During schema cache building, the function `addNonColumnFields` will check whether any column types match custom GraphQL object types stored in the `TableInfo`. If so, they are converted into `FINestedObject` instead of `FIColumn` in the `FieldInfoMap`.
- When building the `FieldParser`s from `FieldInfo` (function `fieldSelection`) any `FINestedObject` fields are converted into nested object parsers returning `AFNestedObject`.
- The `DataConnector` query planner converts `AFNestedObject` fields into `object` field types in the query sent to the agent.

## Limitations

### HGE not yet implemented:
- Support for nested arrays
- Support for nested objects/arrays in mutations
- Support for nested objects/arrays in order-by
- Support for filters (`where`) in nested objects/arrays
- Support for adding custom GraphQL types via track table metadata API
- Support for interface and union types
- Tests for nested objects

### Mongo agent not yet implemented:

- Generate nested object types from validation schema
- Support for aggregates
- Support for order-by
- Configure agent port
- Build agent in CI
- Agent tests for nested objects and MongoDB agent

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7844
GitOrigin-RevId: aec9ec1e4216293286a68f9b1af6f3f5317db423
2023-04-11 01:30:37 +00:00
Daniel Harvey
99b0139275 chore(server): variable renaming around custom return type permissions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8624
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 901db6df865ce0433399731f878c6f3a10cf6e87
2023-04-10 14:17:20 +00:00
Puru Gupta
c54697b958 server: enable remote schema to remote schema relationship for unauthenticated context
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8562
GitOrigin-RevId: 2b1e2241fd2dbe379d5f9e40224e1245f1188475
2023-04-10 13:35:38 +00:00
Karthikeyan Chinnakonda
ddf34d9ffa Miscellaneous scheduled triggers fixes
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8618
GitOrigin-RevId: f9e3eb0d3d8b2ba36344b9ce0739c6a51e77f59e
2023-04-10 12:27:21 +00:00
Vishnu Bharathi
eabbb917ed ci: tag release v2.22.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8681
GitOrigin-RevId: 79762246e1115f6495d9f4b06d2ec9f43254b5e2
2023-04-07 11:15:45 +00:00
Naveen Naidu
2814735a20 server: fix dirty read of schema cache
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8677
GitOrigin-RevId: 615bfb4dc8d22a46a87ceb76c5f89d608e88f97d
2023-04-07 09:23:03 +00:00
Antoine Leblanc
0476331136 small cleanups of pro's init
### Description

(This PR is better reviewed commit by commit.)

This PR is an aggregation of small incremental changes to Pro's init:
- it deletes some dead code,
- it starts reorganizing the code of that file by sections, similar to OSS' init,
- it extracts and cleans up license key cache init (groups several blocks of code in one separate function)
- makes some changes to a service class to reduce the dependency on `_acAppStateRef`

This PR is a first step: our goal is to move the schema cache build _in_ the app monad, in order to achieve #8344. To do so, we will need to remove `_acAppStateRef` from Pro's `AppContext`. There are two different paths we can take from here, which is why i cut this PR here:
- the first would be to change the different instances we implement on `AppM` to take as an argument the parts of the schema cache they depend on, rather than reading them from `_acAppStateRef`; as of this PR, `MetricsConfig` is the only such field;
- the second would be to apply the same strategy we already used for the TLSAllowList, and use a `IORef` that can be updated after the schema cache is built; this change would have a smaller footprint, but introduces one new `IORef` per such field, which feels something we don't want to generalize

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8655
GitOrigin-RevId: 809697d460bdb5c83ef7d30a2e835f589bcd80a6
2023-04-06 15:37:15 +00:00
paritosh-08
774075a709 server: add code field to warning object in metadata API responses
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8601
GitOrigin-RevId: 7034c0a04b87c44731680917aa3946084b705959
2023-04-06 02:41:24 +00:00
Tom Harding
3cef692dd7 feature(server): Get _all_ source tables
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8649
GitOrigin-RevId: 4bb9311d1d7ab4e8ee641bde5df2babcb1b8b306
2023-04-05 20:16:14 +00:00
Philip Lykke Carlsen
41a5092b97 refactor(tests): Support componentised Postgres fixtures, port SimpleObjectSpec
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8607
GitOrigin-RevId: b068f7308fa8fa4b626aa2f9352da3965b03fa34
2023-04-05 18:05:37 +00:00
Vishnu Bharathi
60afce2b94 ci: tag release v2.23.0-beta.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8641
GitOrigin-RevId: e4395099602829a41d66c47e2c821b7a8912acef
2023-04-05 12:27:36 +00:00
Antoine Leblanc
d00f4ef497 Always flush the loggers without explicitly relying on onException
### Description

This PR makes use of the fact that the `LoggerSet` is created in a `ManagedT` context to guarantee that we flush it when the `ManagedT` context terminates, which is guaranteed even when an exception is thrown since `allocate` is implemented using `bracket`.

This allows us to remove several manual calls to `flip onException flushLoggers`, and avoids having to manually perform that check everywhere.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8629
GitOrigin-RevId: 47657b910dc1bb7cfc0594f02e6cce9893ae3439
2023-04-05 11:07:14 +00:00
Rishichandra Wawhal
c6d65508b2 [feature branch] EE Lite Trials
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8208
Co-authored-by: awjchen <13142944+awjchen@users.noreply.github.com>
Co-authored-by: Vijay Prasanna <11921040+vijayprasanna13@users.noreply.github.com>
Co-authored-by: Toan Nguyen  <1615675+hgiasac@users.noreply.github.com>
Co-authored-by: Abhijeet Khangarot <26903230+abhi40308@users.noreply.github.com>
Co-authored-by: Solomon <24038+solomon-b@users.noreply.github.com>
Co-authored-by: gneeri <10553562+gneeri@users.noreply.github.com>
GitOrigin-RevId: 454ee0dea636da77e43810edb2f427137027956c
2023-04-05 08:59:09 +00:00
Daniel Chambers
fde4c0fae5 Enhance insert table schema with extra info and remove need for cached schema usage in Super Connector mutations
[GDC-643]: https://hasurahq.atlassian.net/browse/GDC-643?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8560
GitOrigin-RevId: 0e965da447eb6a5acf5a0f291f9e205882630e6e
2023-04-05 02:23:20 +00:00
Antoine Leblanc
e6a8bcb1c9 Make flag value a part of the cache's dynamic config.
### Description

If i understand correctly, the _value_ of a feature flag **can** change at runtime. Since this has an impact on how the schema cache is built, this PR makes the value of the flag a part of the cache's "dynamic" config, therefore making it an arrow-ish argument for the incremental framework. It also removes `CheckFeatureFlag` from the static config, now obsolete.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8631
GitOrigin-RevId: 2ca898e4193e8552c40d2b21a819d3dd414601fe
2023-04-04 19:39:39 +00:00
Antoine Leblanc
306162f477 Remove ServerConfigCtx.
### Description

This PR removes `ServerConfigCtx` and `HasServerConfigCtx`. Instead, it favours different approaches:
- when the code was only using one field, it passes that field explicitly (usually `SQLGenCtx` or `CheckFeatureFlag`)
- when the code was using several fields, but in only one function, it inlines
- for the cache build, it introduces `CacheStaticConfig` and `CacheDynamicConfig`, which are subsets of `AppEnv` and `AppContext` respectively

The main goal of this is to help with the modularization of the engine: as `ServerConfigCtx` had fields whose types were imported from several unrelated parts of the engine, using it tied together parts of the engine that should not be aware of one another (such as tying together `Hasura.LogicalModel` and `Hasura.GraphQL.Schema`).

The bulk of this PR is a change to the cache build, as a follow up to #8509: instead of giving the entire `ServerConfigCtx` as a incremental rule argument, we only give the new `CacheDynamicConfig` struct, which has fewer fields. The other required fields, that were coming from the `AppEnv`, are now given via the `HasCacheStaticConfig` constraint, which is a "subset" of `HasAppEnv`.

(Some further work could include moving `StringifyNumbers` out of `GraphQL.Schema.Options`, given how it is used all across the codebase, including in `RQL.DML`.)

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8513
GitOrigin-RevId: 818cbcd71494e3cd946b06adbb02ca328a8a298e
2023-04-04 16:01:42 +00:00
Tom Harding
794690f30c Implement get_source_tables command for all backends
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8619
GitOrigin-RevId: 5e1b2c11775d801a77dc6d92de4c5abc1c9b8c60
2023-04-04 15:27:19 +00:00
Gil Mizrahi
352d8ff09c validate logical models custom return type against postgres
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8563
GitOrigin-RevId: 462a608e0e90d1923bc1d735257f4506825f5db1
2023-04-04 14:02:59 +00:00
Puru Gupta
8a6a8459ab server: zero-downtime env vars update on cloud
[GS-232]: https://hasurahq.atlassian.net/browse/GS-232?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8475
Co-authored-by: Anon Ray <616387+ecthiender@users.noreply.github.com>
Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com>
GitOrigin-RevId: fb47f02f4e0d6d889c0348abc50fd46382f1bd5e
2023-04-04 13:26:21 +00:00
Daniel Harvey
9c99bcb6f8 chore(server): move perms to custom return types
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8604
GitOrigin-RevId: ff024429b3f06e4867334665f35d4bd404a85cba
2023-04-04 12:46:51 +00:00
Antoine Leblanc
0177510b8f Fix haskell error in example code block
Fix trivial error in documentation.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8620
GitOrigin-RevId: 1b8410ae213b1e5f0954bdf4e957d29f1a668696
2023-04-04 11:28:35 +00:00
Antoine Leblanc
e9ae080d28 Add ManagedT deep dive.
### Description

This small documentation PR explains why and how we use `ManagedT`, and how it solves problems we would have with `Managed`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8615
GitOrigin-RevId: 5b7710a8cb6373fefb69bb4e9e8eda389c14c2da
2023-04-04 10:34:58 +00:00
Tom Harding
4854d3ca21 Add extremely basic support for BigQuery JSON fields
[NDAT-501]: https://hasurahq.atlassian.net/browse/NDAT-501?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8614
GitOrigin-RevId: 24530130499174a1a02e0fb4510859fcfeed207d
2023-04-04 09:45:17 +00:00
Philip Lykke Carlsen
df12c7cf46 fix(api-tests): Ensure the test runner runs the logger cleanup function.
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8602
GitOrigin-RevId: 7e07b8b0556a22edf4e058e23ff020cc5e8528f6
2023-04-04 09:01:44 +00:00
pranshi06
e6c8abf7d4 server: add connection_template as an argument in pg_test_connection_template API
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8520
GitOrigin-RevId: 525bba9015ad4e143e94124e42ec4518252932cb
2023-04-03 14:27:12 +00:00
Auke Booij
7cc33dd8ec server: refactor Hasura.Metadata.Class
- Remove `MonadMetadataStorageQueryAPI` which was only implemented by a default implementation
- Introduce `TransT` which can be used to easily derive `lift`ing implementations for `MonadBlaBlaBla` classes

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8579
GitOrigin-RevId: 4f804fda7e2de5c9d75ee4df269f500ebd46b8c9
2023-04-03 13:36:50 +00:00
Gil Mizrahi
ed4f3b7406 feature(server): CockroachDB now supports distinct. Document and test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8596
GitOrigin-RevId: 3dbc5fccb1d4387041a5a80794158c4f50b70848
2023-04-03 11:51:22 +00:00
Daniel Harvey
cb9f822fc0 chore(server): move user-defined-functions into Hasura.Function.*
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8595
GitOrigin-RevId: b3b7dec8504fe4daf324125e4017fa7d1945b3ca
2023-04-03 10:20:20 +00:00
Tom Harding
7e06b30e4d Add metadata commands for custom return type permissions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8587
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
GitOrigin-RevId: 660f2eda9cf1c7c612d66745064b3998c77804e0
2023-03-31 16:29:24 +00:00