Commit Graph

4688 Commits

Author SHA1 Message Date
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
Nicolas Inchauspe
bc2480fb98 console: add horizontal variants for form fields wrapper CON-403
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5147
GitOrigin-RevId: 83b13be7fc969687e5d7ea2f0ad9f56b0ca9947b
2022-07-29 18:12:59 +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
Varun Choudhary
9dcf73daee console: add custom names for streaming subscriptions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5243
GitOrigin-RevId: 08932303b6e411e306b29f0052c9f141a794b3f9
2022-07-29 11:15:40 +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
Sean Park-Ross
42a317b2d2 Docs: Fix schema/postgres/naming-convention.mdx overwrites from restructure
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5233
GitOrigin-RevId: 3804293ff1e637f1d827df5d0b0b96895939fad8
2022-07-28 12:23:32 +00:00
Rob Dominguez
7d797e1b34 Docs: incorporates updates for pg requirements and opentelemetry (closes #4811 and closes #4812)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5207
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Vishnu Bharathi <4211715+scriptnull@users.noreply.github.com>
GitOrigin-RevId: 5b435e34a695ec6c8573467e2e9513e64d313666
2022-07-28 12:20:03 +00:00
Rob Dominguez
654c3c178a Docs: updates styles for tbody globally
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5164
GitOrigin-RevId: 706857ce1bec316e58b97e8f540fe431c40b5982
2022-07-28 12:17:15 +00:00
Abhijeet Khangarot
b0bd7883cc feature (console): add cron triggers new UI with rest connectors
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4933
GitOrigin-RevId: a3c44c370cac016e0d1287ed4c86390f63bd67db
2022-07-28 12:13:26 +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
Nicolas Inchauspe
770a16c22d Replace :focus with :focus-visible for new form components
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5203
GitOrigin-RevId: bb9d39b6a0049d8f24aa985040a5184629811b53
2022-07-27 15:52:56 +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
4f85976155 server: Get make test-backends working and somewhat speedy.
* Fix `make start-sqlserver` so it can find `sqlcmd`.
* Start the DC reference agent when testing all backends.
* Start backends in parallel so it doesn't take so long to spin them up. This is achieved by splitting all `start-*` tasks into `spawn-*` and `wait-for-*`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5176
GitOrigin-RevId: ea483a755daa3fa6a8701f9d3dd0f393bc56510f
2022-07-27 13:30:14 +00:00
Sooraj
1f574c6eaf console: show correct GQL query when user click on "Open In GraphQL" from REST endpoints
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5216
GitOrigin-RevId: 00516b3f5067c82b2ea2ccb60fae97766f503c5a
2022-07-27 12:58:18 +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
paritosh-08
12064dd24c docs: apollo federation
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5146
Co-authored-by: Sean Park-Ross <94021366+seanparkross@users.noreply.github.com>
GitOrigin-RevId: dbd8f3bc08ff847b4925867623417b6a70361d5a
2022-07-27 04:05:08 +00:00
Samir Talwar
a471c5080b Nix: Upgrade Python to the latest version.
There's no reason to pin it to v3.7. This wasn't causing the Docker
Compose issues; it's a dependency version issue.

We actually don't need to install `docker-compose` at all. It's now a
Docker plugin (and is bundled in Docker Desktop) since Docker Compose
v2. You can run it with `docker compose`.

This also fixes a bug in _dev.sh_ due to a moved `make` target.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5197
GitOrigin-RevId: 638b2eb39c99e7a990e7a6c66388831438aed45f
2022-07-26 16:47:18 +00:00
Matt Hardman
a71007566b console: update relationships forms
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4955
Co-authored-by: Varun Choudhary <68095256+Varun-Choudhary@users.noreply.github.com>
GitOrigin-RevId: e0e54a54293779c9e1d66d1aa4ad6b24b55e0ddc
2022-07-26 15:05:45 +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
Anon Ray
b59d53b0ea multitenant/pro: add time limits to policies
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4464
GitOrigin-RevId: 31ad8e12c5727fea2dd69415b98ab2a937cd0d44
2022-07-26 12:42:49 +00:00
Sooraj
e243fccc62 console: create a hook to fetch table definition from URL
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5007
GitOrigin-RevId: f3232d966bd97e7cc6e249c40a753fa5072265b5
2022-07-26 12:07:25 +00:00
Matt Hardman
83882bf558 console: implement clone permissions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4838
GitOrigin-RevId: 1cc7abc977c1296f1a2bccfcdead75fd20039d1a
2022-07-26 10:59:04 +00:00
Daniele Cammareri
b9010f1025 console: fix broken table relationship query on non-default schema
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5132
Co-authored-by: Varun Choudhary <68095256+Varun-Choudhary@users.noreply.github.com>
GitOrigin-RevId: e034eb015405396e8359d9b81e0af4e73c3e0dd9
2022-07-26 10:25:30 +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