Commit Graph

134 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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