Commit Graph

3427 Commits

Author SHA1 Message Date
Gil Mizrahi
904029aa7d Add fancier trace debugging functions to Hasura.Prelude
## Suggestion: Add fancier trace debugging functions to `Hasura.Prelude`

This PR adds two trace functions, `ltrace` and `ltraceM`, which use the `pretty-simple` package to `show` the input with nice formatting and colors for ease of reading (and comparing using diff tools such as `meld` or `vim-diff`).

I've also added warning pragmas to the functions, which means:
1. Traces will not be left in code, as CI builds with -Werror
2. Developers will have to change the `ghc-options` to `-Wwarn` in their `cabal.project.local` settings to use these functions

### Example

Usage:

```hs
selectFunctionAggregate ... = ... do
  ltraceM "functionInfo" function
  ...
```

Output to terminal looks like this:

<img width="524" alt="Screen Shot 2021-08-12 at 10 33 24" src="https://user-images.githubusercontent.com/8547573/129158878-4a5e96ba-30a5-452c-8f33-9eb4b2cc5e2a.png">

### Dependencies

Requires adding the following dependencies:
  - prettyprinter-ansi-terminal-1.1.2 (BSD2)
  - pretty-simple-4.0.0.0 (BSD3)

Question: what is the process for adding new dependencies? How does decisions on this matter happen?

https://github.com/hasura/graphql-engine-mono/pull/2075

GitOrigin-RevId: 490b0f0ca595da319b43e92e190ba50c0b132cd5
2021-08-12 19:33:56 +00:00
Abby Sassel
6b3db83737 server/bigquery: run tests in CI
server/bigquery: run tests in CI #1525

[Example of successful BigQuery test job](https://app.circleci.com/pipelines/github/hasura/graphql-engine-mono/15951/workflows/86deb614-ddbc-4df5-9af3-288eeff6504a/jobs/283568)

TODO:
- [ ] I'll make corresponding changes in the OSS repo once this is merged
- [ ] @scriptnull or anyone with permissions: to require in CI

https://github.com/hasura/graphql-engine-mono/pull/1741

GitOrigin-RevId: d4ba446e9b13d213de135c73bb72973478575a29
2021-08-12 16:48:29 +00:00
Rakesh Emmadi
c2f667a06d server: correctly generate remote relationship field type
>

### Description
>
From HGE version 2.0 onwards, all remote relationship fields are generated as plain types without non-nullable and lists. This PR fixes the same.

### Changelog

- [x] `CHANGELOG.md` is updated with user-facing content relevant to this PR. If no changelog is required, then add the `no-changelog-required` label.

### Affected components

- [x] Server
- [x] Tests

### Related Issues
->
fix https://github.com/hasura/graphql-engine/issues/7284

### Steps to test and verify
>
- Create a remote relationship to a field in remote schema with non-nullable or list type
- The HGE introspection should give the remote relationship field type correctly as like in the remote schema

https://github.com/hasura/graphql-engine-mono/pull/2071

GitOrigin-RevId: e113f5d17b62bfa0a25028c20260ae1782ae224b
2021-08-12 12:17:52 +00:00
pranshi06
d179a6f2ec server: support EdDSA keys for JWT
https://github.com/hasura/graphql-engine-mono/pull/1818

Co-authored-by: paritosh-08 <85472423+paritosh-08@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>
GitOrigin-RevId: aae87d34cd19c97e66721a2bd7602d907aeb90b3
2021-08-12 01:54:06 +00:00
Sameer Kolhar
3f35a9a219 console: support creation of indexes on the console for postgres sources
https://github.com/hasura/graphql-engine-mono/pull/358

Co-authored-by: Ikechukwu Eze <22247592+iykekings@users.noreply.github.com>
GitOrigin-RevId: cd4a5073fb361fe1235f5d49a0dc9b025fc1379f
2021-08-11 18:02:56 +00:00
Gil Mizrahi
39c9e9f7e3 Move symbolically linked cabal files for dev.sh from server directory to root directory
https://github.com/hasura/graphql-engine-mono/pull/2069

GitOrigin-RevId: 8340cd0932fbb7f166be53c392489c998325dca9
2021-08-11 16:50:59 +00:00
Gil Mizrahi
5ca5e105a1 Fix telemetry unit test by sorting before comparing
https://github.com/hasura/graphql-engine-mono/pull/2068

GitOrigin-RevId: 62147b29c1899e43156e5f5d7f0fb67eda00647a
2021-08-11 15:36:30 +00:00
Vijay Prasanna
5d6211d3dc console/inherited-roles: allow resolution of conflicting permissions
https://github.com/hasura/graphql-engine-mono/pull/2027

GitOrigin-RevId: 896759f70aa95bf4b16766cc6e4ca38cf10878e1
2021-08-11 14:21:14 +00:00
Evie Ciobanu
11b3e1573d [server] generate the correct type for single-row returning functions
https://github.com/hasura/graphql-engine-mono/pull/2055

GitOrigin-RevId: 94c1cc32028054c7ec11d6ada2fc57f0820a4d5e
2021-08-11 12:42:30 +00:00
Nicolas Beaussart
e063835b83 console: fix ui for template gallery when there is no image
https://github.com/hasura/graphql-engine-mono/pull/1940

GitOrigin-RevId: 97fca7b6423309c22a1072b9e380ba724d7bad00
2021-08-11 11:24:04 +00:00
Praveen Durairaju
aaff5a5f71 docs: update getting started guide
>

### Description
>
This PR updates the getting started guide to change docker setup into having its own paragraph. Additionally this PR also removes the extra Contact Us link under Additional Resources.

### Changelog

- [ ] `CHANGELOG.md` is updated with user-facing content relevant to this PR. If no changelog is required, then add the `no-changelog-required` label.

### Affected components

- [ ] Docs

Preview Link - https://deploy-preview-2067--hasura-docs-mono.netlify.app/graphql/core/getting-started/index.html#quickstart-guides

https://github.com/hasura/graphql-engine-mono/pull/2067

GitOrigin-RevId: 135fc75cc1083598b89622828ec825ba8498fb0d
2021-08-11 09:26:46 +00:00
nevermore
05a12912aa console: change HEROKU_DATABASE_URL to PG_DATABASE_URL while creating datasource on cloud
https://github.com/hasura/graphql-engine-mono/pull/2050

GitOrigin-RevId: d40b32feb2015780865ad4d74e442fbdc3da82b8
2021-08-11 09:23:19 +00:00
hasura-bot
1633160e36 ci: add mssql config to test_console job
GITHUB_PR_NUMBER: 7382
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/7382

https://github.com/hasura/graphql-engine-mono/pull/2065

Co-authored-by: Vijay Prasanna <11921040+vijayprasanna13@users.noreply.github.com>
GitOrigin-RevId: 6a9c54afa71712eb37e9d12ae7ab68a4edc64911
2021-08-11 06:32:45 +00:00
Solomon Bothwell
a46cf20505 Adds PG Client Cert Metadata API Documentation
https://github.com/hasura/graphql-engine-mono/pull/1884

Co-authored-by: Tirumarai Selvan <8663570+tirumaraiselvan@users.noreply.github.com>
GitOrigin-RevId: 3f41300d4621e0402fa95e09eb0369be02515ac1
2021-08-11 04:23:50 +00:00
awjchen
046da3caca Combine oss and pro server configuration
https://github.com/hasura/graphql-engine-mono/pull/1983

GitOrigin-RevId: 91069bd5d1f9c5a166eae2317cf4435220b472b0
2021-08-11 04:19:27 +00:00
Tirumarai Selvan
7b863a1b3b tag release v2.0.6
GitOrigin-RevId: b2b906cf7b05bc444148a334aba42385046be75c
2021-08-11 01:19:22 +00:00
Nicolas Beaussart
a226d514af console: add tailwindcss for styles
https://github.com/hasura/graphql-engine-mono/pull/2032

GitOrigin-RevId: d6552e990823acc3bdac829487e91ae931ac4345
2021-08-10 13:46:52 +00:00
Varun Choudhary
a4b01b2756 console: auto suggest gen_random_uuid() while adding a default value to UUID type column in schema other than public
https://github.com/hasura/graphql-engine-mono/pull/1910

GitOrigin-RevId: c2ee953ca7cd72fc7cc143465be2fe84e4284636
2021-08-10 05:55:41 +00:00
Brandon Simmons
a0118c99db server benchmarks: minor fixup of afbdb8d74
https://github.com/hasura/graphql-engine-mono/pull/2039

GitOrigin-RevId: 263e7eb3d483eed644d3c41aee6c6e733b2f3633
2021-08-09 19:28:47 +00:00
hasura-bot
5e17966ce7 Update 28_to_29.sql
GITHUB_PR_NUMBER: 7335
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/7335

https://github.com/hasura/graphql-engine-mono/pull/1982

Co-authored-by: Eduardo <5448062+eduardomazolini@users.noreply.github.com>
GitOrigin-RevId: a7d6d6548f742a3389fa270bfc0446622356f95c
2021-08-09 16:36:44 +00:00
Vijay Prasanna
74704801cb console/tests: add manage db tests for mssql
https://github.com/hasura/graphql-engine-mono/pull/1782

Co-authored-by: Sooraj <8408875+soorajshankar@users.noreply.github.com>
GitOrigin-RevId: 1ed4c6d09d2dbd6f68faacd83e7daae916cff972
2021-08-09 14:04:54 +00:00
Rakesh Emmadi
1f3ea7b5eb server: document metadata versioning
This PR adds source code documentation for metadata versioning.

Note: Adding `force-skip-ci` label to bypass server tests as this PR only has changes in source code comments.

https://github.com/hasura/graphql-engine-mono/pull/2026

GitOrigin-RevId: f24dcc1579f98e59e40677b99890a8af273bb96e
2021-08-09 12:44:41 +00:00
hasura-bot
34a011acbc docs: fix typo in MSSQL docs
GITHUB_PR_NUMBER: 7369
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/7369

https://github.com/hasura/graphql-engine-mono/pull/2044

Co-authored-by: Vishwa Mehta <32997409+mehtavishwa30@users.noreply.github.com>
GitOrigin-RevId: 24e862d1fa023d6210cd1716a52ba1135d457ca1
2021-08-09 11:05:17 +00:00
Karthikeyan Chinnakonda
06f5e4fb77 server: inherited roles for mutations, remote schemas, actions and custom functions
https://github.com/hasura/graphql-engine-mono/pull/1715

GitOrigin-RevId: 4818292cff8c3a5b264968e7032887a1e98b6f79
2021-08-09 10:21:05 +00:00
Kali Vara Purushotham Santhati
4d7aa0e105 cli: fix query endpoint construction
closes https://github.com/hasura/graphql-engine/issues/7196

https://github.com/hasura/graphql-engine-mono/pull/2025

GitOrigin-RevId: ab7c765d4de710dd08f48dc1bfb94eb606ac5d3f
2021-08-09 08:41:16 +00:00
Divi
8aa8929b13 cli-ext: add docs for compiling cli-ext for new targets
https://github.com/hasura/graphql-engine-mono/pull/2041

GitOrigin-RevId: 95d5aeaaf621fe7714ab8045327e80232b811897
2021-08-09 07:15:14 +00:00
Aniket Deshpande
a9fb2710db server/bigquery: implement _in and _nin operators. (close #7343)
https://github.com/hasura/graphql-engine-mono/pull/2033

GitOrigin-RevId: 58d4de268b62c6d7cb6106bec38214e651926816
2021-08-06 19:58:33 +00:00
Brandon Simmons
681113f1d8 Jberryman/1993 skip just report mode
https://github.com/hasura/graphql-engine-mono/pull/2028

Co-authored-by: David Overton <7734777+dmoverton@users.noreply.github.com>
GitOrigin-RevId: afbdb8d74bede1e78b054f5582cbf144bba20762
2021-08-06 18:41:27 +00:00
Lyndon Maydwell
d483109443 Revert "Disable TLS checks for actions services with self-signed certificates"
Reverts hasura/graphql-engine-mono#1595

https://github.com/hasura/graphql-engine-mono/pull/2036

GitOrigin-RevId: b32adde77b189c14eef0090866d58750d1481b50
2021-08-06 17:06:55 +00:00
Brandon Simmons
bdf0954c9d server benchmarks: Link directly to graphs in regression report, other style tweaks (#1720)
Depends on https://github.com/hasura/graphql-bench/pull/46

https://github.com/hasura/graphql-engine-mono/pull/2016

GitOrigin-RevId: ef7c5909e56cb1a945b20d5e072ee103bbd8a5ea
2021-08-06 15:49:56 +00:00
jkachmar
4a83bb1834 Remote schema execution logic
https://github.com/hasura/graphql-engine-mono/pull/1995

Co-authored-by: David Overton <7734777+dmoverton@users.noreply.github.com>
GitOrigin-RevId: 178669089ec5e63b1f3da1d3ba0a9f8debbc108d
2021-08-06 13:40:37 +00:00
Antoine Leblanc
52d91e3e8d Update GraphQL Parser version to fix text encoding issue (fix #1965)
### A long tale about encoding

GraphQL has an [introspection system](http://spec.graphql.org/June2018/#sec-Introspection), which allows its schema to be introspected. This is what we use to introspect [remote schemas](41383e1f88/server/src-rsr/introspection.json). There is one place in the introspection where we might find GraphQL values: the default value of an argument.

```json
{
  "fields": [
    {
      "name": "echo",
      "args": [
        {
          "name": "msg",
          "defaultValue": "\"Hello\\nWorld!\""
        }
      ]
    }
  ]
}
```

Note that GraphQL's introspection is transport agnostic: the default value isn't returned as a JSON value, but as a _string-encoded GraphQL Value_. In this case, the value is the GraphQL String `"Hello\nWorld!"`. Embedded into a string, it is encoded as: `"\"Hello\\nWorld!\""`.

When we [parse that value](41383e1f88/server/src-lib/Hasura/GraphQL/RemoteServer.hs (L351)), we first extract that JSON string, to get its content, `"Hello\nWorld!"`, then use our [GraphQL Parser library](21c1ddfb41/src/Language/GraphQL/Draft/Parser.hs (L200)) to interpret this: we find the double quote, understand that the content is a String, unescape the backslashes, and end up with the desired string value: `['H', 'e', 'l', 'l', 'o', '\n', 'W', 'o', 'r', 'l', 'd', '!']`. This all works fine.

However, there was a bug in the _printer_ part of our parser library: when printing back a String value, we would not re-escape characters properly. In practice, this meant that the GraphQL String `"Hello\nWorld"` would be encoded in JSON as `"\"Hello\nWorld!\""`. Note how the `\n` is not properly double-escaped. This led to a variety of problems, as described in #1965:
- we would successfully parse a remote schema containing such characters in its default values, but then would print those erroneous JSON values in our introspection, which would _crash the console_
- we would inject those default values in queries sent to remote schemas, and print them wrong doing so, sending invalid values to remote schemas and getting errors in result

It turns out that this bug had been lurking in the code for a long time: I combed through the history of [the parser library](https://github.com/hasura/graphql-parser-hs), and as far as I can tell, this bug has always been there. So why was it never caught? After all, we do have [round trip tests](21c1ddfb41/test/Spec.hs (L52)) that print + parse arbitrary values and check that we get the same value as a result. They do use any arbitrary unicode character in their generated strings. So... that should have covered it, right?

Well... it turns out that [the tests were ignoring errors](7678066c49/test/Spec.hs (L45)), and would always return "SUCCESS" in CI, even if they failed... Furthermore, the sample size was small enough that, most of the time, _they would not hit such characters_. Running the tests locally on a loop, I only got errors ~10% of the time...

This was all fixed in hasura/graphql-parser-hs#44. This was probably one of Hasura's longest standing bugs? ^^'

### Description

This PR bumps the version of graphql-parser-hs in the engine, and switches some of our own arbitrary tests to use unicode characters in text rather than alphanumeric values. It turns out those tests were much better at hitting "bad" values, and that they consistently failed when generating arbitrary unicode characters.

https://github.com/hasura/graphql-engine-mono/pull/2031

GitOrigin-RevId: 54fa48270386a67336e5544351691619e0684559
2021-08-06 11:54:45 +00:00
Antoine Leblanc
2c0a8d818c Kill Arbitrary, take 2 (fix #1736)
### Description

A first PR, #1947, removed all the `Arbitrary` stuff from our codebase. But #1740, merged on the same day, added some tests relying on `Arbitrary`. In the merge process, some unneeded `Arbitrary` code got reintroduced.

This PR removes all `Arbitrary` stuff from `src-lib`, and cleans / refactor `Hasura.Generator` in `src-test` to only reduce it to the bare minimum amount of `Arbitrary` instances.

https://github.com/hasura/graphql-engine-mono/pull/1957

GitOrigin-RevId: 7e76009bb022205e3737fca45749411a266cc08c
2021-08-06 10:18:37 +00:00
hasura-bot
e78bc4b0ed console: export metadata before tracking new table (fix #6805) (fix #7221) (fix #7233)
GITHUB_PR_NUMBER: 7330
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/7330

https://github.com/hasura/graphql-engine-mono/pull/1970

Co-authored-by: Kenneth J. Miller <6822406+KloudJack@users.noreply.github.com>
GitOrigin-RevId: 9532f7b596801ebcdd15bd40a9b3ace0b9b88326
2021-08-06 09:09:34 +00:00
Kali Vara Purushotham Santhati
0341037aeb cli-ext: fix sdl formatting
closes https://github.com/hasura/graphql-engine/issues/7296

https://github.com/hasura/graphql-engine-mono/pull/2012

Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: 41383e1f88c709c6cae4059a1b4fb8f2a58259e6
2021-08-06 05:01:07 +00:00
Lyndon Maydwell
f6987ca4ff Disable TLS checks for actions services with self-signed certificates
https://github.com/hasura/graphql-engine-mono/pull/1595

GitOrigin-RevId: 3834e7d005bfaeaa7cc429c9d662d23b3d903f5c
2021-08-06 03:01:24 +00:00
kodiakhq[bot]
5dbb3eb289 Jberryman/1720 rts stats tweak
https://github.com/hasura/graphql-engine-mono/pull/2030

GitOrigin-RevId: 398da37edd64b6e6f89bd52771aa7a6f7797983f
2021-08-05 23:37:53 +00:00
awjchen
3aa0027c40 server: add support for tagged and dynamic metrics
https://github.com/hasura/graphql-engine-mono/pull/1680

GitOrigin-RevId: c92d4f977b5b7fe9a0b71d3841e960a95f722299
2021-08-05 21:08:17 +00:00
Rikin Kachhia
1b1e60dba7 docs: add keywords for better search
https://github.com/hasura/graphql-engine-mono/pull/2003

GitOrigin-RevId: 68a5d461c4738a2671b438a009c9df2de471bed9
2021-08-05 16:38:31 +00:00
David Overton
394a1fa83b Skip remote_schema benchmark in CI
https://github.com/hasura/graphql-engine-mono/pull/2017

GitOrigin-RevId: e6c31ab35816a8dc690c9e5f9d64f76469db65ae
2021-08-05 16:20:47 +00:00
David Overton
1000df2e0a Fix/remote nested field customization
https://github.com/hasura/graphql-engine-mono/pull/2009

GitOrigin-RevId: bec59d2173afd6f392997f6bd953775f4a42dd48
2021-08-05 14:59:55 +00:00
Rakesh Emmadi
87d81fe802 docs: improve computed field related docs
>

### Description
>
This PR contains doc changes for #1793 and #1697.

### Changelog

- [ ] `CHANGELOG.md` is updated with user-facing content relevant to this PR. If no changelog is required, then add the `no-changelog-required` label.

### Affected components

- [x] Docs

https://github.com/hasura/graphql-engine-mono/pull/1932

GitOrigin-RevId: 1240ec106ab11aafb96f9732b76becd87604a32c
2021-08-05 13:48:37 +00:00
Aishwarya Rao
1adfe29f0e docs: dedicated VPC docs
This PR includes addition of dedicated VPC docs to the existing cloud docs.

https://github.com/hasura/graphql-engine-mono/pull/1809

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Shahidh K Muhammed <4124733+shahidhk@users.noreply.github.com>
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: fb14aa04fd214fb25d369e176c4cd18db28d7f34
2021-08-05 12:50:01 +00:00
Ikechukwu Eze
2e1f0df610 console: fix untracked foreign-key relationships suggestion across schemas
This PR fixes untracked foreign-key relationships suggestion across schemas.

### Changelog

- [x] `CHANGELOG.md` is updated with user-facing content relevant to this PR. If no changelog is required, then add the `no-changelog-required` label.

### Affected components

- [x] Console

### Related Issues
close [#7177](https://github.com/hasura/graphql-engine/issues/7177)

### Solution and Design
Previously to determine relations, we'd check the foreign keys constraint on all tables in the metadata,
but from 2.0, we filtered these tables based on schema. Therefore, relationships are only reflected if both tables are of the same schema. This PR makes sure that all tables in the metadata are considered

### Steps to test and verify
- Create two schemas and a table in each
- Create a foreign key constraint on one of the tables to the other using RawSQL
- Go the schema page of the table where the constraint was created on.
- Confirm that the console suggests to track the relationship you created in step 2 above

#### Breaking changes

- [x] No Breaking changes

https://github.com/hasura/graphql-engine-mono/pull/2000

GitOrigin-RevId: c1d5229955e731bb8019955ebd7a925d7870eb17
2021-08-05 12:32:53 +00:00
Varun Choudhary
b4e329307a console: fix splitgraph console issue
Closes: https://github.com/hasura/graphql-engine-mono/issues/1746

### Description

Main problem: https://github.com/hasura/graphql-engine-mono/issues/1746#issuecomment-880492976
Solution: I ensure that there is URL encoding while routing from the data manager

The other issue that was addressed was that there was some query that was failing on the splitgraph DB that uses explicit typecasting. I removed the same from our query.

### Affected components

- [x] Console

https://github.com/hasura/graphql-engine-mono/pull/1802

GitOrigin-RevId: 8d6ebae217b07357bf147a2c881bae9de156a450
2021-08-05 10:57:38 +00:00
Vishnu Bharathi
28c7a1d0d0 scripts: avoid premature release tagging
https://github.com/hasura/graphql-engine-mono/pull/2021

GitOrigin-RevId: fd40b14e99aba0a8624f91aac11083f52545fef1
2021-08-05 10:05:25 +00:00
Tirumarai Selvan
553aecb5e5 tag release v2.0.5
GitOrigin-RevId: 8c98e9dba9fa655b5d7503211a5d3f42f641cef5
2021-08-05 07:35:10 +00:00
awjchen
cd957fb5ea ci: hide old benchmark reports on Github
https://github.com/hasura/graphql-engine-mono/pull/1996

GitOrigin-RevId: 0d2b607de9ea180e269c8f30f4a8b9618129d98f
2021-08-05 05:55:18 +00:00
jkachmar
c322af93f8 server: Uses GraphQL type in remote variable cache key
https://github.com/hasura/graphql-engine-mono/pull/1801

GitOrigin-RevId: 98843e422b2431849b675acdb318ffae2f492f18
2021-08-04 21:24:36 +00:00
Karthikeyan Chinnakonda
2f71e2e7c9 server: fine tune cron triggers behaviour in replace metadata API call
https://github.com/hasura/graphql-engine-mono/pull/1991

GitOrigin-RevId: 7eb7d7b20d0a03eda7829d3a17a35dffe0f7bf1a
2021-08-04 14:52:20 +00:00