Commit Graph

2292 Commits

Author SHA1 Message Date
Tom Harding
7e6c9df291 Move CustomRootFieldsSpec under Subscriptions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5494
GitOrigin-RevId: bdd0fd4e7a6b6465be59dd497c0ff06588f35445
2022-08-16 11:54:29 +00:00
Samir Talwar
2757c2156b server/tests-py: Move installing node_modules to the makefile.
This means that if `remote_schemas/nodejs/package.json` changes, the
dependencies will be automatically reinstalled.

It also moves `package-lock.json` to the correct location (in the
directory in which we run `npm install`), and updates it.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5481
GitOrigin-RevId: f3fb431afd19de150f39ec2e4cb6572b896c870f
2022-08-16 09:27:04 +00:00
Daniel Chambers
c6e7dff526 server: Data Connector agent test suite bugfixes
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5500
GitOrigin-RevId: 5bb1a326ecd7aa95cbbda3591d2a51dea605125a
2022-08-16 04:46:29 +00:00
Daniel Chambers
a1d0be0d86 server: Added additional tests to Data Connector agent test suite [GDW-281]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5499
GitOrigin-RevId: 26b7c66333ee3a251a4a33a67fc38b55ebc3fa21
2022-08-16 03:02:43 +00:00
Tom Harding
a54cbc17c3 Migrate InsertCheckPermissionSpec to the new structure
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5363
GitOrigin-RevId: 6de7600f7d9e6a04a10290d85bb83bb564352772
2022-08-15 18:10:44 +00:00
Daniel Harvey
f4df7f0162 tests: fix interpolateYaml quasi quoter when parsing '*'
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5491
GitOrigin-RevId: 3fbea70c9c9ebf4584cb140854e98db680a4137f
2022-08-15 17:17:44 +00:00
Samir Talwar
b690a3fc3a server/tests-py: Install the pytest-durations plugin.
[pytest-durations][] is an enhancement to pytest over the built-in
[`--durations` parameter][] which also shows the duration of setup,
teardown, and fixtures that take the longest.

While it's not strictly necessary now, I used it to figure out what was
taking so long when trying to run things in parallel, and found it very
helpful, so I think it's worth preserving.

[pytest-durations]: https://pypi.org/project/pytest-durations/
[`--durations` parameter]: https://docs.pytest.org/en/6.2.x/usage.html#profiling-test-execution-duration

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5480
GitOrigin-RevId: b789418dd4c971adb91e08b7837a962bede44452
2022-08-15 16:15:37 +00:00
Brandon Martin
98ba6f8751 Merge pull request #5477 from hasura/gil/fix_ulls_first
server/postgres: Fix ulls first parsers + long identifiers + test

GitOrigin-RevId: 74e067b13ca0b4bc47147e715b87a187cd1aeb29
2022-08-15 15:42:34 +00:00
Samir Talwar
b856d96989 server/tests-py: Factor out service URLs as environment variables.
Making it easier to inject different ones later.

I also included a change to _.prettierignore_ so Visual Studio Code doesn't keep trying to reformat the JavaScript or YAML files in `server/tests-py`, as it can cause diffs to balloon for no obvious benefit.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5456
GitOrigin-RevId: bc6d548708160a328e1e61a00e19be8e124da025
2022-08-15 14:59:05 +00:00
Samir Talwar
a0176c215f server/tests-py: Set up postgis extensions using a fixture.
Let's put it in one place.

This is a precursor to moving database provisioning into the Python
integration tests.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5453
GitOrigin-RevId: 5920b0b1177d94496485fcb4e178b946534ee4eb
2022-08-15 14:30:42 +00:00
Daniel Harvey
57025ef3b3 tests: Rename DoNotTruncateSessionVariables regression test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5485
GitOrigin-RevId: 4e29e05516e716958febcee03f21862944d5dd88
2022-08-15 13:58:14 +00:00
Samir Talwar
a4c3fb3ff0 server/tests-py: A little bit of tidying up.
Small, benign changes, extracted from #5449. Very boring.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5450
GitOrigin-RevId: f6da8bc9770b47471079518d599eef0cb4d203c1
2022-08-15 13:16:39 +00:00
Samir Talwar
061b2be9f1 server/tests-py: Fail fast and log more when HTTP requests hang.
`requests` does not set a default timeout, so tests can hang forever if you get something wrong.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5457
GitOrigin-RevId: 379d97705d6b52b019213cd46f92f3892dc8a46b
2022-08-15 12:40:17 +00:00
Tom Harding
147927e060 Mark RequestHeadersSpec explicitly as a regression test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5364
GitOrigin-RevId: cef9a8c5c59e428c5c9b08af3a10b9f7012fa7cf
2022-08-15 11:38:16 +00:00
awjchen
1a4e3ae001 server: add event trigger metrics for Prometheus
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5346
GitOrigin-RevId: 0db925f85e06e99b636995887c0e19a49fe9be2d
2022-08-15 05:34:04 +00:00
Gil Mizrahi
e626d87a3c server/postgres: Long identifiers in insert with parameters
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5466
Co-authored-by: Brandon Martin <40686+codedmart@users.noreply.github.com>
GitOrigin-RevId: dbc028529081de6257cc24acd1a5bfde8b39d057
2022-08-12 00:27:31 +00:00
Philip Lykke Carlsen
6fe8b42798 Simplify instance boilerplate
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5412
GitOrigin-RevId: 19755ee2502758616d67ce42df7295424b61b6cf
2022-08-11 16:32:41 +00:00
Abby Sassel
26bbe2be34 server/tests: bigquery scalar type tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5405
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: fc0a509500068331f9d80d58b411f144e011f094
2022-08-11 15:37:07 +00:00
Gil Mizrahi
0922a3bb24 server/tests-hspec: delete Context and using NonEmpty for Fixtures
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5451
GitOrigin-RevId: 8847af09a83293c619326d22209289397911bc5a
2022-08-11 15:04:11 +00:00
Auke Booij
a96e0c33cd Refactor EncJSON: fewer footguns, better syntax
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5408
GitOrigin-RevId: 077afebc09e6aed6f201d5ed686d6f6e7050bf24
2022-08-11 14:19:29 +00:00
Auke Booij
4d5ee4c17e Inline a whole bunch of nothing for BackendSchema
This makes it easier to refactor `BackendSchema`, because if the type of a type class method is changed, it's easier to update the corresponding dummy implementations.

Partially addresses hasura/graphql-engine-mono#2971, in the sense that this aids refactors.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5443
GitOrigin-RevId: 65e169d01415a04e7c419a628cf32e743448543d
2022-08-11 11:58:40 +00:00
Daniel Harvey
c41fbfbb49 tests: tests-hspec docs to use Fixture
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5448
GitOrigin-RevId: 87b54feaef9dcf1139d64e85303797a9a273bda3
2022-08-11 11:02:02 +00:00
Evie Ciobanu
80cbf3ae33 server/nada: add unit test infrastructure for Postgres delete SQL generation
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5434
GitOrigin-RevId: 839a45a1469272def9d28c0f3e7454a5bf506f35
2022-08-11 10:46:49 +00:00
Daniel Harvey
99509da1f2 tests: convert EventTrigger hspec tests to use Fixture
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5432
GitOrigin-RevId: 402aa785255333bc90b6df6a398eefb09611dee0
2022-08-11 10:12:56 +00:00
Auke Booij
8888e06bbb Spell out the TH in Hasura.SQL.{Tag,AnyBackend}
The module `Hasura.SQL.AnyBackend` was introduced (in #751) to centralize the logic for case-switching behavior that depends on the particular flavor of relational DB backend (Postgres vs MSSQL vs BigQuery vs MySQL vs DataConnectors). This allows us to write a bunch of code in a backend-agnostic way, even if runtime behavior does depend on the chosen backend. At the same time, it allows us to write backend-specific code without having to care (too much) about the existence of other backends.

In #851 this module was rewritten to use Template Haskell.

I've heard that one of the reasons for the use of TH was that this would make it easier to keep backends out of the compilation product entirely. This would allow customers, especially on OSS, to benefit from simpler software licensing.

However:
1. This conditional compilation never materialized.
2. It's not clear whether writing this particular module based on TH would be sufficient for conditional compilation. And in any case, it can be done using CPP pragmas as well.
3. The TH code is extraordinarily complex. Since its introduction, it has been documented extraordinarily well, but it's still very difficult to maintain and/or refactor, due to its non-idiomatic nature.
4. Hasura's company objectives are now Cloud-oriented, so that software licensing issues work differently, and in particular, do not depend on what's part of the compilation product.

So this PR reverts on #851 by spelling out the code generated by TH. This is a net-negative diff size. IOW we used to generate less code than the size of the code doing the generating. This makes the code readable and maintainable.

The generated code has been modified in one way, which I'll now describe.

In the scenario that support for a new backend is introduced, a constructor is added to the `BackendType` type. This would then cause `liftTag` to be partial, thus raising a compiler warning. Resolving this requires adding corresponding constructors to the `BackendTag` and `AnyBackend` types. This would then require amending **almost** all other methods.

The exceptions are `composeAnyBackend` and `unpackAnyBackend`. These methods test whether two values are compatible, i.e. belong to the same backend. Both have a default case that in one way or another ignores the input values. Using TH here ensures that all values that belong together are caught. But after spelling out the TH, the presence of the default case means that no compiler warning is thrown for a missing match of matching values. So in the default case, we now do an explicit check for equality. If there _is_ an equality, that means that there is a missing `case`. So this is reported as an `error` (which is very crude, but it should be).

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5333
GitOrigin-RevId: 5aaf0a93394bd740aa7371526d3175c8142b3541
2022-08-11 09:11:07 +00:00
Antoine Leblanc
3b7cfcd10a move strictness where it is needed
### Description

This PR moves some strictness annotations to a concrete use site, rather than putting `seq` in an helper function.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5436
GitOrigin-RevId: 1f279e05333ab80167ad2e18d09b8792eddc52c3
2022-08-11 07:53:44 +00:00
Gil Mizrahi
51ceff71f7 server/tests-hspec: port Context to Fixture - DisableRootFields
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5430
GitOrigin-RevId: f31a692c0f2ac4dd6c88b2c60c9aeb26d6f5bfae
2022-08-11 07:25:39 +00:00
Solomon
7ae2a491ec Gardening: Cleanup Metadata Types Module
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5416
GitOrigin-RevId: 1d2d29da825942f9a0a472d034e68f0eb09a5c26
2022-08-10 23:19:25 +00:00
Gil Mizrahi
c08bb5377f server/tests-hspec: porting more tests to fixture
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5404
GitOrigin-RevId: 0be4f50b17765a8f0b1fb37944777ead7ec6bfc9
2022-08-10 20:38:39 +00:00
Solomon
3855efa9a5 Move soEventsHttpPoolSize and soEventsFetchInterval defaulting into arg parser
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5284
GitOrigin-RevId: f2302b3219f3aa9ebde623b4efa7f3ee8a97c031
2022-08-10 19:18:11 +00:00
Daniel Harvey
2bdc54ebb4 tests: convert RemoteRelationships hspec tests to use Fixture
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5424
GitOrigin-RevId: 0b23ba62aa0e2d279d8238aecd6c84ef8994097e
2022-08-10 16:45:19 +00:00
Daniel Harvey
548edcc6e6 tests: convert InsertDefaults Context test to Fixture
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5382
GitOrigin-RevId: 3964dda7307bde6e294be36791a76c8e459afa25
2022-08-10 16:16:49 +00:00
Vishnu Bharathi
a785c664e5 ci: tag release v2.10.0 and v2.11.0-beta.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5423
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: c0513156c9527f58bab86e8a67435e7be6ee035d
2022-08-10 13:54:03 +00:00
Gil Mizrahi
d5936a0a9b server/tests-hspec: port Context to Fixture - permissions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5420
GitOrigin-RevId: aaf785b05bf54d8996c3f3c5148dd6c52e6aea5c
2022-08-10 13:09:07 +00:00
Karthikeyan Chinnakonda
f3dd172821 server: accept extensions_schema while adding a source
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5401
Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com>
GitOrigin-RevId: 75b68c439fc68662a8e312f84132126d761dda48
2022-08-10 09:42:09 +00:00
Daniel Harvey
7bb5c2760a tests: convert DataConnector hspec tests from Context -> Fixture
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5388
GitOrigin-RevId: d645b360cd6f471c4bcaa18842cb2de2dc7a04d8
2022-08-10 07:54:26 +00:00
Gil Mizrahi
e1d0fbe0ff Fix querying multicolumn relationship in bigquery
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5407
GitOrigin-RevId: 21517278991a54a0f06231a10b36b7b69e352608
2022-08-09 18:40:39 +00:00
Karthikeyan Chinnakonda
66caae4a44 server: accept schema name as a target for the graphql-engine to install DB extensions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5362
GitOrigin-RevId: 5e246c3af3bdf2a7b5b2a66e2e09f40abcdfd9c9
2022-08-09 11:43:48 +00:00
Tom Harding
d26b16106f Migrate ViewsSpec to the new structure
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5337
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: c1056790b42039630d649c96ad7aa2aa5c691ecf
2022-08-09 11:16:30 +00:00
Daniel Harvey
f3aefc8418 tests: expose SchemaName from Harness.Test.Schema
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5389
GitOrigin-RevId: fae69b4f49068bd05d6799f62d56b58bcbb96d06
2022-08-09 09:34:56 +00:00
Daniel Harvey
bcd7c01161 tests: Convert more Context -> Fixture in hspec tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5384
GitOrigin-RevId: 582583b1722bb9942eda96c6b418eff8a69921d5
2022-08-09 08:21:23 +00:00
Tom Harding
0460d7d6d1 Migrate CustomFieldNamesSpec to the new structure
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5323
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 612cb72edf61227d8315102cb22eaaa603405b86
2022-08-09 07:26:14 +00:00
Daniel Harvey
744c03a84e tests: create BigQuery datasets for each test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5288
GitOrigin-RevId: 7caedacd280fc6f8ea71af16397bb2c9641effc8
2022-08-08 14:29:51 +00:00
Antoine Leblanc
6c14a018e4 Run the reader context per schema block
### Description

This PR is a first step towards having a dedicated reader context per schema block. It adds the required Reader instance, and switches from a `SchemaT ReaderT` stack to a `ReaderT SchemaT` stack. Furthermore, it cleans up / harmonizes some of the top-level schema building functions.

Sources and remotes are now built each within their own run of `runReaderT`: for now, the reader context is the same in both cases, meaning no special care is required at the boundary of remote relationships.

Actions are explicitly run with the source context for now; we could envision creating a third and distinct context for them.

This PR is expected to be a no-op.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5300
GitOrigin-RevId: a014e5b3504eb4ef740c820d305d6d2695f622f7
2022-08-08 13:05:51 +00:00
Tom Harding
70f5b04ea2 Update InsertVarcharColumnSpec test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5353
GitOrigin-RevId: 74f6e0a9322aa8926a162f8cfaae112669003f0b
2022-08-08 12:21:21 +00:00
Tom Harding
59d5853a95 Move EnumSpec into the Schema directory
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5324
GitOrigin-RevId: 50aa48c1ef42ee73b76742ab934ab90c5153b855
2022-08-08 10:56:35 +00:00
Evie Ciobanu
72cfb7fc9b server/nada: test mkUpdateCTE
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5341
GitOrigin-RevId: 39db14cc2d2329d8cadb7a6080b1e2361eba1fb5
2022-08-05 21:42:19 +00:00
Philip Lykke Carlsen
13113a5387 Reformat instance declarations
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5332
GitOrigin-RevId: 58b40e445dc0eac5e15efa725eaee128989aeeb5
2022-08-05 15:29:01 +00:00
Samir Talwar
aa18f65217 server: Move the schema parsers to their own library.
It's about time.

To do this I had to check a few more boxes.

* I copied the flags from `graphql-engine.cabal` to the libraries in `server/lib`.
* I moved `Cacheable` instances of schema parser types beside the typeclass declaration.
* I removed imports of `Hasura.Prelude` from the tests, and rewrote them accordingly.
* I copied the `TestMonad` parse monad into `server/src-test/Hasura/GraphQL/Schema/RemoteTest.hs`, which was using it. I think this could be done with the real thing, but I tried replacing it with constraints and it messed with my head somewhat.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5311
GitOrigin-RevId: ebebcc50a16f2d517b7f730fe72410827ca3e86c
2022-08-05 13:53:39 +00:00
Tom Harding
a61741fbf5 Migrate the GatheringUniqueConstraintsSpec test to the new structure
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5350
GitOrigin-RevId: ae622a859af4c308daf1aacc2825657ec7f0f8ab
2022-08-05 12:22:57 +00:00
Puru Gupta
2ca81b37e8 multitenant: fix dubious config status updates during tenant start
## Description ✍️
This PR fixes the config status update when the `Service configured successfully` message is written before the server is actually spawned. Now the status is updated only when the server is spawned successfully. To be specific, this change posts the status closer to where we log `starting API server`.

### Related Issues ✍
#2751

### Solution and Design ✍
We update the status inside `runHGEServer` function. This helps in adding the message only when the server is started. If any exception is thrown before the server is spawned, only that message is written to `config_status` table instead of the `Service configured successfully` message.

## Affected components ✍️

-  Server

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5179
Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com>
Co-authored-by: Anon Ray <616387+ecthiender@users.noreply.github.com>
GitOrigin-RevId: 7860008403aa0645583e26915f620b66a5bbc531
2022-08-05 11:51:13 +00:00
Daniel Harvey
6f5416db3e tests: move yaml expectations out of yaml quoter file
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5295
GitOrigin-RevId: 66239be3f2b7c83721af174dc72a1e0796211842
2022-08-05 09:36:03 +00:00
Anon Ray
162e51c668 multitenant: refactor config status updates
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4383
Co-authored-by: Puru Gupta <32328846+purugupta99@users.noreply.github.com>
Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com>
GitOrigin-RevId: f1e376d0b7ef8a64fb7f8bc38e8b764350f054ac
2022-08-05 06:31:07 +00:00
Solomon
07e4a49e5e Consolidate Arg/Env Parser Defaults and cleanup arg merging code
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5262
GitOrigin-RevId: 2501e44a8fe0a57b13141c307d2dd44b028052b6
2022-08-05 00:29:52 +00:00
Tom Harding
d8a4f2cf9b Update HelloWorldSpec to reflect the usual test structure
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5325
GitOrigin-RevId: 85b5aabcdf9fbca51d31eaa36e8a81dfac0a40d1
2022-08-04 14:34:28 +00:00
Auke Booij
1007ea27ae server: refactor MonadSchema into MonadMemoize
Followup to hasura/graphql-engine-mono#4713.

The `memoizeOn` method, part of `MonadSchema`, originally had the following type:
```haskell
  memoizeOn
    :: (HasCallStack, Ord a, Typeable a, Typeable b, Typeable k)
    => TH.Name
    -> a
    -> m (Parser k n b)
    -> m (Parser k n b)
```
The reason for operating on `Parser`s specifically was that the `MonadSchema` effect would additionally initialize certain `Unique` values, which appear (nested in) the type of `Parser`.

hasura/graphql-engine-mono#518 changed the type of `memoizeOn`, to additionally allow memoizing `FieldParser`s. These also contained a `Unique` value, which was similarly initialized by the `MonadSchema` effect. The new type of `memoizeOn` was as follows:
```haskell
  memoizeOn
    :: forall p d a b
     . (HasCallStack, HasDefinition (p n b) d, Ord a, Typeable p, Typeable a, Typeable b)
    => TH.Name
    -> a
    -> m (p n b)
    -> m (p n b)
```

Note the type `p n b` of the value being memoized: by choosing `p` to be either `Parser k` or `FieldParser`, both can be memoized. Also note the new `HasDefinition (p n b) d` constraint, which provided a `Lens` for accessing the `Unique` value to be initialized.

A quick simplification is that the `HasCallStack` constraint has never been used by any code. This was realized in hasura/graphql-engine-mono#4713, by removing that constraint.

hasura/graphql-engine-mono#2980 removed the `Unique` value from our GraphQL-related types entirely, as their original purpose was never truly realized. One part of removing `Unique` consisted of dropping the `HasDefinition (p n b) d` constraint from `memoizeOn`.

What I didn't realize at the time was that this meant that the type of `memoizeOn` could be generalized and simplified much further. This PR finally implements that generalization. The new type is as follows:
```haskell
  memoizeOn ::
    forall a p.
    (Ord a, Typeable a, Typeable p) =>
    TH.Name ->
    a ->
    m p ->
    m p
```

This change has a couple of consequences.

1. While constructing the schema, we often output `Maybe (Parser ...)`, to model that the existence of certain pieces of GraphQL schema sometimes depends on the permissions that a certain role has. The previous versions of `memoizeOn` were not able to handle this, as the only thing they could memoize was fully-defined (if not yet fully-evaluated) `(Field)Parser`s. This much more general API _would_ allow memoizing `Maybe (Parser ...)`s. However, we probably have to be continue being cautious with this: if we blindly memoize all `Maybe (Parser ...)`s, the resulting code may never be able to decide whether the value is `Just` or `Nothing` - i.e. it never commits to the existence-or-not of a GraphQL schema fragment. This would manifest as a non-well-founded knot tying, and this would get reported as an error by the implementation of `memoizeOn`.

   tl;dr: This generalization _technically_ allows for memoizing `Maybe` values, but we probably still want to avoid doing so.

   For this reason, the PR adds a specialized version of `memoizeOn` to `Hasura.GraphQL.Schema.Parser`.
2. There is no longer any need to connect the `MonadSchema` knot-tying effect with the `MonadParse` effect. In fact, after this PR, the `memoizeOn` method is completely GraphQL-agnostic, and so we implement hasura/graphql-engine-mono#4726, separating `memoizeOn` from `MonadParse` entirely - `memoizeOn` can be defined and implemented as a general Haskell typeclass method.

   Since `MonadSchema` has been made into a single-type-parameter type class, it has been renamed to something more general, namely `MonadMemoize`. Its only task is to memoize arbitrary `Typeable p` objects under a combined key consisting of a `TH.Name` and a `Typeable a`.

   Also for this reason, the new `MonadMemoize` has been moved to the more general `Control.Monad.Memoize`.
3. After this change, it's somewhat clearer what `memoizeOn` does: it memoizes an arbitrary value of a `Typeable` type. The only thing that needs to be understood in its implementation is how the manual blackholing works. There is no more semantic interaction with _any_ GraphQL code.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4725
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
GitOrigin-RevId: 089fa2e82c2ce29da76850e994eabb1e261f9c92
2022-08-04 13:45:53 +00:00
paritosh-08
f6067cb977 server/console: add metadata API set_apollo_federation_config
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5294
Co-authored-by: Varun Choudhary <68095256+Varun-Choudhary@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
GitOrigin-RevId: 274d76ff92970ecffa43943125313ba84b07c495
2022-08-04 09:38:02 +00:00
Gil Mizrahi
52c1e9b0a8 Prefix the string md5_ to md5 renames
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5231
GitOrigin-RevId: 6e628a82b889dbc04e93dc5461adb302424c332c
2022-08-04 09:06:33 +00:00
Daniel Chambers
c209b60239 server: Support the namespacing of table names in Data Connectors
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5329
GitOrigin-RevId: 5cf492bc2b09fef6250f4dd50f74f750f55ebe6a
2022-08-04 08:35:52 +00:00
Tom Harding
bbafd0339c Add the HelloWorldSpec link back in the README
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5326
GitOrigin-RevId: 567c852117f5873f948c2cbbb7b62e467ceba171
2022-08-04 07:17:25 +00:00
Solomon
ca1bb1d745 Resolve a variety of smaller TODOs in the OSS Arg/Env Parser
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5303
GitOrigin-RevId: f45cf4b828c31d918ed16f5de19d9880bf8a5579
2022-08-04 03:23:30 +00:00
Solomon
24932c0d56 Monomorphize AuthHookG
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5279
GitOrigin-RevId: a54d23ca96c3178f134ad8be271645775fe3edd4
2022-08-04 02:25:41 +00:00
Daniel Chambers
b24b12b2e6 server: Improve test failure error message in Data Connector agent test suite
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5304
GitOrigin-RevId: 8238c1b59c378b7fe37ae0c9afecbf04f8841e2e
2022-08-04 01:02:22 +00:00
Samir Talwar
1e1a36a192 server/tests-py: Use environment variables for services in queries.
I'm trying to shore up the Python integration tests to make them more reliable. In doing so, I noticed this.

---

Rather than hard-coding hostnames and ports, we can (and already do) inject these into the HGE process using environment variables.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5255
GitOrigin-RevId: 6bb593999ece42cedef6619f31f9d9b2e39f30ef
2022-08-03 20:05:46 +00:00
Samir Talwar
1f5afa1956 server/tests-py: Update README with more recent links.
When documenting how adding a backend works, the information was a bit
out of date. Updated to link to files from the latest commit to `main`,
at the time of writing.

Also runs the README through the `prettier` autoformatter.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5301
GitOrigin-RevId: df54f95d85156e9f95a4a7788eed93c6359cc81c
2022-08-03 19:30:00 +00:00
Antoine Leblanc
666f4cacb7 Only require MkRootFieldName in top-level functions (that make root fields)
### Description

By definition, root fields are at the root of the schema: only functions that craft root fields need to know about how to customize the name of root fields. However, the presence of `Has MkRootFieldName` in `MonadBuildSchemaBase` meant that the entirety of the schema building code was implicitly aware of / capable of altering root field names.

This PR removes this constraint, and moves it to the functions that do craft root fields. This has several upsides:
- it makes it more explicit where root fields are being crafted
- it prevents functions that should not use this from mistakenly applying it to non-root fields
- it simplifies the shared schema context

### Future work

- can we maybe pass this as an argument, instead of making it a required part of the context?
- ~~AFAICT, we only ever use `mempty` for it: is this actually dead code that we should actually just remove altogether?~~

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5235
GitOrigin-RevId: 4268751f3ab87ae8e03b6fe9e1efa1b096200027
2022-08-03 19:09:50 +00:00
Philip Lykke Carlsen
b658df1c43 Spike attempt at adding logging to the hspec test-suite
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4772
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 5c6c9056952574462d5b309774331a909a7eac6d
2022-08-03 14:19:53 +00:00
Samir Talwar
b77005c320 schema-parsers: Duplicate scientificToFoo to break a dependency.
For some reason these functions exist in `Backends.Postgres.SQL.Value`.
We don't want to depend on that module here.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5292
GitOrigin-RevId: a09bd3cdb0caf08938bce0728a8d281344c1d4ce
2022-08-03 12:04:48 +00:00
Tom Harding
c6ff297c71 Port the ColumnPresetsSpec test to the new structure
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5291
GitOrigin-RevId: 4106229cfd1c0d83df8d689b271e060fcbf9cc47
2022-08-03 09:14:50 +00:00
Solomon
1f072911c9 Remove template haskell from Server/Init.hs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5281
GitOrigin-RevId: 9c90c3aaecd04b646399d24b065b9182b2f93f17
2022-08-03 05:53:13 +00:00
Solomon
d5ed2912bd Add 'streaming_subscription' description to experimental featureflag
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5278
GitOrigin-RevId: 1c17c0adc80ff03cdbeb9c49b7743325d5df9fb9
2022-08-03 04:49:22 +00:00
Samir Talwar
5df8419a4f server/tests-py: Use markers for backends instead of parameterized tests.
I'm trying to shore up the Python integration tests to make them more reliable. In doing so, I noticed this.

---

It feels a lot more sensible as we never run on more than one backend at a time.

This also removes the `check_file_exists` parameter from the setup functions; it never worked. It was always set to the result of a comparison between a backend name and a function, which was always `False`. Enabling it breaks things.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5254
GitOrigin-RevId: 8718ab21527c2ba0a7205d1c01ebaac1a10be844
2022-08-02 19:33:59 +00:00
Gil Mizrahi
6dc1eab513 server/tests: Porting Context to Fixture - add custom options
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5270
GitOrigin-RevId: a0f2e401f681e5df0f6cbb6c138686537e3605ee
2022-08-02 18:02:43 +00:00
Tom Harding
4d478e78cf Migrate InsertEnumColumnSpec to the new structure
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5296
GitOrigin-RevId: 99e3f403a2b51cf0dfafbfb3330c931ca909ef9b
2022-08-02 16:25:50 +00:00
Daniel Harvey
4d74bb79ab tests: interpolateYaml quasiquoter for string interpolation
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5162
GitOrigin-RevId: 5b4efb6fe2d8445eb9fad428c1fb0da6d0ac604c
2022-08-02 12:52:58 +00:00
Samir Talwar
349ccd3296 Use docker compose, not docker-compose.
Docker Compose is now a plugin for Docker, bundled by default in Docker Desktop and many Linux distribution packages. The standalone `docker-compose` binary has been deprecated since Docker Compose v2.

Using the new version directly allows us to write development scripts that do not require `docker-compose` to be installed.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5185
GitOrigin-RevId: c8542b8b2405d1aa32288991688c6fde4af96383
2022-08-02 10:30:57 +00:00
Gil Mizrahi
59d8bc66cc Update tests-hspec readme with m1 and docker compose troubleshooting
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5282
GitOrigin-RevId: 4d8c777a0ce06312485707da2cb77d01c3b6cd02
2022-08-02 08:53:03 +00:00
Daniel Chambers
731dff7558 server: Support min/max aggregates on string-type columns [GDW-206]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5264
GitOrigin-RevId: 6937e4936a2bb5c6cb8814da9ed4529fdfb6072a
2022-08-02 00:23:13 +00:00
Solomon
97f336e743 Rename prefix Raw options to suffix for consistency
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5237
GitOrigin-RevId: 70e64582452667f2e5b42f82b5ed307f21427954
2022-08-01 19:36:20 +00:00
Solomon
7498439a78 Refactor/cleanup init config
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5227
GitOrigin-RevId: 2dd08c4949abe1e0ea94c55db57c1418a8ca0b67
2022-08-01 17:14:22 +00:00
Tom Harding
4d123987d6 Refactor the NestedRelationshipsSpec into the new structure
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5269
GitOrigin-RevId: 0c02d0d2c273b04403972eb3357b9ad8352a8f74
2022-08-01 15:46:28 +00:00
Jesse Hallett
ab59be86c3 server: split metadata serialization helpers into new module
Moves code from `Hasura.RQL.Types.Metadata` that is specific to serialization into a new module, `Hasura.RQL.Types.Metadata.Serialization`.

I'm breaking up #5184 into smaller PRs. This is the third and final PR in that effort. This PR is stacked on #5210 and #5211.

The tracking issue is https://hasurahq.atlassian.net/browse/MM-35

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5212
GitOrigin-RevId: 6cde6d52173590fafe0969a06f2a3411db4fbc78
2022-08-01 13:55:32 +00:00
Jesse Hallett
b9ec9b78dd server: convert Metadata to DTO (smaller PR)
Introduces a new function, `metadataToDTO`, that converts a `Metadata` value to a `MetadataV3` DTO value. This is the next step in the alternative serialization path for metadata that comes with a generated OpenAPI specification.

This PR carves up the existing `metadataToOrdJSON` function so that helpers previously embedded in the `where` block of that function can also be used in the implementation of `metadataToDTO`. If I did everything correctly `metadataToOrdJSON` should behave exactly as before.

In a followup PR I will move the extracted helpers to a new submodule, `Hasura.RQL.Types.Metadata.Serialization`, since they add up to several hundred lines of code.

I'm breaking up #5184 into smaller PRs, and this is the second PR in that effort. This PR is stacked on #5210.

The tracking issue is https://hasurahq.atlassian.net/browse/MM-35

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5211
GitOrigin-RevId: 2596ed5312d7b1232c47ae1d08a51d8ead11fcb8
2022-08-01 12:50:00 +00:00
Tom Harding
08c47b7568 Move and refactor the Directives tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5267
GitOrigin-RevId: ec37b8bcea8f50b97fca4008dec7575929ed1841
2022-08-01 12:05:56 +00:00
Tom Harding
b85b018108 Remove GEq and GCompare for (:~~:)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5266
GitOrigin-RevId: 0457b30bf10f1176f3ba7b21d6754dd0c4af75e6
2022-08-01 10:11:16 +00:00
Gil Mizrahi
b70f2a1434 Remove strictness annotations from data types in the Hasura.RQL hierarchy
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5253
GitOrigin-RevId: ab9dd99ce654cda299504bfe6be2f3240c2f82e2
2022-08-01 09:33:35 +00:00
Daniel Chambers
8197d72523 server: Added a complex Data Connector agent test scenario
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5245
GitOrigin-RevId: 0592872eb66a84b286de0b4de9566b83514255a7
2022-08-01 00:41:58 +00:00
Solomon
4769837775 Remove template haskell from Init/Config.hs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5226
GitOrigin-RevId: 96f39fad25c726a0d9b64a4a83fbb32b92f09241
2022-07-30 01:05:34 +00:00
Jesse Hallett
4ed1fdb859 server: move Metadata code to avoid circular dependencies in upcoming work
A following PR moves serialization-related code out `Hasura.RQL.Types.Metadata` into a specialized submodule. To avoid circular dependencies a number of other definitions also need to be moved into their own submodule. This PR does that extra moving first so that we can keep each PR as small, and as easy to review as possible.

There are a lot of changed lines; but it's all moving code from one module to another.

I'm breaking up #5184 into smaller PRs, and this is the first PR in that effort.

The tracking issue is https://hasurahq.atlassian.net/browse/MM-35

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5210
GitOrigin-RevId: 6fb6e29a967ab5ad4724006c8e0addd2d63a3946
2022-07-30 00:15:18 +00:00
Samir Talwar
07328fd9fc server: Automate generation and verification of Cabal files from hpack.
We currently use `hpack` to generate the Cabal files from _package.yaml_
files for the two small libraries in _server/lib_. While this is more
convenient, we also check the Cabal files into the repository to avoid
needing an extra step upon pulling changes.

In order to ensure that the Cabal files do not get out of sync with the
hpack files, this introduces a few improvements:

1.  Makefile targets to automatically generate the Cabal files without
    needing to know the correct incantation. These targets are a
    dependency of all build targets, so you can simply run
    `make build-all` and it will work.
2.  An extra comment at the top of all generated Cabal files that
    explains how to regenerate it.
3.  A `lint-hpack` Makefile target that verifies that the Cabal files
    are up-to-date.
4.  A CI job that runs `make lint-hpack`, to stop inconsistencies
    getting merged into trunk.

Most of these changes are ported from #4794.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5217
GitOrigin-RevId: d3dfbe19ec00528368d357b6d0215a7ba4062f68
2022-07-29 16:22:12 +00:00
Antoine Leblanc
0a69db81c9 Move RoleName into SchemaContext.
### Description

I am not 100% sure about this PR; while I think the code is better this way, I'm willing to be convinced otherwise.

In short, this PR moves the `RoleName` field into the `SchemaContext`, instead of being a nebulous `Has RoleName` constraint on the reader monad. The major upside of this is that it makes it an explicit named field, rather than something that must be given as part of a tuple of arguments when calling `runReader`.

However, the downside is that it breaks the helper permissions functions of `Schema.Table`, which relied on `Has RoleName r`. This PR makes the choice of passing the role name explicitly to all of those functions, which in turn means first explicitly fetching the role name in a lot of places. It makes it more explicit when a schema building block relies on the role name, but is a bit verbose...

### Alternatives

Some alternatives worth considering:
- attempting something like `Has context r, Has RoleName context`, which would allow them to be independent from the context but still fetch the role name from the reader, but might require type annotations to not be ambiguous
- keeping the permission functions the same, with `Has RoleName r`, and introducing a bunch of newtypes instead of using tuples to explicitly implement all the required `Has` instances
- changing the permission functions to `Has SchemaContext r`, since they are functions used only to build the schema, and therefore may be allowed to be tied to the context.

What do y'all think?

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5073
GitOrigin-RevId: 8fd09fafb54905a4d115ef30842d35da0c3db5d2
2022-07-29 15:38:44 +00:00
Tom Harding
178e452b6b Use witherable, remove catMaybes/mapMaybe
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5250
GitOrigin-RevId: 5f0a582b3a853d2dbcce20e88c17970290625fc6
2022-07-29 14:53:16 +00:00
Gil Mizrahi
d64940f615 Remove strictness annotations from data types in the Hasura.Backends hierarchy
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5252
GitOrigin-RevId: e2c4098a06c674fa62118d0c1bdbc82c7d5b954e
2022-07-29 14:06:23 +00:00
Gil Mizrahi
34fd7b9f61 hspec: update to 2.10.0 and use custom ghc-options
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5232
GitOrigin-RevId: 24dfd5742a93445cb86cf2dd0500f9420b21b406
2022-07-29 10:16:37 +00:00
Daniel Chambers
4831c75d4b server: Refactor Data Connector Agent tests to remove duplicate code and test data
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5241
GitOrigin-RevId: 04b0031b81110d978f3f0e502dbe22485d54f950
2022-07-29 08:08:12 +00:00
Solomon
5ad2829b3c Remove Sources of Boolean Blindness in RawServeOptions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5225
GitOrigin-RevId: 7c6095d016052c920b11491bf916cd6eec68b038
2022-07-29 00:47:06 +00:00
Solomon
c4d1eed49c Introduce WithEnvT transformer for OSS/Pro Env Parsing
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5209
GitOrigin-RevId: 7d29170cf36e6f3a6a2f614a0087bbafbf0cd63b
2022-07-28 16:52:09 +00:00
Tom Harding
0494ef3f2b Remove SerializationSpec, move to BigQuery-specific tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5218
GitOrigin-RevId: 3e14e7cefb02d21aa1c938185043e3af428d5190
2022-07-28 10:18:59 +00:00
Tom Harding
3dc17c3f77 Remove PostgresTypesSpec, create Test.Postgres.TimestampSpec
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5220
GitOrigin-RevId: eb892113ea1a9491c6cb793102ad5f56ae2713fb
2022-07-28 09:42:43 +00:00
Tom Harding
f7392a26e3 Move UpdateManySpec into Test.Mutations.MultiplePerRequest
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5206
GitOrigin-RevId: a3f1d37de38c40c2e08506ed30eb0a56ce3bb45e
2022-07-28 08:54:35 +00:00
Daniel Chambers
94ddf10df6 server: Remove multiple column count aggregate support from Data Connectors [GDW-207]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5224
GitOrigin-RevId: be62ad21ed60cf5c9fb05cda8454b99a0c024866
2022-07-28 07:25:23 +00:00
Daniel Chambers
ac4f3d8ed0 server: Aggregates support for Data Connectors [GDW-187]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5194
GitOrigin-RevId: f0f4f0974710af943b1e47d07d199a277156285d
2022-07-28 05:40:53 +00:00
Daniel Harvey
b2f1d1e0c6 server: add BigQuery dataset insert and delete functions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5061
GitOrigin-RevId: 541236f915a0fe2d159068ca68ec92b0fa13f5e7
2022-07-27 14:25:36 +00:00
Samir Talwar
f01c7f4ee6 server: Remove QErr and Code dependencies from the schema parsers.
In the process of decoupling the schema parsers from the GraphQL Engine, we need to remove dependencies on `Hasura.Base.Error`.

First of all, we have avoided using `QErr` in schema parsers code, instead returning a more appropriate data type which can be converted to a `Hasura.Base.Error.QErr` later.

Secondly, we create a new `ParseErrorCode` type to represent parse failure types, which are then converted to a `Hasura.Base.Error.Code` later.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5181
GitOrigin-RevId: 8655e26adb1e7d5e3d552c77a8a403f987b53467
2022-07-27 12:26:44 +00:00
pranshi06
5203559173 server: Add warning log for no admin secret
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5034
GitOrigin-RevId: 82498837c38c66882aa1cc7c78131aa965fe70ac
2022-07-27 11:47:32 +00:00
Tom Harding
63cc498619 Move PrimaryKeySpec into the new test structure
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5182
GitOrigin-RevId: 26dafbf95ff6d2cf2f7d3e9d9eec2441f2ef02ce
2022-07-27 11:04:16 +00:00
Vishnu Bharathi
61bc9c498b ci: tag release v2.9.0 and v2.10.0-beta.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5214
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: 93adb002a5a7d9c3983738d9719e83918a571160
2022-07-27 10:16:23 +00:00
Tom Harding
bd1fde3d8b Create and organise OffsetSpec, remove LimitOffsetSpec
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5186
GitOrigin-RevId: 08687b3e77a6e8663cf0ec59e638aa917a334574
2022-07-27 09:46:55 +00:00
Tom Harding
04887f00de Remove Test.OrderingSpec, create Test.Queries.SortSpec
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5188
GitOrigin-RevId: 8d5ca048a838a29991ca4b4425ce0439c60f94b1
2022-07-27 09:08:20 +00:00
Tom Harding
9a55b50d0e Remove the BasicFieldsSpec module, reorganise its contents
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5189
GitOrigin-RevId: f68baca8cc5c0b52135141191bbbee5771d791e1
2022-07-27 08:33:59 +00:00
Naveen Naidu
b69182f4fe server: delete hasura SQL triggers when tables are untracked
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5130
GitOrigin-RevId: c8bec0c5ac0eb9c576e86a218311b5c0503ee400
2022-07-27 07:58:11 +00:00
Lyndon Maydwell
607497f82f Increase timeout for DC Agents
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5172
GitOrigin-RevId: 1d286447901e34a77518e062315b80f4f775eebf
2022-07-27 07:19:44 +00:00
Naveen Naidu
e4dad73adb server/pro: log when rate limits and time limits are hit
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5170
GitOrigin-RevId: fe07b0bf48804c6b4af3d5887d853ffcfde6207d
2022-07-27 06:40:21 +00:00
David Overton
a6dca587d2 Update autodocodec
Updates to the latest version of autodocodec and uses the new features, in particular `discriminatedUnionCodec`.
This allows us to remove the `ValueWrapper*` types and `sumTypeCodec`. Sum types are now encoded as discriminated unions.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5155
GitOrigin-RevId: 20bfdc12b28d35db354c4a149b9175fab0b2b7d2
2022-07-27 05:28:47 +00:00
Samir Talwar
87456360ad server: Move ErrorMessage to its own package.
This is now the sole in-universe dependency of the schema parsers. As
such, we need to extract it as a library before we can extract the
schema parsers as a library.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5202
GitOrigin-RevId: fbe571855768e56dc8b8e259b8efe900de3ecc54
2022-07-27 04:38:12 +00:00
Tom Harding
b1bf07db34 Absorb SelectSpec into ObjectQueriesSpec
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5196
GitOrigin-RevId: ee1f2c53225904b63f3bd0c33aeecbdd5cb02f36
2022-07-26 14:18:58 +00:00
Tom Harding
307071840f Add the basic limit query
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5183
GitOrigin-RevId: 76e1f59c3e5212f69b4b13e431627cfff141a8b5
2022-07-26 13:32:16 +00:00
Tom Harding
5cca33611b Remove redundant test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5187
GitOrigin-RevId: 25d711ef42f431d3aa6874581580ce2dad53f3f1
2022-07-26 09:28:31 +00:00
Solomon
1e5b2b9fa5 Restructure Pro Parser modules to align with the OSS Parser
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5191
GitOrigin-RevId: 96b7d4c7e5a1b2d84664587bb43a79afcf29766f
2022-07-26 07:33:35 +00:00
Daniel Chambers
2b9c224170 server: Simplify FieldValue in Data Connector query responses for agents
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5149
GitOrigin-RevId: 4ed438fdd9887b0b4d23a98156e350deb3403465
2022-07-26 02:30:14 +00:00
Solomon
3bbd19f747 Add unit tests for Pro Env Var parsing
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5165
GitOrigin-RevId: ee6ce6aa28c773e6c249f61059f6399ada0b62e1
2022-07-26 00:43:26 +00:00
Samir Talwar
adca95a78d server: Use make to simplify tests-py venv generation.
Rather than a homebrewed approach, we can use `make` to figure out when
it's necessary to regenerate our venv.

This Makefile will regenerate _requirements.txt_ from
_requirements-top-level.txt_ when the latter is changed.

It will also regenerate the venv when _requirements.txt_ is changed
(i.e. changes are pulled, or it's regenerated as described above).

`make` uses file/directory timestamps to figure out what to rebuild.
This is probably more reliable than expecting people to update a version
number whenever they change a file.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5152
GitOrigin-RevId: 24b27d49bf6c4ba1d57ac38ea38ae278216c6d66
2022-07-25 20:05:49 +00:00
Tom Harding
15fa2f7b56 Remove HelloWorldSpec
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5178
GitOrigin-RevId: d8c48a01f452b632503ba7b90c9d549167e5c519
2022-07-25 18:07:08 +00:00
Samir Talwar
e1c7767d5e Run both integration test suites against PostgresSQL v14 with Postgis.
Let's be consistent about this.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5177
GitOrigin-RevId: 75a48452984a0762e52ee251a98f086f2ae1b150
2022-07-25 16:37:54 +00:00
paritosh-08
95adde4ce2 server: support for Apollo federation
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4584
Co-authored-by: Auke Booij <164426+abooij@users.noreply.github.com>
GitOrigin-RevId: 0f60c263efb5fbaa25620dd8159e8cfda25a61b2
2022-07-25 15:54:41 +00:00
Tom Harding
73d8d35df3 Add the Schema.TableRelationshipsSpec tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5133
GitOrigin-RevId: 29b749ffc1e47f0d64cc6334bedb265b75fa7aa2
2022-07-25 14:52:42 +00:00
Tom Harding
7b2bb262b8 Add the Queries.SimpleSpec tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5138
GitOrigin-RevId: 1328772e5262f4cd4d931bfb40103fe619d39f83
2022-07-25 13:34:47 +00:00
Samir Talwar
33b19c327c Replace Data.Text.Extended with ErrorMessage in a few more places.
Mostly in the schema parsers code, to reduce its exposure to the rest of
the codebase.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5088
GitOrigin-RevId: 752fcc10b4748b601e2e5313db326fe7f84febb4
2022-07-25 10:42:03 +00:00
Abby Sassel
77b4b395ef server/bigquery: test row level permissions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5115
GitOrigin-RevId: 8fa2261cefc3d2932542be6b07499b47df74e9d1
2022-07-25 09:53:14 +00:00
pranshi06
ba734fb0f3 server: refactor ActionWebhookResponse type
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3796
GitOrigin-RevId: 671a586b12c721dc93d3ace7ab6f601898abccc0
2022-07-25 07:07:51 +00:00
awjchen
227e11d481 server: expose Prometheus metrics from Hasura Pro
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4972
GitOrigin-RevId: fadfcb0981cd9dfe0a316804ead87d7778ece1e9
2022-07-23 21:19:20 +00:00
Solomon
11e605ecd6 Bug Fix for missing --admin-secret result in final admin secret hashset
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5166
GitOrigin-RevId: 30dd5a5c7fdeef349afbb64e2342030ae8afdda4
2022-07-23 03:49:17 +00:00
Gil Mizrahi
ee15c804bc server/postgres: prefix identifiers longer than 63 characters with their md5 hash
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5080
GitOrigin-RevId: 58e5e6aab136617d1bbfc6621c89942da358b04d
2022-07-22 15:29:02 +00:00
Tom Harding
ca218706be Delete WhereSpec, add FilterSearchSpec
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5151
GitOrigin-RevId: 97628540f82bcff7d7fe5acf54586df96acd78f4
2022-07-22 14:51:02 +00:00
Samir Talwar
0e4d709285 Factor tool versions out into server/VERSIONS.json.
This helps us use the same versions locally as in CI. If you're using the Nix setup, it guarantees it.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5111
GitOrigin-RevId: 6e00cd7a78593df1e60fac37cc1195aba60e488f
2022-07-22 12:23:46 +00:00
Samir Talwar
89eafb1589 server: Re-freeze tests-py/requirements.txt.
I tried re-freezing _server/tests-py/requirements-top-level.txt_
recently, and discovered that it caused the tests to fail.

This pins a couple of dependencies so that we can safely re-freeze.
Specifically:

- `cryptography` is pinned at v3.*
- `graphene` is pinned at v2.*
- `PyJWT` is pinned at v2.3.*
- `websocket-client` is pinned at v0.56.0 (this was done in
  _requirements.txt_ already, but that file is supposed to be
  regenerated)

Upgrading `SQLAlchemy` required changing PostgreSQL URLs to use
"postgresql://" as the URL scheme, not "postgres://".

Updating `ruamel.yaml` caused a few tests to fail as we are passing
`ruamel.yaml.scalarstring.LiteralScalarString` values as header values.
This is fixed by explicitly converting header values to strings.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5120
GitOrigin-RevId: 9c12a3013c3d1f23dddbe781037663838b23f6f5
2022-07-22 10:25:33 +00:00
Daniel Chambers
2df835624d server: Nodes field support in Data Connector aggregate queries [GDW-187]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5108
GitOrigin-RevId: 2d707abab0ae429e30be620225c4c419b960aa3f
2022-07-22 09:47:32 +00:00
paritosh-08
c562fd41a4 server: fix desc order_by for dataconnector
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5144
GitOrigin-RevId: d17e765eaf8cda3630c6339b90aa90eeff5b5cea
2022-07-22 06:36:24 +00:00
Solomon
0109dd7fd4 Refactor/extract pro arg parser and add tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5142
GitOrigin-RevId: 724d5ad0e3f66fb5ba79f48946426ad4eddee37d
2022-07-21 23:37:10 +00:00
Lyndon Maydwell
6821b90910 Moving kriti function references into a single module for coordination of availability
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5095
GitOrigin-RevId: 8394c33f0182baad53306c6efc3ab720957b7339
2022-07-21 07:07:29 +00:00
Samir Talwar
aaf97834f3 server: Replace forkIO with async in the DC mock agent.
I got a flaky test run recently, in which some Data Connectors tests in
_tests-hspec_ failed. The failure was not very helpful, but the log
output contained this message:

> Network.Socket.bind: resource busy (Address already in use)

I _think_ this was caused by killing the Data Connectors mock agent
thread, but not waiting for the server to stop. `Async.cancel` should
handle this, as it waits for the thread to stop.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5121
GitOrigin-RevId: 3419dce2fc5ff52e3a6f2d452ea44dd85b326452
2022-07-21 04:57:27 +00:00
Vishnu Bharathi
c91aea2aff ci: tag release v2.9.0-beta.3
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5112
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: f415a847c3ed984e289e1f531d716b245fa7fba8
2022-07-20 12:45:59 +00:00
Daniel Chambers
c1380e1daf server: Data Connectors aggregation agent API contract [GDW-95]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5069
GitOrigin-RevId: acd80975c162935d5594e55db47228cf689e5fd7
2022-07-20 05:21:54 +00:00
Daniel Harvey
dd122217de tests: use GraphqlString class to interpolate variables in GraphQL quasiquoter
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5062
GitOrigin-RevId: a8fdad5bc87093b8117541dd39499065e2b4370f
2022-07-19 15:43:39 +00:00
Naveen Naidu
38a10bebb7 server: delete hasura SQL triggers when MSSQL source is dropped
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5060
GitOrigin-RevId: 377df03697d973cdaa643999b213697d7a368dee
2022-07-19 11:40:50 +00:00
Evie Ciobanu
187bf385fc remove homebrew NESeq, use vendored
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5094
GitOrigin-RevId: 3342e571d3574a4d94fe3bfedb60f332b8c10853
2022-07-19 08:42:28 +00:00
paritosh-08
d66abcefab server: transform enum with upper for graphql-default
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5032
GitOrigin-RevId: 206a673f4bd59700436f6160feeb7df415f637ad
2022-07-19 06:56:45 +00:00
Lyndon Maydwell
2107c70e17 Kriti Transform of the DataConnectors Configuration [GDW-144]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4996
GitOrigin-RevId: 26d367ab83df4b161f58133afab2788c6f0c9746
2022-07-19 01:52:50 +00:00
Lyndon Maydwell
f4ef0ddbdd Updating DC Reference Agent and Agent tests to match schema
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5066
GitOrigin-RevId: f15a3309ccd5eb4e19eee0f4b59dccba2cd7fefa
2022-07-19 00:38:13 +00:00
Samir Talwar
9c4792c417 server: Shorten the init specs.
Makes the init specs shorter by using `shouldBe` instead of `shouldSatisfy` wherever possible. This also makes test failures more expressive.

It also simplifies boolean logic in most places, following HLint warnings. These changes brought to you by `hlint --refactor`, which is basically magic.

I have left some redundancy in the boolean logic for clarity, along with the appropriate HLint suppressions.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5087
GitOrigin-RevId: 52bf3626be2615e6a32a0fc0e8be19cca31ee4ad
2022-07-18 22:13:31 +00:00
Samir Talwar
eab4f75212 An ErrorMessage type, to encapsulate.
This introduces an `ErrorMessage` newtype which wraps `Text` in a manner which is designed to be easy to construct, and difficult to deconstruct.

It provides functionality similar to `Data.Text.Extended`, but designed _only_ for error messages. Error messages are constructed through `fromString`, concatenation, or the `toErrorValue` function, which is designed to be overridden for all meaningful domain types that might show up in an error message. Notably, there are not and should never be instances of `ToErrorValue` for `String`, `Text`, `Int`, etc. This is so that we correctly represent the value in a way that is specific to its type. For example, all `Name` values (from the _graphql-parser-hs_ library) are single-quoted now; no exceptions.

I have mostly had to add `instance ToErrorValue` for various backend types (and also add newtypes where necessary). Some of these are not strictly necessary for this changeset, as I had bigger aspirations when I started. These aspirations have been tempered by trying and failing twice.

As such, in this changeset, I have started by introducing this type to the `parseError` and `parseErrorWith` functions. In the future, I would like to extend this to the `QErr` record and the various `throwError` functions, but this is a much larger task and should probably be done in stages.

For now, `toErrorMessage` and `fromErrorMessage` are provided for conversion to and from `Text`, but the intent is to stop exporting these once all error messages are converted to the new type.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5018
GitOrigin-RevId: 84b37e238992e4312255a87ca44f41af65e2d89a
2022-07-18 20:27:06 +00:00
Samir Talwar
0869e89faa Remove or ignore all instances of unsafeMkName.
This removes the one remaining instance of `unsafeMkName` in production
code, uses `G.name` where possible in tests, and ignores instances where
it's not possible (such as `instance Arbitrary G.Name`).

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5074
GitOrigin-RevId: d8049edf1f1bc2ef25f34874ef5bd5a5934bd33d
2022-07-18 17:02:15 +00:00
Evie Ciobanu
d76aab99e1 server: postgres multiple updates
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4837
GitOrigin-RevId: 505f669298298fd004dfc4e84eaa0d21df055216
2022-07-18 15:16:47 +00:00
Tom Harding
4f3fc9853b Use hspec-discover for src-test, remove unitSpecs list.
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5078
GitOrigin-RevId: c2137264810a2575bae8d83fcdd7a0c8251db50e
2022-07-18 14:15:17 +00:00
Antoine Leblanc
a3e23adac5 Remove remote schema permissions from schema options.
### Description

A trivial PR, extracted out of #4936, that removes remote schema permissions from the schema context, as they are only ever used at the top level: whether or not we need to use remote schema permissions is not something that impacts _how_ we build the schema, but whether some parts of the schema should be built at all, and therefore doesn't need to be accessible throughout the build process.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5050
GitOrigin-RevId: 734673370393d5640ad753222982baf2698f6d8f
2022-07-18 13:09:40 +00:00
Gil Mizrahi
98d6a635a1 server/postgres: document and refactor IdentifierUniqueness and SQL.DML
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5036
GitOrigin-RevId: e6d076edb1a5f6664c941b84d06329ece43751cb
2022-07-18 09:46:17 +00:00
Solomon
0799c6ae47 Adds unit tests for pro arg/env parsing
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5064
GitOrigin-RevId: 8b5da77f2e62d5bd3368b7b9fd5703e7ba3971dc
2022-07-17 02:05:08 +00:00
Samir Talwar
3d5f39702b Inline scalar type names in RQL.Common.
So that we don't need to import `RQL` from `GraphQL.Parser`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5057
GitOrigin-RevId: 17b35871b853c52a6b03afe5bff9553f56f8e3b4
2022-07-15 10:11:13 +00:00
Solomon
044cd25df6 OSS Init Modules Restructure
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4938
GitOrigin-RevId: 578a9176f5f28303b74607e008712f75c37355d8
2022-07-15 08:55:25 +00:00
Solomon
59cf4d428e Adds unit tests to OSS Arg/Env parsing
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5056
GitOrigin-RevId: d5de7da9bc795813a3d0f2073919b935fb609d14
2022-07-15 05:04:02 +00:00
David Overton
b2b195c0a3 Add support for custom comparison operators
Add support for custom comparison operators in the DC agent API and IR.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4974
GitOrigin-RevId: 9580160e6171df77fe4979b7c2e87c473aaccbfc
2022-07-15 03:29:06 +00:00
Tom Harding
2e7e6fd98a Move SchemaOptions to its own module, remove magic bools
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5048
GitOrigin-RevId: f666a10c6af5feda9d761d3ffee5c77695361fdf
2022-07-14 17:59:01 +00:00
Tom Harding
9b22eed82a Remove scalarTypeGraphQLName
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5051
GitOrigin-RevId: 7312156b29ceac50787e43f06bc01f2ba48de28f
2022-07-14 14:04:56 +00:00
Tom Harding
2e940f88c4 Add fallback for unrecognised types in BigQuery RestArgument decoder
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5042
GitOrigin-RevId: 45efb6dff9fbe8e2ec10356921e5c61b2af1bcda
2022-07-14 08:27:54 +00:00
Daniel Harvey
6b03f8b0af server: remove systemDefined field from CoreFieldInfo
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5028
GitOrigin-RevId: 168dc2aeae12258231ddb8300a0aa2fe5817927c
2022-07-13 15:21:01 +00:00
Vishnu Bharathi
f6ea3168b6 ci: tag release v2.9.0-beta.2
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5038
Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com>
GitOrigin-RevId: 4f99534b8e726cc18aabc0265dbd83497ca2380b
2022-07-13 13:03:03 +00:00
paritosh-08
25a027ba79 server/console: use root_field_namespace as prefix for remote schema
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5000
GitOrigin-RevId: 6427691e1609e939b4245d90cff20de72b18e99a
2022-07-13 05:30:04 +00:00
Samir Talwar
c980af1b8f Move MkTypename and NamingCase into their own modules.
This moves `MkTypename` and `NamingCase` into their own modules, with the intent of reducing the scope of the schema parsers code, and trying to reduce imports of large modules when small ones will do.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4978
GitOrigin-RevId: 19541257fe010035390f6183a4eaa37bae0d3ca1
2022-07-12 14:01:28 +00:00
Gil Mizrahi
555e0d0afe server: adding a few code comments
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5014
GitOrigin-RevId: 7f0cb241d3eb2d91bd6feb2b2eb6bf830f1757f9
2022-07-12 09:26:32 +00:00
paritosh-08
84366c9281 server: apply naming convention to prefixing/suffixing for graphql-default
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5020
GitOrigin-RevId: 145ed4d5dcc352308486fefe9bb7f75f8ed1a84a
2022-07-12 08:34:38 +00:00
Daniel Chambers
728fcd011e Add Data Connector agent request logging, improve error messages, and add tracing support [GDW-83]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4987
GitOrigin-RevId: 71570d1656e0cd5be49c179740be81804a3ad05a
2022-07-11 08:05:40 +00:00
Abby Sassel
3318963d99 server/tests: sunset (FKA) TestGraphQLQueryBasicCommon pytests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4990
GitOrigin-RevId: 85c0ac27a7437c6ff96ce282b2fcf6950d5f4d07
2022-07-08 04:19:38 +00:00
kodiakhq[bot]
d8b595575d server: more GHC 9.2 changes compatible with 8.10 (#3550)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4968
GitOrigin-RevId: 1175b2fcc90e0436c99da7fa58d317a49c7704d4
2022-07-07 16:51:18 +00:00
Jesse Hallett
80d19a80c4 server: update docs for updating cabal.project.freeze
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4980
GitOrigin-RevId: 7015295b037869f21a1c30895c9ffb846da62ff2
2022-07-07 15:59:26 +00:00
Jesse Hallett
f4328c3076 server: move ordered Aeson into its own package
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4939
GitOrigin-RevId: 62e83ae7c69f4e0a5334cf1e0c85c22a5d378f59
2022-07-07 15:55:52 +00:00
Vishnu Bharathi
967f4047ac ci: tag release v2.8.4
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4988
GitOrigin-RevId: 9cf042bbbcb36eaefdc0bae862f9529a973443fd
2022-07-07 07:39:23 +00:00
Karthikeyan Chinnakonda
584aa666bd server: add support to customize streaming subscriptions root field
Earlier, if the `select` root field had a custom root field set, the same custom root field was then used for the streaming subscription root field as well. This leads to duplicate root fields being generated in the `subscription_root`.

This PR fixes that. It provides a way to customize the streaming subscription root field and not use the `select` root field's custom root field name for the streaming subscription root field.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4967
Co-authored-by: Anon Ray <616387+ecthiender@users.noreply.github.com>
GitOrigin-RevId: 54e74ce97561b0e5cfdfc60d1ca340aaebecf7d4
2022-07-06 12:14:25 +00:00
Samir Talwar
975b022b29 server/parsers: Reduce usages of "utils"-like functions.
This reduces the usage of "utils" modules in the parsers code, especially those that are simply re-exported from elsewhere, to facilitate extracting the parsers code into its own library.

It mostly inlines the imports that are re-exported from `Hasura.Prelude` and `Data.Parser.JSONPath`. It also removes references to `Data.*.Extended` modules. When necessary, it re-implements the functionality (which is typically trivial).

It does not tackle all external dependencies. I observed the following that will take more work:

- `Data.GADT.Compare.Extended`
- `Data.Text.Extended`
- `Hasura.Base.Error`
- `Hasura.RQL.Types.Common`
- `Hasura.Server.Utils`

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4964
GitOrigin-RevId: 54ad3c1b7a31f13e34340ebe9fcc36d0ad57b8bd
2022-07-06 07:56:35 +00:00
paritosh-08
2498176052 server: fix namespace visibility during introspection
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4971
GitOrigin-RevId: 0ed090b61da65849466607c29480f031f241e929
2022-07-06 05:41:15 +00:00
Abby Sassel
4b4a11dd07 server/tests: sunset TestGraphQLQueryBasicMySQL pytests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4961
GitOrigin-RevId: 8745c075701378ebfad8cc66bb714b8a79666199
2022-07-05 18:35:00 +00:00
Samir Talwar
987b55f981 server/tests-py: Reduce the number of locations we check the status code.
We have a lot of `assert st_code == 200` scattered about. This is a
problem because (a) it makes the code harder to parse and (b) the error
message is lacking; I have seen a few flaky tests which were impossible
to diagnose because I didn't know what the response _should_ be.

This reduces the number of places in which we perform this assertion
(moving most of them to `HGECtx.execute_query`), so that we can have a
better chance of seeing a useful error message on test failure.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4957
GitOrigin-RevId: 3ff388bccf49f96569aa6b7db85266a0c5ee27ea
2022-07-05 18:01:07 +00:00
Samir Talwar
b21d058bec server/tests-py: Load the Python environment in a .envrc file.
This makes it easier to run the tests when `cd`-ing into the directory,
and also takes care of cleaning up the environment when you exit the
directory.

It also helps editors with direnv support find the relevant libraries
so that they can perform more helpful analysis.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4963
GitOrigin-RevId: d253c054c09c1bf7017ade9f7af414b56ee26fe0
2022-07-05 16:52:27 +00:00
Samir Talwar
3fc25a39d3 server: Handle special characters in parseJSONPath and encodeJSONPath.
This improves `parseJSONPath` and `encodeJSONPath` to encode special characters appropriately by delegating to Aeson.

This also makes a couple of improvements to `encodeJSONPath`.

1. The function is moved from `Hasura.Base.Error` to `Data.Parser.JSONPath`. This still doesn't seem too appropriate but it is somewhat better. I am basing this on the fact that its test cases already lived in `Data.Parser.JSONPathSpec`.
2. It now returns `Text`, not `String`.
4. It quotes strings with double quotes (`"`) rather than single quotes (`'`), just like JSON.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4935
GitOrigin-RevId: bf44353cd740500245f2e38907a7d6263ae0291c
2022-07-05 15:53:45 +00:00
Samir Talwar
f566f55d02 server/pytest: Attempting to improve TestNamingConventions.
I found a couple of flaws in `TestNamingConventions` and friends:

1. We had two test cases with the same name, which means one of them
   would be overwritten. Renamed to avoid conflict.
2. The `skipif` check for
   `TestNamingConventionWithoutExperimentalFeature` seemed broken. I
   have fixed it by making it line up with its `reason`, and extracted
   some logic out into a function to avoid duplication.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4958
GitOrigin-RevId: f572d86c893135839dbaba70bf89984bc9d79331
2022-07-05 12:37:30 +00:00
Auke Booij
34d016a7fc Restore comment mangled up by graphql-engine-mono/pull#4770
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4950
GitOrigin-RevId: c13d59e841e32e94e0c1c4767f7706f03ec8c84f
2022-07-04 16:59:59 +00:00
Antoine Leblanc
b73b9c1658 Make test path relative to project folder.
### Description

The path to the metadata file in this test was given in a relative fashion, which therefore assumes that the tests are run from a specific folder. This PR relaxes this requirement by making use of `makeRelativeToProject`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4934
GitOrigin-RevId: a3c4736bb126d719881beb922c3b4b461d9dda11
2022-07-04 15:45:02 +00:00
Karthikeyan Chinnakonda
edef724879 server: Create SQL trigger if not found while reloading metadata
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4716
GitOrigin-RevId: 5303477aa19257535e682e6cbd3e79d49aba1fa2
2022-07-04 10:10:54 +00:00
Samir Talwar
2be2200b1a server: Split CatalogVersion into Source… and Metadata…
This reflects the two different usages, which should not be conflated.

We also propagate the type a little more, to avoid `Text`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4931
GitOrigin-RevId: 16278f14aa4c2cb5667ea54bbb6b25e6d362835c
2022-07-04 09:32:12 +00:00
paritosh-08
680cf5b3c0 server: fix missing/wrong graphql-default field name transformations
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4927
GitOrigin-RevId: 02dc61f05e06f46c193be3685abbef9c8535edef
2022-07-04 05:41:26 +00:00
Daniel Chambers
b9fb7d8720 Support composite primary keys for Data Connector [GDW-127]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4926
GitOrigin-RevId: 2b6e5052f56a765e0b9a19345fcc4688d7e4700f
2022-07-01 12:21:17 +00:00
Samir Talwar
40617719ef server: Remove the Show instance from QErr and anything that touches it.
We only use these `Show` instances in error messages (where we call
`show` explicitly anyway) and test cases (in which Hspec requires `Show
a` for any `a` in an assertion).

This removes the instance in favor of a custom `showQErr` function
(which serializes the error to JSON). It is then used in certain error
message production which previously called `show` on a `QErr`.

There are two places where we serialize a QErr and then construct a new
QErr from the resulting string. Instead, we modify the existing QErr to
add extra information.

An orphan `Show QErr` instance is retained for tests so that we can have
nice test failure messages.

This is preparation for future changes in which the error message within
`QErr` will not be exposed directly, and therefore will not have a
`Show` instance. That said, it feels like a sensible kind of cleanup
anyway.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4897
GitOrigin-RevId: 8f79f7a356f0aea571156f39aefac242bf751f3a
2022-07-01 11:48:26 +00:00
Tom Harding
99f6172d0d Implement HLint suggestions and turn warnings into errors
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4903
GitOrigin-RevId: acab9bbd8373bdf427a80ab1dd73d49ab61996a2
2022-07-01 10:50:33 +00:00
Auke Booij
0df0ba6a82 Thinner monad stack for Parse
The definition of the Parse monad (which implements MonadParse) can be simplified from using two monad transformers to a single monad. We can simplify from:
```haskell
newtype Parse a = Parse
  { unParse :: ReaderT JSONPath (Except ParseError) a }
```
to
```haskell
newtype Parse a = Parse
  { unParse :: Except ParseError a }
```
In other words, we don't actually need a Reader monad at all.

The technique is that rather than _always_ keeping track of the `JSONPath` while traversing the query, instead simply wait until an error occurs, and if it does, we adjust its `JSONPath` while we're unrolling the stack, using `withExceptT`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4807
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
GitOrigin-RevId: 94de2c97dc65cb0bd918050cf5e99ac62168b331
2022-07-01 09:16:01 +00:00
Naveen Naidu
2ab9646a4e server: fix mssql getMaintenanceModeTx
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4928
GitOrigin-RevId: e965ec74746bd56c0644b77b9e7085692ba91977
2022-07-01 07:57:27 +00:00
Naveen Naidu
d33025ff5b server: fix indexes for MSSQL event triggers
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4766
GitOrigin-RevId: 1c1bf173e53fd0b6692131632023817dc843b302
2022-07-01 06:51:41 +00:00
paritosh-08
0c6ddc3666 server: fix typename for custom table name with graphql-default naming convention
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4843
GitOrigin-RevId: 3d61b9d6a893b2a69a6f16bc409242d5ecc3bc8a
2022-07-01 06:12:02 +00:00
Solomon
0f6c4a890b Monomorphize Some Hge Options
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4925
GitOrigin-RevId: e4d39c2c495a0979f7e90d54e0df9a40260f5a18
2022-07-01 03:40:46 +00:00
Philip Lykke Carlsen
824697a1e8 Break up class BackendSchema in two
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4901
GitOrigin-RevId: fdef33b69626d1694dc1938bb76e001284dd1b50
2022-06-30 15:23:35 +00:00
Antoine Leblanc
3a400fab3d Rewrite OpenAPI
### Description

This PR rewrites OpenAPI to be more idiomatic. Some noteworthy changes:
- we accumulate all required information during the Analyze phase, to avoid having to do a single lookup in the schema cache during the OpenAPI generation phase (we now only need the schema cache as input to run the analysis)
- we no longer build intermediary endpoint information and aggregate it, we directly build the the `PathItem` for each endpoint; additionally, that means we no longer have to assume that different methods have the same metadata
- we no longer have to first declare types, then craft references: we do everything in one step
- we now properly deal with nullability by treating "typeName" and "typeName!" as different
- we add a bunch of additional fields in the generated "schema", such as title
- we do now support enum values in both input and output positions
- checking whether the request body is required is now performed on the fly rather than by introspecting the generated schema
- the methods in the file are sorted by topic

### Controversial point

However, this PR creates some additional complexity, that we might not want to keep. The main complexity is _knot-tying_: to avoid lookups when generating the OpenAPI, it builds an actual graph of input types, which means that we need something similar to (but simpler than) `MonadSchema`, to avoid infinite recursions when analyzing the input types of a query. To do this, this PR introduces `CircularT`, a lesser `SchemaT` that aims at avoiding ever having to reinvent this particular wheel ever again.

### Remaining work

- [x] fix existing tests (they are all failing due to some of the schema changes)
- [ ] add tests to cover the new features:
  - [x] tests for `CircularT`
  - [ ] tests for enums in output schemas
- [x] extract / document `CircularT` if we wish to keep it
- [x] add more comments to `OpenAPI`
- [x] have a second look at `buildVariableSchema`
- [x] fix all missing diagnostics in `Analyze`
- [x] add a Changelog entry?

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4654
Co-authored-by: David Overton <7734777+dmoverton@users.noreply.github.com>
GitOrigin-RevId: f4a9191f22dfcc1dccefd6a52f5c586b6ad17172
2022-06-30 12:57:09 +00:00
Naveen Naidu
f7178e75f9 server: fix unlockEventsInSource bug
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4821
GitOrigin-RevId: be417c1f05600e3b57fa1e448f69ebd8536c8ff7
2022-06-30 11:27:16 +00:00
Vishnu Bharathi
b4f9626b00 ci: tag release v2.8.3
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4915
Co-authored-by: Divi <32202683+imperfect-fourth@users.noreply.github.com>
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: e7f5372829b8bb4d84f30b20c4cd488f516389d1
2022-06-30 10:57:25 +00:00
Tom Harding
ffad733bd3 Port the "test_user_perms" pytest to hspec
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4828
GitOrigin-RevId: 6227b8601e6b4d6f6bf2bd199cdb4d94a200c96c
2022-06-30 10:28:08 +00:00
Tom Harding
c90b8c4776 Add forkIO and threadDelay errors to HLint.
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4682
GitOrigin-RevId: 35897df6793b41dbf54521a868c2d2daf7e268ea
2022-06-30 09:56:06 +00:00
Daniel Chambers
3f405915e9 Added a healthcheck endpoint to the Data Connector Agent API spec
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4890
GitOrigin-RevId: 605408bddf03bef66eb03be8c242797e8fcf89bb
2022-06-30 08:37:53 +00:00
Naveen Naidu
25bd8b6e0f server: fix mssql_redeliver_event API
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4885
GitOrigin-RevId: c422f10a06301cf33467e404438bee4b52b4d86d
2022-06-30 06:45:35 +00:00
paritosh-08
3d001fedb8 server: respect experimental flag for naming convention of table column names
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4845
GitOrigin-RevId: f1347ec64ff883d1dcc87e588a063557d37cb968
2022-06-30 05:57:18 +00:00
Philip Lykke Carlsen
a409e79167 Move postgres specific schema into the Postgres namespace
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4895
GitOrigin-RevId: 62772d966bf2b4a4dcb26c1dd0bd4f30749b7c91
2022-06-29 16:05:35 +00:00
Vishnu Bharathi
331ae6ab56 ci: tag release v2.8.2 and v2.8.2-pro.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4899
GitOrigin-RevId: 5e1aa15b8fc1c744d7f9362596ac0d31d5235a2a
2022-06-29 13:54:48 +00:00
Abby Sassel
9d93baa96f server/postgres: parameterise array variables in queries/subscriptions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4776
Co-authored-by: Tom Harding <6302310+i-am-tom@users.noreply.github.com>
Co-authored-by: Brandon Martin <40686+codedmart@users.noreply.github.com>
GitOrigin-RevId: ca962e3bfaa28ef00c5d04273d6604348d7da1c8
2022-06-29 13:37:11 +00:00
Brandon Martin
5e29a1304d Revert "Add _cast support for other postgres datatypes fix #6050 and …
…fix #5426"

This reverts commit f85742318167d1e51f463c45fcd00f26269c2555.

## Description ✍️
With this commit there is the possiblity that you could get conflicting
type definitions with remote schemas. Reverting for now as we determine
a solution. At which point we will add this back in.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4879
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 932b4a9226717c826d4bde7e375695354cee8c0c
2022-06-29 12:09:40 +00:00
Samir Talwar
5f38743f29 server: Encapsulate catalog versions in their own type.
This came about as I tried to add an instance over catalog versions and
found they were just simple integers most of the time (and in one case,
a float).

I think this change also clarifies how catalog versions work.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4864
GitOrigin-RevId: a6b7db86de564b71a8c2b602bee6a456b8e20d63
2022-06-29 08:19:33 +00:00
Daniel Chambers
59ffce9ac1 Generate TypeScript types for the Data Connector reference agent from the OpenAPI schema
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4855
GitOrigin-RevId: 4cc09d6706e67c69fbbedef72ff816365b9f7b4e
2022-06-29 07:43:52 +00:00
Karthikeyan Chinnakonda
4b2ca2ea63 server: Recreate event trigger tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4808
GitOrigin-RevId: c4eac26ec24036a6c6fb4fbdb1fdc57663eba21d
2022-06-29 06:46:18 +00:00
Daniel Chambers
f18e571455 Data Connectors: Fixed multiple relationships on the same table not generating correct query
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4880
GitOrigin-RevId: 537361cafca7ce4fc2a74b43740092bf09fcab6d
2022-06-29 01:08:11 +00:00
Auke Booij
8ccf7724ce server: Metadata origin for definitions (type parameter version v2)
The code that builds the GraphQL schema, and `buildGQLContext` in particular, is partial: not every value of `(ServerConfigCtx, GraphQLQueryType, SourceCache, HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject), ActionCache, AnnotatedCustomTypes)` results in a valid GraphQL schema. When it fails, we want to be able to return better error messages than we currently do.

The key thing that is missing is a way to trace back GraphQL type information to their origin from the Hasura metadata. Currently, we have a number of correctness checks of our GraphQL schema. But these correctness checks only have access to pure GraphQL type information, and hence can only report errors in terms of that. Possibly the worst is the "conflicting definitions" error, which, in practice, can only be debugged by Hasura engineers. This is terrible DX for customers.

This PR allows us to print better error messages, by adding a field to the `Definition` type that traces the GraphQL type to its origin in the metadata. So the idea is simple: just add `MetadataObjId`, or `Maybe` that, or some other sum type of that, to `Definition`.

However, we want to avoid having to import a `Hasura.RQL` module from `Hasura.GraphQL.Parser`. So we instead define this additional field of `Definition` through a new type parameter, which is threaded through in `Hasura.GraphQL.Parser`. We then define type synonyms in `Hasura.GraphQL.Schema.Parser` that fill in this type parameter, so that it is not visible for the majority of the codebase.

The idea of associating metadata information to `Definition`s really comes to fruition when combined with hasura/graphql-engine-mono#4517. Their combination would allow us to use the API of fatal errors (just like the current `MonadError QErr`) to report _inconsistencies_ in the metadata. Such inconsistencies are then _automatically_ ignored. So no ad-hoc decisions need to be made on how to cut out inconsistent metadata from the GraphQL schema. This will allow us to report much better errors, as well as improve the likelihood of a successful HGE startup.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4770
Co-authored-by: Samir Talwar <47582+SamirTalwar@users.noreply.github.com>
GitOrigin-RevId: 728402b0cae83ae8e83463a826ceeb609001acae
2022-06-28 15:53:44 +00:00
Daniel Harvey
e4da80421e server: Change withPath to take a single pathItem in MonadParse
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4815
GitOrigin-RevId: d0d889754944cc8270bdee2fd21b0cf5dcad9175
2022-06-28 10:08:09 +00:00
Samir Talwar
c2d0d272ee server: Create the BigQuery test tables and data in one go.
This has a couple of advantages:

1.  One query is probably faster than many.
2.  Creating a table with data is valid on the BigQuery sandbox (free tier); `INSERT INTO` is not.
3.  We eat fewer resources by not running any DML, and so should hit usage caps less often.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4867
GitOrigin-RevId: 70537d5b306e5231beb8ae197a95bd8ea995e1e9
2022-06-28 08:40:33 +00:00
Lyndon Maydwell
ab8369bdcf PG SSL-cert maybe fields
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4767
GitOrigin-RevId: 042fa622c6f208cf72fee40acee28e87ebcf1f67
2022-06-28 01:26:03 +00:00
Jesse Hallett
2f3ae93ab0 server: initial set of DTO types for metadata
This implements an initial set of DTO types that represent serialized metadata. These new types come with codecs using autodocodec which are used to derive both JSON serialization, and OpenAPI documentation. This ensures that we can automatically generate API documentation that is guaranteed to match JSON produced by the server.

For the moment the new types are not used for anything except to generate an early version of an OpenAPI document. Because this is early work the DTO types for each metadata format version list top-level properties only with placeholders for the types of each top-level property. This early iteration demonstrates using a sum type in Haskell that maps to a tagged union in OpenAPI (using the `version` field value as a tag).

This work is experimental and incomplete! Please do not incorporate the generated OpenAPI documentation into essential workflows at this time.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4801
GitOrigin-RevId: d2f110a6237b73520cdba24667333ef14e8cdd3d
2022-06-27 16:33:31 +00:00
Gil Mizrahi
38b1c0d774 server/tests/bigquery: Expose internal error information + handle teardown robustly + retry on jobRateLimitExceeded error
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4810
Co-authored-by: Samir Talwar <47582+SamirTalwar@users.noreply.github.com>
GitOrigin-RevId: e8696491475a668976a0e86322b7a8772ed9f946
2022-06-27 14:33:42 +00:00
Rakesh Emmadi
7634be3216 server: fix dropping column from a table that has update permissions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4840
GitOrigin-RevId: cea142fe225315f4f4094f157d8a95df14273306
2022-06-27 10:02:23 +00:00
awjchen
1db8ca4700 server: build event triggers earlier in the schema cache
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4597
GitOrigin-RevId: 2eb1d16fe1790fd4092c608d62beefb467e546f4
2022-06-27 00:37:57 +00:00
Brandon Simmons
b704192268 server: GHC 9.2 changes compatible with 8.10 (#3550)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4841
Co-authored-by: awjchen <13142944+awjchen@users.noreply.github.com>
GitOrigin-RevId: ce47b1290fefb07f3f800c6c62120437c02086e5
2022-06-25 22:09:05 +00:00
Solomon
baf196daa6 [GDW-111] Mockable GDC Agent for integration testing
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4802
GitOrigin-RevId: 36cdfcff4a864598a4d10e746ecdf93dae2b4c02
2022-06-25 19:06:54 +00:00
Samir Talwar
75c01223a8 server: Use plain assertions in pytest.
When pytest rewrites assertions to make them more useful, it also
truncates long assertion messages in the middle, often obscuring the
actual error.

Disabling this allows us to see the full message, which should hopefully
allow us to see the actual error.

In order to support this, we need to make sure that custom assertion
messages include the actual assertion information, as this will no
longer be rendered by pytest.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4835
GitOrigin-RevId: de6839a3b40d0edc7cb96e46625eebca0aaf0c95
2022-06-25 00:04:16 +00:00
Vishnu Bharathi
66105d6741 ci: build and publish multitenant docker image in cloud release pipeline
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4709
GitOrigin-RevId: 78c3a41fab37c20c674b55d8f5bd8a0a1f478115
2022-06-24 15:34:04 +00:00
Daniel Chambers
7ec5e79bd1 AVRelationship Support for Data Connectors [GDW-123]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4735
GitOrigin-RevId: f23965a6c7ea8a0e6b25dbf9d3faeccec0ef6ec3
2022-06-24 06:59:52 +00:00
Antoine Leblanc
664633fc4b Remove the source cache from the schema context
### Description

This PR removes the source cache from the schema context. :)

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4830
GitOrigin-RevId: af312a22b70d042c5faf8d67c0cee254537be836
2022-06-23 11:43:17 +00:00
Antoine Leblanc
661a1b6560 Remove source cache requirement in action schema
### Description

This PR removes the need for the `SourceCache` when building the schema for the actions. To do so, it changes the way we represent custom types in the source cache. Instead of trying to reuse the same `ObjectTypeDefinition` and `TypeRelationship`. we now have separate `AnnotatedObjectType` and `AnnotatedRelationship`. When building them, at schema cache building time, we persist all the relevant source information, so that it's all available at schema building time.

This PR makes no attempt at re-using `RemoteRelationship` primitives, to avoid having to change the way async action queries are executed, and to avoid having to make complicated changes to how we parse and represent those relationships.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4813
GitOrigin-RevId: 3cc65c5a043c8d3da5f7214eed40c558c4349327
2022-06-23 10:52:32 +00:00
Samir Talwar
8db9b77c77 server: Reorganize quasi-quoted names.
Pretty much all quasi-quoted names in the server code base have ended up in `Hasura.GraphQL.Parser.Constants`. I'm now finding this unpleasant for two reasons:

1. I would like to factor out the parser code into its own Cabal package, and I don't want to have to expose all these names.
2. Most of them really have nothing to do with the parsers.

In order to remedy this, I have:

1. moved the names used by parser code to `Hasura.GraphQL.Parser.DirectiveName`, as they're all related to directives;
2. moved `Hasura.GraphQL.Parser.Constants` to `Hasura.Name`, changing the qualified import name from `G` to `Name`;
3. moved names only used in tests to the appropriate test case;
4. removed unused items from `Hasura.Name`; and
5. grouped related names.

Most of the changes are simply changing `G` to `Name`, which I find much more meaningful.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4777
GitOrigin-RevId: a77aa0aee137b2b5e6faec94495d3a9fbfa1348b
2022-06-23 09:15:31 +00:00
Daniel Chambers
d896cc4d95 Replace Haskell DC Reference Agent with TypeScript DC Reference Agent in HSpec tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4689
Co-authored-by: Vishnu Bharathi <4211715+scriptnull@users.noreply.github.com>
GitOrigin-RevId: 9dc6a2e373b3d7ab0bdce7ddcd7b7e6e5b1dc498
2022-06-23 08:09:46 +00:00
Solomon
fbfa32207d Fixes asyncActionsFetchIntervalEnv help message.
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4832
GitOrigin-RevId: 0acc9f5ab5eb4ba6ee2eb45d870a80df0be223c1
2022-06-23 05:07:13 +00:00
Solomon
cb10636177 Updates arg parser HGE header
## Description ✍️
The `--help` header was out of date. This PR updates it to match the description on github.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4831
GitOrigin-RevId: 449f71b2901318132e45445632b1a8af358c0afb
2022-06-23 01:28:30 +00:00
Antoine Leblanc
609cab89e6 Backend-agnostic custom scalars
### Description

This small clean-up PR makes one further step towards backend-agnostic actions: it makes all the code parsing custom types backend agnostic. Surprisingly, this could be done *without* the need to finish generalizing the column parser. The remaining sore point is async queries, that still target Postgres explicitly.

In theory, this is enough to start allowing non-Postgres scalars in custom types. In practice, however:
- no other backend exposes scalars in a way that would allow users to do that as of this PR;
- we currently have no strategy to avoid / detect scalar collisions across backends.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4691
GitOrigin-RevId: bfe63fb131e306663d4406697ce23c02736566c5
2022-06-22 13:14:40 +00:00
Benoit Ranque
e6614db17b console: Hide timescaledb internal schema from data tab
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4439
Co-authored-by: Sooraj <8408875+soorajshankar@users.noreply.github.com>
GitOrigin-RevId: 49c746e8d23b87363462942d4823c7ab9de2744e
2022-06-22 07:38:38 +00:00
paritosh-08
98d899d4ba server: add update_source API and extend add_source to edit source customization
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4705
Co-authored-by: Rakesh Emmadi <12475069+rakeshkky@users.noreply.github.com>
GitOrigin-RevId: d185f19c88c4030075522d001fdbc0bafa66db8f
2022-06-22 07:07:28 +00:00
Daniel Harvey
88ace749bc server: Fix a bunch of HLint suggestions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4738
GitOrigin-RevId: d0c0b13ac02ca80e51ae3d582f2e6917f76ad202
2022-06-21 11:12:42 +00:00
Vishnu Bharathi
6b71746afd ci: tag release v2.8.1 and v2.9.0-beta.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4805
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
Co-authored-by: Philip Lykke Carlsen <358550+plcplc@users.noreply.github.com>
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: 10c5557319c7f106c251c308efee6c135edc3fcd
2022-06-21 10:10:10 +00:00
Brandon Simmons
80cc53aaac server: vendor used bits of 'ip' package to cut dependencies
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4704
GitOrigin-RevId: 14759b410e99a1a97aa01b1139d9d61292301aff
2022-06-20 23:16:51 +00:00
Samir Talwar
dd5198d0ba Nix: Use nixpkgs-fmt to format everything.
You can now run `nix fmt` (or `make format-changed`) to reformat Nix
files.

This is not enforced by CI.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4754
GitOrigin-RevId: a2e7cbe6c037d68ba6303278616314de60b6aa72
2022-06-20 13:02:45 +00:00
Gil Mizrahi
3e81ab3a57 server/postgres: test identifier uniqueness rewrite
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4693
GitOrigin-RevId: bd882835b86a37df125f79d5597826a15498fcaf
2022-06-17 10:44:18 +00:00
Daniel Harvey
03c93ad96f server: Refactor TByteString to SerializableBlob
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4736
GitOrigin-RevId: 446832b00c24205c2237666ac9d954277c5fd05d
2022-06-17 09:57:38 +00:00
Philip Lykke Carlsen
f33fad5fc1 Zendesk-5146 followup tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4768
GitOrigin-RevId: 2d182344d724cf0fc07ec73f8a3c4d786afe9243
2022-06-17 08:45:13 +00:00
Philip Lykke Carlsen
6a15d3ea5f Fix zendesk-5146. Add check for empty columns in unique constraints g…
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4764
GitOrigin-RevId: 79e62f1ea2639ec81a48f5f71b58eaadf4fe6482
2022-06-17 07:49:20 +00:00
Daniel Harvey
921ada70e9 tooling: Opt-in shared tooling
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4753
GitOrigin-RevId: 3fc3324e584210e57e5acb9d8361d4e5b3caf26a
2022-06-16 17:12:35 +00:00
Daniel Harvey
2bb1aa543c server: runParse returns QErr
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4759
GitOrigin-RevId: c0bfe928e4cdb457b374df197b82c3882ae4410e
2022-06-16 12:22:30 +00:00
Daniel Harvey
0f97c27115 Replace ParseT with Parse
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4724
GitOrigin-RevId: d742bc876ca11dbbe7e3f02bbdf9bf9c2440cbe6
2022-06-16 11:12:10 +00:00
Evie Ciobanu
8f0b3f6d06 server: build/run unit tests faster
This aims to support loading up a `ghci repl` with both the `graphql-engine` library and the unit tests. This is currently not officially supported by cabal, but it uses a hack, which is why I added a flag. See the updated documentation for more info.

Also see

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4739
GitOrigin-RevId: 5e7b15855a7a829ed76b5830be1efc9146d25da6
2022-06-16 10:39:24 +00:00
Daniel Harvey
249cbb914e server: Replace ValidationT with ExceptT in ParseT (close #3641)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4712
GitOrigin-RevId: 6acfd8dc2276962d333c68ac85a7a729e87b6d2d
2022-06-16 09:54:09 +00:00
David Overton
5c7489cc23 Flesh out capabilities types
>

## Description ✍️
->

Fleshes out the Capabilities types used by Data Connector agents.

### Related Issues ✍
->

https://hasurahq.atlassian.net/browse/GDW-85

### Solution and Design ✍
>

Capabilities are divided into sections for queries, mutation, subscriptions, filtering and relationships:
```haskell
data Capabilities = Capabilities
  { cQueries :: Maybe QueryCapabilities,
    cMutations :: Maybe MutationCapabilities,
    cSubscriptions :: Maybe SubscriptionCapabilities,
    cFiltering :: Maybe FilteringCapabilities,
    cRelationships :: Maybe RelationshipCapabilities
  }
```

Each section is optional. If the section is absent it means the the related capabilities are not supported by the agent.
The types for each section can contain additional details about exactly what is supported. E.g.
```haskell
data QueryCapabilities = QueryCapabilities
  { qcSupportsPrimaryKeys :: Bool
  }
```

These are currently mostly empty, but will be filled in later.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4671
GitOrigin-RevId: 3d48570266bfce5e177a543a0ed6f63a7b450f0b
2022-06-16 08:31:07 +00:00
Tom Harding
16213a9b77 Remove resolveUnpreparedValue
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4743
GitOrigin-RevId: 1d532ac2475e292e587581ac840d056e3b96a951
2022-06-15 18:17:23 +00:00
Naveen Naidu
2526dd0114 server: fix create event trigger failure on tables with MSSQL reserved keywords as name
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4648
GitOrigin-RevId: 5e3eb614350b047f2e2384fea9b234bf0ad9d47f
2022-06-15 17:11:44 +00:00
Rakesh Emmadi
b4534c1177 server/bigquery: apply LIMIT to computed field subqueries
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4694
GitOrigin-RevId: 9a0b7dd4afa5257b12b9e0e02e26b2ca6d283c9d
2022-06-15 16:31:46 +00:00
Vishnu Bharathi
f96b5462ff ci: tag release v2.8.0 and v2.8.0-pro.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4732
GitOrigin-RevId: cc258aff48eed06ab2b2086f71c5e5220f608038
2022-06-15 13:59:02 +00:00
Auke Booij
26e39b130e server: avoid some imports in Hasura.GraphQL.Parser.Class
This avoids an import of `Hasura.GraphQL.Parser.Internal.Types`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4713
GitOrigin-RevId: d878465966207622af997979d424e7a25a6e1cac
2022-06-15 11:54:06 +00:00
Samir Talwar
1f2f9a8f94 server: Fix up the instructions on testing against BigQuery.
This improves the experience of testing against BigQuery in a few ways:

1.  There is an explicit instruction to create a dataset, which was not
    documented.
2.  The verification script uses the environment variables, just like the
    tests.
3.  The verification script passes the correct content type headers.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4706
GitOrigin-RevId: 15b5bd28b1762c130c0ec09d6babe8c08e05ab15
2022-06-15 09:45:19 +00:00
Tom Harding
0f553cf1a3 Remove Data.Set.Extended
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4698
GitOrigin-RevId: 06104ea4c67301f058bb24fd395707bb69721954
2022-06-15 09:02:23 +00:00
Gil Mizrahi
5dd3f71539 server/telemetry: support multiple sources
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4493
GitOrigin-RevId: 3b34ea0aa6f78fa43c8d372d8b61d49191632eff
2022-06-15 08:03:31 +00:00
Daniel Harvey
9ee4d248cb Update MacOS setup instructions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4715
GitOrigin-RevId: 9b2634084cfffecef5bde3645fd1dceaced8960e
2022-06-15 07:08:23 +00:00
paritosh-08
0dd6e69131 server: fix incorrectly ignoring the experimental feature naming_convention
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4728
GitOrigin-RevId: 5ed2406ec15d3fbbd3d8a31f28da5c217810804a
2022-06-15 05:21:15 +00:00
Jesse Hallett
f14891c64b docs: add info to server error message when env var missing in webhook preview
When a user changes request options in a custom action through the
console that triggers a request to the server to test webhook transform
options, and to show a preview of the result. If the action uses an
environment variable in its webhook URL, and there is no mock value for
that variable in the action's sample context then the user will see an
error. This change expands the error message to explain what caused the
error, and how to fix it.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4556
GitOrigin-RevId: 75b19bae17aac982c2bdfbd4417bd55923889f2f
2022-06-14 16:25:41 +00:00
paritosh-08
620de6ee42 server: add default naming convention to TenantConfig
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4710
GitOrigin-RevId: c989bed76fb22eef13304b0d8ef02b53dd70fd59
2022-06-14 09:18:20 +00:00
Daniel Chambers
0723925ffc Expose the entire official Chinook dataset through the DC Reference agent and use it in the tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4688
GitOrigin-RevId: f87b2e23be69aed3cc7f95e814f9426db174dc9b
2022-06-13 20:59:48 +00:00
Philip Lykke Carlsen
8510cbfe87 Remove redundant strict data declartions
We already enable `-XStrictData` in `graphql-engine.cabal`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4699
GitOrigin-RevId: c5c17ed75319da794d5a1655ac9b069f0fa68dea
2022-06-13 13:18:17 +00:00
Tom Harding
2c3b483a08 Remove partial NonEmpty.fromList calls (closes #3865)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4665
GitOrigin-RevId: 637c61a1612c4e31aabc247b07a836d16454c470
2022-06-13 11:20:53 +00:00
Solomon
97ae14a43a [GDW-93] Fix "conflicting definitions" when using both DC backend and PG backend
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4686
GitOrigin-RevId: 254e2ad5d951f73a799e55b1dbcfaa0097054122
2022-06-10 04:00:07 +00:00
Tom Harding
e22eb1afea Weeding (2/?)
## Description

Following on from #4572, this removes more dead code as identified by Weeder. Comments and thoughts similarly welcome!

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4587
GitOrigin-RevId: 73aa6a5a2833ee41d29b71fcd0a72ed19822ca73
2022-06-09 16:40:49 +00:00
Rakesh Emmadi
fbc98bcc25 server/bigquery: add a reference to github ticket for computed field limit issue
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4658
GitOrigin-RevId: cc4e1165682d484408ef22fcedd16bc793f4d918
2022-06-09 15:36:34 +00:00
Brandon Simmons
623b856101 fix hspec tests broken during merge of #4611
tests-hspec don't fail the merge so this got through

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4668
GitOrigin-RevId: 1205c2da0340500d63f4c83601416bb234d2b60e
2022-06-08 19:38:12 +00:00
Benoit Ranque
525361d3d2 escape sql underscores in LIKE expressions (close #8435)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4596
GitOrigin-RevId: 48f143b8e6bbc60371656cc4bfbae1a5864f9921
2022-06-08 18:54:19 +00:00
Philip Lykke Carlsen
12c3eddef7 Amendments to the hspec testsuite
This PR proposes some changes to the hspec testsuite:

* It amends the framework to make it easier to test from the ghci REPL
* It introduces a new module `Fixture`, distinguished from `Context` by:
   * using a new concept of `SetupAction`s which bundle setup and teardown actions into one abstraction, making test system state setup more concise, modularized and safe (because the fixture know knows about the ordering of setup actions and can do partial rollbacks)
   * somewhat opinionated, elides the `Options` of `Context`, preferring instead that tests that care about stringification of json numbers manage that themselves.

(Note that this PR builds on #4390, so contains some spurious commits which will become irrelevant once that PR is merged)

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4630
GitOrigin-RevId: 619c8d985aed0aa42de31d6f16891d0782f4b4b5
2022-06-08 16:36:50 +00:00
Brandon Simmons
6e8da71ece server: migrate to aeson-2 in preparation for ghc 9.2 upgrade
(Work here originally done by awjchen, rebased and fixed up for merge by
jberryman)

This is part of a merge train towards GHC 9.2 compatibility. The main
issue is the use of the new abstract `KeyMap` in 2.0. See:
https://hackage.haskell.org/package/aeson-2.0.3.0/changelog

Alex's original work is here:
#4305

BEHAVIOR CHANGE NOTE: This change causes a different arbitrary ordering
of serialized Json, for example during metadata export. CLI users care
about this in particular, and so we need to call it out as a _behavior
change_ as we did in v2.5.0. The good news though is that after this
change ordering should be more stable (alphabetical key order).

See: https://hasurahq.slack.com/archives/C01M20G1YRW/p1654012632634389

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4611
Co-authored-by: awjchen <13142944+awjchen@users.noreply.github.com>
GitOrigin-RevId: 700265162c782739b2bb88300ee3cda3819b2e87
2022-06-08 15:32:27 +00:00
Vishnu Bharathi
af20404ac0 ci: tag release v2.8.0-beta.1 and v2.8.0-beta.1-pro.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4659
Co-authored-by: Tirumarai Selvan <8663570+tirumaraiselvan@users.noreply.github.com>
GitOrigin-RevId: 85914a11c339d9d77f265da702e38d3f9f46ff59
2022-06-08 08:31:09 +00:00
Philip Lykke Carlsen
3e33fd6ff7 Make on_conflict schema available abstract of update permissions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4390
GitOrigin-RevId: 5f3f9da173cad37f9330c5a27fd1edfc2559a4d6
2022-06-07 23:25:48 +00:00
Rakesh Emmadi
270fe74f67 server/bigquery: define select permissions for computed fields returning custom table schema
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4628
GitOrigin-RevId: 604b4d592dc438c88790add6319ee4f246cc25b9
2022-06-07 16:50:17 +00:00
Antoine Leblanc
e3c2bf53a5 Move, document, and prune action types and custom types types.
### Description

This PR is a first step in a series of cleanups of action relationships. This first step does not contain any behavioral change, and it simply reorganizes / prunes / rearranges / documents the code. Mainly:
- it divides some files in RQL.Types between metadata types, schema cache types, execution types;
- it renames some types for consistency;
- it minimizes exports and prunes unnecessary types;
- it moves some types in places where they make more sense;
- it replaces uses of `DMap BackendTag` with `BackendMap`.

Most of the "movement" within files re-organizes declarations in a "top-down" fashion, by moving all TH splices to the end of the file, which avoids order or declarations mattering.

### Optional list types

One main type change this PR makes is a replacement of variant list types in `CustomTypes.hs`; we had `Maybe [a]`, or sometimes `Maybe (NonEmpty a)`. This PR harmonizes all of them to `[a]`, as most of the code would use them as such, by doing `fromMaybe []` or `maybe [] toList`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4613
GitOrigin-RevId: bc624e10df587eba862ff27a5e8021b32d0d78a2
2022-06-07 15:45:00 +00:00
Antoine Leblanc
eaba2e08d3 Clean Relay's code, break schema cycles, introduce Node ID V2
## Motivation

This PR rewrites most of Relay to achieve the following:
- ~~fix a bug in which the same node id could refer to two different tables in the schema~~
- remove one of the few remaining uses of the source cache in the schema building code

In doing so, it also:
- simplifies the `BackendSchema` class by removing `node` from it,
- makes it much easier for other backends to support Relay,
- documents, re-organizes, and clarifies the code.

## Description

This PR introduces a new `NodeId` version ~~, and adapts the Postgres code to always generate this V2 version~~. This new id contains the source name, in addition to the table name, in order to disambiguate similar table names across different sources (which is now possible with source customization). In doing so, it now explicitly handles that case for V1 node ids, and returns an explicit error message instead of running the risk of _silently returning the wrong information_.

Furthermore, it adapts `nodeField` to support multiple backends; most of the code was trivial to generalize, and as a result it lowers the cost of entry for other backends, that now only need to support `AFNodeId` in their translation layer.

Finally, it removes one more cycle in the schema building code, by using the same trick we used for remote relationships instead of using the memoization trick of #4576.

## Remaining work

- ~~[ ]write a Changelog entry~~
- ~~[x] adapt all tests that were asserting on an old node id~~

## Future work

This PR was adapted from its original form to avoid a breaking change: while it introduces a Node ID V2, we keep generating V1 IDs and the parser rejects V2 IDs. It will be easy to make the switch at a later data in a subsequent PR.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4593
GitOrigin-RevId: 88e5cb91e8b0646900547fa8c7c0e1463de267a1
2022-06-07 13:36:29 +00:00
Naveen Naidu
0817d46f1a server: log details of healthcheck failure
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4634
GitOrigin-RevId: 9a0c2ecd3db3fba15e352c9318127a82a36ac52b
2022-06-07 11:24:20 +00:00
Puru Gupta
93e58e093b multitenant: fix serialisation error in scheduled triggers on startup (fix #4360)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4625
GitOrigin-RevId: d61f46d0e8208d7d6fb0f3abfa3ae87329ef94e5
2022-06-07 07:09:56 +00:00
Karthikeyan Chinnakonda
d905911eab server: disable query/subscription root fields
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4524
Co-authored-by: Auke Booij <164426+abooij@users.noreply.github.com>
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: 1cae7a1596825925da9e82c2675507482f41c3fb
2022-06-07 05:33:12 +00:00
Solomon
01f56735ac Feature/gdw 113
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4620
GitOrigin-RevId: f732fff4f3f2449ebc97f76522ee6ad11bcfbc68
2022-06-07 01:35:38 +00:00
Rakesh Emmadi
524819b4b7 server: rename spiScalarComputedFields to spiComputedFields
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4629
GitOrigin-RevId: 53d72d8ed73ecab486718f424bbd8d30c6f423bf
2022-06-06 07:24:03 +00:00
Puru Gupta
ebc8cd5134 server: do not serialize env vars in logs or errors: PR III - Event Triggers
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4521
Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com>
Co-authored-by: Brandon Simmons <210815+jberryman@users.noreply.github.com>
GitOrigin-RevId: c7702e8f3da466dc108936328de30ceb87df258a
2022-06-05 20:28:13 +00:00
pranshi06
056765578f server: add support for custom scalar in action output types
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4185
GitOrigin-RevId: 16a24fdcdbd195b4b59bcca7957c469ba073dabb
2022-06-03 09:48:26 +00:00
David Overton
6586053296 Gdw 85/capabilities endpoint
>

## Description ✍️

- Creates a new `/capabilities` endpoint for the GDC agent API
- Removes capabilities from the `/schema` endpoint
- Removes the `/config-schema` endpoint and includes the `ConfigSchemaResponse` within the `CapabilitiesResponse`

### Related Issues ✍
->

https://hasurahq.atlassian.net/browse/GDW-85

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4478
GitOrigin-RevId: 426662ee9e751343d94207d439a5025df65d2de7
2022-06-03 08:08:23 +00:00
Daniel Chambers
e5c1106864 server: Send source name as a header to Data Connector agents [GDW-110]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4614
GitOrigin-RevId: f7828d4c0bbf4c46059b08b86b22915cc8de3cbf
2022-06-02 05:23:51 +00:00
Daniel Chambers
1dbdb0236c server: Data Connector IR refactor, support for column boolean comparison expressions [GDW-114]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4579
GitOrigin-RevId: 84da015123a53124488b88ce66bde26113625754
2022-06-02 02:07:57 +00:00
hasura-bot
e48f3cbef1 Add _cast support for other postgres datatypes fix #6050 and fix #5426
GITHUB_PR_NUMBER: 8524
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/8524

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4551
Co-authored-by: Abdullah Saleem <5978905+abdullah2993@users.noreply.github.com>
Co-authored-by: Abby Sassel <3883855+sassela@users.noreply.github.com>
GitOrigin-RevId: f85742318167d1e51f463c45fcd00f26269c2555
2022-06-01 16:41:49 +00:00
Tom Harding
a3031aed03 Add Weeder, begin weeding (1/?)
## Description

This PR adds a config file for [`weeder`](https://github.com/ocharles/weeder) to the `-mono` repository. `weeder` checks for dead code by building a call graph from the given entry points (currently every module named `Main` with a `main` function) and then marking every function _not_ in that call graph as dead code.

To avoid very large PRs, I'm going to tackle this in a series. This first PR adds the basic configuration, plus removes as many weeds as it took for me to realise this was going to become a very big PR. The PRs after this will largely be removing dead code, until the final PR that will add Weeder to the CI pipeline.

### Related Issues

This closes #2973.

## Affected components

- Server

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4572
GitOrigin-RevId: ac8eaa9473e5ac1f16babcb35388694392d0d7dc
2022-05-31 15:43:34 +00:00
Naveen Naidu
11867b50a4 server: extend backend_only setting for update and delete permissions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4530
Co-authored-by: Karthikeyan Chinnakonda <15602904+codingkarthik@users.noreply.github.com>
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: c4c1a3bd9736ec275e77c6f55c76049c550443f9
2022-05-31 14:42:14 +00:00
paritosh-08
e053ffe8ec server: hotfix for default naming convention issue
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4585
GitOrigin-RevId: 8e9e7eef0017e9c634167b08c4d2a61ee7ac1fdf
2022-05-31 09:09:04 +00:00
pranshi06
cd0f674821 server: Adds support to return array of scalars in Actions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3661
GitOrigin-RevId: bc37e7aa0cb861069536aa97aa4dff1fdc05e08b
2022-05-31 05:23:47 +00:00
Auke Booij
13fc1c62d1 Move Hasura.GraphQL.Parser.Column to .RQL.IR. and .GraphQL.Schema.
This is a first step towards clarifying the role of `UnpreparedValue` as part of the IR. It certainly does not belong in the parser framework.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4588
GitOrigin-RevId: d1582a0b266729b79e00d31057178a4099168e6d
2022-05-30 22:07:57 +00:00
Abby Sassel
1f68bd3c03 server/docs: add error message to troubleshooting.md
for easier searchability. from discussion at https://hasurahq.slack.com/archives/CV3UR1MT2/p1653911179537459?thread_ts=1653656301.295359&cid=CV3UR1MT2

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4586
GitOrigin-RevId: d0df3eade14050f99d549dc004372a4fb0ec378a
2022-05-30 15:28:35 +00:00
Rakesh Emmadi
af6eb1232e server/bigquery: computed fields SQL generation and execution
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4555
GitOrigin-RevId: c668cb6bd76ed646b9449d8037c2f9038c99e3a8
2022-05-30 15:24:33 +00:00
Tom Harding
59df4dffb3 [gh-pages] Remove broken haddock links from hasura.github.io
Hello!

I noticed that on [the deployed docs](https://hasura.github.io/graphql-engine/server/), [the first Haddock link](https://hasura.github.io/graphql-engine/server/haddock) and alpha/beta links were broken. I've removed the broken links and checked the other two.

Thanks!

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4536
GitOrigin-RevId: 52d575996c01c2ebf2396987b39474013c93812d
2022-05-30 12:22:49 +00:00
Gil Mizrahi
ae0dae0eed fix insertion of multiple empty objects
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4583
GitOrigin-RevId: a4eebf7d734c6556c2509ac66ccafbdb520189ba
2022-05-30 12:18:36 +00:00
Antoine Leblanc
8a999bd44d Structural updates to the server's engineering documentation
### Description

This PR does several things:
- it cleans up some structural issues with the engineering documentation:
  - it harmonizes the table of contents structure across different files
  - adds a link to the bigquery documentation
  - moves some files to a new `deep-dives` subfolder
  - puts a title at the top of each page to avoid github assuming their title is "table of contents"
- it pre-fills the glossary with a long list of words that could use an entry (all empty for now)
- it adds the only remaining relevant server file from [hasura-internal's wiki](https://github.com/hasura/graphql-engine-internal/wiki): the old "multiple backends architecture" file

### Discussion

A few things worth discussing in the scope of this PR:
- is it worth migrating old documentation such as the multiple backends architecture, that document a decision process rather instead of being up-to-date reflections of the code? are we planning to delete hasura-internal?
- should we focus instead on _new_ documentation, aimed to be kept up to date?
- are there other old documents we want to move in here, or is that it?
- is this glossary structure ok, or would a purely alphabetical structure make sense?
- does it make sense to have the glossary only in the engineering section? more generally, _what's our broader plan for documentation_?

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4537
GitOrigin-RevId: c2b674657b19af7a75f66a2a304c80c30f5b0afb
2022-05-30 09:46:06 +00:00
Abby Sassel
2518d16191 Create troubleshooting.md
Documenting a workaround discussed at https://hasurahq.slack.com/archives/C03263T1L9W/p1653561662369129 in a new Troubleshooting doc

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4575
GitOrigin-RevId: eb80662b93f157d363cd0b53993fc5bb5972b546
2022-05-30 09:18:44 +00:00
Antoine Leblanc
cdf5e3b5f0 Specialize RQL.DML to postgres.
### Description

When generalizing the code, back in late 2020, we over-eagerly generalized parts of the code that are specific to RQL's DML. This was in part due to the fact that, at the time, the DML types were all mixed alongside other types in `RQL.Types`. As a result, a lot of `RQL.DML.Internal` was generic over the backend type, instead of being specialized to `'Postgres 'Vanilla`.

A consequence of this is that, before this PR, `DML.Internal` ended up having a dependency on non-Postgres backends, due to the use of `annBoolExp`, which requires a `BackendMetadata` instance. Since the code was written in a generic manner, `DML.Internal` in turn depended on having the metadata instances in scope... This PR changes that to, instead, explicitly import the Postgres instance.

(Note that this module didn't import `RQL.Types.Metadata.Instances`, but depends on a module that imports it, and **orphan instances are transitively imported**, as evidenced by the need for that explicit import in #4568.)

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4573
GitOrigin-RevId: 7b82b5d7c23c03654518a1816802d400f37c3c64
2022-05-27 18:23:19 +00:00
Antoine Leblanc
498442b1d3 Remove circular dependency in schema building code
### Description

The main goal of this PR is, as stated, to remove the circular dependency in the schema building code. This cycle arises from the existence of remote relationships: when we build the schema for a source A, a remote relationship might force us to jump to the schema of a source B, or some remote schema. As a result, we end up having to do a dispatch from a "leaf" of the schema, similar to the one done at the root. In turn, this forces us to carry along in the schema a lot of information required for that dispatch, AND it forces us to import the instances in scope, creating an import loop.

As discussed in #4489, this PR implements the "dependency injection" solution: we pass to the schema a function to call to do the dispatch, and to get a generated field for a remote relationship. That way, this function can be chosen at the root level, and the leaves need not be aware of the overall context.

This PR grew a bit bigger than that, however; in an attempt to try and remove the `SourceCache` from the schema altogether, it changed a lot of functions across the schema building code, to thread along the `SourceInfo b` of the source being built. This avoids having to do cache lookups within a given source. A few cases remain, such as relay, that we might try to tackle in a subsequent PR.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4557
GitOrigin-RevId: 9388e48372877520a72a9fd1677005df9f7b2d72
2022-05-27 17:22:38 +00:00
Antoine Leblanc
cbe0479406 Remove unrelated functions from GraphQL.Schema.Common
### Description

There were several functions in `GraphQL.Schema.Common` that were unrelated to the schema building process, and were about metadata manipulation or dependency computation. Having those functions in the schema part of the code forces several places in the code to depend on the schema code, despite being completely unrelated.

This PR moves those functions where they make sense: alongside similar functions in `RQL.Types.*`, and rewrites `getRemoteDependencies` for clarity (it was using the term "indirect dependency" in a way that was inconsistent with the rest of the code).

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4568
GitOrigin-RevId: 948a18cebbb337a8bb6367c1f2d2ef5628209d96
2022-05-27 15:41:06 +00:00
Auke Booij
cda117a4a9 Add unless/when related hints
Example:

```
server/src-lib/Hasura/RQL/DDL/Schema/Table.hs:(200,15)-(205,28): Warning: Use when
Found:
  if tnGQL `elem` ns then
      throw400 RemoteSchemaConflicts
        $ "node " <> tnGQL <> " already exists in current graphql schema"
  else
      pure ()
Perhaps:
  when
    (tnGQL `elem` ns)
    (throw400 RemoteSchemaConflicts
       $ "node " <> tnGQL <> " already exists in current graphql schema")
```

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4570
GitOrigin-RevId: 1b04e5e39d20c99643220154c03dae82a025f0f1
2022-05-27 13:34:42 +00:00
Antoine Leblanc
9308c92e8d Fix a /= [] and add hint.
### Description

Several places in the code used `a /= []`, which is inelegant. To my surprise, hlint did not warn about this, despite the fact that it forces an `Eq` instance on the elements. This PR replaces all occurrences of that pattern with `not (null a)` and adds a lint warning for it.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4569
GitOrigin-RevId: 6471e75ade9e71e5d583a0dac7815c01870c696b
2022-05-27 12:28:24 +00:00
paritosh-08
42da1dbc2e server/docs: follow up on the naming convention
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4563
GitOrigin-RevId: 0ae1f226a63dae34e6cb0d001b4915c05b0974cf
2022-05-27 05:56:52 +00:00
Gil Mizrahi
2b3d7c407b server/mssql: drop the temp table after delete
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4562
GitOrigin-RevId: f5f5815d9e2f58912a294cf564cfdc38995263d3
2022-05-26 15:21:54 +00:00
Evie Ciobanu
a8c0137f21 server: add infrastructure to write runit tests for update parsers
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4533
GitOrigin-RevId: d094149d6cbdeebe152c58032715bad725480d9b
2022-05-26 14:06:24 +00:00
paritosh-08
fd30fb343b server: naming conventions for auto generated fields
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3982
Co-authored-by: Brandon Simmons <210815+jberryman@users.noreply.github.com>
GitOrigin-RevId: f90b2e8f394e7bd69780f003d2d980475f104f42
2022-05-26 11:55:29 +00:00
Vishnu Bharathi
0d1f1aad9a ci: tag release v2.7.0
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4553
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: 6b822051ab9b72b2de93a0367a8fedaef544fab3
2022-05-25 10:55:59 +00:00
Rakesh Emmadi
acde210fdc server/bigquery: generate graphql schema for table computed fields
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4460
GitOrigin-RevId: 7b772cd9fba6b612ad05eb1aca1fa13e6ae8556d
2022-05-25 10:25:38 +00:00
Abby Sassel
45843b94d9 server/tests: fix Bigquery HTTP request failed with status code 400 and status message "Bad Request"
Fixes https://github.com/hasura/graphql-engine-mono/issues/4546

Error: `Bigquery HTTP request failed with status code 400 and status message "Bad Request" `

Likely fix: untrack `author` table before dropping it in `SerializationSpec`. [This is the main change](fadbbfe8f2), the rest is cleanup.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4548
GitOrigin-RevId: 36be213d8ccfeb2dbb6b797225dc07e6e3dc83ba
2022-05-24 17:08:52 +00:00
Auke Booij
cb67ad5e95 server: Clean up some deriving statements
By generalizing the instances, they can be written as attached instance derivations, rather than standalone ones.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4518
GitOrigin-RevId: 7a387911cf6ad46fe6acd36648275d6c2c68ffe3
2022-05-24 07:22:55 +00:00
Daniel Chambers
9e5f860a29 server: Default SourceMetadata's kind to Postgres Vanilla
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4514
Co-authored-by: David Overton <7734777+dmoverton@users.noreply.github.com>
GitOrigin-RevId: 37572758c3722a85ac005f5bd13a9bf6a407bad4
2022-05-24 04:16:44 +00:00
Auke Booij
82ceafaf44 Remove unused schema.graphql resource
This file was no longer needed after the PDV refactor (hasura/graphql-engine#4111). It was replaced by `Hasura.GraphQL.Schema.Introspect`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4532
GitOrigin-RevId: 61a5f44a9e68238d61095a3f176b2d5847c63307
2022-05-23 16:44:20 +00:00
Puru Gupta
d5e46b6041 server: do not serialize env vars in logs or errors: PR II - Actions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4486
Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com>
Co-authored-by: Brandon Simmons <210815+jberryman@users.noreply.github.com>
GitOrigin-RevId: 35bb05f9a3c98689c05f2865e0923c00b46e5419
2022-05-23 11:13:49 +00:00
Puru Gupta
5501f686df server: do not serialize env vars in logs or errors: PR I - Remote Schemas
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4463
Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com>
Co-authored-by: Brandon Simmons <210815+jberryman@users.noreply.github.com>
GitOrigin-RevId: 71c6824130d71312f5bd5ae94fc268c0544c6ca3
2022-05-21 09:05:59 +00:00
Vamshi Surabhi
73b161b2bc move action IR types to IR.Actions module
A very minor cleanup (came out of documenting the architecture of actions). Does what's mentioned in the title.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4451
GitOrigin-RevId: d480ff438256df468df65b43d15f92a30b14b997
2022-05-14 11:10:42 +00:00
Vishnu Bharathi
b6eb71ae07 ci: tag release for v2.6.2 and v2.7.0-beta.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4499
GitOrigin-RevId: 8c4c6256ea953c55f8db03460e32d0a775d0d2ea
2022-05-12 17:45:42 +00:00
Lyndon Maydwell
5d5552f185 Fix for too much information in Pro PSQL exceptions wrt. Certificates
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4475
GitOrigin-RevId: 8a64b4387c559ca447252dcadf6c5e231b079c65
2022-05-12 14:30:35 +00:00
Gil Mizrahi
cd38a9a1fc server/postgres + server/mssql: Insert empty objects with default values
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4487
Co-authored-by: Abby Sassel <3883855+sassela@users.noreply.github.com>
GitOrigin-RevId: 3413f0b5dbe6ec42fff360d83b5202e4aa4aa86e
2022-05-11 16:01:57 +00:00
Solomon
b4f89569c8 GDC: Integration Tests and Servant Agent
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4467
GitOrigin-RevId: 5e81d8581197c90ad2de9106e724c63d7592ae72
2022-05-11 06:15:27 +00:00
Tom Harding
3db241155d Make ForeignKey mappings non-empty
Previously, these were represented with a HashMap, but supposedly that map can never be empty. Now, it uses NEHashMap, which carries the non-empty invariant behind a smart constructor.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4481
GitOrigin-RevId: 93ad9aaa9354f25a1ba10e8207ae19614e1e439e
2022-05-10 15:44:46 +00:00
Karthikeyan Chinnakonda
ce9912ff8c server: run_sql to not drop the SQL triggers created by the graphql-engine
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4397
GitOrigin-RevId: dcd43fc31f64af8c6c9c92c66d46a593d5b12fbd
2022-05-10 13:47:16 +00:00
Antoine Leblanc
697137dd77 Fix Postgres not padding timestamps correctly (fix hasura/graphql-engine#8096)
## Description

As identified in hasura/graphql-engine#8096, the format string we used for timestamps was incorrect; we were using `%F`, which expands to `%Y-%m-%d`; but that meant that the year was not padded to four digits: `0001` would be represented simply as `1`. However, Postgres inteprets that `1` as `2001`, probably due to interpretation rules about two-digit years (in `25/12/01`, `01` is indeed `2001`).

```
# create table timestamp_test ( test timestamptz );
CREATE TABLE
# insert into timestamp_test values ('1-01-01T00:00:57Z');
INSERT 0 1
# select * from timestamp_test;
          test
------------------------
 2001-01-01 00:00:57+00
(1 row)
```

To fix this, this PR changes the format string to use `%0Y`, which always pads the year number with zeroes.

## Remaining work

- [x] write Changelog entry
- [ ] copy timestamp tests from the python suite into the hspec tests

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3536
GitOrigin-RevId: fa144111358339fd4a35b32d888c1d2c5b418ea6
2022-05-09 12:18:18 +00:00
Evie Ciobanu
d1f8b9a87d server: further improve anybackend module docs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4465
GitOrigin-RevId: fda2b45468a94d5b25f9d5aed8199502ee9370ad
2022-05-09 10:12:59 +00:00
hasura-bot
8bf2dd0c65 Improve COMPILING-ON-MACOS.md
GITHUB_PR_NUMBER: 8472
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/8472

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4466
Co-authored-by: Nico Burns <1007307+nicoburns@users.noreply.github.com>
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: dae49cafaba8492224d70df4624ad36888e0e3ab
2022-05-09 08:32:56 +00:00
Antoine Leblanc
04d8f068b6 Remove explicit case on the backend tag in Cache
### Description

As part of the cache building process, we create / update / migrate the catalog that each DB uses as a place to store event trigger information. The function that decides how this should be done was doing an explicit `case ... of` on the backend tag, instead of delegating to one of the backend classes. The downsides of this is that:
- it adds a "friction point" where the backend matters in the core of the engine, which is otherwise written to be almost entirely backend-agnostic
- it creates imports from deep in the engine to the `Backends`, which we try to restrict to a very small set of clearly identified files (the `Instances` files)
- it is currently implemented using a "catch all" default case, which might not always be correct for new backends

This PR makes the catalog updating process a part of `BackendMetadata`, and cleans the corresponding schema cache code.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4457
GitOrigin-RevId: 592f0eaa97a7c38f4e6d4400e1d2353aab12c97e
2022-05-05 13:44:56 +00:00
Daniel Chambers
97ac9cbcdc Data Connector Agent Configuration Schema [GDW-103]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4450
GitOrigin-RevId: 2dce6e901c9734407d084d57166039fd94394279
2022-05-05 05:19:46 +00:00
Sibi Prabakaran
a06abcea86 docs: Add Debugging section for hspec
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4448
GitOrigin-RevId: 57aff86ebd0ef0ec90fa4ba11f5a7a83cf4e9c27
2022-05-04 14:57:15 +00:00
Rakesh Emmadi
7474f50ef0 server/bigquery: enable metadata API to add/drop computed fields to BigQuery tables
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4414
GitOrigin-RevId: 7899824a49ba9fd479f4cf08789450153f454168
2022-05-04 14:53:31 +00:00
paritosh-08
fb4f745f74 server: refactor Hasura.GraphQL.Analyse
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4310
GitOrigin-RevId: 36bd42476724cc6b94987a4362c2a46616be4f0c
2022-05-04 10:57:55 +00:00
Sibi Prabakaran
49f2e0f4a3 Unify hspec test for SelectSpec and DirectiveSpec
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4387
GitOrigin-RevId: 890d07ebda838a4c6dc4221908bacba2ee75a0a2
2022-05-04 09:59:29 +00:00
Abby Sassel
7eda345f3b server/tests: Troubleshooting docs
From discussion threads at https://hasurahq.slack.com/archives/CV3UR1MT2/p1651627110710999 and https://hasurahq.slack.com/archives/CV3UR1MT2/p1651590300512049

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4445
GitOrigin-RevId: c5c674f91d065e6864ec781b17db151bc649e75c
2022-05-04 08:23:53 +00:00
Abby Sassel
738693f61f server/docs: Add/update BigQuery test setup info
This PR adds BigQuery setup notes for the hspec test suite.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4444
GitOrigin-RevId: 4d3ea3315e60dedf47f6236ea79e6fa4945fa8f0
2022-05-04 07:37:22 +00:00
Gil Mizrahi
4411bc9b17 add some haddock annotations to AnyBackend.hs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4415
GitOrigin-RevId: 8e3feca04ef92bed8870da128959b9d48fb92727
2022-05-03 13:15:41 +00:00
Vishnu Bharathi
9c90bb0b2c ci: tag release v2.5.2 and v2.6.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4430
GitOrigin-RevId: 9080dac0ffa75558401716ed8b437d63ff1d82c1
2022-05-03 09:36:04 +00:00
Vamshi Surabhi
d5cb312f8b replace SQLOperator with ScalarSelectionArguments
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4426
GitOrigin-RevId: 69beda27ccf4cb47dab80d59ec383704be805bf6
2022-05-03 09:00:01 +00:00
Sibi Prabakaran
c199215947 Unified setup for NestedRelationshipsSpec
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4378
GitOrigin-RevId: 3881591ad0ec109352e09a989377121550632fdd
2022-05-03 07:38:47 +00:00
Naveen Naidu
955db8ab11 server: Use quote_ident for quoting table name when using regclass
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4413
Co-authored-by: Karthikeyan Chinnakonda <15602904+codingkarthik@users.noreply.github.com>
GitOrigin-RevId: 721fae15587bdab6f27b8d1189fe6e41c42097e7
2022-05-02 13:16:55 +00:00
Daniel Chambers
4f835623b1 Rename Data Wrapper to Data Connector [GDW-89]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4400
GitOrigin-RevId: 2d90542f95ef4dad70c8dfe1ca3b4c1f3bdaa527
2022-05-02 05:04:07 +00:00
Lyndon Maydwell
53ca4da79d Fixing URL parameter for variable <name> not supported bug in REST endpoints for Dates
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4345
GitOrigin-RevId: 0b739530757ee1081d764d9582e3c0e648861d4e
2022-05-02 03:34:34 +00:00
Daniel Chambers
9453932112 Data Connector Agent Configuration via HGE Metadata [GDW-103]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4358
GitOrigin-RevId: 36e18edf00ba0665b40a80c0b07c374ffcfe56e4
2022-05-01 23:02:08 +00:00
Daniel Chambers
970d69edd4 Added BackendConfig to allow sources to share configuration of Data Connectors [GDW-78]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4271
GitOrigin-RevId: 6990010bff622a424ca0bb9d24579bf121819fb0
2022-04-29 02:14:10 +00:00
Naveen Naidu
222419527f server: refactor MaintenanceMode datatype
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4298
GitOrigin-RevId: 0b88d040bd4b24c61c4ae91e18dc6edf67b3672e
2022-04-28 20:56:11 +00:00
Naveen Naidu
1d641aa2ff server: support query tags for MSSQL data sources
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4373
GitOrigin-RevId: 45717defdc973f3b7f1c9b972e2d3c836eec4476
2022-04-28 19:34:45 +00:00
Rakesh Emmadi
030de648e3 server/bigquery: internal types and function to fetch routine information from BigQuery
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4376
GitOrigin-RevId: 30f2d0373dba262cc868ea48a613272ca19865f6
2022-04-28 12:38:27 +00:00
Sibi Prabakaran
88f8c676d4 Update hspec documentation for TestEnvironment
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4386
GitOrigin-RevId: 471b538316f2766ccd7d8919299d947f9b2ac4a4
2022-04-28 08:59:09 +00:00
Solomon
db1c50affa Feature/gdw execute array literals GDW-82
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4319
GitOrigin-RevId: 20db2a1eb6e8521c4e572aa642c802129792468f
2022-04-28 01:53:06 +00:00
Abby Sassel
25d77afaff server/tests: Fix BigQuery test failure Job exceeded rate limits error in CI
Fixes https://github.com/hasura/graphql-engine-mono/issues/3695.

Error: [BigQuery test failure Job exceeded rate limits](https://github.com/hasura/graphql-engine-mono/issues/3695)

Cause:
1. [this command](2325755954/.circleci/test-server.sh (L1263)) runs tests matching the `Bigquery or Common` string, for the `test-oss-server-bigquery` CI job.
2. in this case, the pytest filter matched on `TestGraphQLQueryBoolExpSearchCommon`. Although unrelated pytests are skipped, BQ setup and teardown runs uneccesarily for the [MSSQL and Postgres backends](e444cf1f5d/server/tests-py/test_graphql_queries.py (L868)).
4. the setup and teardown runs three times in quick succession, _for each of_ SQL Server, Postgres and BigQuery. Occasionally, this surpassed [BigQuery's maximum rate of 5 table update operations in 10 seconds](https://cloud.google.com/bigquery/quotas#load_job_per_table.long).

Fix: restrict setup/teardown to only the relevant backends...
- Hotfix (this PR): ...by renaming pytest classes and changing the pytest filters in `test-server`
	- ok, this is faintly horrifying and an inelegant convention change. On the bright side, it shaves a minute or so off our integration test suite run by skipping fewer tests. Anecdata for `test-oss-server-bigquery`
		- before: 87 passed, 299 skipped, 1 warning, 1 error in 192.99s
		- after: 87 passed, 20 skipped, 1 warning in 170.82s
	- [`Common` was a terrible name, anyway](https://github.com/hasura/graphql-engine-mono/issues/2079), for `AnyCombinationOfBackends`.
- Better fix: ...by refactoring the `conftest.py` helpers. I ran out of a timebox so will write up a separate issue. Given we're actively [porting pytests over to hspec](https://github.com/hasura/graphql-engine/issues/8432), I don't know how much it's worth investing time in a refactor.

To verify the fix: I ran a full CI build a few times [[1]](https://buildkite.com/hasura/graphql-engine-mono/builds/8069#078c781a-c8ef-44f2-a400-15f91fb88e42)[[2]](https://buildkite.com/hasura/graphql-engine-mono/builds/8072#f9e7f59d-264f-46a4-973d-21aa762cca35)[[3]](https://buildkite.com/hasura/graphql-engine-mono/builds/8075#bb104e80-ff76-408c-a46b-6f40e92e6317) whilst troubleshooting to convince myself this fixed the problem.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4362
GitOrigin-RevId: 4c3283f0654b70e9dcda642d9012f6376aa95290
2022-04-27 18:40:41 +00:00
Antoine Leblanc
f684fecc6c Cut ties with RQL.DML.Internal
## Description

As the name suggests, `DML.Internal` contains internal implementation details of RQL's DML. However, a lot of unrelated parts of the codebase still use some of the code it contains. This PR fixes this, and removes all imports of `RQL.DML.Internal` from outside of `RQL.DML`. Most of the time, this involves moving a function out of `DML.Internal` to an underlying module (see `getRolePermInfo`) or moving a function _back_ into it (see `checkRetCols`).

This PR also clarifies a bit the situation with `withTyAnn` and `withTypeAnn` by renaming the former into `withScalarTypeAnn` and moving them together. Worth noting: there might be a bug lurking in that function, as it doesn't seem to use the proper type annotations for some extension types!

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4380
GitOrigin-RevId: c8ae5b4e8378fefc0bcccf778d97813df727d3cb
2022-04-27 15:37:23 +00:00