Commit Graph

4051 Commits

Author SHA1 Message Date
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
Robert
437ef45431 pro, multitenant: remove broken process-level ekg stats
Fixes #3364.

This removes code that's only there to collect some metrics that were apparently never collected in production anyway, as confirmed by this slack discussion: https://hasurahq.slack.com/archives/CTRL7L1PZ/p1645547435034329

> We don't ever ingest these statsd metrics to lux, nor on HC AFAIK.

We're keeping the command line options for the moment to allow lux time to stop passing them.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3365
GitOrigin-RevId: bc6aa2c18a7d3eb0779ed17494662df5b7b54a76
2022-03-07 16:54:19 +00:00
Robert
94f70e6256 server, pro: remove Setup.hs scripts
They're tied to old-style cabal, and graphql-engine doesn't build with
those anymore anyhow.

Also removes a cabal.project Cabal version constraint related to Setup.hs.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3847
GitOrigin-RevId: 715e836cd2ddf7982143ba0ab8821f87a5eac0b1
2022-03-07 16:09:20 +00:00
Abby Sassel
9e12e32116 server/docs: add bigquery "quickstart"
[rendered](https://github.com/hasura/graphql-engine-mono/blob/bigquery-quickstart/server/documentation/data-sources/bigquery.md)

This PR introduces a contributor-facing quickstart guide for BigQuery. I've added pointers to existing docs or helpful links based on questions and blockers we've faced in the past whilst working on and testing BigQuery. Let me know if I've missed anything you think would be especially helpful.

closes https://github.com/hasura/graphql-engine-mono/issues/3791

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3772
GitOrigin-RevId: 9ccf93772422d9eda5d54192a5972904f35c3266
2022-03-07 13:37:00 +00:00
Rakesh Emmadi
878f6108e6 server/bigquery: apply 'order by' to 'array_agg' projection inside an array relationship join sub-query
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3824
GitOrigin-RevId: b1739c35fb2c387152729d3ff72c6ff7ef9b9118
2022-03-07 10:13:02 +00:00
Vishnu Bharathi
e73f187db4 ci: tag release v2.2.2 and v2.2.2-pro.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3889
GitOrigin-RevId: 84abcfe6070e39ae3a85a3ff0098eff18d93e278
2022-03-07 08:35:13 +00:00
Antoine Leblanc
f96b889401 Replace all occurrences of mapMaybe id by catMaybes.
### Description

Several libraries define `catMaybes` as `mapMaybe id`. We had it defined in `Data.HashMap.Strict.Extended` already. This small PR also defines it in `Extended` modules for other containers and replaces every occurrence of `mapMaybe id` accordingly.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3884
GitOrigin-RevId: d222a2ca2f4eb9b725b20450a62a626d3886dbf4
2022-03-03 20:13:10 +00:00
Auke Booij
2abe02c672 Fix #3635
In hasura/graphql-engine#5144, we noticed that having remote relationships in the schema is problematic for Relay. In particular, we don't support remote schemas in Relay at all, and because of this, remote relationships were also broken.

The fix was easy: when we're building the schema for Relay, whenever we encounter a remote relationship in our configuration, we simply skip building that field. The implementation was easy: (see hasura/graphql-engine#5145)
```diff
-    SFRemoteRelationship info -> pure $ mkRemoteRelationshipFld info
+    SFRemoteRelationship info ->
+      -- https://github.com/hasura/graphql-engine/issues/5144
+      if isRelay then [] else pure $ mkRemoteRelationshipFld info
```
A test case was added in that PR to prevent us from accidentally re-including remote relationships in the Relay schema. (However, it now looks like that test case does not function correctly.)

The above code was later refactored in #3037, making use of the `MaybeT` effect. However, this effect was not used correctly, so that the result of the check was ignored.

This fixes the code to use the `MaybeT` effect correctly.

CC @0x777 @rakeshkky

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3868
GitOrigin-RevId: e528303e01eacf60173cba1eec1898986cf12359
2022-03-03 15:01:25 +00:00
paritosh-08
a0c83b8e99 server: add inconsistency information in reload_metadata API call
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3860
GitOrigin-RevId: 02d1963946d69fdf6886aa61806eb71db60f8931
2022-03-03 13:34:44 +00:00
hasura-bot
cd483f3389 docs: misc changes
GITHUB_PR_NUMBER: 8273
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/8273

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3872
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: d4f0276d9fd8ef0197896808c3b9bf387a231745
2022-03-03 12:17:38 +00:00
Karthikeyan Chinnakonda
a3e6b1c741 server/mssql: add support for creating event triggers (incremental PR #2)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2634
Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com>
GitOrigin-RevId: 29567fa336c22d1812dfcfa6294f54e74a741f0c
2022-03-03 09:53:49 +00:00
David Overton
1eb7fe5999 Nested action joins
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3613
GitOrigin-RevId: 95fdb317a1052bdc440865f2dc8c5897e8531539
2022-03-03 03:44:20 +00:00
Solomon
876300c049 Adds x-www-form-urlencoded body transformation
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3764
GitOrigin-RevId: 60ce63496d94406476dd446a498d7a7d625465be
2022-03-02 19:43:22 +00:00
Vishnu Bharathi
eed47e973a ci: tag release for v2.3.0 and v2.4.0-beta.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3853
Co-authored-by: Alberto Francesco Motta <36401353+afmotta@users.noreply.github.com>
GitOrigin-RevId: ce28cdb679e6c2dda85c7309f81ee19f5f8ab714
2022-03-02 14:01:17 +00:00
Varun Choudhary
c82fdc4253 console: fixed an issue where cron triggers where not removed from the list after deletion
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3838
Co-authored-by: Alberto Francesco Motta <36401353+afmotta@users.noreply.github.com>
GitOrigin-RevId: ebfe928fb6c966898ad88d97f114abf500a6af19
2022-03-02 09:28:08 +00:00
Rikin Kachhia
8b88d15f06 console: only show tables from current schema in clone permissions section
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3823
Co-authored-by: Varun Choudhary <68095256+Varun-Choudhary@users.noreply.github.com>
GitOrigin-RevId: ec47f1578c89bea42fbe5db0b742a7058604c4b8
2022-03-02 06:11:40 +00:00
Solomon
deb3baa504 Bug fix/webhook transforms header filtering
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3795
Co-authored-by: Lyndon Maydwell <92299+sordina@users.noreply.github.com>
Co-authored-by: Tirumarai Selvan <8663570+tirumaraiselvan@users.noreply.github.com>
GitOrigin-RevId: 60becefedebbc89a9580c7989a0212903a843d25
2022-03-01 22:55:46 +00:00
Antoine Leblanc
0e3beb028d Extract generic containers from the codebase
### Description

There were several places in the codebase where we would either implement a generic container, or express the need for one. This PR extracts / creates all relevant containers, and adapts the relevant parts of the code to make use of said new generic containers. More specifically, it introduces the following modules:
- `Data.Set.Extended`, for new functions on `Data.Set`
- `Data.HashMap.Strict.Multi`, for hash maps that accept multiple values
- `Data.HashMap.Strict.NonEmpty`, for hash maps that can never be constructed as empty
- `Data.Trie`, for a generic implementation of a prefix tree

This PR makes use of those new containers in the following parts of the code:
- `Hasura.GraphQL.Execute.RemoteJoin.Types`
- `Hasura.RQL.Types.Endpoint*`

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3828
GitOrigin-RevId: e6c1b971bcb3f5ab66bc91d0fa4d0e9df7a0c6c6
2022-03-01 16:04:22 +00:00
Abhijeet Khangarot
0d120471cd console: provide checkbox to remove body in rest connectors v2
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3544
GitOrigin-RevId: 2beb58f09577bda72470fb0deb1099287ab4c8a9
2022-03-01 15:22:03 +00:00
Brandon Martin
7c3698d91f Exclude _timescaledb_internal from pg_table_metadata.sql
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3686
GitOrigin-RevId: 335f34ba4b165a271a23dff22c9b3bee5d497df8
2022-03-01 14:00:18 +00:00
Robert
b73ce89205 server: remove cabal flag "developer"
The only purpose was enabling the developer API by default. I don't
think that justifies a flag and CPP usage.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3820
GitOrigin-RevId: 058c9a7b03e5e164ef88e35c42f50bae3c42b5b6
2022-03-01 11:41:45 +00:00
Naveen Naidu
43305cd184 docs/server: Minor formatting and fix broken links
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3592
GitOrigin-RevId: f5c4b46654887f8c6ae4cde5c8905cb483324181
2022-03-01 10:53:33 +00:00
Vijay Prasanna
cf9a8be7a8 console: update documentation for useTableRelationship hook
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3818
GitOrigin-RevId: 17c49801b0dd6b4a73b8aafc5ba3b7c0a3ef28ff
2022-03-01 08:25:07 +00:00
Aniket Deshpande
853e9b760d Draft: server: HSpec: Unify setup/teardown data and specialize for backends
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3765
GitOrigin-RevId: 22c36c83ff900b3423144353ccdf61980b66bc6b
2022-02-28 22:48:44 +00:00
Abby Sassel
45c95d8cd8 server/tests: Add some detail to the hspec test style guide
[rendered](https://github.com/hasura/graphql-engine-mono/blob/hspec-docs/server/tests-hspec/README.md)

This PR adds a little detail to the style guide, from design discussions whilst writing the RFC and reviewing some recent PRs.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3815
GitOrigin-RevId: f6ead6b3327eed022b8b51083ab6b9508d89f3d0
2022-02-28 17:51:30 +00:00
Vishnu Bharathi
661bfeb153 ci: tag release v2.3.0-beta.3 and v2.3.0-beta.3-pro.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3821
GitOrigin-RevId: 1220a68e4a03f22814dad2cc8b556a3a32b6f0f4
2022-02-28 13:56:51 +00:00
Divya Bhushan
8cfdd1ee3b docs: updating response from the get_inconsistent_metadata api
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3789
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: 8a11e9fc11f6526d2d3135bd22aa9d1765fa0a20
2022-02-28 12:23:34 +00:00