Commit Graph

602 Commits

Author SHA1 Message Date
Solomon Bothwell
af5ff07614 Request Transformations
https://github.com/hasura/graphql-engine-mono/pull/1984

Co-authored-by: jkachmar <8461423+jkachmar@users.noreply.github.com>
GitOrigin-RevId: 1767d6bdde48c156fe171b5a9b7e44d7f2eb4869
2021-09-16 11:03:57 +00:00
David Overton
7c77c81cf9 return original schema in introspect_remote_schema
https://github.com/hasura/graphql-engine-mono/pull/2364

GitOrigin-RevId: 99698aa977bf8ff85e29d67a0956ff1509cd30be
2021-09-16 09:07:18 +00:00
Antoine Leblanc
e2ce1972f6 Prevent empty subscription roots (fix hasura/graphql-engine#6898)
### Description

We always build a subscription root, even when there was no possible fields. This breaks some third party clients, as the spec does not allow empty types in the schema. This PR fixes this by changing the `buildSubscriptionParser` helper to return a `Maybe` value, and harmonizes / cleans places where we build the subscription root.

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

GitOrigin-RevId: 1aeae25e321eee957e7645c436d17e69207309fd
2021-09-16 07:42:46 +00:00
Antoine Leblanc
a5589c185b Fix nullability of nested objrel inserts (fix hasura/graphql-engine#7484)
### Description

During the PDV refactor that led to 2.0, we broke an undocumented and untested semantic of inserts: accepting _explicit_ null values in nested object inserts.

In short: in the schema, we often distinguish between _explicit_ null values `{id: 3, author: null}` and _implicit_ null values that correspond to the field being omitted `{id: 3}`. In this particular case, we forgot to accept explicit null values. Since the field is optional (meaning we accept implicit null values), it was nullable in the schema, like it was in pre-PDV times. But in practice we would reject explicit nulls.

This PR fixes this, and adds a test. Furthermore, it does a bit of a cleanup of the Mutation part of the schema, and more specifically of all insertion code.

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

GitOrigin-RevId: 895cfeecef7e8e49903a3fb37987707150446eb0
2021-09-15 13:11:48 +00:00
Karthikeyan Chinnakonda
982b5a3d15 server: log operation details for each query in a batch query execution
https://github.com/hasura/graphql-engine-mono/pull/2306

GitOrigin-RevId: 066a02fc57711b1faad447e6e448e3e004376c74
2021-09-15 08:30:32 +00:00
Karthikeyan Chinnakonda
a268a3dc2f server: fix bug which allowed metadata to be inconsistent in the replace_metadata API call
https://github.com/hasura/graphql-engine-mono/pull/2288

GitOrigin-RevId: 93b181c957a5c38748c419a5146f0590605957ce
2021-09-14 12:03:06 +00:00
Matt Hardman
bbed956137 console: support tracking of functions with return a single row (close#2281)
### Description
- Tracking functions that return a single row were unsupported, this was fixed with -> [this](https://github.com/hasura/graphql-engine/issues/4299#issuecomment-911553730)
- This PR updates the console to list functions that return a single row as trackable

### 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
#2281

### Solution and Design
>

### Steps to test and verify

- Create the following table

```sql
create table users (
    "id" int primary key,
    "name" text
);
```

- Create a function that returns one row, (don't tick track function)

```sql
CREATE OR REPLACE FUNCTION public.me()
 RETURNS users
 LANGUAGE sql
 STABLE
AS $function$
select *
from public.users
where id = 1;
$function$
```

- click on the schema and the function should appear in untracked functions

<img width="614" alt="Screenshot 2021-09-13 at 11 18 30" src="https://user-images.githubusercontent.com/28978422/133067170-24d5adc7-73d4-44ae-941f-ed790d2d861c.png">

---

### Kodiak commit message
Information used by [Kodiak bot](https://kodiakhq.com/) while merging this PR.

#### Commit title
Same as the title of this pull request

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

Co-authored-by: Ikechukwu Eze <22247592+iykekings@users.noreply.github.com>
GitOrigin-RevId: 6365a1bf35205a51e995c2b17104eb2f79563756
2021-09-14 05:29:08 +00:00
Sameer Kolhar
bafefac73d server: update create_scheduled_event API to respond with event_id
https://github.com/hasura/graphql-engine-mono/pull/2313

GitOrigin-RevId: a72880734074105d55bb387fdb5d1a9f5fac1d72
2021-09-13 18:01:55 +00:00
Abby Sassel
16b09f7d52 server/mssql: support transactions
https://github.com/hasura/graphql-engine-mono/pull/2268

GitOrigin-RevId: b1bc2812cd403688228b3ecf143aa36b3a6af707
2021-09-09 07:59:55 +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
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
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
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
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
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
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
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
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
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
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
Ikechukwu Eze
4330798a71 console: fix error due too rendering inconsistent object's message
https://github.com/hasura/graphql-engine-mono/pull/2116

GitOrigin-RevId: a2d8230bf685a201991adfe33f548c9e9c24e44b
2021-08-19 16:43:17 +00:00
David Overton
20f7a6e726 server: fix untrack_function for non-default source
https://github.com/hasura/graphql-engine-mono/pull/2152

GitOrigin-RevId: 339b365044443cec6a83e1a6b3ec06677dc51e1d
2021-08-19 10:28:49 +00:00
Karthikeyan Chinnakonda
eaf0211787 docs: document clean up steps for scheduled triggers
https://github.com/hasura/graphql-engine-mono/pull/2077

Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: 7f4fae18052b46122106a0fb57ab4b5c0c000b18
2021-08-18 16:16:39 +00:00
Aniket Deshpande
2700554412 bq: test table customization features
https://github.com/hasura/graphql-engine-mono/pull/2062

Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: 5573efd1b28e088d5730c7d22e16889dc852b5fe
2021-08-18 13:00:58 +00:00
Rikin Kachhia
47f8bc9b42 server: update non-existent object error messages
https://github.com/hasura/graphql-engine-mono/pull/2098

GitOrigin-RevId: 61a10560a9df50afd80a6186e0d23b74874e3265
2021-08-18 10:52:28 +00:00
Rakesh Emmadi
fa152d842d server/postgres: optimize SQL query generation with LIMITs
>

### Description
>
This PR supersedes https://github.com/hasura/graphql-engine-mono/pull/1484. Apply `limit` to the table selection before joining relationship rows to improve query performance.

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

### Related Issues
->
Fix https://github.com/hasura/graphql-engine/issues/5745

### Solution and Design
>
Prior to this change, we apply `LIMIT` and `OFFSET` to the outer selection from sub-query which includes joins for relationships. Now, we move `LIMIT` and `OFFSET` (if present) to inner selection of base table. But, this isn't done always! If there are order by relationships' columns we apply at the outer selection. To know more, please refer to [source code note](https://github.com/hasura/graphql-engine-mono/pull/2078/files#diff-46d868ee45d3eaac667cebb34731f573c77d5c9c8097bb9ccf1115fc07f65bfdR652).

```graphql
query {
  article(limit: 2){
    id
    title
    content
    author{
      name
    }
  }
}
```
Before:
```sql
SELECT
  coalesce(json_agg("root"), '[]') AS "root"
FROM
  (
    SELECT
      row_to_json(
        (
          SELECT
            "_4_e"
          FROM
            (
              SELECT
                "_0_root.base"."id" AS "id",
                "_0_root.base"."title" AS "title",
                "_0_root.base"."content" AS "content",
                "_3_root.or.author"."author" AS "author"
            ) AS "_4_e"
        )
      ) AS "root"
    FROM
      (
        SELECT
          *
        FROM
          "public"."article"
        WHERE
          ('true')
      ) AS "_0_root.base"
      LEFT OUTER JOIN LATERAL (
        SELECT
          row_to_json(
            (
              SELECT
                "_2_e"
              FROM
                (
                  SELECT
                    "_1_root.or.author.base"."name" AS "name"
                ) AS "_2_e"
            )
          ) AS "author"
        FROM
          (
            SELECT
              *
            FROM
              "public"."author"
            WHERE
              (("_0_root.base"."author_id") = ("id"))
          ) AS "_1_root.or.author.base"
      ) AS "_3_root.or.author" ON ('true')
    LIMIT
      2
  ) AS "_5_root"
```
cost
```
Aggregate  (cost=0.73..0.74 rows=1 width=32)
  ->  Limit  (cost=0.15..0.71 rows=2 width=32)
        ->  Nested Loop Left Join  (cost=0.15..223.96 rows=810 width=32)
              ->  Seq Scan on article  (cost=0.00..18.10 rows=810 width=72)
              ->  Index Scan using author_pkey on author  (cost=0.15..0.24 rows=1 width=36)
                    Index Cond: (article.author_id = id)
                    SubPlan 1
                      ->  Result  (cost=0.00..0.01 rows=1 width=32)
              SubPlan 2
                ->  Result  (cost=0.00..0.01 rows=1 width=32)
```

After:
```sql
SELECT
  coalesce(json_agg("root"), '[]') AS "root"
FROM
  (
    SELECT
      row_to_json(
        (
          SELECT
            "_4_e"
          FROM
            (
              SELECT
                "_0_root.base"."id" AS "id",
                "_0_root.base"."title" AS "title",
                "_0_root.base"."content" AS "content",
                "_3_root.or.author"."author" AS "author"
            ) AS "_4_e"
        )
      ) AS "root"
    FROM
      (
        SELECT
          *
        FROM
          "public"."article"
        WHERE
          ('true')
        LIMIT
          2
      ) AS "_0_root.base"
      LEFT OUTER JOIN LATERAL (
        SELECT
          row_to_json(
            (
              SELECT
                "_2_e"
              FROM
                (
                  SELECT
                    "_1_root.or.author.base"."name" AS "name"
                ) AS "_2_e"
            )
          ) AS "author"
        FROM
          (
            SELECT
              *
            FROM
              "public"."author"
            WHERE
              (("_0_root.base"."author_id") = ("id"))
          ) AS "_1_root.or.author.base"
      ) AS "_3_root.or.author" ON ('true')
  ) AS "_5_root"
```
cost:
```
Aggregate  (cost=16.47..16.48 rows=1 width=32)
  ->  Nested Loop Left Join  (cost=0.15..16.44 rows=2 width=100)
        ->  Limit  (cost=0.00..0.04 rows=2 width=72)
              ->  Seq Scan on article  (cost=0.00..18.10 rows=810 width=72)
        ->  Index Scan using author_pkey on author  (cost=0.15..8.18 rows=1 width=36)
              Index Cond: (article.author_id = id)
              SubPlan 1
                ->  Result  (cost=0.00..0.01 rows=1 width=32)
  SubPlan 2
    ->  Result  (cost=0.00..0.01 rows=1 width=32)
```

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

Co-authored-by: Evie Ciobanu <1017953+eviefp@users.noreply.github.com>
GitOrigin-RevId: 47eaccdbfb3499efd2c9f733f3312ad31c77916f
2021-08-17 17:03:08 +00:00
Vishnu Bharathi
cf6f3edc1f tag release v2.0.7 (#2118)
GitOrigin-RevId: b86611a3393d2b8008b09c1d833d5b2c43f72aaf
2021-08-17 13:07:37 +00:00
hasura-bot
2d03920169 console: add custom timeouts to actions
GITHUB_PR_NUMBER: 6251
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/6251

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

Co-authored-by: Varun Choudhary <68095256+Varun-Choudhary@users.noreply.github.com>
Co-authored-by: Sooraj <8408875+soorajshankar@users.noreply.github.com>
GitOrigin-RevId: 758c6d7edfbf3f7f3173653bceb53608b0f253d8
2021-08-17 11:59:22 +00:00
Karthikeyan Chinnakonda
1294ae59f2 server: fix bug when downgrading from v2 to v1 when there is atleast one cron trigger present in the metadata
https://github.com/hasura/graphql-engine-mono/pull/2101

GitOrigin-RevId: 7011f0c18cb0cef828214ec084adc39cfb3aba1c
2021-08-17 07:02:09 +00:00
Karthikeyan Chinnakonda
ef2278f9c7 server: add an index on event_id in hdb_cron_event_invocation_logs table
https://github.com/hasura/graphql-engine-mono/pull/2083

GitOrigin-RevId: b5748424c7b685a0bad2117adfe0eb189e40197c
2021-08-17 05:45:11 +00:00
Ikechukwu Eze
64a5c52904 console: support computed fields in permission builder
>

### Description
>

### 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
closes [#7336](https://github.com/hasura/graphql-engine/issues/7336)

### Steps to test and verify

- Add a scalar computed field with only table row as argument, to the table you want to use for testing
- Then head to table's permission tab, and try to use permission builder to set permissions for any role
- confirm that computed fields are listed as options along table columns

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

GitOrigin-RevId: 2cd16ca4a0e6a6288d4b62549ebe1aaaf841952b
2021-08-16 12:28:03 +00:00
Abhijeet Khangarot
5de2ef7d31 console: allow same named queries and unnamed queries on allowlist file upload
https://github.com/hasura/graphql-engine-mono/pull/1906

GitOrigin-RevId: bdd752f49213a2056f39050d40d3dc299dc07819
2021-08-16 09:23:12 +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
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
Tirumarai Selvan
7b863a1b3b tag release v2.0.6
GitOrigin-RevId: b2b906cf7b05bc444148a334aba42385046be75c
2021-08-11 01:19:22 +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
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
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
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
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