Commit Graph

3417 Commits

Author SHA1 Message Date
Kali Vara Purushotham Santhati
b75ab7233e cli: fix data-race warnings
#### Issue: https://github.com/hasura/graphql-engine-mono/issues/2179

### Problem:

1. There are few warnings when tests are executed with cli if it is built with `race` flag
It is because of a race condition between stdin in migrate_delete for the prompt and stdout for other commands.

2. The integration test of the console used to behave as follows:
    ```
     - Initially there won't be any wg.adds in wait-group so the second go-routine created in console-test (integration-test)
     - It will send the interrupt signal to the channel before the server has been started
     - So practically the server won't start
    ```
3. The read and write for consoleopts.WG has been happening in different go-routines without control or lock system(reading and writing into same memory location without lock system). So there is a chance of data-race(warning for data-race while integration tests are executed)
4. Data-race errors from `promptui` package

### Solution:

1. Use `--force` flag to avoid getting the input from the prompt in `migrate_delete_test.go`
2. Introduced two fields in server and console opts to let know other go-routines whether the server has been started or not
3. To avoid data-race above which are shared b/w go-routines to know the status of servers has been operated atomically.
4. using new package https://github.com/AlecAivazis/survey

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

GitOrigin-RevId: 387eb1be74f24dda34bb3588314b5a909adac227
2021-09-07 13:34:54 +00:00
Tirumarai Selvan
4cabb0bdf9 tag release v2.0.9
GitOrigin-RevId: dfba245a4dbe1a71b1e3cc7c92914fc0a919c2b0
2021-09-07 07:49:53 +00:00
Vishnu Bharathi
2329c16ce9 cli: embed cli-ext as exe in case of windows
https://github.com/hasura/graphql-engine-mono/pull/2295

Co-authored-by: Kali Vara Purushotham Santhati <72007599+purush7@users.noreply.github.com>
GitOrigin-RevId: 16a03d33d5bf4d45a71ba79b3b775fba3176a1e8
2021-09-07 06:01:00 +00:00
Sameer Kolhar
f6af579619 server,docs,tests: add support for connection_parameters to pg_add_source API
https://github.com/hasura/graphql-engine-mono/pull/1690

GitOrigin-RevId: a7be66c9af3143b34133d197f7858ba22f442a41
2021-09-06 17:00:12 +00:00
Robert
565e816716 server: don't use Show to encode error codes
This moves the previous (illegal) `Show` instance for `Hasura.Base.Error.Code` to a `ToJSON`
instance, and uses that in the error `ToJSON` instances.

Addressing https://github.com/hasura/graphql-engine-mono/pull/2277#issuecomment-911557169.
This PR is against #2277.

It adds a replacement derived `Show` instance, which is used:
- in the derived `Show` instance for `QErr`
- in some unit tests

Mostly verified that we didn't otherwise rely on the hand-rolled `Show`
instance by compiling without it (and a faked `QErr` instance), and seeing
that the only compile failures were in tests. (Compare the individual commits.)

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

GitOrigin-RevId: 678fe241a14bd0c9aaf5b267efc510ad9d619dd7
2021-09-06 15:49:56 +00:00
Sameer Kolhar
3bd7b9049d server: don't propogate tracecontext and userinfo for GraphQL queries on PG backends
https://github.com/hasura/graphql-engine-mono/pull/2294

GitOrigin-RevId: c4be1c04a676154a233e75b31ff00b689443b933
2021-09-06 14:30:40 +00:00
Anon Ray
dc1ac69dac server: add parameterized query hash for websocket logs
https://github.com/hasura/graphql-engine-mono/pull/2061

Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com>
GitOrigin-RevId: bf26b804d93b19ef7fc15c71fec80fb6d6632e64
2021-09-06 12:27:48 +00:00
Karthikeyan Chinnakonda
94f3ad041c server: generalize event triggers - incremental PR 1
https://github.com/hasura/graphql-engine-mono/pull/2269

GitOrigin-RevId: c4ea0cc41a1c66d418219cc1d41bf95656426733
2021-09-06 11:16:32 +00:00
paritosh-08
8c05efb6d9 server: disable mutation for materialised views
The materialized views cannot be mutated, so this commit removes the option to run mutation on the materialized views via graphql endpoint. Before this, users could have tried running mutation for the materialized views using the graphql endpoint (or from HGE console), which would have resulted in the following error:
``` JSON
{
  "errors": [
    {
      "extensions": {
        "internal": {
          "statement": "WITH \"articles_mat_view__mutation_result_alias\" AS (DELETE FROM \"public\".\"articles_mat_view\"  WHERE (('true') AND (((((\"public\".\"articles_mat_view\".\"id\") = (('20155721-961c-4d8b-a5c4-873ed62c7a61')::uuid)) AND ('true')) AND ('true')) AND ('true'))) RETURNING * ), \"articles_mat_view__all_columns_alias\" AS (SELECT  \"id\" , \"author_id\" , \"content\" , \"test_col\" , \"test_col2\"  FROM \"articles_mat_view__mutation_result_alias\"      ) SELECT  json_build_object('affected_rows', (SELECT  COUNT(*)  FROM \"articles_mat_view__all_columns_alias\"      ) )        ",
          "prepared": false,
          "error": {
            "exec_status": "FatalError",
            "hint": null,
            "message": "cannot change materialized view \"articles_mat_view\"",
            "status_code": "42809",
            "description": null
          },
          "arguments": []
        },
        "path": "$",
        "code": "unexpected"
      },
      "message": "database query error"
    }
  ]
}
```
So, we don't want to generate the mutation fields for the materialized views altogether.

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

GitOrigin-RevId: 4ef441764035a8039e1c780d454569ee1f2febc3
2021-09-06 10:10:35 +00:00
Sooraj
d06dd037be add oss issue template
https://github.com/hasura/graphql-engine-mono/pull/2178

GitOrigin-RevId: 8c5a181bb087d118164af962f4d5874a795255b8
2021-09-06 08:01:43 +00:00
Shahidh K Muhammed
a41d34c62f docs: add a note about cloudflare to custom domains
https://github.com/hasura/graphql-engine-mono/pull/2285

GitOrigin-RevId: 83561117c8ad939e5098db9bb285d8853f8d9b41
2021-09-06 07:11:11 +00:00
Robert
f9dfb84c55 server: sort and prune error codes
This sorts the constructors in `Hasura.Base.Error.Code`, and removes unused ones.

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

GitOrigin-RevId: 2faf68edf70492c21a846d626951e65012a37e7c
2021-09-03 11:47:59 +00:00
Nicolas Beaussart
1b90360bb3 console: add fixed height to html
https://github.com/hasura/graphql-engine-mono/pull/2073

Co-authored-by: Martin Mark <74692114+martin-hasura@users.noreply.github.com>
GitOrigin-RevId: b13f9e478b2569a5bd9b6c845c80df81a560cdc4
2021-09-03 07:36:58 +00:00
Vishnu Bharathi
4b7a035012 ci: introduce docker image scans
https://github.com/hasura/graphql-engine-mono/pull/2177

GitOrigin-RevId: 03cbcbd0cdf1ec20941b7eed8842e5075ccee94d
2021-09-03 06:51:46 +00:00
Rakesh Emmadi
10e01a4669 server/mssql: refine aggregate field SQL generation code
>

### Description
>
Correctly alias the aggregate field projections in site instead of aliasing them later stage.

PS: I discovered this required change while [developing SQL generation for MSSQL inserts](https://github.com/hasura/graphql-engine-mono/pull/2248).

### 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] Server

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

GitOrigin-RevId: 0d90fd8d8c0541b18ca9cb1197e413f3454bb227
2021-09-02 23:01:15 +00:00
Sameer Kolhar
afbc30fec5 server: set tracecontext and userInfo for DML actions on PG sources
https://github.com/hasura/graphql-engine-mono/pull/2174

GitOrigin-RevId: e8cfb4e330938e7dfb7232e58d2c1fc07bf97896
2021-09-01 17:57:39 +00:00
Rakesh Emmadi
7ca48decfb server/mssql: integrate insert mutation schema parser for MSSQL backend
>

### Description
>
This PR is an incremental work towards [enabling insert mutations on MSSQL](https://github.com/hasura/graphql-engine-mono/pull/1974). In this PR, we generate insert mutation schema parser for MSSQL backend.

### 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] Server

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

GitOrigin-RevId: 8595008dece35f7fded9c52e134de8b97b64f53f
2021-08-31 13:35:49 +00:00
Kali Vara Purushotham Santhati
b50df8a24b cli: add progress bar to migrate apply
https://github.com/hasura/graphql-engine-mono/pull/1673

Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: 59b8258557b2769853d0ca64032f453780a3cd7e
2021-08-31 09:57:32 +00:00
Tirumarai Selvan
9d592fde87 tag release v2.0.8
GitOrigin-RevId: 7e2c6333183ebf763ff37bda114219f5e7bf0951
2021-08-30 12:43:41 +00:00
Swann Moreau
4887f70caa [server] revert #2078 "server/postgres: optimize SQL query generation with LIMITs"
Fixes https://github.com/hasura/graphql-engine/issues/7453, by reverting #2078 (commit 47eaccdbfb3499efd2c9f733f3312ad31c77916f).

https://hasurahq.slack.com/archives/CKFUG6RCH/p1629900718181700

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

GitOrigin-RevId: 53d5fee9c6008b26bc14213e5a16f6aba6d9c6b1
2021-08-30 11:54:53 +00:00
Ikechukwu Eze
8ca110b5bb console: fix data sidebar not updated when a table is renamed
https://github.com/hasura/graphql-engine-mono/pull/2237

GitOrigin-RevId: 53ee0ab1b786e8364df3af73396c97c6acb5470f
2021-08-30 10:50:28 +00:00
Lyndon Maydwell
da7c53b8dd Changelog - Update docs for caching rate limits
https://github.com/hasura/graphql-engine-mono/pull/2229

GitOrigin-RevId: 9e1bdf906cf88bed3ef16bb624d0a8d99d7571e7
2021-08-30 07:34:07 +00:00
Ikechukwu Eze
3f4dda2520 console: support computed fields in remote schema join
https://github.com/hasura/graphql-engine-mono/pull/2188

GitOrigin-RevId: 2d6fae62dbdcbdc7515a7b4982299dc9610a2230
2021-08-27 09:58:17 +00:00
Evie Ciobanu
7a1446cec2 [rfc] MySQL relationships
Closes https://github.com/hasura/graphql-engine-mono/issues/2096

This RFC describes the MySQL relationships feature - [rendered](https://github.com/hasura/graphql-engine-mono/blob/evie/rfc/mysql-relationships/rfcs/mysql-relationships.md)

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

GitOrigin-RevId: 9f086120e65bfee091fa4c4e75c0f00f1fe4229f
2021-08-27 08:44:50 +00:00
Abby Sassel
1e7ab8665d server/bigquery: fix data source references & pytest filter in CI
https://github.com/hasura/graphql-engine-mono/pull/2169

GitOrigin-RevId: a0a7190a404ee558a965e06fe1a022953f6f5a10
2021-08-26 18:12:05 +00:00
Auke Booij
272e49a3c5 server: don't inline some text helper functions
Some of these `INLINE` pragmas might be counterproductive.

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

GitOrigin-RevId: f5eeb21f646b4e5c18d7f3096a7eb7bc822950ae
2021-08-26 17:05:32 +00:00
Auke Booij
fe8eabff19 server: fix the nullability of object relationships (fix hasura/graphql-engine#7201)
When adding object relationships, we set the nullability of the generated GraphQL field based on whether the database backend enforces that the referenced data always exists. For manual relationships (corresponding to `manual_configuration`), the database backend is unaware of any relationship between data, and hence such fields are always set to be nullable.

For relationships generated from foreign key constraints (corresponding to `foreign_key_constraint_on`), we distinguish between two cases:

1. The "forward" object relationship from a referencing table (i.e. which has the foreign key constraint) to a referenced table. This should be set to be non-nullable when all referencing columns are non-nullable. But in fact, it used to set it to be non-nullable if *any* referencing column is non-nullable, which is only correct in Postgres when `MATCH FULL` is set (a flag we don't consider). This fixes that by changing a boolean conjunction to a disjunction.
2. The "reverse" object relationship from a referenced table to a referencing table which has the foreign key constraint. This should always be set to be nullable. But in fact, it used to always be set to non-nullable, as was reported in hasura/graphql-engine#7201. This fixes that.

Moreover, we have moved the computation of the nullability from `Hasura.RQL.DDL.Relationship` to `Hasura.GraphQL.Schema.Select`: this nullability used to be passed through the `riIsNullable` field of `RelInfo`, but for array relationships this information is not actually used, and moreover the remaining fields of `RelInfo` are already enough to deduce the nullability.

This also adds regression tests for both (1) and (2) above.

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

GitOrigin-RevId: 617f12765614f49746d18d3368f41dfae2f3e6ca
2021-08-26 15:27:34 +00:00
Varun Choudhary
31fd4a3df2 console: support insecure TLS allowlist
https://github.com/hasura/graphql-engine-mono/pull/1985

Co-authored-by: Sooraj <8408875+soorajshankar@users.noreply.github.com>
GitOrigin-RevId: 9d71ff7624346395c91720bca260a5219622555e
2021-08-26 14:08:14 +00:00
Vaishnavi
487b400445 docs: add cloud manging envs guide
https://github.com/hasura/graphql-engine-mono/pull/2175

Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: 5fee7757c408e97ddd82f479efb17476f44f6607
2021-08-26 12:56:14 +00:00
Antoine Leblanc
7720496b95 Avoid building the engine twice when only running unit tests.
### Description

When running the tests with `dev.sh`, we always build the engine, before attempting to run the tests. This builds the engine twice, due to the flag change. This PR changes this to only do this first build if we're planning to actually run the integration tests.

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

GitOrigin-RevId: 32e8a6568f3665ad99adaf42421a711241974638
2021-08-26 11:53:06 +00:00
Rikin Kachhia
d185212c3e docs: add getTenantId API to cloud api ref
https://github.com/hasura/graphql-engine-mono/pull/2207

GitOrigin-RevId: c8b1b5ab83573d0a807d3059aecaae08ba960115
2021-08-26 10:21:31 +00:00
Rikin Kachhia
2b17c57648 docs: add db current feature support sections
https://github.com/hasura/graphql-engine-mono/pull/2209

GitOrigin-RevId: ff74089342014bf9e40a8e2fd1416b8df0382246
2021-08-26 09:13:25 +00:00
Aravind K P
39f5d04ba8 cli: optimize state copy
https://github.com/hasura/graphql-engine-mono/pull/2176

GitOrigin-RevId: 71f72704c3097ee05f3adca954b4c283701cf5e9
2021-08-26 06:09:55 +00:00
Auke Booij
88aa42a986 server: Add regression tests for hasura/graphql-engine#7172
In hasura/graphql-engine#7172, an issue was found where under certain conditions a JSON field from Postgres would be parsed as a GraphQL input object, which is not possible in general, and also unnecessary. Luckily, this was already fixed by the time `v2.0.6` got around, presumably thanks to 4a83bb1834. This adds a regression test.

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

GitOrigin-RevId: 1ded1456f6b89726e08f77cf3383ad88c04de451
2021-08-25 21:06:09 +00:00
hasura-bot
52aaf2751a Fix typo: iconsistent -> inconsistent
GITHUB_PR_NUMBER: 7394
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/7394

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

Co-authored-by: Tyler Breisacher <244381+MatrixFrog@users.noreply.github.com>
GitOrigin-RevId: a5a4547e5e187193ab4f7a2cb4b8e85139c75967
2021-08-25 13:26:18 +00:00
Karthikeyan Chinnakonda
a210ca7fa6 server: update the partial unique cron event index to be a full index
https://github.com/hasura/graphql-engine-mono/pull/2181

GitOrigin-RevId: bf757b09cb8e9a299b21470f350d0b3fd4ad1dcb
2021-08-25 07:31:55 +00:00
Lyndon Maydwell
605499e6da [pro, server] Allow response when cache limits are hit
https://github.com/hasura/graphql-engine-mono/pull/2094

GitOrigin-RevId: f8b186a7cf830f61226e7ea82631a4a9e5f269bc
2021-08-25 01:53:45 +00:00
Robert
c9481d4599 server: remove align, These(..) from Prelude
This removes the module re-exports of [Data.Align](https://hackage.haskell.org/package/semialign-1.2/docs/Data-Align.html) and [Data.These](https://hackage.haskell.org/package/these-1.1.1.1/docs/Data-These.html) from `Hasura.Prelude`. The reasoning being that they're not used widely and reasonably obscure, and that being explicit about the imports makes for an easier to understand codebase.

(I spent longer than I'd have liked earlier today figuring out where `align` in multitenant came from.
The right one not showing up on the first hoogle page doesn't help. Yes, better tool use could have
avoided that, but still...)

Do feel free to shoot this down, I won't insist on the change.

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

GitOrigin-RevId: 10f887b74538b17623bee6d6451c5aba11573fbd
2021-08-24 17:42:13 +00:00
Sameer Kolhar
edeb8c98fd server: support for graphql-ws protocol
https://github.com/hasura/graphql-engine-mono/pull/1655

Co-authored-by: Rakesh Emmadi <12475069+rakeshkky@users.noreply.github.com>
Co-authored-by: Vijay Prasanna <11921040+vijayprasanna13@users.noreply.github.com>
Co-authored-by: hasura-bot <30118761+hasura-bot@users.noreply.github.com>
Co-authored-by: Brandon Simmons <210815+jberryman@users.noreply.github.com>
Co-authored-by: Varun Choudhary <68095256+Varun-Choudhary@users.noreply.github.com>
Co-authored-by: Divi <32202683+imperfect-fourth@users.noreply.github.com>
GitOrigin-RevId: 9db3902388fef06b94f9513255e2b5333bd23c3e
2021-08-24 16:26:12 +00:00
Robert
3789405e37 multitenant: Improve error messages for schema update
- update pg-client-hs version to provide detailed listen errors
- rework multitenant schema update logging for clarity

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

GitOrigin-RevId: 43569e22df54841cf7637d37744f61f233767762
2021-08-24 15:09:56 +00:00
Rikin Kachhia
8246bcc9d3 docs: misc fixes
- add config api to default enabled api list
- add source key to pg_dump api ref
- add websocket-compression option to config ref
- add websocket-timeout option to config ref
- document using negative integers to decrement
- update one-to-one nested insert caveat

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

GitOrigin-RevId: d76bcdc136b2a25b9f2589155142f3272aa69c7b
2021-08-24 12:08:36 +00:00
Praveen Durairaju
77842fffe0 update readme, add newsletter link to docs
>

### Description
>
This PR updates the readme.md of the repo, removing some old stuff and updating contents to reflect Hasura's latest features and offerings from v2.0.

### 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] Docs

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

GitOrigin-RevId: a51654a6893a66e2d2c7816018c8bccb5ff0eea9
2021-08-24 11:24:48 +00:00
Evie Ciobanu
5cba4fd079 server: add a short note clarifying order of teardown functions
Closes https://github.com/hasura/graphql-engine-mono/issues/1435

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

GitOrigin-RevId: ecbdf98edb3a6b0b8bcd1b96fb9ee533b4f98cad
2021-08-24 09:20:13 +00:00
Auke Booij
99963a78c2 server: reduce memory usage during type collection by using a more concrete effect stack
Replaces one instance of `mtl`-style effects with `transformers`-style, as this results in a measurable reduction in memory usage. The change is kept completely within one module.

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

GitOrigin-RevId: 587b8e61725bb4a505404bbe741185759b7bceeb
2021-08-24 09:16:15 +00:00
Lyndon Maydwell
9a1c7d5ea0 server: Adding support for TLS allowlist by domain and service id (port)
https://github.com/hasura/graphql-engine-mono/pull/2153

Co-authored-by: Sameer Kolhar <6604943+kolharsam@users.noreply.github.com>
GitOrigin-RevId: 473a29af97236fc879ae178b0c2a6c31c1f12563
2021-08-24 07:37:25 +00:00
Kali Vara Purushotham Santhati
c6d47a7db3 cli: use server metadata as base for comparison in metadata diff
Reference: https://hasurahq.slack.com/archives/C024GF6FCTH/p1629193174042700

Problem: The `metadata diff` is conventional where it takes the project metadata and w.r.t to the signs `---`, `+++`, it shows the diff output but it is not similar to git diff as taking the remote repo as base and `+` denotes it has, `-` not. So make the metadata diff output follow as git diff output

Solution: To change the order of arguments in diff function and assign `---` to server,`+++` to project, so that it will be similar to prev diff output

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

GitOrigin-RevId: bf35b5a3ef835fc64f590b65160c01c9a8c1382a
2021-08-24 03:25:05 +00:00
Robert
191e7a7ccf pro, server: simplify and unify limit resolution
This should be mostly a no-op change, with one exception:

When limits are not disabled, but neither node nor depth limit
is configured, we no longer count nodes/depth uselessly.

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

GitOrigin-RevId: 9943f89d6b969ca101a9a5601417c5b14a358a10
2021-08-23 19:27:11 +00:00
Auke Booij
67f2f49f33 server: remove stray comment
This re-removes a comment that was previously removed in
7bead93827 and re-added by
f49e13c890

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

GitOrigin-RevId: d16c19c8a0d5bed2a52b8033a1fe20cc6d6a2c92
2021-08-23 15:03:33 +00:00
Nicolas Beaussart
05c0382036 console: fix remote schema permission spacing
https://github.com/hasura/graphql-engine-mono/pull/2182

GitOrigin-RevId: c362e377879c3faba3857b0bdcd77a9cb586c8f5
2021-08-23 12:56:16 +00:00
Brandon Simmons
21b7d4d072 server benchmarks: fix running bench.sh locally in both modes; add missing --network=host in postgres container
We also added a missing `--network=host` to the postgres container, which it turns out improves performance numbers a bit (hopefully increases stability a bit too).

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

Co-authored-by: David Overton <7734777+dmoverton@users.noreply.github.com>
GitOrigin-RevId: 3fffc8fbfc77606dd26421eed079629306b08d05
2021-08-22 07:14:15 +00:00