Commit Graph

102 Commits

Author SHA1 Message Date
Rakesh Emmadi
be28f8c947 add env var to enable console (close #632) (#642) 2018-10-10 12:16:38 +05:30
Vamshi Surabhi
8970518bdb upgrade stackage to 12.12 (#684) 2018-10-10 12:03:00 +05:30
Vamshi Surabhi
603461ad8f track connection_init error on each ws connection (close #682) (#683) 2018-10-09 15:51:05 +05:30
Rakesh Emmadi
d57be587b3 format schema name and table name as identifiers in event triggers (fix #639) (#644) 2018-10-09 12:09:20 +05:30
Rakesh Emmadi
00d5a5c1a3 insert mutations can now handle nested-data/relationsips (close #343) (#429) 2018-10-05 20:43:51 +05:30
Anon Ray
7d9851b0a9 generate coverage report for server tests (close #464) (#512) 2018-10-05 18:07:19 +05:30
Vamshi Surabhi
32ae105279 improved sql generation for select queries (closes #6, #121, #278) (#643)
Better SQL generation for select queries (the query plans will be the same but much more readable). This closes some long standing issues (#6, #121, #278).
2018-10-05 14:26:47 +05:30
Rakesh Emmadi
91376316f2 breaking: encode bigint and bigserial postgres types as strings in response (fix #633) (#640)
This is breaking change where bigint and bigserial Postgres types will be encoded as GraphQL String types, as opposed to Int as present in earlier releases.

Input types were already encoded as String.

This is achieved by selecting `bigint` and `bigserial` columns as `text`s in the SQL query: `select "big_id"::text ..` instead of `select "big_id" .. `.

Reason for that change is outlined in #633 where JavaScript cannot decode 64 bit Integers.
2018-10-05 10:46:21 +05:30
Gaurav Sachdeva
d02361ce14 fix typos, punctuation, etc in docs (#635) 2018-10-04 19:55:46 +05:30
nizar-m
596bccde49 add python based tests, remove haskell tests
this does not generate coverage report yet
2018-10-04 18:14:15 +05:30
Vamshi Surabhi
67ee3fc0f2 on a conn_init error send connection_err message instead of closing the ws conn (fix #537) (#572) 2018-09-29 13:21:49 +05:30
Rakesh Emmadi
fc7ea9213c fix non-admin insert returns null column values when query affects zero rows in postgres (fix #563) (#565)
Insert trigger function: If query affects no rows then return `null`

Insert trigger function is modified to have 
 `IF r IS NULL THEN RETURN null; ELSE RETURN r; END IF;` in return statement.
2018-09-29 11:12:47 +05:30
Vamshi Surabhi
b084249e01 do not clean hdb_views by dropping and creating the schema (closes #567) (#568)
Fix migration logic to accommodate for non superuser permissions. Closes #567 

- [x] Server

By clearing the `hdb_views` schema of existing views and functions instead of dropping and creating it again. 

- [x] Bug fix (non-breaking change which fixes an issue)
2018-09-28 16:22:54 +05:30
Anon Ray
1a0af29920 remove 's' unit from query_execution_time in logs (close #509) (#553)
Removes the seconds unit (trailing `s`) from `query_execution_time` in logs.

- [x] Server

It was a string before, changed to double.

- [x] Bug fix (non-breaking change which fixes an issue)

Docs should mention the type/unit of `query_execution_time` is numeric/double.
2018-09-27 18:02:21 +05:30
Vamshi Surabhi
5e619cc479 fix geojson inconsistencies (closes #510) (#513)
Graphql-engine now accepts crs key to specify the Coordinate Reference System as accepted in GeoJSON 2008 spec.

- [x] Server
2018-09-27 17:53:17 +05:30
Karthik Venkateswaran
a9dc756a40 update console variables and contributing guide (close #517) (#538)
Changes `consoleMode` variable templated by HGE to `server` and modified console to respect in the same way and adds a patch to continue working with the older HGEs

- [x] Server
- [x] Console
2018-09-27 17:10:32 +05:30
Anon Ray
75090d51b9 jwt config now takes a jwk url (close #465) (#527)
JWT config now takes an optional jwk_url parameter (which points to published JWK Set). This is useful for providers who rotate their JWK Set.

Optional jwk_url parameter is taken. The published JWK set under that URL should be in standard JWK format (tools.ietf.org/html/rfc7517#section-4.8).

If the response contains an Expires header, the JWK set is automatically refreshed.
2018-09-27 16:52:49 +05:30
Tirumarai Selvan
2cd2b23b2d add custom headers for webhooks, refactor retry logic (#419) 2018-09-24 17:20:11 +05:30
Rakesh Emmadi
8f6b19d6f1 quote constraint name for non-admin inserts (fix #494) (#497)
### Description
What component does this PR affect? 

- [x] Server
### Related Issue
#494 

### Solution and Design
Use `quote_ident()` SQL function over `constraint_name` in insert trigger function definition.

### Type
- [x] Bug fix (non-breaking change which fixes an issue)
2018-09-20 20:54:20 +05:30
Anon Ray
04696aec45 fix pgcrypto extension creation failures on heroku (fix #495) (#496)
### Description
Fixes #495 

What component does this PR affect? 

- [x] Server

### Solution and Design
Create the extension explicitly mentioning the public schema. 

### Type

- [x] Bug fix (non-breaking change which fixes an issue)
2018-09-20 12:55:39 +05:30
Aravind Shankar
729b56dd20 live queries tests for subscription (#487) 2018-09-20 07:16:03 +05:30
Tirumarai Selvan
c42af444f7 implement query to update an event trigger (#367) 2018-09-19 17:42:57 +05:30
Rakesh Emmadi
ec516ce55b allow _is_null operator for filter/check permissions (close #456) (#477) 2018-09-18 17:15:35 +05:30
nizar-m
cde559fe58 dont set non-null constraint for manual object relationships (close #462) 2018-09-18 17:01:16 +05:30
Vamshi Surabhi
85df9ac1e8 payload is now optional in connection_init message (close #470) (#471) 2018-09-18 13:13:30 +05:30
Vamshi Surabhi
534f23d1a6 python based tests (#387) 2018-09-18 11:51:57 +05:30
Rakesh Emmadi
e6c5aa5b43 indicate access key is set in the console context (close #426) (#447) 2018-09-14 18:57:46 +05:30
Tirumarai Selvan
f94de38e4c dont reload schema cache for event deliveries (#453) 2018-09-14 18:13:42 +05:30
Anon Ray
4b4c675ab7 better handling for pgcrypto extension (fix #338) (#423) 2018-09-14 17:11:51 +05:30
Anon Ray
af6121f83d jwt claims check should be case-insensitive (fix #435) (#438) 2018-09-13 18:34:50 +05:30
Tirumarai Selvan
c3a38517cd dont retry http requests in the client (close #434) (#436) 2018-09-13 17:22:11 +05:30
Shahidh K Muhammed
be20a11d37
update checks on ci systems (close #319) (#383) 2018-09-12 16:33:36 +05:30
Anon Ray
a5930edd8a uri-decode database uri strings (fix #372) (#424) 2018-09-12 11:49:08 +05:30
Rakesh Emmadi
86b769c8e5 returning on json queries now returns only affected row (fix #380) (#381) 2018-09-08 23:02:58 +05:30
Vamshi Surabhi
dd8e09d6cb add jsonb boolean operators (close #369) (#376) 2018-09-07 17:45:28 +05:30
Tirumarai Selvan
e905535beb implement api to deliver a particular event (close #371) (#373) 2018-09-07 17:21:01 +05:30
Tirumarai Selvan
2814e87e37 make sure only events for existing triggers are fetched (#368) 2018-09-07 13:53:56 +05:30
Anon Ray
f726bb549d add custom namespace in jwt claims (close #350) (#364) 2018-09-07 11:30:50 +05:30
Karthik Venkateswaran
e3102dfd5e ui buttons to export and import metadata, reload metadata api (close #293) (#323) 2018-09-05 20:55:30 +05:30
Tirumarai Selvan
e402d11318 update catalog version to 2 (#357) 2018-09-05 17:12:20 +05:30
Tirumarai Selvan
82e09efce6 add event triggers (#329) 2018-09-05 16:56:46 +05:30
Rakesh Emmadi
0a3f68a6eb allow selectively updating columns on a conflict during insert (fix #342)
* fix primary key changing on upsert, fix #342

* add 'update_columns' in 'on_conflict' object, consider 'allowUpsert'

* 'ConflictCtx' type should respect upsert cases

* validation for not null fields in an object
2018-09-04 19:09:48 +05:30
Rakesh Emmadi
10edb431e4 generate a returning field in a mutation only when the select permission is defined (fix #340) (#341) 2018-09-03 12:35:00 +05:30
Anon Ray
b2f88ff28a add support for jwt authorization (close #186) (#255)
The API:
1. HGE has `--jwt-secret` flag or `HASURA_GRAPHQL_JWT_SECRET` env var. The value of which is a JSON.

2. The structure of this JSON is: `{"type": "<standard-JWT-algorithms>", "key": "<the-key>"}`
`type` : Standard JWT algos : `HS256`, `RS256`, `RS512` etc. (see jwt.io).
`key`:
  i. Incase of symmetric key, the key as it is.
  ii. Incase of asymmetric keys, only the public key, in a PEM encoded string or as a X509 certificate.

3. The claims in the JWT token must contain the following:
  i. `x-hasura-default-role` field: default role of that user
  ii. `x-hasura-allowed-roles` : A list of allowed roles for the user. The default role is overriden by `x-hasura-role` header.

4. The claims in the JWT token,  can have other `x-hasura-*` fields where their values can only be strings.

5. The JWT tokens are sent as `Authorization: Bearer <token>` headers.

---
To test:
1. Generate a shared secret (for HMAC-SHA256) or RSA key pair.
2. Goto https://jwt.io/ , add the keys
3. Edit the claims to have `x-hasura-role` (mandatory) and other `x-hasura-*` fields. Add permissions related to the claims to test permissions.
4. Start HGE with `--jwt-secret` flag or `HASURA_GRAPHQL_JWT_SECRET` env var, which takes a JSON string: `{"type": "HS256", "key": "mylongsharedsecret"}` or `{"type":"RS256", "key": "<PEM-encoded-public-key>"}`
5. Copy the JWT token from jwt.io and use it in the `Authorization: Bearer <token>` header.

---
TODO: Support EC public keys. It is blocked on frasertweedale/hs-jose#61
2018-08-30 16:02:09 +05:30
Rakesh Emmadi
daf01c2b9d mutation return type and query type are same (close #315) (#324) 2018-08-30 15:19:21 +05:30
Rakesh Emmadi
f72d8de87a fix insert fails for non-admin roles on v1/query (fix #327) (#328)
* fix insert fails for non-admin roles on v1/query, fix #327

* add test case for user role upsert usint constraint name
2018-08-29 19:11:33 +05:30
Rakesh Emmadi
75e4400bc5 add req_user_id as alias to x-hasura-user-id (fix #317) (#320) 2018-08-29 11:17:13 +05:30
Rakesh Emmadi
efc9fc7ba9 simpler root level select fields using primary keys (fix #304) (#306)
* select fields by primary key col values as argument values, fix #304

* change field name 'table_by_pkey' to 'table_by_pk'
2018-08-27 19:47:03 +05:30
Rakesh Emmadi
0f13f72bfe do not allow creating permissions for admin role, fix #310 (#312) 2018-08-27 17:20:18 +05:30
Rakesh Emmadi
a0574307c3 set header variables in subscription transaction, fix #297 (#299) 2018-08-22 13:53:53 +05:30