Commit Graph

1668 Commits

Author SHA1 Message Date
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
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
Daniel Chambers
0f9f2192a0 server: Customize root field GraphQL schema descriptions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3719
GitOrigin-RevId: b0a9bb6a0f65aac72ca95b66219eec16b2f5a0dd
2022-02-28 07:50:12 +00:00
Antoine Leblanc
a1886b3729 Generalize remote schemas IR
### Description

This PR is one further step towards remote joins from remote schemas. It introduces a custom partial AST to represent queries to remote schemas in the IR: we now need to augment what used to be a straightforward GraphQL AST with additional information for remote join fields.

This PR does the minimal amount of work to adjust the rest of the code accordingly, using `Void` in all places that expect a type representing remote relationships.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3794
GitOrigin-RevId: 33fc317731aace71f82ad158a1951ea93350d6cc
2022-02-25 20:38:46 +00:00
Brandon Martin
ecc9ffd070 server: Fix experimental sql optimization read
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3809
GitOrigin-RevId: 66f22ff705d22d0d9ecc7da20aac649734b41398
2022-02-25 18:43:12 +00:00
jkachmar
dc73b7b7d5 server: Renames the experimental backend modules
No logic in this PR, just tidying things up (renaming the backend from `Experimental` to `DataWrapper`).

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3779
GitOrigin-RevId: f11acf563ccd8b9f16bc23c5e92da392aa4cfb2c
2022-02-25 16:09:17 +00:00
Puru Gupta
fcef6e5cb2 server: http ip blocklist (closes #2449)
## Description

This PR is in reference to #2449 (support IP blacklisting for multitenant)

*RFC Update: Add support for IPv6 blocking*

### Solution and Design

Using [http-client-restricted](https://hackage.haskell.org/package/http-client-restricted) package, we're creating the HTTP manager with restricting capabilities. The IPs can be supplied from the CLI arguments as `--ipv4BlocklistCidrs cidr1, cidr2...` or `--disableDefaultIPv4Blocklist` for a default IP list. The new manager will block all requests to the provided CIDRs.

We are extracting the error message string to show the end-user that given IP is blocked from being set as a webhook. There are 2 ways to extract the error message "connection to IP address is blocked". Given below are the responses from event trigger to a blocked IP for these implementations:
- 6d74fde316f61e246c861befcca5059d33972fa7 - We return the error message string as a HTTPErr(HOther) from `Hasura/Eventing/HTTP.hs`.
```
{
    "data": {
        "message": "blocked connection to private IP address "
    },
    "version": "2",
    "type": "client_error"
}
```

- 88e17456345cbb449a5ecd4877c84c9f319dbc25 - We case match on HTTPExceptionContent for InternaException in `Hasura/HTTP.hs` and extract the error message string from it. (this is implemented as it handles all the cases where pro engine makes webhook requests)
```
{
  "data": {
    "message": {
      "type": "http_exception",
      "message": "blocked connection to private IP address ",
      "request": {
        "secure": false,
        "path": "/webhook",
        "responseTimeout": "ResponseTimeoutMicro 60000000",
        "queryString": "",
        "method": "POST",
        "requestHeaders": {
          "Content-Type": "application/json",
          "X-B3-ParentSpanId": "5ae6573edb2a6b36",
          "X-B3-TraceId": "29ea7bd6de6ebb8f",
          "X-B3-SpanId": "303137d9f1d4f341",
          "User-Agent": "hasura-graphql-engine/cerebushttp-ip-blacklist-a793a0e41-dirty"
        },
        "host": "139.59.90.109",
        "port": 8000
      }
    }
  },
  "version": "2",
  "type": "client_error"
}
```

### Steps to test and verify
The restricted IPs can be used as webhooks in event triggers, and hasura will return an error message in reponse.

### Limitations, known bugs & workarounds
- The `http-client-restricted` has a needlessly complex interface, and puts effort into implementing proxy support which we don't want, so we've inlined a stripped down version.
- Performance constraint: As the blocking is checked for each request, if a long list of blocked CIDRs is supplied, iterating through all of them is not what we would prefer. Using trie is suggested to overcome this. (Added to RFC)
- Calls to Lux endpoints are inconsistent: We use either the http manager from the ProServeCtx which is unrestricted, or the http manager from the ServeCtx which is restricted (the latter through the instances for MonadMetadataApiAuthorization and UserAuthentication). (The failure scenario here would be: cloud sets PRO_ENDPOINT to something that resolves to an internal address, and then restricted requests to those endpoints fail, causing auth to fail on user requests. This is about HTTP requests to lux auth endpoints.)

## Changelog

-  `CHANGELOG.md` is updated with user-facing content relevant to this PR.

## Affected components

-  Server
-  Tests

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3186
Co-authored-by: Robert <132113+robx@users.noreply.github.com>
GitOrigin-RevId: 5bd2de2d028bc416b02c99e996c7bebce56fb1e7
2022-02-25 13:30:57 +00:00
Robert
5e7018b424 server: remove redundant LANGUAGE pragmas
These are all enabled as default-extensions.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3800
GitOrigin-RevId: ab9f4b900df53d66221095c02d6b12a930ff5873
2022-02-25 12:40:00 +00:00
awjchen
dcaa6a7bc3 ci: hide old benchmark reports for PRs with many comments
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3780
GitOrigin-RevId: 47414b17e311184fc038ef8291091c1d67a991aa
2022-02-24 20:09:17 +00:00
kodiakhq[bot]
1181625173 server: optimize collectTypeDefinitions and refactor
Numbers from CI for the new (currently noisy) `replace_metadata` adhoc benchmark:

    chinook:      0.19s  ->  0.16
    huge_schema: 36.98s  ->  29.89

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3685
GitOrigin-RevId: be79b666858b03e8407c0d89765e9aac0af8d40a
2022-02-24 18:56:22 +00:00
paritosh-08
bc74046ab2 server: case insensitive lookup in session variable
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3663
GitOrigin-RevId: b36666d8849a23dad209f9921f140390c2b57496
2022-02-24 13:08:35 +00:00
Vishnu Bharathi
faf9716c28 ci: tag release v2.2.1 and v2.2.1-pro.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3785
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: 90bcd2a062268c6c20d4006505574c5db5b88b81
2022-02-24 10:33:40 +00:00
Karthikeyan Chinnakonda
bea650b3e0 server/mssql: source catalog initialization for event triggers (Incremental PR - I)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2505
Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com>
GitOrigin-RevId: 56681f90cfbfcf2f99c27f08c01d32790bd03c4d
2022-02-24 08:14:10 +00:00
Robert
91cc962e5d server: move http manager out of GlobalCtx
It was only used for one purpose. This makes the sketchy manager handling in schema cache init a bit more visible.

Should help make the change in #2449 more robust.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3677
GitOrigin-RevId: e34b990bafb4893663ae195d5bf329130056f1ff
2022-02-23 23:41:28 +00:00
Philip Lykke Carlsen
b9ad721ea6 Reduce boolean blindness by promoting data type StringifyNumbers
I discovered and removed instances of Boolean Blindness about whether json numbers should be stringified or not.

Although quite far-reaching, this is a completely mechanical change and should have no observable impact outside the server code.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3763
GitOrigin-RevId: c588891afd8a6923a135c736f6581a43a2eddbc7
2022-02-23 20:19:24 +00:00
Gil Mizrahi
431dab97d6 tests-hspec: Extract Exceptions, refactor env vars, use json file as well for BigQuery
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3777
GitOrigin-RevId: e46458585e21bb431887a30f179d7a1df0b39609
2022-02-23 19:33:32 +00:00
Gil Mizrahi
2e41489a6b tests-hspec refactor leftovers and another small refactor: typos, setup/teardown catch, better error messages for env-vars
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3748
GitOrigin-RevId: 4e4959e41ff33539d82968bbdf56dc10b362e641
2022-02-23 15:27:13 +00:00
Evie Ciobanu
374ec8ab12 server: reference hspec README in CONTRIBUTING
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3775
GitOrigin-RevId: ff781587ec968d91f8423a8aa3498e5e981aade2
2022-02-23 13:47:44 +00:00
Auke Booij
b535257251 Avoid Arrows by interpreting monads
TL;DR
---

We go from this:
```haskell
  (|
    withRecordInconsistency
      ( (|
          modifyErrA
            ( do
                (info, dependencies) <- liftEitherA -< buildRelInfo relDef
                recordDependencies -< (metadataObject, schemaObject, dependencies)
                returnA -< info
            )
        |) (addTableContext @b table . addRelationshipContext)
      )
    |) metadataObject
```
to this:
```haskell
  withRecordInconsistencyM metadataObject $ do
    modifyErr (addTableContext @b table . addRelationshipContext) $ do
      (info, dependencies) <- liftEither $ buildRelInfo relDef
      recordDependenciesM metadataObject schemaObject dependencies
      return info
```

Background
---
We use Haskell's `Arrows` language extension to gain some syntactic sugar when working with `Arrow`s. `Arrow`s are a programming abstraction comparable to `Monad`s.

Unfortunately the syntactic sugar provided by this language extension is not very sweet.

This PR shows how we can sometimes avoid using `Arrow`s altogether, without loss of functionality or correctness. It is a demo of a technique that can be used to cut down the amount of `Arrows`-based code in our codebase by about half.

Approach
---

Although _in general_ not every `Monad` is an `Arrow`, specific `Arrow` instantiations are exactly as powerful as their `Monad` equivalents. Otherwise they wouldn't be very equivalent, would they?

Just like `liftEither` interprets the `Either e` monad into an arbitrary monad implementing `MonadError e`, we add `interpA` which interprets certain concrete monads such as `Writer w` into specific arrows, e.g. ones satisfying `ArrowWriter w`. This means that the part of the code that only uses such interpretable effects can be written _monadically_, and then used in _arrow_ constructions down the line.

This approach cannot be used for arrow effects which do not have a monadic equivalent. In our codebase, the only instance of this is `ArrowCache m`, implemented by the `Rule m` arrow. So code written with `ArrowCache m` in the context cannot be rewritten monadically using this technique.

See also
---
- #1827
- #2210

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3543
Co-authored-by: jkachmar <8461423+jkachmar@users.noreply.github.com>
GitOrigin-RevId: eb79619c95f7a571bce99bc144ce42ee65d08505
2022-02-22 18:09:50 +00:00
Brandon Simmons
a3fc1889bb benchmarks: add an initial adhoc operation mode, suitable for benchma…
…rking metadata operations

And add an initial benchmark for replace_metadata, to unblock some
performance improvements to that op in a PR to be merged after this.

This is an MVP just to have something in CI to reference when optimizing
metadata operations. See TODO for roadmap.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3673
Co-authored-by: jkachmar <8461423+jkachmar@users.noreply.github.com>
GitOrigin-RevId: 968d1f92ca79c78ad90b2304d2214069bc739621
2022-02-22 16:59:44 +00:00
jkachmar
df4ca23a39 server: Splits QuickCheck extension and orphan instance modules
## Description

Hopefully this is relatively self-explanatory: this change splits the helper functions we've used to extend QuickCheck from the orphan instances and generators that we have defined for unit tests. These have now been placed in `Test.QuickCheck.Extended` and `Hasura.QuickCheck.Instances`, respectively.

This change also adds some documentation to the functions defined in `Test.QuickCheck.Extended` in the spirit of similar functions defined by `Test.QuickCheck`, itself.

### Motivation

We should adhere to the existing convention of constructing "extension modules" for common libraries separately from the code that takes advantage of these.

Alone, this wouldn't be a reason to split up `Hasura.Generators`, but we should **also** follow a convention of defining **all** orphan instances in modules whose names clearly indicate that they exist solely for the purpose of exporting these orphan instances (e.g. `Hasura.QuickCheck.Instances`).

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3747
GitOrigin-RevId: fb856a790b4a39163f81481d4f900fafb1797ea6
2022-02-22 15:33:37 +00:00
Antoine Leblanc
41087fc12a Improve combined context names in tests
### Description

This PR adds a custom instance for `Show` to `ContextName`, to avoid combined names being rendered as `Combine Postgres Postgres`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3750
GitOrigin-RevId: 00a202e4191607c319bd202ea23623d6cc9f0dff
2022-02-22 13:55:21 +00:00
Vishnu Bharathi
0e988bcbf4 ci: tag release v2.3.0-beta.2 and v2.3.0-beta.2-pro.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3756
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: d93845719f1c0e7318453da296a7fb6b2a2f3e74
2022-02-22 13:13:20 +00:00
Antoine Leblanc
0fad2485f3 Fix remote relationship test setup.
### Description

This small PR fixes a few errors in the setup of remote relationships. We were not using the proper local state setup functions coming from the LHS context, and the RHS function for remote relationships was misnamed.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3749
GitOrigin-RevId: 5f261aced6bf5dbb05749af10c59e01a9214ea11
2022-02-22 11:55:42 +00:00
Auke Booij
7547786b2b Build introspection Schema ad-hoc at parsing time
In order to respond to GraphQL queries that make use of the introspection fields `__type` or `__schema`, we need two things:
- an overview of the relevant GraphQL type information, stored in a `Schema` object, and
- to have included the `__type` and `__schema` fields in the `query_root` that we generate.

It used to be necessary to do the above items in that order, since the `__type` and `__schema` fields (i.e. the respective `FieldParser`s) were generated _from_ a `Schema` object.

Thanks to recent refactorings in `Hasura.GraphQL.Schema.Introspect` (see hasura/graphql-engine-mono#2835 or hasura/graphql-engine@5760d9289c), the introspection fields _themselves_ are now `Schema`-agnostic, and simply return a function that takes a `Schema` object after parsing. For instance, the type of `schema`, corresponding to the `__schema` field, has literally changed as follows:
```diff
-schema :: MonadParse n => Schema -> FieldParser n (          J.Value)
+schema :: MonadParse n =>           FieldParser n (Schema -> J.Value)
 ```

This means that the introspection fields can be included in the GraphQL schema *before* we have generated a `Schema` object. In particular, rather than the current architecture of generating `Schema` at startup time for every role, we can instead generate `Schema` ad-hoc at query parsing time, only for those queries that make use of the introspection fields. This avoids us storing a `Schema` for every role for the lifetime of the server.

However: this introduces a functional change, as the code that generates the `Schema` object, and in particular the `accumulateTypeDefinitions` method, also does certain correctness checks, to prevent exposing a spec-incompliant GraphQL schema. If these correctness checks are being done at parsing time rather than startup time, then we catch certain errors only later on. For this reason, this PR adds an explicit run of this type accumulation at startup time. For efficiency reasons, and since this correctness check is not essential for correct operation of HGE, this is done for the admin role only.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3231
GitOrigin-RevId: 23701c548b785929b28667025436b6ce60bfe1cd
2022-02-21 20:23:55 +00:00
Evie Ciobanu
b74ed10cb5 server: trivial refactor in postgres insert
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3746
GitOrigin-RevId: 3d3004862bb64bef55d2716f4c2a86f95343cab5
2022-02-21 18:22:56 +00:00
Gil Mizrahi
ad7ecc8ed5 tests-hspec refactors: Feature -> Context, local state creation, enum name
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3743
GitOrigin-RevId: e2b3dba91b1b9ca66e0e140f9ec8d6d2d2e8a319
2022-02-21 17:06:04 +00:00
Rakesh Emmadi
e77c110927 server/bigquery: fix parsing timestamp input values
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3667
GitOrigin-RevId: b696c219f96929fa8321c1a6d04589ee8d5b0827
2022-02-21 14:48:00 +00:00
Anon Ray
e87433c2bb server: remove hdb_lib and add tests for read-only source
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3634
Co-authored-by: Philip Lykke Carlsen <358550+plcplc@users.noreply.github.com>
GitOrigin-RevId: 2db62a279496cd7e5dd57bdf02c3efa7b70042c8
2022-02-21 10:00:00 +00:00
Philip Lykke Carlsen
109a0beca8 (Fix #3456) Guard calls to JSON_QUERY on null arguments
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3655
GitOrigin-RevId: 6e0aed6e96b2995af11366676fa9c453bb44a7aa
2022-02-21 08:53:06 +00:00
Auke Booij
557a3d4b6e Derive a few Semigroup+Monoid instances
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3717
GitOrigin-RevId: 9bc7f64754a8461a006d9b633a712124f828166e
2022-02-18 14:58:04 +00:00
Antoine Leblanc
5541ec011e Add remote relationships hspec tests
## Description

This PR adds the possibility for hspec tests to start a remote server with a custom schema, using the _morpheus_ library. In addition, it adds:
- X-to-DB object relationships tests
- X-to-DB array relationships tests
- X-to-RS relationships tests

For now, all those X are only postgres, but the tests are written in a way that will allow for it to easily be any other DB, or even remote schemas. The actual tests were taken mostly from #3069.

To achieve this, this PR heavily refactors the test harness. Most importantly: it generalizes the notion of a `Backend` to a notion of generic `Context`, allowing for contexts that are the unions of two backends, or of a backend and a remote schema.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3567
Co-authored-by: jkachmar <8461423+jkachmar@users.noreply.github.com>
GitOrigin-RevId: 623f700ba482743f94d3eaf659e6cfa22cd0dbc9
2022-02-18 13:36:31 +00:00
Auke Booij
9bb6575d60 Metadata code cleanups
There are three minor cleanups here:

- The first argument to the `setMetadataInCatalog` method is always `Just`. It is thus important to avoid `Maybe`, because this means that a crucial piece of code (saving metadata) is completely untested.
- Rather than spelling them out, we can derive the `Semigroup`/`Monoid` instances for `MetadataModifier` through the `Endo` type.
- I've renamed the name of the getter of the `MetadataModifier` newtype to **r**unMetadataModifier. Using record puns, this allows us to write:

```diff
-  putMetadata $ unMetadataModifier metadataModifier metadata
+  putMetadata $ runMetadataModifier metadata
```
which is nicer to read.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3703
GitOrigin-RevId: fd36b3c5202017f5afc943c01dfdd7c82c099bdd
2022-02-18 12:47:56 +00:00
jkachmar
d50aae87a5 Updates cabal freeze file
#### TODO

- [x] fix `hashable >= 1.3.1` serialization ordering issue [^1]
  - `test_graphql_mutations.py::TestGraphQLMutateEnums` was failing
- [x] fix `unordered-containers` serialization ordering issue [^2]
  - `test_graphql_queries.py` was failing on Citus
- [ ] verify that no new failures have been introduced
- [ ] open issues to fix the above
  - identify test cases that "leak" implementation details by depending on `hashable` instance ordering
  - bump `hashable >= 1.3.1` and update test cases with new ordering OR modify them so that ordering is stable
  - bump `unordered-containers >= 0.2.15.0` and update test cases with new ordering OR modify them so that ordering is stable
    - one of the test cases was failing on string equality comparison for a generated Citus query
    - we probably don't want to _actually_ do this unless there are _very specific_ guarantees we want to make about generated query structure
---

Just what it says on the tin.

https://github.com/hasura/graphql-engine-mono/pull/3538 updated the freeze file a few weeks ago, but it looks like the index state hadn't been updated since December so a lot of stuff that had newer versions didn't get updated.

---

EDIT: I should add, the motivation for doing this in the first place is that `hspec > 2.8.4` now supports specifying filtering spec trees based on patterns provided by the `HSPEC_MATCH` environment variable.

For example, one could have a script that executes the following:
```
HSPEC_MATCH="PostgreSQL" \
  ghcid \
    --command \
      'cabal repl graphql-engine:test:tests-hspec \
         --repl-option -O0 \
         --repl-option -fobject-code' \
    --test "main"
```
...which will loop on typechecking the `tests-hspec` component, and then as soon as it passes (i.e. no warnings or errors) will run _only_ the `PostgreSQL` sub-components.

[^1]: `hashable >= 1.3.1.0` [updated its default salts](https://github.com/haskell-unordered-containers/hashable/pull/196), which [broke serialization ordering](https://github.com/haskell/aeson/issues/837)
[^2]: `unordered-containers >= 0.2.16.0` [introduced changes to some of its internal functions](https://hackage.haskell.org/package/unordered-containers-0.2.16.0/changelog) which seem like they could have affected serialization stability

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3672
GitOrigin-RevId: bbd1d48c73db4021913f0b5345b7315a8d6525d3
2022-02-18 05:32:08 +00:00
Gil Mizrahi
69fd7449be server/mssql: Add max precision to nvarchar and varchar session variables
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3668
GitOrigin-RevId: 04de036eec00297e79d15d0b0429f9994378735a
2022-02-17 14:12:45 +00:00
Auke Booij
f026d44438 Role-invariant schema constructors
We build the GraphQL schema by combining building blocks such as `tableSelectionSet` and `columnParser`. These building blocks individually build `{InputFields,Field,}Parser` objects. Those object specify the valid GraphQL schema.

Since the GraphQL schema is role-dependent, at some point we need to know what fragment of the GraphQL schema a specific role is allowed to access, and this is stored in `{Sel,Upd,Ins,Del}PermInfo` objects.

We have passed around these permission objects as function arguments to the schema building blocks since we first started dealing with permissions during the PDV refactor - see hasura/graphql-engine@5168b99e46 in hasura/graphql-engine#4111. This means that, for instance, `tableSelectionSet` has as its type:
```haskell
tableSelectionSet ::
  forall b r m n.
  MonadBuildSchema b r m n =>
  SourceName ->
  TableInfo b ->
  SelPermInfo b ->
  m (Parser 'Output n (AnnotatedFields b))
```

There are three reasons to change this.

1. We often pass a `Maybe (xPermInfo b)` instead of a proper `xPermInfo b`, and it's not clear what the intended semantics of this is. Some potential improvements on the data types involved are discussed in issue hasura/graphql-engine-mono#3125.
2. In most cases we also already pass a `TableInfo b`, and together with the `MonadRole` that is usually also in scope, this means that we could look up the required permissions regardless: so passing the permissions explicitly undermines the "single source of truth" principle. Breaking this principle also makes the code more difficult to read.
3. We are working towards role-based parsers (see hasura/graphql-engine-mono#2711), where the `{InputFields,Field,}Parser` objects are constructed in a role-invariant way, so that we have a single object that can be used for all roles. In particular, this means that the schema building blocks _need_ to be constructed in a role-invariant way. While this PR doesn't accomplish that, it does reduce the amount of role-specific arguments being passed, thus fixing hasura/graphql-engine-mono#3068.

Concretely, this PR simply drops the `xPermInfo b` argument from almost all schema building blocks. Instead these objects are looked up from the `TableInfo b` as-needed. The resulting code is considerably simpler and shorter.

One way to interpret this change is as follows. Before this PR, we figured out permissions at the top-level in `Hasura.GraphQL.Schema`, passing down the obtained `xPermInfo` objects as required. After this PR, we have a bottom-up approach where the schema building blocks themselves decide whether they want to be included for a particular role.

So this moves some permission logic out of `Hasura.GraphQL.Schema`, which is very complex.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3608
GitOrigin-RevId: 51a744f34ec7d57bc8077667ae7f9cb9c4f6c962
2022-02-17 08:17:17 +00:00
Solomon
d1ba271c3d Feature/removable request transform body and modified request transform API
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3475
GitOrigin-RevId: bc847b18d491fe4957a190f5d0fe2ae6e6719791
2022-02-17 04:37:18 +00:00
Vishnu Bharathi
0cd4bd1bff ci: tag release v2.3.0-beta.1 and v2.3.0-beta.1-pro.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3678
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: b5ffb38ec015773cffe6ec49fa1b2133f7bc4118
2022-02-16 11:09:47 +00:00
Naveen Naidu
2e823234f9 server/remote-schema: Include OperationName in the request sent to remote schemas
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3581
Co-authored-by: Puru Gupta <32328846+purugupta99@users.noreply.github.com>
GitOrigin-RevId: 2db21d0df158a5a3229b883ee426b2f38f864f80
2022-02-16 07:55:19 +00:00
Robert
1ff3723ed8 server: assorted minor clean-up around HTTP managers
- consistent qualified imports
- less convoluted initialization of pro logging HTTP manager
- pass pro HTTP manager directly instead of via Has
- remove some dead healthcheck code

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3639
GitOrigin-RevId: dfa7b9c62d1842a07a8514cdb77f1ed86064fb06
2022-02-16 07:09:47 +00:00
Daniel Chambers
2c7a4e3a16 Customization of computed field GraphQL schema descriptions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3615
GitOrigin-RevId: f51590d4cfc0412be9baa371353f9b9f3b908f84
2022-02-15 23:17:27 +00:00
Solomon
6c7820caa0 Bumps Kriti Version
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3625
GitOrigin-RevId: a453254ac89b470a56189e6178b2a00cf628fe63
2022-02-15 22:32:38 +00:00
Robert
ef64590985 server: remove an unused type and export
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3671
GitOrigin-RevId: 2d31c0131519be77366a7f1b761b8a07cfd36003
2022-02-15 19:56:13 +00:00
pranshi06
582d78110f server: Support returning scalar types in actions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3453
GitOrigin-RevId: 59fee1460c5571322988b1f558a91ebeb2d55d22
2022-02-15 14:40:34 +00:00
Antoine Leblanc
dc4a286c64 Prepare test suite for remote servers tests
## Description

This PR adds all the scaffolding for tests that require remote servers. It is mostly a refactor of `Feature`; where we listed for each test a list of individual backends, we now provide a list of `Context`s, that allows for tests to specify not only how it should be setup, but also what state needs to be carried around throughout the test. This will be useful when launching custom remote servers.

Additionally, this PR:
- cleans the way we generate logs in the engine as part of the tests
- cleans the cabal file
- introduce a few more helpers for sending commands to the engine (such as `postMetadata_`)
- allows for headers in queries sent to the engine (to support permissions tests)
- adds basic code to start / stop a "remote" server

This PR is a pre-requisite of #3567.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3573
Co-authored-by: jkachmar <8461423+jkachmar@users.noreply.github.com>
GitOrigin-RevId: 05f808c6b85729dbb3ea6648c3e10a3c16b641ef
2022-02-14 17:25:28 +00:00
Kirill Zaborsky
2d9387e791 Add backoff for BigQuery calls
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3344
GitOrigin-RevId: ea5bdd02522e9a89c70501d4680e8741c3c6b6fc
2022-02-14 09:46:38 +00:00
Kirill Zaborsky
960cf2d954 Use 'hasura' as dataset in python test to unify it with hspec
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3636
GitOrigin-RevId: f4114fded09cbdd9875488610c635537478e4ab5
2022-02-14 06:23:07 +00:00
David Overton
8d0eb6b812 Use 429 error code when rate limit exceeded
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3628
GitOrigin-RevId: f5ae470b4036961e906125ef1a8446f0d48b39b1
2022-02-14 05:13:46 +00:00
Lyndon Maydwell
ff6aac31b8 Adding multiple jwt secrets (incorporating provenance requirements)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3173
Co-authored-by: Solomon <24038+solomon-b@users.noreply.github.com>
Co-authored-by: Daniel Chambers <1214352+daniel-chambers@users.noreply.github.com>
GitOrigin-RevId: 395a5d5854896f866b612895d6f41e29376c2caa
2022-02-13 23:34:39 +00:00
Auke Booij
47315b78d6 Add Note explaining type collection
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3588
GitOrigin-RevId: f46d06e9476b22fe7abc699a5236ffefd23c1935
2022-02-10 18:14:01 +00:00
jkachmar
89714a85f6 Fixes 'Harness.Quoter' link typo
Just what it says on the tin.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3640
GitOrigin-RevId: 021f76720846f82ab893b206293681f1e0bfcacf
2022-02-10 16:09:35 +00:00
Daniel Chambers
dd403f92e2 Customization of table GraphQL schema descriptions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3570
GitOrigin-RevId: f642a4d9efdd26a344951fcab6c1bbbc1253dfa3
2022-02-10 06:32:44 +00:00
Kirill Zaborsky
773870f443 BigQuery hspec tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3435
Co-authored-by: Vishnu Bharathi <4211715+scriptnull@users.noreply.github.com>
GitOrigin-RevId: 78f698becb83bd9732eddbe419361aff2799dd2c
2022-02-09 15:30:13 +00:00
paritosh-08
4d2a5dba51 server: fix multiple calls to database on startup
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3569
GitOrigin-RevId: 820d56a7af7faa05292ef65734d5d40fe3dd4641
2022-02-09 05:14:29 +00:00
Gil Mizrahi
efec0bf9ca server/postgres: LIMIT 1 on object relationships
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3489
Co-authored-by: Abby Sassel <3883855+sassela@users.noreply.github.com>
GitOrigin-RevId: f09a75508545cdbc34cf8728fad95bbb00bde018
2022-02-08 17:40:24 +00:00
Swann Moreau
8bd34b4a51 server, pro: add support for per-role allowlists
spec: https://github.com/hasura/graphql-engine-mono/pull/2278

Briefly:
- extend metadata so that allowlist entries get a new scope field
- update `add_collection_to_allowlist` to accept this new scope field,
  and adds `update_scope_of_collection_in_allowlist` to change the scope
- scope can be global or role-based; a collection is available for every
  role if it is global, and available to every listed role if it is role-based
- graphql-engine-oss is aware of role-based allowlist metadata; collections
  with non-global scope are treated as if they weren't in the allowlist

To run the tests:
- `cabal run graphql-engine-tests -- unit --match Allowlist`
- py-tests against pro:
  - launch `graphql-engine-pro` with `HASURA_GRAPHQL_ADMIN_SECRET` and `HASURA_GRAPHQL_ENABLE_ALLOWLIST`
  - `pytest test_allowlist_queries.py --hge-urls=... --pg-urls=... --hge-key=... --test-allowlist-queries --pro-tests`

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2477
Co-authored-by: Anon Ray <616387+ecthiender@users.noreply.github.com>
Co-authored-by: Robert <132113+robx@users.noreply.github.com>
GitOrigin-RevId: 01f8026fbe59d8701e2de30986511a452fce1a99
2022-02-08 16:54:49 +00:00
Evie Ciobanu
9337edf096 Evie/postgres/module docs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3563
GitOrigin-RevId: e35aafbd210d526ed53db7088e1a47f89f0b9c44
2022-02-08 09:25:35 +00:00
Gil Mizrahi
8432407156 Add a tip on how to benchmark a query on postgres
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3593
GitOrigin-RevId: ebc3d05f788f45fd0b1cdebc40c090c7163824ad
2022-02-08 08:29:22 +00:00
Karthikeyan Chinnakonda
8d2acc833d server: add a note about experimental features
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3598
GitOrigin-RevId: e7f8d2f8d1b9490f0e28e59073f7b6a62447c04c
2022-02-08 07:52:24 +00:00
paritosh-08
b75706dd12 server: validate REST endpoint queries after metadata change
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2338
Co-authored-by: Sameer Kolhar <6604943+kolharsam@users.noreply.github.com>
GitOrigin-RevId: 9cd6bb940ba74fe41bdf2db3c4f35e89c4fb0577
2022-02-08 04:47:52 +00:00
Auke Booij
c4ef2d21f8 Make optimize_permission_filters an --experimental-features flag
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3589
GitOrigin-RevId: 5e102e5dd348e170ebe10f04ff9598fdc4167522
2022-02-07 18:05:39 +00:00
Rakesh Emmadi
793aede022 server/mssql: improve database exception handling and better API errors
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3487
GitOrigin-RevId: d3f696072e8290b45c2f81509ce31cb5c13a4aef
2022-02-07 14:12:55 +00:00
Daniel Chambers
ba5b7fedd4 Try to make JWK refresh integration tests more reliable in CI
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3577
GitOrigin-RevId: a5f8f6e3dc373e8f2b44fcfdcb6b97696d8c62b5
2022-02-07 09:13:09 +00:00
Antoine Leblanc
aaadd2c81f Build schema cache for relationships from remote schemas
## Description

This PR is a subset of #3069, that does roughly that #3031 was aiming to do: add the schema cache building phase for relationships from remote servers. This PR does not change any of the code that *uses* remote relationships, meaning we ignore the added schema cache information. It also contains dependency-tracking code, which was originally missing from #3031; in turn, this pulls some of the metadata API as well, since we identify remote relationships by how they were created.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3540
GitOrigin-RevId: ed962b6d07fd4adbf0a71e0d79736a4e8b422fea
2022-02-03 18:59:32 +00:00
Auke Booij
c4cdacf989 First attempt at deduplicating permission filters
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3362
Co-authored-by: Chris Parks <592078+cdparks@users.noreply.github.com>
GitOrigin-RevId: 802c099c26ff024e6cf594ea0317480e260486e9
2022-02-03 16:14:44 +00:00
Solomon
9d78ba5ddd Fixes env var error reporting in Webhook Debug Endpoint
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3549
GitOrigin-RevId: c0b48735ea50bf3782bfdcab2a1eeaa582f0c3b6
2022-02-03 14:57:30 +00:00
Philip Lykke Carlsen
e1918adb52 Replace "identity column" with "column mutability" data for all backends
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3373
GitOrigin-RevId: bf08cc9008a4b0b3ece4952528c15c45e57fc74c
2022-02-03 14:15:35 +00:00
Antoine Leblanc
bd2fce3691 Stable sort of extracted notes
## Description

This PR updates the notes-extracting script, to allow for a stable sort across runs:
- files are now treated in alphabetical order of the full file name:
  - within a file, notes are treated in order
  - that order is reflected in the generated index file
- within a note, references are sorted by file, then by line number

Additionally it fixes(?) a note whose format was unexpected.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3352
GitOrigin-RevId: 2b2b57ec0aa2657d75a88e4951e6b19bb2d665e3
2022-02-03 13:33:09 +00:00
Auke Booij
b4c56f26e1 Derive a few instances for PGMetadataStorageAppT
Use GHC's "deriving via" mechanism to obtain a few type class instances for free.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3382
GitOrigin-RevId: 43df1e2e3f770d07f8bc7101cc47b80fc7a34915
2022-02-02 17:26:27 +00:00
Vishnu Bharathi
f4007596fb tag release v2.2.0
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3558
GitOrigin-RevId: b4ba6830be191aac6ce9e8e5bef974bd5322260d
2022-02-02 12:49:55 +00:00
Robert
0c17f238a2 server: report duplicate entries in metadata lists using ToTxt instead of Show
This change is because in https://github.com/hasura/graphql-engine-mono/pull/2477, errors come out as
```
multiple declarations exist for the following allowlist : [CollectionName {unCollectionName = NonEmptyText {unNonEmptyText = "collection_1"}}]'
```
which is awfully messy. This changes it to
```
multiple declarations exist for the following allowlist: collection_1
```

This should improve error messages across the board -- e.g. `RoleName` has a nice `ToTxt` instance, while we used to use a derived `Show` instances. However, there might just be instances where the `Show` instance was better, bit hard to be sure based on scanning the code since we don't have test coverage for these errors.

Broken out of the allowlist PR since it affects more than just the allowlist.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3470
GitOrigin-RevId: 7a2c29f17d9f15d840cb2f89caefcdd3aae44d25
2022-02-01 11:30:58 +00:00
Antoine Leblanc
3525e60021 Deploy server documentation to github page in CI
_(This PR is on top of #3352.)_

## Description

This PR overhauls our documentation CI steps to push all generated server documentation to the `gh-pages` branch of the OSS repo. The goal of this PR is to arrive in the situation where `https://hasura.github.io/graphql-engine/server/` is automatically populated to contain the following:
  - all the markdown files from `server/documentation`, copied verbatim, no transformation applied
  - all the notes, collected from the code by the `extract-notes.sh` script, in `server/notes`
  - the generated haddock documentation for each major release or branch in `server/haddock`.

To do so, this PR does the following:
  - it includes the script to extract notes from #3352,
  - it rewrites the documentation checking CI step, to generate the notes and publish the resulting "server/documentation" folder,
  - it includes a new CI step to deploy the documentation to the `gh-pages` branch

Of note:
  - we will generate a different haddock folder for each main branch and release; in practice, that means the _main_, _stable_, _alpha_, _beta_ branches, and every build tagged with a version number
  - the step that builds the haddock documentation checks that ALL projects in the repo build, including pro, but the deploy only deploys the graphql-engine documentation, as it pushes it to a publicly-accessible place

## Required work

**DO NOT MERGE THIS PR IT IS NOT READY**. Some work needs to go into this PR before it is ready.

First of all: the `gh-pages` branch of the OSS repo does NOT yet contain the documentation scaffolding that this new process assumes. At the bare minimum, it should be a orphan branch that contains a top-level README.md file, and a _server_ folder. An example of the bare minimum required can be previewed [on my fork](https://nicuveo.github.io/graphql-engine/server/).

The content of the `server/documentation` folder needs to be adjusted to reflect this; at the very least, a `README.md` file needs to be added to do the indexing (again, see the placeholder [on my fork](https://nicuveo.github.io/graphql-engine/server/) for an example).

This way of publishing documentation must be validated against [proposed changes to the documentation](https://github.com/hasura/graphql-engine-mono/pull/3294). @marionschleifer what do you think?

~~The buildkite code in this branch is currently untested, and I am not sure how to test it.~~

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3380
GitOrigin-RevId: b24f6759c64ae29886c1f1b481b172febc512032
2022-01-31 13:16:29 +00:00
Daniel Chambers
3c74f91a1c Add default User-Agent header for Action requests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3505
GitOrigin-RevId: fe74349d1ca699dc0edca1e5a829fd658226a5ee
2022-01-31 06:50:13 +00:00
Chris Done
e97f93e02e server/tests: run Haskell integration tests in CI
This PR introduces a BuildKite pipeline step to run the new hspec tests in CI.

Closes https://github.com/hasura/graphql-engine-mono/issues/2866

Relates to https://github.com/hasura/graphql-engine/issues/7760

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2987
Co-authored-by: Vishnu Bharathi <4211715+scriptnull@users.noreply.github.com>
Co-authored-by: Kirill Zaborsky <70110+qrilka@users.noreply.github.com>
GitOrigin-RevId: 48cea2b81394ff1c4b19bd178ca10bbcb200f33e
2022-01-28 12:22:09 +00:00
Daniel Chambers
4d9417fac4 server: Refresh JWKs maximum once per second
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3429
GitOrigin-RevId: 123fe33f026a36282ee1137eeefd612191ff4844
2022-01-28 00:18:56 +00:00
Antoine Leblanc
d66d2d81fd server: use placeholder to prevent empty query roots
### Description

The GraphQL spec has to conflicting requirements:
1. an object must contain at least one field: the schema may not contain empty objects
2. the _query_root_ must always be present

Given _1_, the schema generation code removes from the schema all fields that would result in empty objects, such as a table for which a user does not have select permissions. But, as a result, our code also potentially removes _query_root_ if it is empty, breaking _2_.

This PR introduces a dummy "placeholder" field in the query root if it's empty, to ensure we never remove it from the schema.

### Remaining work

- [x] changelog entry
- [x] tests

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/148
GitOrigin-RevId: bfd6bfcc2f3de92900b6ba566012f093399ca037
2022-01-27 18:08:11 +00:00
Antoine Leblanc
a023a3259d Prevent uses of unsafeMkName whenever possible.
### Description

This PR is the result of a discussion in #3363. Namely, we would like to remove all uses of `unsafeMkName`, or at the very least document every single one of them, to avoid similar issues. To do so, this PR does the following:
- it adds a hlint suggestion not to use that function:
  - suggestions don't mark the PR as failed, but will be shown at review time
  - it is possible to disable that hint with `{- HLINT ignore myFunction "unsafe" -}`
- wherever possible, it removes uses of `unsafeMkName` in favour of `mkName`
- it adds a comment with a tracking issue for the two remaining uses:
  - #3478
  - #3479

### Remaining work

- discuss whether this hint should make the linter step fail, since the linter step isn't required to merge anyway, and there is a way to disable the hint wherever we think the use of that function is acceptable
- check that none of those uses were load-bearing and result in errors now

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3480
GitOrigin-RevId: 0a7e3e9d1a48185764c04ab61e34b58273af347c
2022-01-27 15:13:37 +00:00
Antoine Leblanc
81d9071948 Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002)
## Description

When setting up a remote relationship to a remote schema, values coming from the left-hand side are given as _arguments_ to the targeted field of the remote schema. In turn, that means we need to adjust the arguments to that remote field; in the case of input objects, it means creating a brand new input object in which the relevant fields have been removed.

To both avoid conflicts, and be explicit, we give a pretty verbose name to such an input object: its original name, followed by "remote_rel", followed by the full name of the field (table name + relationship name). The bug there was introduced when working on extending remote relationships to other backends: we changed the code that translates the table name to a graphql identifier to be generic, and use the table's `ToTxt` instance instead. However, when a table is not in the default schema, the character used by that instance is `.`, which is not a valid GraphQL name.

This PR fixes it, by doing two things:
- it defines a safe function to translate LHS identifiers to graphql names (by replacing all invalid characters by `_`)
- it doesn't use `unsafeMkName` anymore, and checks at validation time that the type name is correct

## Further work

On this PR:
- [x] add a test
- [x] write a Changelog entry

Beyond this PR, we might want to:
- prioritize #1747
- analyze all calls to `unsafeMkName` and remove as many as possible

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3363
GitOrigin-RevId: fe98eb1d34157b2c8323af453f5c369de616af38
2022-01-27 14:34:01 +00:00
Gil Mizrahi
084a9f2f7b Reorganize Harness.Quoter.Yaml and add shouldReturnOneOfYaml
- I've made some stylistic changes to `Harness.Quoter.Yaml` so that the exposed API will appear at the top
- I've added a new expectation `shouldReturnOneOfYaml`, which can be helpful in testing non-deterministic results (by specifying all the possible valid results). Can be useful for https://github.com/hasura/graphql-engine-mono/issues/3458

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3492
GitOrigin-RevId: 71c1fe490f8a0717f2729efa2750d5d0034cec86
2022-01-27 13:15:28 +00:00
Karthikeyan Chinnakonda
56e40e1d0e server: add a new metadata API to return all the cron triggers
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3464
GitOrigin-RevId: 97b043ec0b4194cde83f2d78c3dc963cf0414c29
2022-01-27 06:44:37 +00:00
Daniel Chambers
bd6f7cd756 Fixed GQL aliases not being respected in the OpenAPI schema
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3484
GitOrigin-RevId: 0f49dd7f64e80dfe6940d673afa76f12f6599126
2022-01-27 05:55:55 +00:00
Gil Mizrahi
9d2ac22365 tests-hspec - custom finally and readme toc
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3471
GitOrigin-RevId: 4a1477b7e7f175bf7b4c81405747588980c43d7b
2022-01-26 12:18:22 +00:00
Antoine Leblanc
dfe9a046f6 Factor backends' metadata in hspec tests.
## Description

This PR adds a `defaultSourceMetadata` expression to each backend's harness file, and introduces `setSource` and `setSources` to factor out all the calls to `replace_metadata` in the tests.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3425
GitOrigin-RevId: 5eacb156ffa198123262759eb2bbdebe8ab09fd7
2022-01-25 16:35:44 +00:00
Antoine Leblanc
472d5df5ae Add documentation scaffolding for first sync-up.
## Description

This PR adds a basic README file to `server/documentation`, in order to get something somewhat decent when we run the first automatic sync.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3468
GitOrigin-RevId: 10c3afc1ea02ee3eb914009e3b9ad22065c1db50
2022-01-25 13:18:22 +00:00
Daniel Chambers
c861f0b09d Fix REST endpoints with path segments not showing correctly in the OpenAPI spec
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3443
GitOrigin-RevId: 92ab7ccc004fedb149f336b0585e6f002e08e2a9
2022-01-25 06:28:47 +00:00
David Overton
8eca322b94 Fix for customized remote schema input object types in query variables
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3417
GitOrigin-RevId: a4d3e59f5177f971a64a2b9e62fd1acaa8079a6b
2022-01-24 04:46:46 +00:00
Evie Ciobanu
dc113cc2b8 server: add tests for transaction commit/rollback
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3418
GitOrigin-RevId: fde6ce718cebabed53c90369215358c248a9658f
2022-01-21 12:49:12 +00:00
Gil Mizrahi
abefdd31d0 update contributing and compiling on m1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3431
GitOrigin-RevId: fe899b33ca9f3d128b125e40a58dfee0407826a5
2022-01-21 11:21:49 +00:00
Gil Mizrahi
b091c75372 Add README.md to tests-hspec and reorganize module namespace
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3421
GitOrigin-RevId: 8802d7e6a360edee62011ef371cc8930f36b25b1
2022-01-21 07:49:31 +00:00
paritosh-08
00558666b1 server: add analyzeGraphqlQuery
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3288
GitOrigin-RevId: a5fd39acc8039f2e6ec5090adfc984ac09281d6b
2022-01-21 05:40:20 +00:00
Evie Ciobanu
ab829b4355 test: have dev.sh pass through CLI options for unit tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3420
GitOrigin-RevId: eba7ac0bb609cf83ac1e636c24907601ffcd3651
2022-01-20 15:40:34 +00:00
Anon Ray
137b81c84f server/gardening: rename mkMgr to mkHttpManager
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3394
GitOrigin-RevId: 87ba91ced1d8c408ea8ebacef3f7660952b9fdf4
2022-01-19 12:33:45 +00:00
Rakesh Emmadi
34c2fb2b66 server: cleanup references to "pgCol" in common and non-postgres backend code
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3393
GitOrigin-RevId: b45cd83f7c3fbc1656011ee888968743b0bbb736
2022-01-19 08:38:48 +00:00
Evie Ciobanu
9297a2e09d server: mssql transactions: rearrange, export less, improve docs, hlint
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3387
GitOrigin-RevId: 904fcf8349ab0626b64ff86cd8b076dd08abff8e
2022-01-19 05:26:49 +00:00
Solomon
4b792abdcc Feature/webhook response transforms
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3074
Co-authored-by: David Overton <7734777+dmoverton@users.noreply.github.com>
Co-authored-by: Lyndon Maydwell <92299+sordina@users.noreply.github.com>
Co-authored-by: Tirumarai Selvan <8663570+tirumaraiselvan@users.noreply.github.com>
GitOrigin-RevId: 006c5c9b71cdca1c2f47962230e6189e09557fab
2022-01-19 04:47:36 +00:00
Rakesh Emmadi
fbfdf9a04d server/mssql: restrict "count" aggregate query on multiple columns
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3354
GitOrigin-RevId: d9890782ff8e3ea40ec52c0da82e43ecf5c36d2b
2022-01-18 14:54:46 +00:00
Kirill Zaborsky
47b9321ba4 BigQuery operators: like/nlike, geography
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2924
GitOrigin-RevId: 3748411cb4419a21a58283836adb5cb39d351d19
2022-01-18 13:37:12 +00:00
Auke Booij
a7dbe95666 Hlint all Haskell code
So far we've only used `hlint` to lint the OSS code. This moves some things around to lint the Pro code as well.

Note that the CI action only runs `hlint` on Haskell files that are _changed_ by a PR, relative to its merge-base (usually `main`).

As a reminder, you can use the `ignore-server-hlint-checks` label to prevent this from blocking a merge.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3383
GitOrigin-RevId: d5779c63d780f526a1d58ae4107f0d5262a23ec1
2022-01-18 04:06:15 +00:00
Rakesh Emmadi
f45130bc39 server/mssql: move mssql_run_sql test cases from v1/run_sql to v2/mssql/run_sql
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3370
GitOrigin-RevId: dfeb6e2dfda3fbe6ec2d318909dc793042b86d04
2022-01-18 02:21:04 +00:00
Kirill Zaborsky
7beb15b4a3 distinct_on for BigQuery
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3191
GitOrigin-RevId: e9f1c814b2caf09946389c4bcb30a0c42277abaf
2022-01-17 10:02:17 +00:00
Vamshi Surabhi
2e1be1d2c5 bump python test suite dependencies
This PR upgrades some of the pinned dependencies do not build with python 3.10 - cffi, ruamel, py. Further, it upgrades other packages where the effort is minimal.

For the reviewers: Please review it commit by commit.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3367
GitOrigin-RevId: c5401fe289d3185a79c4d382297f86fbde139825
2022-01-17 07:40:56 +00:00
Rakesh Emmadi
08f1725698 server/mssql: expand transactions to GraphQL queries and mssql_run_sql API
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3286
GitOrigin-RevId: 0b37767e271dfa43d36fa7f7cc9928ba6a22964d
2022-01-14 14:09:22 +00:00
Gil Mizrahi
ac8f9daaa9 Use hspec-discover for hspec-tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3328
GitOrigin-RevId: 5f1cfc43434d971083b32e992e40f348bbf75ecd
2022-01-13 21:14:53 +00:00
Kirill Zaborsky
560daa63a8 BigQuery: fix support for joins in nodes of aggregate queries
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3233
GitOrigin-RevId: a3a4624d5cd0c4c562e27d1e3605882e7f5a3d0d
2022-01-13 15:09:52 +00:00
Evie Ciobanu
db22401e4f server: document python integration test suite
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3350
GitOrigin-RevId: 47dcebbfa84ed3681da40b3ea52e9b849b2fe8e4
2022-01-13 14:29:10 +00:00
Rakesh Emmadi
42a2787290 server/mssql: update odbc git reference to the commit which has error message fix
## Description

I come across a flaky test due to inconsistent error messages from the odbc lib we use for MSSQL database interactions.
```
cabal new-run -- test:graphql-engine-tests mssql
Up to date

Database.MSSQL.TransactionSpec
  runTx
    runs command in a transaction
    commits a successful transaction, returning a single field
    commits a successful transaction, returning multiple fields
    an unsuccesful transaction, expecting Int
    a successfull query expecting multiple rows
    an unsuccesful transaction; expecting single row
    displays the SQL Server error on an unsuccessful transaction FAILED [1]
    rolls back an unsuccessful transaction

Failures:

  src-test/Database/MSSQL/TransactionSpec.hs:60:15:
  1) Database.MSSQL.TransactionSpec.runTx displays the SQL Server error on an unsuccessful transaction
       expected: UnsuccessfulReturnCode "odbc_SQLExecDirectW" (-1) "[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The definition for column 'INVALID_SYNTAX' must include a data type.[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The definition for column 'INVALID_SYNTAX' must include a data type."
        but got: UnsuccessfulReturnCode "odbc_SQLExecDirectW" (-1) "[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The definition for column 'INVALID_SYNTAX' must include a data type.[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The definition for column 'INVALID_SYNTAX' must include a data type.\DEL"

  To rerun use: --match "/Database.MSSQL.TransactionSpec/runTx/displays the SQL Server error on an unsuccessful transaction/"

Randomized with seed 1101559172

Finished in 0.2140 seconds
8 examples, 1 failure
```
From above, we got a error message with `\DEL` appended. It is also driving the tests to fail in the CI on random PRs.

We brought this into notice of "fpco", the authors of the library and they got us a [quick fix](https://github.com/fpco/odbc/pull/43), which also improves the errors by removing the redundancy of the error message.

In this PR
- We update the `odbc` library git reference to fc5b592a60
- Update the error messages in tests to conform with improved error messages from `odbc`

## Related issues
Closes https://github.com/hasura/graphql-engine-mono/issues/3340

## Changelog

-  `CHANGELOG.md` is updated with user-facing content relevant to this PR.

## Affected components
-  server
-  tests

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3345
GitOrigin-RevId: a5694e8afb58b5ad71b9c9635a80dea1ec449f51
2022-01-13 11:15:01 +00:00
Evie Ciobanu
e30d51ee38 server: bump pytest version
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3348
GitOrigin-RevId: b1fd23da3c8af59e28575438ebffe75f6fb79428
2022-01-13 10:30:55 +00:00
Gil Mizrahi
fe41fbabbd mssql: Test upserts with permissions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3280
GitOrigin-RevId: 861d4db59f75c83daef975fb3471b3c07889c9bc
2022-01-11 13:36:56 +00:00
Naveen Naidu
d097aea394 server/mssql: Add omitNothingFields to MSSQLConnConfiguration
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3325
GitOrigin-RevId: 09f11073a9ef37f10281b778c6884fa420dece20
2022-01-11 09:52:00 +00:00
Evie Ciobanu
463a303390 server: add MSSQL module haddocks
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3293
GitOrigin-RevId: 3062d5b1f41ce1fb18afc78773a2c947d8765309
2022-01-10 22:55:48 +00:00
Chris Done
14bf8ba1be hspec: Tests for MySQL equivalent to the ones from the Python suite. close hasura/graphql-engine#7757
This fills in the gaps specified in this comment: https://github.com/hasura/graphql-engine/issues/7757#issuecomment-979948890 From the issue regarding fleshing out all MySQL tests that we already had in the python suite.

I'll push commits here.

Closes https://github.com/hasura/graphql-engine/issues/7757

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3271
GitOrigin-RevId: 9f68ed1c2b81cae1d479f9482c975f18a699c93a
2022-01-07 17:52:53 +00:00
Gil Mizrahi
59ab1bbe57 refactor Hasura.Backends.MSSQL.Instances.Execute
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3265
GitOrigin-RevId: f7faa22be30ecc5a876dc40ad93cb8d2452de65e
2022-01-06 09:49:58 +00:00
Philip Lykke Carlsen
304ec36c3a (Fix #3154) Remove occurrences of Text in MSSQL IR in favor of dedicated data types.
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3264
GitOrigin-RevId: 923ea2794bef9850f1aa5714b610890d02165882
2022-01-05 11:10:39 +00:00
Rakesh Emmadi
f49bb2b180 server/mssql: rollback a transaction based on the transaction state
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3247
GitOrigin-RevId: 70307d8723a63b9314b6ff4d897dcac6e8e93fb9
2022-01-05 08:03:59 +00:00
Naveen Naidu
3a8fadb22b server/mssql: support read replicas
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2578
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
GitOrigin-RevId: 88a02f8a617006853b350f48f4317c78ab97435b
2022-01-04 11:54:56 +00:00
Kirill Zaborsky
71f2d04b4f Disable pretty printing in BigQuery responses
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3222
GitOrigin-RevId: 03cf0670d949efa7cdd16ee55124925fd54a31c0
2022-01-04 10:57:15 +00:00
Gil Mizrahi
f919c27ba4 Add docstrings to the module headers of a few selected mssql modules
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3241
GitOrigin-RevId: 582a2e77c8120ad2dc818d5f0b51cf56afc79bc5
2022-01-03 17:17:18 +00:00
Brandon Simmons
265470b08c ci: misc. cleanup, naming
GitOrigin-RevId: 253c326e0c873bfa875a13f1d44a605a5fa11476
2022-01-03 06:26:39 +00:00
Brandon Simmons
736236a904 ci: combine pro/oss build jobs
The motivation here is:
- save some CI resources
- make it cleaner/more sensible to do library caching

Since OSS is a dependency of pro, and at the same time the various
executables can be built in parallel, doing this all in the same job
probably is more sensible.

Future improvements: there are separate pro and oss pipelines and one or
the other of those will need to wait unnecessarily while everything
finishes. In practice, currently this isn't a big deal, but we could use
the BuildKite blocking job API to get more fine-grained downstream
triggering.

GitOrigin-RevId: aa917996cbfc678becaaafca490d6edc7de89b1f
2022-01-03 06:26:26 +00:00
Gil Mizrahi
a5f2161e1c server/mssql: upsert - sql generation and execution
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3207
Co-authored-by: Rakesh Emmadi <12475069+rakeshkky@users.noreply.github.com>
GitOrigin-RevId: 92a4aa3cf802bc76858c4be4273a2f6a7d4aa395
2021-12-31 10:56:58 +00:00
Chris Done
15071a3bc9 Add SQL Server & Citus to hspec test suite harness and a BasicFields test for each
Relates to https://github.com/hasura/graphql-engine/issues/7755

This includes:

1. SQL Server
2. Citus

And removes the persistent-based testing in favor of duplicating the schema setup, data insertion and teardown.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3030
Co-authored-by: Abby Sassel <3883855+sassela@users.noreply.github.com>
GitOrigin-RevId: ab03e68436d2ae07a9ddeb5a499ff41e48d0e2d6
2021-12-30 11:01:43 +00:00
Kirill Zaborsky
a2bf2fdc8f Fix aggregates for comparable types in BigQuery
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3211
GitOrigin-RevId: 1a63b0835fc5af687f6caca187968edc9efbb821
2021-12-30 10:00:47 +00:00
Rakesh Emmadi
549a5a31f0 server/mssql: fix pytest class names for update mutations
**TLDR**: Rename the pytest class names for update mutations by suffixing with `MSSQL` instead of `Mssql`.

We run the pytest in the CI using option `-k "MSSQL or Common"` which runs the test classes having `Common` or `MSSQL` in their name. Assuming the option `-k` to be case insensitive I named the update mutation test classes ending with `Mssql`. To confirm whether the CI is running the update mutation tests, I opened this PR with a commit making a test to fail and it is not reflected in the CI (all tests are passing!). I renamed the test classes with `MSSQL` as suffix. Now, the CI is able to capture the failing test as expected. Finally, the failing test is fixed.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3227
GitOrigin-RevId: 65b2b2bfbaca64c44ff7607148c32eb0c15e4956
2021-12-29 18:03:46 +00:00
Kirill Zaborsky
234a5385cd Fix support for FLOAT64 in BigQuery
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3209
GitOrigin-RevId: e7e981bcd043f0daab4b70344afb684484361758
2021-12-29 17:16:44 +00:00
Evie Ciobanu
393662c0e1 server: Add string interpolation support for the graphql QQ for integration tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3220
GitOrigin-RevId: 07cc2c0ae026b2a009f491b89625fd2a7085d729
2021-12-29 15:50:51 +00:00
Philip Lykke Carlsen
33a107d371 Improvements to Update Operators api docs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3225
GitOrigin-RevId: 8f8123353249efb5acaab00681988171e44fae02
2021-12-29 03:52:01 +00:00
Evie Ciobanu
babdd61ad7 server: Document and update HIE file for haskell integration suite
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3215
GitOrigin-RevId: 006789ae185f31a34740780d6ddeb0a68bcdbb5d
2021-12-23 16:52:21 +00:00
Rakesh Emmadi
60183df1ea server/mssql: use temporary tables for insert mutation execution
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3205
GitOrigin-RevId: ff889ce43ed613c283edefa68992eab7c36db18c
2021-12-22 11:05:29 +00:00
David Overton
02aef27a75 Add request body to OpenAPI
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2632
Co-authored-by: Lyndon Maydwell <92299+sordina@users.noreply.github.com>
Co-authored-by: paritosh-08 <85472423+paritosh-08@users.noreply.github.com>
GitOrigin-RevId: 067e182effaed255ff047abeee309d65a9fb191c
2021-12-22 08:31:14 +00:00
jkachmar
63cff8b731 Experimental backend adapter
This commit introduces an "experimental" backend adapter to the GraphQL Engine.

It defines a high-level interface which will eventually be used as the basis for implementing separate data source query generation & marshaling services that communicate with the GraphQL Engine Server via some protocol.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2684
Co-authored-by: awjchen <13142944+awjchen@users.noreply.github.com>
Co-authored-by: Chris Parks <592078+cdparks@users.noreply.github.com>
GitOrigin-RevId: 4463b682142ad6e069e223b88b14db511f634768
2021-12-22 00:11:28 +00:00
Vamshi Surabhi
cca3831180 simplified schema cache representation of remote relationships
This PR pretty much does the same thing to remote relationship types in schemacache as what #2979 did to remote relationship types in the IR. On main remote relationships are represented by types of form `T from to`.  This PR changes it to `T from` which makes it a lot more reusable.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3037
GitOrigin-RevId: 90a5c9e2346c8dc2da6ec5b8c970d6c863d2afb8
2021-12-21 23:15:50 +00:00
Swann Moreau
5760d9289c server: introspection cleanups
this pr modifies the representation chosen for introspection parsers, "pushing down" the `Schema` input so it is not required to build the parser anymore. instead, the value produced when the parser is evaluated becomes a function that consumes a schema:
```diff
-schema :: MonadParse n => Schema -> FieldParser n (          J.Value)
+schema :: MonadParse n =>           FieldParser n (Schema -> J.Value)
 ```

this addresses points (1) and (2) of #2833 and is intended to make #2799 easier: we will need to enforce permissions when generating introspection objects, hiding fields the user is not allowed to see, so if we can pass the schema _later_, we can build this parser once, evaluate it once to (morally) obtain a function `Schema -> Value`, and simply run that single `Schema -> Value` function on different role-based schemas.

(we really need some terminology to be fixed here: "parser" is already not the best name, and then we have parser vs value/function "returned" by parser vs...)

however, we have immediate benefits: we no longer _need_ a `Schema` object to build the introspection parsers! this means we can remove the bogus "degenerate case" schema that is currently constructed in `emptyIntrospection` (and indeed we remove that binding altogether).

(fun fact: the diff for this pull request has a negative line count despite adding a lot of comments. @abooij says i have bragging rights in perpetuity now, à la @nicuveo)

changes:
- internal changes to the operation of the server, invisible outside of a small number of `GraphQL.Schema.*` modules
- no user-facing changes

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2835
Co-authored-by: Auke Booij <164426+abooij@users.noreply.github.com>
Co-authored-by: Brandon Simmons <210815+jberryman@users.noreply.github.com>
GitOrigin-RevId: 9990f53b8f5c733424c4d71a24d94c13dee842ba
2021-12-21 17:29:54 +00:00
Philip Lykke Carlsen
c221d749dd Produce errors if permissions are set on non-mutable columns
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3195
GitOrigin-RevId: 1c1d326742fa626ad34241cb4e745ba168556bc2
2021-12-21 09:43:47 +00:00
Chris Parks
1913f6c763 Avoid overlapping legacy/unified formats when parsing RemoteRelationshipDefinition (closes #3171)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3184
GitOrigin-RevId: 5827f065c918e4d6f7a89247b68d18bac264440f
2021-12-20 19:32:13 +00:00
Auke Booij
e805fc01f3 Avoid NonNullableType
This refactors the AST of GraphQL types so that we don't need `NonNullableType`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3178
GitOrigin-RevId: 6513c8ea0a3cf4ad3ca7d8ef9ca996912fd5eedc
2021-12-20 17:03:28 +00:00
Auke Booij
2c3277e0a7 Refactor InputFieldInfo
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3143
GitOrigin-RevId: a374e07216f3f7d7dee61b222a2758d3ebeb98bb
2021-12-20 15:53:45 +00:00
Evie Ciobanu
974113c80e server: Improve code readability around OnConflict clauses
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3181
GitOrigin-RevId: 0ded0f2776fcbaaf51420f796673cf132b8cc248
2021-12-20 11:16:46 +00:00
Abby Sassel
6c6bb678f8 server: Include column mutability data in the schema generation code
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3182
Co-authored-by: Philip Lykke Carlsen <358550+plcplc@users.noreply.github.com>
GitOrigin-RevId: ba9d31f5443aa936b1d5b58b0f4e10abf0064a7e
2021-12-17 17:26:51 +00:00
Brandon Simmons
175391bb88 pytest: fix nondeterminism in bigquery/nested_array_relationships.yaml
Noticed this triggered in https://buildkite.com/hasura/graphql-engine-mono/builds/2770#93c45308-2178-479b-ba61-a81488b77ce5

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

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3160
Co-authored-by: Abby Sassel <3883855+sassela@users.noreply.github.com>
GitOrigin-RevId: e2146ca249264aa5c089d1cd7805e401167e22b2
2021-12-17 14:31:17 +00:00
Vishnu Bharathi
26a69b3821 tag release v2.1.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3175
GitOrigin-RevId: 702444a8adba2817540382396704bcfbad0df228
2021-12-17 12:38:06 +00:00
Antoine Leblanc
bacadc30da Fix several issues with remote relationships.
## Remaining Work

- [x] changelog entry
- [x] more tests: `<backend>_delete_remote_relationship` is definitely untested
- [x] negative tests: we probably want to assert that there are some APIs we DON'T support
- [x] update the console to use the new API, if necessary
- [x] ~~adding the corresponding documentation for the API for other backends (only `pg_` was added here)~~
  - deferred to https://github.com/hasura/graphql-engine-mono/issues/3170
- [x] ~~deciding which backends should support this API~~
  - deferred to https://github.com/hasura/graphql-engine-mono/issues/3170
- [x] ~~deciding what to do about potentially overlapping schematic representations~~
  - ~~cf. https://github.com/hasura/graphql-engine-mono/pull/3157#issuecomment-995307624~~
  - deferred to https://github.com/hasura/graphql-engine-mono/issues/3171
- [x] ~~add more descriptive versioning information to some of the types that are changing in this PR~~
  -  cf. https://github.com/hasura/graphql-engine-mono/pull/3157#discussion_r769830920
  - deferred to https://github.com/hasura/graphql-engine-mono/issues/3172

## Description

This PR fixes several important issues wrt. the remote relationship API.

- it fixes a regression introduced by [#3124](https://github.com/hasura/graphql-engine-mono/pull/3124), which prevented `<backend>_create_remote_relationship` from accepting the old argument format (break of backwards compatibility, broke the console)
- it removes the command `create_remote_relationship` added to the v1/metadata API as a work-around as part of [#3124](https://github.com/hasura/graphql-engine-mono/pull/3124)
- it reverts the subsequent fix in the console: [#3149](https://github.com/hasura/graphql-engine-mono/pull/3149)

Furthermore, this PR also addresses two other issues:
- THE DOCUMENTATION OF THE METADATA API WAS WRONG, and documented `create_remote_relationship` instead of `<backend>_create_remote_relationship`: this PR fixes this by adding `pg_` everywhere, but does not attempt to add the corresponding documentation for other backends, partly because:
- `<backend>_delete_remote_relationship` WAS BROKEN ON NON-POSTGRES BACKENDS; it always expected an argument parameterized by Postgres.

As of main, the `<backend>_(create|update|delete)_remote_relationship` commands are supported on Postgres, Citus, BigQuery, but **NOT MSSQL**. I do not know if this is intentional or not, if it even should be publicized or not, and as a result this PR doesn't change this.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3157
Co-authored-by: jkachmar <8461423+jkachmar@users.noreply.github.com>
GitOrigin-RevId: 37e2f41522a9229a11c595574c3f4984317d652a
2021-12-16 20:29:19 +00:00
paritosh-08
40678855d0 server: add support for nested object type in action
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2788
Co-authored-by: David Overton <7734777+dmoverton@users.noreply.github.com>
GitOrigin-RevId: f8ed9741e95b6864a48af7db338f3f619617483a
2021-12-15 23:52:43 +00:00
Philip Lykke Carlsen
37ecb0e3b2 server/mssql: Generate upsert mutation schema
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3056
GitOrigin-RevId: 8d58ae983c4d3ad55dfeff744c891d77c7c6de1a
2021-12-15 17:08:26 +00:00
Kirill Zaborsky
279f22ed08 Fix support for multiple array relationships in BigQuery
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3003
GitOrigin-RevId: 7a9bf10be6436da2d87d5555f589e23c40c76dd6
2021-12-15 15:19:49 +00:00
Rakesh Emmadi
f00404e0f6 server/mssql: update mutation, SQL generation and execution
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3059
GitOrigin-RevId: 4ed0cbf54ac2a7103cb2b7adc97b2dfdf9994c4f
2021-12-15 13:56:34 +00:00
Evie Ciobanu
aff1ebb060 server: add more MSSQL tests to CI
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3129
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 1e8fc7ed2426fc07f64ca042c9a0be005cc9d052
2021-12-15 10:44:09 +00:00
Vishnu Bharathi
291de84179 tag release v2.1.0
GitOrigin-RevId: 3456e09d2c096a3a89866f9e92c86605237b9693
2021-12-14 15:38:26 +00:00
Anon Ray
4121c1dd3d Revert "Feature/multiple jwt secrets"
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3136
Co-authored-by: pranshi06 <85474619+pranshi06@users.noreply.github.com>
GitOrigin-RevId: aa41817e39f932f909067f2effca9d9973a5fb94
2021-12-14 14:29:52 +00:00
Vamshi Surabhi
0728a9e60e fixes remote relationships format in metadata (fixes graphql-engine-mono/issues/3108)
## Description

This PR fixes two issues:
  - in [#2903](https://github.com/hasura/graphql-engine-mono/pull/2903), we introduced a new metadata representation of remote relationships, which broke parsing a metadata blob containing an old-style db-to-rs remote relationship
  - in [#1179](https://github.com/hasura/graphql-engine-mono/pull/1179), we silently and mistakenly deprecated `create_remote_relationship` in favour of `<backend>_create_remote_relationship`

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3124
Co-authored-by: jkachmar <8461423+jkachmar@users.noreply.github.com>
Co-authored-by: Antoine Leblanc <1618949+nicuveo@users.noreply.github.com>
GitOrigin-RevId: 45481db7a8d42c7612e938707cd2d652c4c81bf8
2021-12-14 06:46:11 +00:00
Lyndon Maydwell
36a987811e Fix interpreting urls from environment in the TestWebhookTransform endpoint
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3127
GitOrigin-RevId: 0e5ceaa01f3f27275accd828647ae8587216c80f
2021-12-14 03:25:13 +00:00
Chris Parks
038a6113c3 Remove Identifier associated type family from Backend class (close #1758)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3096
GitOrigin-RevId: 03f218a76c5f333a77646a60c8c69767e2286ea6
2021-12-13 16:49:09 +00:00
Brandon Simmons
c415cd7c0d server benchmarks: add introspection queries
This excercises a different code path from regular queries and is
pretty slow. Motivated by https://github.com/hasura/graphql-engine-mono/pull/2835

We may need to break chinook up into two sets if it keeps growing or
becomes a bottleneck, but do that later.

GitOrigin-RevId: 5832aef520db85f694924e038c0f2c9a7dd17a13
2021-12-09 15:10:42 +00:00
Brandon Simmons
a94be908df benchmarks: add to interpretation guide docs
GitOrigin-RevId: 89ae86f688e0186960ae116ba05357c1eedde817
2021-12-09 15:10:37 +00:00
Evie Ciobanu
392dec868e server/gardening: change BackendInsert's kind to PostgresKind
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3100
GitOrigin-RevId: 9978969bad501d5792e23363b4808b2dbb5826fb
2021-12-09 14:17:47 +00:00
Vishnu Bharathi
a835d95b17 tag release v2.1.0-beta.3
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3099
GitOrigin-RevId: 7aa2926871bd44d80490768f86fab7bac02a7758
2021-12-09 11:28:19 +00:00
Vishnu Bharathi
6cfbde92e4 ci: add support for linux/arm64 docker image
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2933
GitOrigin-RevId: ceeab6164d8437703cd6e37e3dad9d63940ef966
2021-12-09 09:34:22 +00:00
Philip Lykke Carlsen
2fbcd783e7 Refactor XOnConflict and ExtraInsertData
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3055
GitOrigin-RevId: 06f7f92f0e09695f5f7bc02df457d3b96ac9f5f6
2021-12-09 09:06:56 +00:00
Solomon
e4064c9a90 Allows for mock env vars in test-webhook-transform endpoint
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3097
Co-authored-by: Lyndon Maydwell <92299+sordina@users.noreply.github.com>
GitOrigin-RevId: f0cd00b8f972a1b96213bd098ea09d72b3aba723
2021-12-09 07:59:46 +00:00
pranshi06
dee86453ea server: fallback to unauthorised role when JWT is not found in cookie
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2882
GitOrigin-RevId: ad03fbd0572e00ffe7abea106388a4df4d12af2c
2021-12-08 18:29:29 +00:00
Naveen Naidu
3773ba98b0 multitenant: support for starting multitenant in read only mode
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2993
Co-authored-by: Anon Ray <616387+ecthiender@users.noreply.github.com>
GitOrigin-RevId: e598d340d81aa96a85bd1ec043f9b7ed847934ef
2021-12-08 06:27:49 +00:00
hasura-bot
1376293e40 make pg_table_metadata CockroachDB compatible
GITHUB_PR_NUMBER: 7788
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/7788

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2805
Co-authored-by: Oliver Tan <3646147+otan@users.noreply.github.com>
GitOrigin-RevId: 9de4ddc4b13a9780edee5d1d12579d225ce3bffe
2021-12-07 17:25:33 +00:00
Vamshi Surabhi
23e1cb218a simplification of generalized joins execution
This PR simplifies the types that represent a remote relationship in IR so that they can be reused in other parts (in remote schema types) which could have remote relationships.

The comments on the PR explain the main changes.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2979
GitOrigin-RevId: 559c51d9d6ae79e2183ce4347018741b9096ac74
2021-12-07 13:12:57 +00:00
Solomon
0faa92337d Use transformed request body in event invocation logs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3057
GitOrigin-RevId: 7e001830f97c81289553e37c35098ccaeadbdf22
2021-12-06 22:40:31 +00:00
Robert
5473bfa952 tests: simplify command line of Haskell test suite
# Description

The tests were only being run with fully qualified postgresql and
mssql connection env vars anyhow. Makes it a bit simpler to run the
tests.

- the test suite now requires only plain connection strings as
  `HASURA_GRAPHQL_DATABASE_URL` (postgres) or
  `HASURA_MSSQL_CONN_STR` (mssql)
- update `CONTRIBUTING.md` for this change, and make it
  generally a bit less inaccurate

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3065
GitOrigin-RevId: b0b2f01ef867645d55c87a0e5c2bc1c0e94ee41f
2021-12-06 15:47:45 +00:00
Gil Mizrahi
2ac04384a0 Add tip for writing unit tests for SQL generation
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3045
GitOrigin-RevId: a74947471dd2132582ab6be890e80887d272d3ff
2021-12-06 07:59:44 +00:00
Lyndon Maydwell
87426fdef4 Fixing REST Enpoints list variable bug
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3034
GitOrigin-RevId: af1c182879754359b253e630f1393d97d8bcfa2a
2021-12-03 21:57:25 +00:00
Solomon
4a33d6c979 Allows for env var use in test_webhook_transform mock request url
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3009
GitOrigin-RevId: e678cef69d3d4dcb47f80cd584aa0d3c25a091b8
2021-12-03 07:13:35 +00:00
Rakesh Emmadi
7194dc691c server/mssql: fix SQL generation for aggregation queries in sql server (fixes #7773 & #7871)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3024
GitOrigin-RevId: 30c0e7d713375d0c54ff7145d00985e3ade4f1a9
2021-12-02 14:22:42 +00:00
Solomon
f243760398 Feature/multiple jwt secrets
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2765
Co-authored-by: Philip Lykke Carlsen <358550+plcplc@users.noreply.github.com>
Co-authored-by: Chris Done <11019+chrisdone@users.noreply.github.com>
Co-authored-by: Aishwarya Rao <59638722+aishwaryarao712@users.noreply.github.com>
Co-authored-by: Tirumarai Selvan <8663570+tirumaraiselvan@users.noreply.github.com>
Co-authored-by: Karthikeyan Chinnakonda <15602904+codingkarthik@users.noreply.github.com>
Co-authored-by: Ikechukwu Eze <22247592+iykekings@users.noreply.github.com>
Co-authored-by: Brandon Simmons <210815+jberryman@users.noreply.github.com>
Co-authored-by: awjchen <13142944+awjchen@users.noreply.github.com>
Co-authored-by: Martin Mark <74692114+martin-hasura@users.noreply.github.com>
Co-authored-by: Abby Sassel <3883855+sassela@users.noreply.github.com>
Co-authored-by: Sooraj <8408875+soorajshankar@users.noreply.github.com>
Co-authored-by: Sameer Kolhar <6604943+kolharsam@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: Rakesh Emmadi <12475069+rakeshkky@users.noreply.github.com>
Co-authored-by: Sibi Prabakaran <737477+psibi@users.noreply.github.com>
Co-authored-by: Robert <132113+robx@users.noreply.github.com>
Co-authored-by: Vishnu Bharathi <4211715+scriptnull@users.noreply.github.com>
Co-authored-by: Praveen Durairaju <14110316+praveenweb@users.noreply.github.com>
Co-authored-by: Abhijeet Khangarot <26903230+abhi40308@users.noreply.github.com>
GitOrigin-RevId: b3b07c3b42da9f3daa450d6d9e5fbf0bf506c651
2021-12-02 05:36:46 +00:00
Auke Booij
caf9957aca Remove Unique from Definition
GraphQL types can refer to each other in a circular way. The PDV framework used to use values of type `Unique` to recognize two fragments of GraphQL schema as being the same instance. Internally, this is based on `Data.Unique` from the `base` package, which simply increases a counter on every creation of a `Unique` object.

**NB**: The `Unique` values are _not_ used for knot tying the schema combinators themselves (i.e. `Parser`s). The knot tying for `Parser`s is purely based on keys provided to `memoizeOn`. The `Unique` values are _only_ used to recognize two pieces of GraphQL _schema_ as being identical. Originally, the idea was that this would help us with a perfectly correct identification of GraphQL types. But this fully correct equality checking of GraphQL types was never implemented, and does not seem to be necessary to prevent bugs.

Specifically, these `Unique` values are stored as part of `data Definition a`, which specifies a part of our internal abstract syntax tree for the GraphQL types that we expose. The `Unique` values get initialized by the `SchemaT` effect.

In #2894 and #2895, we are experimenting with how (parts of) the GraphQL types can be hidden behind certain permission predicates. This would allow a single GraphQL schema in memory to serve all roles, implementing #2711. The permission predicates get evaluated at query parsing time when we know what role is doing a certain request, thus outputting the correct GraphQL types for that role.

If the approach of #2895 is followed, then the `Definition` objects, and thus the `Unique` values, would be hidden behind the permission predicates. Since the permission predicates are evaluated only after the schema is already supposed to be built, this means that the permission predicates would prevent us from initializing the `Unique` values, rendering them useless.

The simplest remedy to this is to remove our usage of `Unique` altogether from the GraphQL schema and schema combinators. It doesn't serve a functional purpose, doesn't prevent bugs, and requires extra bookkeeping.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2980
GitOrigin-RevId: 50d3f9e0b9fbf578ac49c8fc773ba64a94b1f43d
2021-12-01 16:21:35 +00:00
Evie Ciobanu
0a4194a1bc server: throw broken invariant on data loader error
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3010
GitOrigin-RevId: 3b09a7d61343d406d1ecc5d6aaab866564c9dff8
2021-12-01 12:50:38 +00:00
Philip Lykke Carlsen
4c1f3d0140 Adding ColumnMutability to column metadata
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2962
GitOrigin-RevId: ee2687e84842dc5dd647ce9aa017c6051556d0e5
2021-12-01 11:34:16 +00:00
Antoine Leblanc
90d3192df2 Unified remote relationship metadata
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2903
Co-authored-by: Vamshi Surabhi <6562944+0x777@users.noreply.github.com>
GitOrigin-RevId: 11fd6efe8cea246471e525cfb5bad66fa53ccaf9
2021-12-01 04:54:30 +00:00
Antoine Leblanc
f7071b3c93 Changed RemoteSchemaIntrospection's internal representation from a list to a hashmap.
### Description

This PR changes the internal representation of a parsed remote schema. We were still using a list of type definitions, meaning every time we were doing a type lookup we had to iterate through a linked list! 🙀 It was very noticeable on large schemas, that need to do a lot of lookups. This PR consequently changes the internal representation to a HashMap. Building the OneGraph schema on my machine now takes **23 seconds**, compared to **367 seconds** before this patch.

Some important points:
- ~~this PR removes a check for type duplication in remote schemas; it's unclear to me whether that's something we need to add back or not~~ (no longer true)
- this PR makes it obvious that we do not distinguish between "this remote schema is missing type X" and "this remote schema expects type X to be an object, but it's a scalar"; this PR doesn't change anything about it, but adds a comment where we could surface that error (see [2991](https://github.com/hasura/graphql-engine-mono/issues/2991))

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2963
GitOrigin-RevId: f5c96ad40f4e0afcf8cef635b4d64178111f98d3
2021-11-30 14:47:50 +00:00
Naveen Naidu
5cd6c5e43d multitenant: support for event disabling
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2900
GitOrigin-RevId: b2844fa433cfd8f8a29b7e98c6ec44773fd44a57
2021-11-30 12:32:26 +00:00
Auke Booij
29158900d8 Refactor type name customization
Source typename customization (hasura/graphql-engine@aac64f2c81) introduced a mechanism to change certain names in the GraphQL schema that is exposed. In particular it allows last-minute modification of:
1. the names of some types, and
2. the names of some root fields.

The above two items are assigned distinct customization algorithms, and at times both algorithms are in scope. So a need to distinguish them is needed.

In the original design, this was addressed by introducing a newtype wrapper `Typename` around GraphQL `Name`s, dedicated to the names of types. However, in the majority of the codebase, type names are also represented by `Name`. For this reason, it was unavoidable to allow for easy conversion. This was supported by a `HasName Typename` instance, as well as by publishing the constructors of `Typename`.

This means that the type safety that newtypes can add is lost. In particular, it is now very easy to confuse type name customization with root field name customization.

This refactors the above design by instead introducing newtypes around the customization operations:
```haskell
newtype MkTypename = MkTypename {runMkTypename :: Name -> Name}
  deriving (Semigroup, Monoid) via (Endo Name)

newtype MkRootFieldName = MkRootFieldName {runMkRootFieldName :: Name -> Name}
  deriving (Semigroup, Monoid) via (Endo Name)
```
The `Monoid` instance allows easy composition of customization operations, piggybacking off of the type of `Endo`maps.

This design allows safe co-existence of the two customization algorithms, while avoiding the syntactic overhead of packing and unpacking newtypes.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2989
GitOrigin-RevId: da3a353a9b003ee40c8d0a1e02872e99d2edd3ca
2021-11-30 09:52:53 +00:00
David Overton
5bfce057c6 Refactor remote schema customization
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2771
GitOrigin-RevId: 0c90136f956df3f4552140e6ca3d2f4766f8b3f5
2021-11-30 00:38:27 +00:00
Abby Sassel
3fc34aa028 server: deduplicate some pytests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2988
GitOrigin-RevId: 018903d81c6025da2d9eb78aad4762a78f1f6c69
2021-11-26 19:38:17 +00:00
Chris Done
12335bce91 Add a test of tests in common via persistent #2872
Dupe of https://github.com/hasura/graphql-engine-mono/pull/2872 with branch renamed so it doesn't break a tool.

prev pr: https://github.com/hasura/graphql-engine-mono/pull/2921

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2922
Co-authored-by: Abby Sassel <3883855+sassela@users.noreply.github.com>
GitOrigin-RevId: 24af6a814dd106864a2fd3cb985edfe9a8ef5d61
2021-11-26 18:22:00 +00:00
Philip Lykke Carlsen
4f6831d76e Defining the MSSQL update schema using said components
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2923
GitOrigin-RevId: 732988f666f00b3c5eebf6089f9887ee5d679c11
2021-11-26 13:48:09 +00:00
Antoine Leblanc
e3d5c0217f Rename tables in metadata tests to avoid conflicts.
### Description

Tests are not run the same way locally and on CI, which means that tests that work on CI can fail locally. In this case, the setup for each test is creating and dropping a table named `author`; a lot of the tests were also creating a table named `author` in source `pg1`. If `pg1` is the same as the default source, which is the case locally, then all of those tests fail, while the tests that use a default `pg1` such as CI would succeed.

This PR fixes this by renaming `author` to `author_local` where appropriate.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2982
GitOrigin-RevId: 5bc0149bc5f6cb27de9864afaded8af071ade454
2021-11-26 11:40:23 +00:00
Philip Lykke Carlsen
63ee663626 Excise query tags from backend schema
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2960
GitOrigin-RevId: ff6418609117abc8e0410c0897f2af9779cecf16
2021-11-25 21:08:54 +00:00
Gil Mizrahi
f1cbe4e72b pass MSSQL_SA_PASSWORD to mssql container, and add MSSQL_HOST
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2969
GitOrigin-RevId: 42e4cdf36306148ea34ea19fd42ce5048a38dbbc
2021-11-25 10:23:53 +00:00
Abby Sassel
3166010ac1 server: belatedly address #2889 feedback
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2945
GitOrigin-RevId: 8ccb6479391c2b38af6a4c9ac209e29d4e26f65c
2021-11-24 21:40:44 +00:00
Kirill Zaborsky
a2afe4116b BigQuery remote joins
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2874
Co-authored-by: Abby Sassel <3883855+sassela@users.noreply.github.com>
GitOrigin-RevId: 24b0304716795a28038629775238996c28b312a3
2021-11-24 16:22:55 +00:00
Gil Mizrahi
6dae132fce Add instructions for compiling graphql-engine natively on M1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2049
GitOrigin-RevId: 9f10c26eef5382fb7b8e750ad272a5797b4cd6d8
2021-11-24 09:59:10 +00:00
Chris Done
926da74819 Auto-launch graphql-engine (close hasura/graphql-engine#7801, hasura/graphql-engine#7827 )
Dupe of https://github.com/hasura/graphql-engine-mono/pull/2853 with branch renamed so it doesn't break a tool.

prev pr: https://github.com/hasura/graphql-engine-mono/pull/2911

next pr: https://github.com/hasura/graphql-engine-mono/pull/2922

This implements https://github.com/hasura/graphql-engine/issues/7801

Some points to keep in mind for review:

* How state is passed to the tests. Do we like how this works?
   * I quite like it, with the opaque type [`State`](68f33051ca/server/tests-hspec/Harness/State.hs (L17)), we can avoid churn when adding things.
   * The [setup/teardown](68f33051ca/server/tests-hspec/Spec.hs (L19-L31)) seems clean.
   * By using hspec's own means to pass and denote context, we avoid "getting new ideas" for how to structure the tests -- we use a standard. Hopefully, that means the tests' structure rarely change.
* The various flags passed in the [ServeOptions](68f33051ca/server/tests-hspec/Harness/Constants.hs (L123)) - if there are any causes for concern, raise them here. My thinking is that, there are lots. I've picked some "sane" defaults (mostly empty). The tests pass. I think as we add more complex tests, these flags will be scrutinised and updated as needed. I think it's valuable that all flags are explicitly listed here, though.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2921
GitOrigin-RevId: 2c2e70bf784ef571a48509a7e5006fd0f48773b5
2021-11-23 18:16:15 +00:00
Chris Parks
a79886bcda Use left join instead of lateral join to fetch foreign key constraints
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2939
GitOrigin-RevId: ed42b885e6e08e653b0888e0eb2012041361a41f
2021-11-23 15:19:49 +00:00
Rakesh Emmadi
4f32324759 server/mssql: refine and generalize mssql OUTPUT clause and temporary table syntax AST
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2931
GitOrigin-RevId: e6aef494a096ca119597dc92bcaf9f16e644a72a
2021-11-22 09:12:45 +00:00
Gil Mizrahi
69ae2a565f adding server/documentation/tips.md
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2920
GitOrigin-RevId: 769133fd546b4f1eb544193e6cdb3cb292bde3ad
2021-11-21 06:29:58 +00:00
Gil Mizrahi
39002bc572 Parse session variables to their correct type in mssql
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2908
GitOrigin-RevId: d9d8811e0d0658f6396a7c94bce9b7d2deb5245e
2021-11-20 09:03:44 +00:00
Gil Mizrahi
0e65932355 server/mssql support delete mutations (close hasura/graphql-engine#7626)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2691
Co-authored-by: Abby Sassel <3883855+sassela@users.noreply.github.com>
Co-authored-by: Rakesh Emmadi <12475069+rakeshkky@users.noreply.github.com>
GitOrigin-RevId: 8b66cc30e8e036ee56a5267c1d2f308155951ae9
2021-11-19 17:06:01 +00:00
Abby Sassel
a7195155ab Add MySQL basic tests (close hasura/graphql-engine#7753)
dupe of @chrisdone's work https://github.com/hasura/graphql-engine-mono/pull/2852 with a branch rename

prev pr: https://github.com/hasura/graphql-engine-mono/pull/2901

next PR: https://github.com/hasura/graphql-engine-mono/pull/2921

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2911
Co-authored-by: Chris Done <11019+chrisdone@users.noreply.github.com>
GitOrigin-RevId: 81130e100c220a235d9869c89e90d63515e35f74
2021-11-19 15:14:46 +00:00
Philip Lykke Carlsen
84027dad04 Breaking up the Postgres implementation of the update-schema into reusable components
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2889
GitOrigin-RevId: 49c5d59a6f817832f11b1773b078aa24cc650ab5
2021-11-18 18:03:57 +00:00
David Overton
f7e13cb7c9 Skip test if databases are not distinct
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2890
GitOrigin-RevId: 3728c6c5d3e1e12bcff2726a9ee5238dcd3b004b
2021-11-17 23:59:28 +00:00
Abby Sassel
1f14781d15 Create integration testing environment (close hasura/graphql-engine#7752)
dupe of @chrisdone's work https://github.com/hasura/graphql-engine-mono/pull/2829 with a branch rename

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2901
Co-authored-by: Chris Done <11019+chrisdone@users.noreply.github.com>
GitOrigin-RevId: 8381e53a18242b75d7e17b18a2ba3b2d99dd1322
2021-11-17 19:51:47 +00:00
Robert
9d185ffa03 server: make /healthz action clearer
This is effectively a no-op, the `Left err` case can't actually happen.

- removes some unused logic
- refactors the /healthz endpoint to be clearer
- that includes logging the full QErr if checkMetadataHealth fails,
  but it actually can't because the existing Postgres implementation
  just lifts

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2849
GitOrigin-RevId: ac8abf51b6d869ad4048419e36012137c86e5abd
2021-11-17 17:59:39 +00:00
Robert
783cd678b7 benchmarks: skip failing remote_schema suite
This skips the failing benchmark suite `remote_schema` while it's broken, #2883.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2884
GitOrigin-RevId: 629031d4926452a669f08c924e0be61bcd92f559
2021-11-17 13:00:45 +00:00