graphql-engine/cabal.project

80 lines
2.4 KiB
Plaintext
Raw Normal View History

2020-01-24 02:20:58 +03:00
-- Global project configuration.
--
-- This file can be overridden with cabal.project.local (see e.g. cabal.project.dev)
--
-- If you need to switch between several local configurations you can also
-- create a symlink to this file with a different name, e.g.:
-- $ ln -s cabal.project cabal.project.myconfig
-- $ ln -s cabal.project.freeze cabal.project.myconfig.freeze
-- ...and then create a new set of overrides in:
-- cabal.project.myconfig.local
-- ...and then invoke cabal with
-- $ cabal new-build --project-file=cabal.project.myconfig
--
allow custom mutations through actions (#3042) * basic doc for actions * custom_types, sync and async actions * switch to graphql-parser-hs on github * update docs * metadata import/export * webhook calls are now supported * relationships in sync actions * initialise.sql is now in sync with the migration file * fix metadata tests * allow specifying arguments of actions * fix blacklist check on check_build_worthiness job * track custom_types and actions related tables * handlers are now triggered on async actions * default to pgjson unless a field is involved in relationships, for generating definition list * use 'true' for action filter for non admin role * fix create_action_permission sql query * drop permissions when dropping an action * add a hdb_role view (and relationships) to fetch all roles in the system * rename 'webhook' key in action definition to 'handler' * allow templating actions wehook URLs with env vars * add 'update_action' /v1/query type * allow forwarding client headers by setting `forward_client_headers` in action definition * add 'headers' configuration in action definition * handle webhook error response based on status codes * support array relationships for custom types * implement single row mutation, see https://github.com/hasura/graphql-engine/issues/3731 * single row mutation: rename 'pk_columns' -> 'columns' and no-op refactor * use top level primary key inputs for delete_by_pk & account select permissions for single row mutations * use only REST semantics to resolve the webhook response * use 'pk_columns' instead of 'columns' for update_by_pk input * add python basic tests for single row mutations * add action context (name) in webhook payload * Async action response is accessible for non admin roles only if the request session vars equals to action's * clean nulls, empty arrays for actions, custom types in export metadata * async action mutation returns only the UUID of the action * unit tests for URL template parser * Basic sync actions python tests * fix output in async query & add async tests * add admin secret header in async actions python test * document async action architecture in Resolve/Action.hs file * support actions returning array of objects * tests for list type response actions * update docs with actions and custom types metadata API reference * update actions python tests as per #f8e1330 Co-authored-by: Tirumarai Selvan <tirumarai.selvan@gmail.com> Co-authored-by: Aravind Shankar <face11301@gmail.com> Co-authored-by: Rakesh Emmadi <12475069+rakeshkky@users.noreply.github.com>
2020-02-13 20:38:23 +03:00
-- See: https://www.haskell.org/cabal/users-guide/nix-local-build.html#configuring-builds-with-cabal-project
packages: server
constraints:
-- Ensure we don't end up with a freeze file that forces an incompatible
-- version in CI for `Setup.hs` scripts.
setup.Cabal <3.4
package *
optimization: 2
-- For tooling, e.g. 'weeder', and IDE-like stuff:
ghc-options: -fwrite-ide-info
haddock-html: true
haddock-hoogle: true
haddock-hyperlink-source: true
haddock-quickjump: true
package graphql-engine
ghc-options: -j
haddock-options: "--show-all"
source-repository-package
type: git
location: https://github.com/hasura/pg-client-hs.git
tag: f34319871aa5b7bc30551164bcf396f3b664631c
source-repository-package
type: git
location: https://github.com/hasura/graphql-parser-hs.git
Update GraphQL Parser version to fix text encoding issue (fix #1965) ### A long tale about encoding GraphQL has an [introspection system](http://spec.graphql.org/June2018/#sec-Introspection), which allows its schema to be introspected. This is what we use to introspect [remote schemas](https://github.com/hasura/graphql-engine-mono/blob/41383e1f88c709c6cae4059a1b4fb8f2a58259e6/server/src-rsr/introspection.json). There is one place in the introspection where we might find GraphQL values: the default value of an argument. ```json { "fields": [ { "name": "echo", "args": [ { "name": "msg", "defaultValue": "\"Hello\\nWorld!\"" } ] } ] } ``` Note that GraphQL's introspection is transport agnostic: the default value isn't returned as a JSON value, but as a _string-encoded GraphQL Value_. In this case, the value is the GraphQL String `"Hello\nWorld!"`. Embedded into a string, it is encoded as: `"\"Hello\\nWorld!\""`. When we [parse that value](https://github.com/hasura/graphql-engine-mono/blob/41383e1f88c709c6cae4059a1b4fb8f2a58259e6/server/src-lib/Hasura/GraphQL/RemoteServer.hs#L351), we first extract that JSON string, to get its content, `"Hello\nWorld!"`, then use our [GraphQL Parser library](https://github.com/hasura/graphql-parser-hs/blob/21c1ddfb41791578b66633a2e51f9deb43761108/src/Language/GraphQL/Draft/Parser.hs#L200) to interpret this: we find the double quote, understand that the content is a String, unescape the backslashes, and end up with the desired string value: `['H', 'e', 'l', 'l', 'o', '\n', 'W', 'o', 'r', 'l', 'd', '!']`. This all works fine. However, there was a bug in the _printer_ part of our parser library: when printing back a String value, we would not re-escape characters properly. In practice, this meant that the GraphQL String `"Hello\nWorld"` would be encoded in JSON as `"\"Hello\nWorld!\""`. Note how the `\n` is not properly double-escaped. This led to a variety of problems, as described in #1965: - we would successfully parse a remote schema containing such characters in its default values, but then would print those erroneous JSON values in our introspection, which would _crash the console_ - we would inject those default values in queries sent to remote schemas, and print them wrong doing so, sending invalid values to remote schemas and getting errors in result It turns out that this bug had been lurking in the code for a long time: I combed through the history of [the parser library](https://github.com/hasura/graphql-parser-hs), and as far as I can tell, this bug has always been there. So why was it never caught? After all, we do have [round trip tests](https://github.com/hasura/graphql-parser-hs/blob/21c1ddfb41791578b66633a2e51f9deb43761108/test/Spec.hs#L52) that print + parse arbitrary values and check that we get the same value as a result. They do use any arbitrary unicode character in their generated strings. So... that should have covered it, right? Well... it turns out that [the tests were ignoring errors](https://github.com/hasura/graphql-parser-hs/blob/7678066c49b61acf0c102a0ffe48e86897e2e22d/test/Spec.hs#L45), and would always return "SUCCESS" in CI, even if they failed... Furthermore, the sample size was small enough that, most of the time, _they would not hit such characters_. Running the tests locally on a loop, I only got errors ~10% of the time... This was all fixed in hasura/graphql-parser-hs#44. This was probably one of Hasura's longest standing bugs? ^^' ### Description This PR bumps the version of graphql-parser-hs in the engine, and switches some of our own arbitrary tests to use unicode characters in text rather than alphanumeric values. It turns out those tests were much better at hitting "bad" values, and that they consistently failed when generating arbitrary unicode characters. https://github.com/hasura/graphql-engine-mono/pull/2031 GitOrigin-RevId: 54fa48270386a67336e5544351691619e0684559
2021-08-06 14:53:52 +03:00
tag: 21c1ddfb41791578b66633a2e51f9deb43761108
source-repository-package
type: git
location: https://github.com/hasura/ci-info-hs.git
tag: be578a01979fc95137cc2c84827f9fafb99df60f
source-repository-package
type: git
location: https://github.com/hasura/pool.git
tag: bc4c3f739a8fb8ec4444336a34662895831c9acf
source-repository-package
type: git
location: https://github.com/fpco/odbc.git
tag: 7c0cea45d0b779419eb16177407c4ee9e7ba4c6f
package odbc
ghc-options: -Wwarn
-- Our CI compiles with -Werror, which is also applied to those packages
-- while it's fine for packages we maintain, we can't actually enforce
-- that third-party packages are warning-free, hence this -Wno-error.
-- When the changes in odbc are released, we can instead depend on
-- the hackage version, and remove it from this list of packages.
source-repository-package
type: git
location: https://github.com/hasura/ekg-core.git
tag: e31b47d5c67e1347f141079ad2d18f682e1b046f
source-repository-package
type: git
location: https://github.com/hasura/ekg-json.git
tag: 098e3a5951c4991c823815706f1f58f608bb6ec3