Commit Graph

4077 Commits

Author SHA1 Message Date
jkachmar
647231b685 Yeet some default-extensions
Manually enables:
* EmptyCase
* ExistentialQuantification
* QuantifiedConstraints
* QuasiQuotes
* TemplateHaskell
* TypeFamilyDependencies

...in the following components:
* 'graphql-engine' library
* 'graphql-engine' 'src-test'
* 'graphql-engine' 'tests/integration'
* 'graphql-engine' tests-hspec'

Additionally, performs some light refactoring and documentation.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3991
GitOrigin-RevId: 514477d3466b01f60eca8935d0fef60dd0756838
2022-03-16 00:40:17 +00:00
Gil Mizrahi
c9e80cbfaf tests-hspec refactor + use the new Harness.Test.Schema setup mechanism for the column presets test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3953
GitOrigin-RevId: 02b5fe53d1133c5600a6ad5e55d006f461e6ad87
2022-03-15 16:09:52 +00:00
Gil Mizrahi
4cd72d738a Improve changelog entry for 8221
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3985
GitOrigin-RevId: c1c2a56ff1e73be09ec43e1a1469a73f3c8a6bcb
2022-03-15 15:17:18 +00:00
Antoine Leblanc
f1ef8338ee Fix not detecting collisions between remote relationships for the unauthenticated context.
### Description

This very small PR fixes an error introduced in #3811, when changing the collision detection code: we were properly doing collision detection for remote schemas for the unauthenticated context, and also removing remote relationships... but then we were not using the result to build the schema.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3986
GitOrigin-RevId: 26a5553bf82574f2764fd594b0616dfea95a4757
2022-03-15 15:14:07 +00:00
Karthikeyan Chinnakonda
a2d4724ae4 server: optimization of recreating event triggers only when needed
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3980
GitOrigin-RevId: ac882489d125436423315ee0e055198e96d0998c
2022-03-15 13:01:36 +00:00
Karthikeyan Chinnakonda
c6a7f4c488 server: remove the extraneous drop function while creating an event trigger
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3956
GitOrigin-RevId: 6d97ffce00fe17ca7f15a8e74acbc1b3d974f7b4
2022-03-15 08:42:01 +00:00
Daniel Chambers
69501b2657 server: Use max-age when refreshing JWKs if must-revalidate is present
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3979
GitOrigin-RevId: 5f5ebfb25ff9729e34397084d86b0fe968099b25
2022-03-15 07:36:43 +00:00
David Overton
2a934df0bc Fix bad changelog merge after v2.2.2 release
Fix changelog merge from 2.2.2

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3977
GitOrigin-RevId: 19f0d9b4362cf988c0b156a7b7125969f4ce984f
2022-03-15 05:34:22 +00:00
Robert
d8f139e318 server: app init cleanup
- remove an unused return value
- untangle database query logic slightly
- rename printErrExit functions, and use them more consistently
- simplify the top-level exception handling

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3900
GitOrigin-RevId: a6727c6f899aed00e6a04bd822727341fd51acc4
2022-03-14 18:32:40 +00:00
Antoine Leblanc
376c7d48f1 Add remote relationships from remote schemas in schema parser generators
### Description

This PR extends the `RemoteSchema` parsers to also include remote relationships. This include a significant refactoring of the top level schema building blocks, since remote schemas can no longer be built in isolation: they have to be built within the same run of `MonadSchema` as the sources. It is originally taken from the changes in #3069 and was slightly adapted.

I highly recommend turning OFF whitespace in the Github UI for `Schema.hs`, since I've adjusted the indentation of two large functions.

### Warning

Given the lack of a feature flag, this PR technically **enables the feature**. While the metadata API is not plugged in, a savvy user could use `replace_metadata` to set a metadata that contains remote joins from remote schemas, and they would be enabled. Is this acceptable?

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3811
GitOrigin-RevId: a5b00f865cdb8890b0fc02b139c2ebd48929f138
2022-03-14 16:22:50 +00:00
Gil Mizrahi
92ab93775f server/mssql: Implement column presets
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3856
GitOrigin-RevId: 8527749c33df1a5bdde29338630714e673e308ab
2022-03-14 15:35:15 +00:00
Rishichandra Wawhal
bd05e242d5 console: data sidebar table search
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3826
Co-authored-by: Vijay Prasanna <11921040+vijayprasanna13@users.noreply.github.com>
Co-authored-by: Abhijeet Khangarot <26903230+abhi40308@users.noreply.github.com>
GitOrigin-RevId: a7de40686c9d3f1551e84aeec376ff143935a97a
2022-03-14 13:49:44 +00:00
Varun Choudhary
073b9c33f9 console: fixed an issue where db to db relationship where not removed from the list after deletion [CON-64]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3928
Co-authored-by: Vijay Prasanna <11921040+vijayprasanna13@users.noreply.github.com>
GitOrigin-RevId: 6d3e1af3df9928bccc98036dfa0252110a4a11a9
2022-03-14 12:47:21 +00:00
Varun Choudhary
773b5808fa console: pass only current schema table to local table relationships
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3932
GitOrigin-RevId: 8b4a3821f65457aafe6008b2473d047a95da130b
2022-03-14 12:03:46 +00:00
Rakesh Emmadi
b844c5d732 server/tests: unify HASURA_BIGQUERY_SERVICE_KEY and HASURA_BIGQUERY_SERVICE_ACCOUNT env vars
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3914
GitOrigin-RevId: 66f75420504d1b864b91599c2bdaa832784bb956
2022-03-14 07:50:35 +00:00
Solomon
cf820852b6 Adds a warning about downgrading with v2 webhook schemas
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3913
Co-authored-by: Tirumarai Selvan <8663570+tirumaraiselvan@users.noreply.github.com>
GitOrigin-RevId: 4e19b32ad7b79961fab117f6e4d7617061912808
2022-03-14 06:49:57 +00:00
Rishichandra Wawhal
a21265b489 cloud-docs: bump preview app github action version in cloud docs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3949
GitOrigin-RevId: 96d9ceacd9eb421662d84dfdda48ff58bea78701
2022-03-14 06:16:21 +00:00
Antoine Leblanc
74513e351f Use an enum for EndpointMethod and fix incorrect response aggregation.
### Description

This small PR improves the representation of an endpoint method from `Text` to an enum of the supported methods. Additionally, it cleans some of the instances defined on surrounding types (such as Postgres-specific instances on Endpoint types).

Due to a name conflict, this makes `RQL.Types.Endpoint` impossible to re-export from `RQL.Types`, which in turn forces several other modules to import it explicitly, which I think is fine since we want to ultimately get rid of `RQL.Types`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3965
GitOrigin-RevId: 33869007d0d818ddf486fb61d1f6099f9dad7570
2022-03-13 07:41:02 +00:00
David Overton
ac87eff905 Document ActionFieldsG
<!-- Thank you for ss in the Title above ^ -->

## Description ✍️
<!-- Please fill this se-->
<!-- Describe the changes from a user's perspective -->

Add some documentation on `ActionFieldG` type.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3945
GitOrigin-RevId: d9543ed7a8fe3ccfe9f5267c3a2ac71fb040f4db
2022-03-12 01:38:19 +00:00
Antoine Leblanc
d28c3bea49 Bump parser version.
![image](https://user-images.githubusercontent.com/1618949/157965138-d627d6a9-a0f0-47a4-a192-1e7593e21433.png)

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3964
GitOrigin-RevId: ac93e4ad81a2183b488ff1453f1072aebc83e3f2
2022-03-11 21:45:43 +00:00
Solomon
ca85acbfe3 Feature/improved webhook debug endpoint errors
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3782
Co-authored-by: Abhijeet Khangarot <26903230+abhi40308@users.noreply.github.com>
GitOrigin-RevId: 404197e766efa94a1814e8a0287cd55d9175f2a7
2022-03-10 23:23:55 +00:00
Vishnu Bharathi
2e04bd5ac2 cli: add support for customization field in sources metadata
closes https://github.com/hasura/graphql-engine/issues/8292

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3954
GitOrigin-RevId: cc27dcffbb71579136a3cae7d99ecd239eb37ed2
2022-03-10 16:47:03 +00:00
Antoine Leblanc
effde675aa Clean RemoteJoin.Join by introducing RemoteJoin.Source
### Description

This PR cleans `processRemoteJoins` by splitting the code, introducing comments, and applied the same strategies than #3810 did. Most importantly, it introduces a new module `RemoteJoin.Source`, made to be very similar to `RemoteJoin.RemoteSchema`, that exposes the required tooling to make a join call to a source, which decluters `Join`. Furthermore, this PR uses the same "dependency injection" to make the core of `Join` free from IO: this opens the door to testing the join engine in the unit tests.

None of the functions were modified when moved from their old module to the new one, but there's no way to easily see this in a diff.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3894
GitOrigin-RevId: 1e7c43006f092326e061f9ba12674e207b628bef
2022-03-10 15:26:24 +00:00
Antoine Leblanc
80243a5c34 Remove MonadTableInfo and MonadRole.
### Description

This PR moves Hasura-specific schema functions from `Hasura.GraphQL.Parser.Class` into `Hasura.GraphQL.Schema.Common`. It also removes the two corresponding monad aliases, and consequently harmonizes several parts of the code to use the same common constraint.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3947
GitOrigin-RevId: 40985a7d86da97a311bd480f9a57cc18c350c2a8
2022-03-10 12:13:35 +00:00
Aniket Deshpande
45af1d99f4 Migrate all HSpec tests to unified setup/teardown
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3901
GitOrigin-RevId: 3aa35b6f12c28f997dca1a1f9287a12c814152cb
2022-03-10 11:19:13 +00:00
Philip Lykke Carlsen
4ccc830bb8 Tidy up MSSQL.FromIr
## Description

We go through the module `Hasura.Backends.MSSQL.FromIr` and split it into separate self-contained units, which we document.

Note that this PR has a slightly opinionated follow-up PR #3909 .

### Related Issues

Fix #3666

### Solution and Design

The module `FromIr` has given rise to:

* `FromIr.Expression`
* `FromIr.Query`
* `FromIr.Delete`
* `FromIr.Insert`
* `FromIr.Update`
* `FromIr.SelectIntoTempTable`

And `Execute.MutationResponse` has become `FromIr.MutationResponse` (after some slight adaptation of types).

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3908
GitOrigin-RevId: 364acf1bcdf74f2e19464c31cdded12bd8e9aa59
2022-03-10 10:34:52 +00:00
Aravind K P
2ff0f25e08 cli: refactor metadataobject package
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3943
GitOrigin-RevId: 4cc8f67dd8b6ba0e78f1c35d415f89bd1b901705
2022-03-10 08:13:50 +00:00
hasura-bot
4ec9229f15 add jsonb to string cast support for postgres (fix #6577, #2602)
GITHUB_PR_NUMBER: 7818
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/7818

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2898
Co-authored-by: Teo Stocco <9053709+zifeo@users.noreply.github.com>
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
Co-authored-by: Rakesh Emmadi <12475069+rakeshkky@users.noreply.github.com>
GitOrigin-RevId: 1100f3ce44ea07867a2d7de5b6bb059510f100e1
2022-03-10 07:32:59 +00:00
Antoine Leblanc
b9ee669ee1 Improve remote joins collect
### Description

This PR improves the `Collect` module by re-ordering the functions to make clear what is public API and what is internal implementation. Furthermore, it makes use of `traverseOf` and `traverseFields` to reduce duplication. To do so, it also introduces a few more lenses in the rest of the codebase, and uses this opportunity to harmonize some structures that were not following our naming convention.

While the diff is massive, a lot of it is just code moving around; the file is now divided into separate sections:
- entry points: IR types for which we want to run the collection
- internal monadic structure
- internal traversals: functions that do nothing but drill down further
- actual transformations: the three cases where we do actually have work to do: selection sets on which we do want to insert join columns, extract remote relationships... those functions are left unchanged by this PR
- internal helpers

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3863
GitOrigin-RevId: f7cbecfae9eed9737b62acfa5848bfcf9d4651f6
2022-03-10 06:18:48 +00:00
paritosh-08
c9705de8d8 docs: update cloud response caching docs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3938
GitOrigin-RevId: d71096e977541072cec8d7edc979c373955da8e4
2022-03-10 05:15:55 +00:00
Antoine Leblanc
bdd455473c Reduce the size of SelectSpec test to reduce memory usage.
### Description

Despite making sure only a small range was used for each value, this test can nonetheless result in an explosion of memory usage: it has twice in a row resulted in my poor laptop filling its swap in a matter of seconds, forcing me to kill the test or hard-reboot my machine.

This small PR lowers the high bound of the range used for the generator, to a value that seems to consistently allows the test to finish in a more constrained environment.

Additionally, it also sorts the tests alphabetically: it makes it much easier when scrolling through the output to find a specific test.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3942
GitOrigin-RevId: c7a786511fe82701fab29cf164dc3fbbe77f4262
2022-03-10 03:06:55 +00:00
Antoine Leblanc
85b8753fde Cleanup post #3810
### Description

#3810 was merged with comments still open; this small PR does a few minute clean-ups to address some remaining nits.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3941
GitOrigin-RevId: 3d15eb399828123640a73247b848bc4ddff02c38
2022-03-10 02:13:49 +00:00
Antoine Leblanc
553ecf628b Prevent impure errors with monadic map union
### Description

This very small PR introduces `unionWithM`, to allow hashmap union that might fail, and uses it to transform an `error` into a `throw500`. It also reorders `HashMap.Strict.Extended` to group all "union" functions together.

There is, however, a broader question of whether we should encourage the proliferation of such functions. If so, we might also want to consider:
- `mapWithKeyM`, to remove the `unsafeMkName` of `RemoteJoin.Collect`
- `forWithKey`, as a flipped version of `traverseWithKey`

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3917
GitOrigin-RevId: a488d5bf04a73878b9e42f27ede36199bb4c920a
2022-03-09 23:27:13 +00:00
Divya Bhushan
2e51432fa7 docs: Minor editions on python-flask codegen page
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3674
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: 9c13bb1ca1f53d55e7cf5de5592fc23a8b6c45c7
2022-03-09 14:25:45 +00:00
Abhijeet Khangarot
62aaa7f1e3 console: add remoteSchemaTree component
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3643
Co-authored-by: Matt Hardman <28978422+mattshardman@users.noreply.github.com>
GitOrigin-RevId: 4797a3167f308ea8a7b144c7e12b3273217ebe3a
2022-03-09 10:39:14 +00:00
Evie Ciobanu
20b2a13f22 server: split the Postgres Connection module
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3918
GitOrigin-RevId: e845476ea97354ec886afddbb356fbbc16421476
2022-03-09 07:15:17 +00:00
Daniel Chambers
a8424c48a1 Customize column GraphQL schema descriptions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3888
GitOrigin-RevId: 027c319a66671a44fc6e5506bdfc9d2c10a8569f
2022-03-09 06:35:46 +00:00
Antoine Leblanc
6e1761f8f9 Enable remote joins from remote schemas in the execution engine.
### Description

This PR adds the ability to perform remote joins from remote schemas in the engine. To do so, we alter the definition of an `ExecutionStep` targeting a remote schema: the `ExecStepRemote` constructor now expects a `Maybe RemoteJoins`. This new argument is used when processing the execution step, in the transport layer (either `Transport.HTTP` or `Transport.WebSocket`).

For this `Maybe RemoteJoins` to be extracted from a parsed query, this PR also extends the `Execute.RemoteJoin.Collect` module, to implement "collection" from a selection set. Not only do those new functions extract the remote joins, but they also apply all necessary transformations to the selection sets (such as inserting the necessary "phantom" fields used as join keys).

Finally in `Execute.RemoteJoin.Join`, we make two changes. First, we now always look for nested remote joins, regardless of whether the join we just performed went to a source or a remote schema; and second we adapt our join tree logic according to the special cases that were added to deal with remote server edge cases.

Additionally, this PR refactors / cleans / documents `Execute.RemoteJoin.RemoteServer`. This is not required as part of this change and could be moved to a separate PR if needed (a similar cleanup of `Join` is done independently in #3894). It also introduces a draft of a new documentation page for this project, that will be refined in the release PR that ships the feature (either #3069 or a copy of it).

While this PR extends the engine, it doesn't plug such relationships in the schema, meaning that, as of this PR, the new code paths in `Join` are technically unreachable. Adding the corresponding schema code and, ultimately, enabling the metadata API will be done in subsequent PRs.

### Keeping track of concrete type names

The main change this PR makes to the existing `Join` code is to handle a new reserved field we sometimes use when targeting remote servers: the `__hasura_internal_typename` field. In short, a GraphQL selection set can sometimes "branch" based on the concrete "runtime type" of the object on which the selection happens:

```graphql
query {
  author(id: 53478) {
    ... on Writer {
      name
      articles {
        title
      }
    }
    ... on Artist {
      name
      articles {
        title
      }
    }
  }
}
```

If both of those `articles` are remote joins, we need to be able, when we get the answer, to differentiate between the two different cases. We do this by asking for `__typename`, to be able to decide if we're in the `Writer` or the `Artist` branch of the query.

To avoid further processing / customization of results, we only insert this `__hasura_internal_typename: __typename` field in the query in the case of unions of interfaces AND if we have the guarantee that we will processing the request as part of the remote joins "folding": that is, if there's any remote join in this branch in the tree. Otherwise, we don't insert the field, and we leave that part of the response untouched.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3810
GitOrigin-RevId: 89aaf16274d68e26ad3730b80c2d2fdc2896b96c
2022-03-09 03:18:22 +00:00
Brandon Simmons
9a96e7d165 server: parallelize buildGQLContext to improve replace_metadata perfo…
…rmance

It makes sense to try to utilize multiple threads for metadata
operations since we expect them to come one at a time (and likely at
lower load periods anyway).

As noted, although we build roles in parallel now, the admin role is
still a bottleneck. For replace_metadata on huge_schema, on my machine
I get:

  BEFORE: 22.7 sec
   AFTER: 13.5 sec

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3911
GitOrigin-RevId: 4d4ee6ac8b5506603e70e4fc666a3aacc054d493
2022-03-09 02:27:42 +00:00
Daniel Chambers
f481507595 server: add metric for the metadata resource version
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3687
Co-authored-by: awjchen <13142944+awjchen@users.noreply.github.com>
GitOrigin-RevId: ae217690ee0371f6fc696fc2e18c72e087dcaff2
2022-03-08 23:00:27 +00:00
Rakesh Emmadi
aa19f1e0d0 server/postgres: improve fetching tables' and functions' metadata (from database)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3778
GitOrigin-RevId: 13bb97bdb7afad265db899f368c74d9f240b214a
2022-03-08 13:03:14 +00:00
Evie Ciobanu
5f0584379d server: testing guidelines
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3776
GitOrigin-RevId: ad4355445a75611b1edfc462374f6c3998a94c4a
2022-03-08 09:53:27 +00:00
paritosh-08
0775c00b0d server: add validation for query collections
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3658
GitOrigin-RevId: 3c644da15c92cac16356985d0fe0c6adb7001862
2022-03-08 09:49:18 +00:00
Karthikeyan Chinnakonda
a2da867fc8 Fetch only events of the ETs which exist in the metadata
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3857
GitOrigin-RevId: 1ee501116103e2be49d4538c80f87c11c066af8e
2022-03-08 09:06:32 +00:00
David Overton
2792f515d4 Traverse variables in action remote joins
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3864
GitOrigin-RevId: 0fb624260db46474056ee323638d9be7d074b3fc
2022-03-08 08:23:20 +00:00
Matt Hardman
d7a5689745 Console/permissions tab component
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3710
Co-authored-by: Vijay Prasanna <11921040+vijayprasanna13@users.noreply.github.com>
Co-authored-by: Abhijeet Khangarot <26903230+abhi40308@users.noreply.github.com>
GitOrigin-RevId: ed84b1fc264f5d4455b6f9c77cfdf0ac0034460d
2022-03-08 07:46:19 +00:00
Varun Choudhary
7717e23ce5 console: Add the Relationships list component in the Remote Schema section
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3832
GitOrigin-RevId: 748f693b005e859f2cf0380a6905fcb434f63a93
2022-03-08 06:51:24 +00:00
Varun Choudhary
74780de599 console: create a hook to fetch all remote schema relationship
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3867
GitOrigin-RevId: c292231e56bb086fd79da7003613f0a031ab0f1f
2022-03-08 04:53:17 +00:00
Solomon
d67d4e2310 Webhook Transform Cleanup / Refactor
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3624
GitOrigin-RevId: 849e6dd70d6fe3d84056a485b20928ff813881d4
2022-03-08 00:43:08 +00:00
Philip Lykke Carlsen
369d1ab2f1 Only overwrite expectations if the flag is actually set
## Description

In https://hasurahq.slack.com/archives/C01RZPEPF0W/p1646672587226349 @rakeshkky discovered a flaw in the SQL explain tests golden tests that would overwrite expectation files even when not instructed to do so.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3912
GitOrigin-RevId: 0c5acc6b96c7b619915d26ec8f78547959d5f78d
2022-03-07 22:17:52 +00:00