Commit Graph

406 Commits

Author SHA1 Message Date
Toan Nguyen
0c74839934 add raw query field for error http log (close #2963) (#3020) 2019-10-07 13:04:33 -05:00
Rakesh Emmadi
8972dfb018 remove brotli compression (#2967)
Although brotli itself is MIT-licensed, the Haskell brotli library that provides bindings to it is GPL-licensed, so we cannot use it unless we get a response on haskell-hvr/brotli#1.
2019-10-05 02:20:50 -05:00
Rakesh Emmadi
084439db7e fix SQL generation if more than one aggregate order_by items present, fix #2981 (#2998) 2019-10-04 23:00:53 -05:00
Vamshi Surabhi
0f143f0ea8 fixes to the subscriptions improvements introduced with #2942 (#3005)
* fix incorrect references to result variables
* remove docs/code related to 'fallback' backend
2019-10-03 14:35:55 -05:00
Tirumarai Selvan
5893cf47ed remove conflict_action type (#2950) 2019-10-03 15:18:49 +05:30
Rakesh Emmadi
55a788594b update custom column names on renaming/dropping columns (#2933) 2019-10-03 13:15:52 +05:30
nizar-m
44da458c81 fix hpc combine error (close #2946) (#2947)
* Fix hpc combine error

* Do not perform ciignore

* xfail test jsonb_has_all

* Bring back ciignore

* Refer jsonb_has_all xfaul to the corresponding issue in graphql-engine-internal
2019-10-02 12:06:27 +05:30
Mark van Driel
342e091f33 Fix typo in warning message (#2949) 2019-09-30 19:24:55 -05:00
Alexis King
18e8fbab1b
Parameterize all SQL values when multiplexing subscription queries (#2942)
Also, add support for explaining subscriptions while we’re at it.
2019-09-30 14:50:57 -05:00
Rakesh Emmadi
79414cb225 add brotli shared lib to packager image (#2924)
Add brotli library dependencies to the server docker image.

The compression feature introduced in #2751 requires brotli shared libraries at runtime. In original PR, adding them to server packager image was missing.
2019-09-24 15:52:50 +05:30
Rakesh Emmadi
8a0615ff70 add gzip brotli compression to http responses (close #2674) (#2751) 2019-09-19 18:24:40 +05:30
Rakesh Emmadi
9bd5826020 allow customising graphql schema for a table (close #981) (#2509)
* allow customizing GraphQL root field names, close #981

* document v2 track_table API in reference

* support customising column field names in GraphQL schema

* [docs] add custom column fields doc in API reference

* add tests

* rename 'ColField' to 'ColumnField'

* embed column's graphql field in 'PGColumnInfo'

-> Value constructor of 'PGCol' is not exposed
-> Using 'parseJSON' to construct 'PGCol' in 'FromJSON' instances

* avoid using 'Maybe TableConfig'

* refactors & 'custom_column_fields' -> 'custom_column_names'

* cli-test: add configuration field in metadata export test

* update expected keys in `FromJSON` instance of `TableMeta`

* use `buildSchemaCacheFor` to update configuration in v2 track_table

* remove 'GraphQLName' type and use 'isValidName' exposed from parser lib

* point graphql-parser-hs library git repo to hasura

* support 'set_table_custom_fields' query API & added docs and tests
2019-09-19 10:17:36 +05:30
Alexis King
d9d47f0062
server: Don’t allow warnings when building in CI (#2892) 2019-09-17 00:00:42 -05:00
Alexis King
54e6439579 Change the way we determine whether or not queries are reusable
This fixes an issue where queries could incorrectly be considered
reusable if a variable was used in two positions: one where it affected
SQL generation and one where it did not.
2019-09-16 22:00:46 -05:00
Alexis King
264d70644b Multiplex all subscriptions, grouping them by their resolved SQL query 2019-09-16 22:00:46 -05:00
Alexis King
171d67899b Add Data.Time.Clock.Units for DiffTime literals and conversions 2019-09-16 22:00:46 -05:00
Ajeet D'Souza
99174cca9b propagate Postgres table comments to GraphQL schema descriptions (close #446) (#2397) 2019-09-16 20:51:11 -05:00
Rakesh Emmadi
e5eb0c4f34 fix row comparison operator in event triggers (fix #2036) (#2868)
Update trigger is failing if any json/geometry columns are present in
event payload rows. Use '*<>' operator instead of '<>' to compare the
internal binary representation of rows if '<>' doesn’t work.
2019-09-12 18:22:01 -05:00
José Lorenzo Rodríguez
5609fba393 Implemented graceful shutdown for websockets (#2827) 2019-09-09 15:26:04 -05:00
Rakesh Emmadi
c148e5753a support optional parameters in database url (close #1709) (#2344) 2019-09-05 15:59:26 -07:00
Rakesh Emmadi
de1ab241f8 allow creating permissions with conditions spanning tables (close #2512) (#2701) 2019-09-05 13:04:53 +05:30
Victor Ferreira
27d85ca6bb fix a typo in limit description of schema (close #2810) (#2811) 2019-09-05 12:47:01 +05:30
Rakesh Emmadi
f7c99689da support intersect filters on raster columns (close #2613) (#2704)
* initial raster support

* _st_intersects_geom -> _st_intersects_geom_nband

* add tests

* update docs

* improve docs

As requested by @marionschleifer

* new type for raster values

Suggested by @lexi-lambda

* replace `SEUnsafe "NULL"` with SENull
2019-08-29 18:37:05 +05:30
Rakesh Emmadi
d9fb0f8780 use named notation for function arguments if any argument is not specified (fix #2730) (#2777)
* use positional arguments in SQL functions
* only allow omitting set of last arguments in functions
* disallow omitting of a non default argument in functions
2019-08-28 14:27:15 -05:00
Tirumarai Selvan
67d3eb3e27 unlock only locked rows during startup (#2778) 2019-08-26 19:41:38 -05:00
Alexis King
78ec906794 server: Include number of enum tables in metrics 2019-08-26 00:54:56 -05:00
Alexis King
c46ecc72dc Refactor non-table functions out of Hasura.RQL.DDL.Table 2019-08-26 00:54:56 -05:00
Alexis King
d4dcd28baa Slightly rearrange and cleanup Hasura.SQL.Value 2019-08-26 00:54:56 -05:00
Alexis King
00862fcad8 Centralize handling of expected PostgreSQL errors 2019-08-26 00:54:56 -05:00
Alexis King
7fa1452ca0 server: Rename a whole bunch of things
* PGTypeSimple → PGTypeScalar
* PGScalarTyped → WithScalarType
* PGColValue → PGScalarValue
* PGColInfo → PGColumnInfo
* PGRawColInfo → PGRawColumnInfo
* mkScalarSessionVar → mkTypedSessionVar
2019-08-26 00:54:56 -05:00
Alexis King
ed26da59a6 Add support for GraphQL enum types via enum table references
These changes also add a new type, PGColumnType, between PGColInfo and
PGScalarType, and they process PGRawColumnType values into PGColumnType
values during schema cache generation.
2019-08-26 00:54:56 -05:00
Alexis King
86663f9af7 Rename PGColType to PGScalarType 2019-08-26 00:54:56 -05:00
Alexis King
d1179f7f98 Don’t use Show for converting PGColTypes to SQL 2019-08-26 00:54:56 -05:00
Alexis King
9be6f706e6 Refactor GCtx to split query and mutation root operations
This mostly simplifies the RootFlds type to make it clearer what it’s
used for, but it has the convenient side-effect of preventing some
“impossible” cases using the type system.
2019-08-26 00:54:56 -05:00
José Lorenzo Rodríguez
c7a2320456 Implemented graceful shutdown for HTTP requests (close #2698) (#2717)
* Listens for SIGTERM as the termination signal
* Stops accepting new connections once the signal is received
* Waits for all connections to be drained, before shutting down
* Forcefully kills all pending connections after 30 seconds

Currently this does not send a close message to websocket clients, I'd
like to submit that change as a separate pull request, but at least this
solve my biggest concern which is not getting confirmation for mutations
while restarting the server.
2019-08-26 00:31:27 -05:00
Tirumarai Selvan
98784212e2 allow configuring timeout for remote schema calls (close #2501) (#2753) 2019-08-23 14:27:19 +05:30
Rakesh Emmadi
8ac78fdaec accept null values in order_by input field (fix #2754) (#2755) 2019-08-22 03:14:27 -05:00
Tirumarai Selvan
7009e77c98 get all Set-Cookie headers (fix #2688) (#2739) 2019-08-19 22:24:13 -05:00
Tirumarai Selvan
46f2ecaa65 don't send the request to the client on HTTP throw (#2738) 2019-08-19 21:18:04 -05:00
Rakesh Emmadi
3527b085fd allow altering type of a column whose permissions defined only with session variables (close #2070) (#2683)
* allow altering type of a column iff session vars are defined in permissions
* use a sum type to define dependency reason
* set jwt expiry test's expiry time to 4 seconds
* derive Data instance for necessary types to simplify 'hasStaticExp'
2019-08-16 16:35:22 -05:00
Alexis King
2aa66ca6f5 Fix websocket race condition in server test suite (fix #2710) (#2712) 2019-08-12 15:14:29 +05:30
José Lorenzo Rodríguez
e952495235 Use SIGINT as the stopsignal in the dockerfile (#2685)
Haskell expects the signal to be `SIGINT`, but the docker default is
`SIGTERM`.
2019-08-11 01:23:06 -05:00
Vamshi Surabhi
52bf885f14
refactor schema.hs into multiple modules (#2661)
Mostly moving around things across modules. No change in
functionality.
2019-08-09 14:49:17 +05:30
Rakesh Emmadi
a03c78854d capture Postgres error code 22025 as HTTP 400 bad request (close #2486) (#2671) 2019-08-08 15:57:42 -05:00
Vamshi Surabhi
a5a07634a5
Merge branch 'master' into dev-scripts-and-doc-tweaks 2019-08-07 12:08:46 +05:30
Anon Ray
b4a0a03631 log when request body parsing fails (fix #2555) (#2556) 2019-08-01 16:21:59 +05:30
Alexis King
84ff3ff01b Set LANG=C.UTF-8 in the docker container (fix #2571) (#2647) 2019-08-01 13:00:07 +05:30
Rakesh Emmadi
6b8a6ca48f dont use sub-query for perm limit if aggregations are absent (#2630) 2019-08-01 05:09:52 +00:00
Brandon Simmons
3e2e14357a Add rebuild-ghc-options to stack.yamls
I found this default a super annoying time waster.
2019-07-31 10:22:50 -04:00
Rakesh Emmadi
db24d3248f schema sync process will not generate garbage data (close #2542) (#2585)
schema syncing logic now requires only a single row in `hdb_schema_update_event`.
2019-07-31 14:31:48 +05:30
Brandon Simmons
bc32130d09 Clarify HASURA_GRAPHQL_EVENTS_FETCH_INTERVAL docs 2019-07-26 01:17:56 -04:00
Brandon Simmons
3a4071af09 Remove some output noise from tests 2019-07-26 01:17:55 -04:00
Brandon Simmons
bc4456eccc Add local development swiss army knife script scripts/dev.sh
At the moment we can...

...run tests in isolation, generating coverage report:

    $ dev.sh test

You can pass args to pytest as well. e.g. to run a specific test:

    $ dev.sh test -k "test_jsonb_has_all"

Launch a postgres container with useful dev defaults, with PostGIS,
cleaning up afterwards:

    $ dev.sh postgres

Build and launch graphql-engine in dev mode, connecting with a
`postgres` launched above

    $ dev.sh graphql-engine
2019-07-26 01:17:35 -04:00
Brandon Simmons
04f90dd35d pytest.exit breaks pytest-xdist and produces a misleading error 2019-07-26 01:16:17 -04:00
Brandon Simmons
7e0f00a229 Remove obsolete Makefile target for tests removed in 6393aba447 2019-07-26 01:16:17 -04:00
Brandon Simmons
02ae91c64d Increase idle GC interval to workaround CPU leak issue (#2581)
This seems to resolve the issue locally (and has worked in the past),
but it's not clear what exactly is going on here (in particular, why
this should resolve what looks like a memory leak). It certainly seems
like a GHC issue of some sort.

Closes #2565
2019-07-24 10:41:52 +05:30
Vamshi Surabhi
4facb3c780 remove support for query templates (#2560)
query templates is a little known feature that lets you template rql
queries and serve them as rest apis. This is not relevant anymore
given the GraphQL interface and getting rid of it reduces the dev
time when adding features in few subsystems.

This feature has never been used outside hasura's internal projects or
documented or exposed through console and hence can safely be removed.
2019-07-23 19:11:34 +00:00
Alexis King
8f9a41ff88 Support casting between PostGIS geometry and geography types in where expressions (close #1983) (#2495)
* server: Bump dependencies to allow Haddock to run successfully

* Support casting between PostGIS geometry and geography types in filters
2019-07-15 14:22:45 +05:30
Vamshi Surabhi
66a2f33fa9 use all available cpu cores by default (#2511)
Use all available cores by default. sets -N rts flag by default. Can be disabled by
setting the `GHCRTS` env variable to `-N1`.
2019-07-12 05:25:15 +00:00
Anon Ray
c797d23a14 fix server tests (#2510) 2019-07-11 10:55:34 +00:00
Anon Ray
f2f14e727b Merge pull request from GHSA-2j98-fw5g-j43v
* fix bug in audience check while verifying JWT

  - previously the check was converting the audience type into a string
  and then comparing with the conf value. all audience types (as it is a
  string or URI) will convert to plain strings
  - use the Audience type from the jose library for comparing

* add docs for audience

* add issuer check as well

* docs minor syntax fix

* skip audience check if not given in conf

* minor docs update

* qualify import jose library
2019-07-11 09:58:39 +00:00
Ajeet D'Souza
92c4cff79e check input for empty strings for metadata api (close #2302) (#2300) 2019-07-11 09:00:45 +00:00
Ajeet D'Souza
605f8633f3 fail on tracking table/function with name conflict (close #2020) (#2383)
Currently, we allow tracking of a table with the same name as an already tracked function, and vice-versa. This causes an issue when querying from GraphQL since it will only query the table and not the function. I've made changes to disallow this by throwing an error.
2019-07-11 07:41:20 +00:00
Anon Ray
8f1e7dbc8d breaking: server logging changes (close #507, close #2171) (#1835) 2019-07-11 05:37:06 +00:00
Vamshi Surabhi
5aa4a46e72
allow fetching gc stats through dev api (#2489) 2019-07-10 17:31:52 +05:30
Vamshi Surabhi
f1cf6d0b17
allow session variables in operators which expect array input (#2475) 2019-07-10 15:49:58 +05:30
Rakesh Emmadi
9eb38e6c96 cache remote schema's introspection query response (fix #1679) (#2089) 2019-07-08 11:21:41 +05:30
Alexis King
6393aba447 Remove obsolete/unmaintained server Haskell test suite (#2472)
* Remove obsolete/unmaintained server Haskell test suite

* Prune some unused server dependencies
2019-07-05 10:56:32 +05:30
Anon Ray
f9863a29c7 update server cabal file to reflect the correct license (#2471) 2019-07-04 10:58:02 +00:00
Ajeet D'Souza
666fd1bbc7 improve code for release channel detection (#2456) 2019-07-04 09:47:17 +00:00
Alexis King
a96adad786 Clarify a few steps involved in running the server test suite (#2467) 2019-07-04 11:43:16 +05:30
Alexis King
fb3794c31a Support Node v12.x and fix tests on macOS (#2455)
* Bump node-sass to version ^4.12.0

This avoids sass/node-sass#2632, which causes compilation failures on
Node v12.x.

* Do most of the work in /pg_dump in Haskell instead of shell

The shell version caused problems on non-Linux systems since it relied
on the non-POSIX -i option for sed, which works slightly differently on
BSD and macOS.
2019-07-03 14:07:13 +05:30
Ajeet D'Souza
b184ce0188 add server version to console html (close #2444) (#2452) 2019-07-02 12:44:29 +00:00
Anon Ray
f31c3b2887 freeze requirements.txt for server tests (#2450) 2019-07-01 13:34:48 +00:00
Rakesh Emmadi
4f9d5952b9 add a make rule to build server docker image locally (#2410) 2019-06-27 11:58:26 +05:30
Ajeet D'Souza
08df38aa8c add name of ci environment to telemetry data (#2382) 2019-06-26 11:53:40 +05:30
Rakesh Emmadi
dc84bb4e77 fix renaming of columns used in insert permission (fix #2398) (#2414) 2019-06-21 16:34:21 +05:30
Shahidh K Muhammed
a8dd3b3deb add api to get server config details (close #1831); add jwt-analyzer (close #1369) (#1925) 2019-06-11 18:59:03 +05:30
Rakesh Emmadi
c3c01beccc support null and default values for function arguments (close #2176, close #2250) (#2282) 2019-06-04 18:13:28 +05:30
Anon Ray
278f26b073 forward set-cookie headers from remote servers (fix #1654) (#2305) 2019-06-04 15:40:28 +05:30
Rakesh Emmadi
31cf7314e2 better change detection when altering foreign key constraints (fix #2060) (#2252)
foreign keys are considered to be dropped only if constraint oid changes
2019-06-03 15:51:55 +05:30
Anon Ray
95a27fba89 fix response for remote schema queries over ws (fix #2246) (#2248) 2019-05-29 17:21:09 +05:30
Rikin Kachhia
7ab9d5eaeb update console favicons to png (#2287) 2019-05-29 10:03:29 +05:30
Rakesh Emmadi
4aabbd5a28 fix and improve help description for stripes and connections (#2278) 2019-05-27 13:46:53 +05:30
Vamshi Surabhi
6aa1216a59
link server with -rtsopts (#2233)
This allows customisation of Haskell's runtime system's parameters.
2019-05-21 14:58:08 +05:30
Rakesh Emmadi
70f4db19ad allow creating multiple relationships which includes the same column (fix #2228) (#2232) 2019-05-21 10:30:33 +05:30
Josha Inglis
277be9074e fix transaction isolation settings on server (#2211) 2019-05-20 19:48:17 +05:30
Rakesh Emmadi
2e19cbee8d keep allowed queries in sync when collections are changed, fix #2221 (#2230) 2019-05-20 15:59:32 +05:30
Rakesh Emmadi
94a8a50410 set allowlist table as system defined on catalog migration, fix #2225 (#2226) 2019-05-20 10:27:32 +05:30
Shahidh K Muhammed
7c89e951f2 serve console assets without any authorization checks (#2201) 2019-05-16 16:58:50 +05:30
Anon Ray
81bdfafd69 ignore content-type header in auth webhook (#2197) 2019-05-16 14:41:15 +05:30
Rishichandra Wawhal
3ef1219fa0 change default endpoint to v1/graphql; remove semver checks (#2181) 2019-05-16 14:38:44 +05:30
Shahidh K Muhammed
76ceb707f4
bundle console assets into server (close #516, close #521, close #2130) (#2192)
This PR builds console static assets into the server docker image at `/srv/console-assets`. When env var `HASURA_GRAPHQL_CONSOLE_ASSETS_DIR=/srv/console-assets` or flag `--console-assets-dir=/srv/console-assets` is set on the server, the files in this directory are served at `/console/assets/*`.

The console html template will have a variable called `cdnAssets: false` when this flag is set and it loads assets from server itself instead of CDN.

The assets are moved to a new bucket with a new naming scheme:

```
graphql-engine-cdn.hasura.io/console/assets/
   /common/{}
   /versioned/<version/{}
   /channel/<channel>/<version>/{}
```

Console served by CLI will still load assets from CDN - will fix that in the next release.
2019-05-16 13:15:29 +05:30
Rakesh Emmadi
0b210cc245 support allow-list for graphql queries (closes #989) (#2075) 2019-05-16 11:43:25 +05:30
Anon Ray
935eaf2211 booleans from env are case insensitve (fix #2177) (#2182) 2019-05-14 16:52:05 +05:30
Anon Ray
7d03e7af2f fix non-200 response for authorization errors on /v1/graphql (#2173) 2019-05-14 16:50:55 +05:30
Rakesh Emmadi
c6f40df6d5 close websocket connection on JWT expiry (fix #578) (#2156) 2019-05-14 11:54:46 +05:30
Anon Ray
ee783e142e fix sending duplicate content-type header to remote schemas (fix #2159) (#2170) 2019-05-13 18:17:01 +05:30
Tirumarai Selvan
36e49ea75b manual event triggers (close #1687) (#2077) 2019-05-13 15:11:07 +05:30
Anon Ray
a21f6cd648 introduce v1/graphql (fix #1368) (#2064)
Changes compared to `/v1alpha1/graphql`

* Changed all graphql responses in **/v1/graphql** endpoint to be 200. All graphql clients expect responses to be HTTP 200. Non-200 responses are considered transport layer errors. 

* Errors in http and websocket layer are now consistent and have similar structure.
2019-05-10 11:35:10 +05:30