1
0
mirror of https://github.com/hasura/graphql-engine.git synced 2024-12-21 06:21:39 +03:00
Commit Graph

1166 Commits

Author SHA1 Message Date
Rakesh Emmadi
5f274b5527 fix mutation returning when relationships are present (fix ) ()
If returning field contains nested selections then mutation is performed in two steps
1. Mutation is performed with returning columns of any primary key and unique constraints
2. returning fields are queried on rows returned by selecting from table by filtering with column values returned in Step 1.

Since mutation takes two courses based on selecting relations in returning field, it is hard to maintain sequence of prepared arguments (PrepArg) generated while resolving returning field. So, we're using txtConverter instead of prepare to resolve mutation fields.
2019-03-07 15:54:07 +05:30
Vamshi Surabhi
98405fdc0c
allow x-hasura- req headers for jwt unauth role, closes () 2019-03-05 17:54:47 +05:30
Anon Ray
d9882fcb03 fix remote queries/mutations to work over websocket (fix ) () 2019-03-05 16:39:02 +05:30
Anon Ray
02d80c9ac6 read cookie while initialising websocket connection (fix ) ()
* read cookie while initialising websocket connection (fix )

* add tests for cookie on websocket init

* fix logic for tests

* enforce cors, and flag to force read cookie when cors disabled

  - as browsers don't enforce SOP on websockets, we enforce CORS policy
  on websocket handshake
  - if CORS is disabled, by default cookie is not read (because XSS
  risk!). Add special flag to force override this behaviour

* add log and forward origin header to webhook

  - add log notice when cors is disabled, and cookie is not read on
  websocket handshake
  - forward origin header to webhook in POST mode. So that when CORS is
  disabled, webhook can also enforce CORS independently.

* add docs, and forward all client headers to webhook
2019-03-04 13:16:53 +05:30
Vamshi Surabhi
f794653b69
update event triggers on rename operations () 2019-03-01 19:29:24 +05:30
Rakesh Emmadi
377290a058 breaking: correct (de)serialisation of postgres numeric types in json (fix ) () 2019-03-01 17:15:04 +05:30
Rakesh Emmadi
6c20ca8a55 allow renaming tables, columns and relationships (close ) () 2019-03-01 14:47:22 +05:30
nizar-m
1fa66dc622 add option to disable metadata and graphql apis (close ) () 2019-02-28 19:23:03 +05:30
Shahidh K Muhammed
097bfb6bfa revert "forward response headers from remote servers ()"
This reverts commit c19fe35f4e.
2019-02-28 17:20:56 +05:30
Anon Ray
c19fe35f4e forward response headers from remote servers (fix ) () 2019-02-28 17:15:07 +05:30
Rakesh Emmadi
c731fde1e3 enforce column presets of update permission with upserts (fix ) () 2019-02-23 16:06:42 +05:30
Tirumarai Selvan
7851015cb2 refactor event processing logic () 2019-02-22 17:55:36 +05:30
Rakesh Emmadi
0833d35088 generate scalar types for SQL function arguments (fix ) ()
Also involved a refactor of the internals to localise the context needed for each field
2019-02-22 15:57:38 +05:30
Igor Pashev
7ccc91ec4f remove grep from server makefile ()
awk can do all the job.
2019-02-19 12:20:54 +05:30
nizar-m
f83a8e591f rename access-key to admin-secret (close ) ()
Rename the admin secret key header used to access GraphQL engine from X-Hasura-Access-Key to X-Hasura-Admin-Secret.

Server CLI and console all support the older flag but marks it as deprecated.
2019-02-14 15:07:47 +05:30
Tirumarai Selvan
51dd6157e1 remove wreq and set response timeout (close ) () 2019-02-14 13:07:59 +05:30
Anon Ray
199a24d050 add support for multiple domains in cors config (close ) ()
Support for multiple domains (as CSV) in the `--cors-domain` flag and `HASURA_GRAPHQL_CORS_DOMAIN` env var.

Following are all valid configurations (must include scheme and optional port):
```shell
HASURA_GRAPHQL_CORS_DOMAIN="https://*.foo.bar.com:8080"
HASURA_GRAPHQL_CORS_DOMAIN="https://*.foo.bar.com, http://*.localhost, https://example.com"
HASURA_GRAPHQL_CORS_DOMAIN="*"
HASURA_GRAPHQL_CORS_DOMAIN="http://example.com, http://*.localhost, http://localhost:3000, https://*.foo.bar.com, https://foo.bar.com"
```

**Note**: top-level domains are not considered as part of wildcard domains. You have to add them separately. E.g - `https://*.foo.com` doesn't include `https://foo.com`.

The default (if the flag or env var is not specified) is `*`. Which means CORS headers are sent for all domains.
2019-02-14 11:28:38 +05:30
Vamshi Surabhi
68bb898b24
Update CONTRIBUTING.md 2019-02-14 10:47:27 +05:30
Vamshi Surabhi
392a37f12a
Update CONTRIBUTING.md 2019-02-14 10:46:14 +05:30
Rakesh Emmadi
2054bdc44e do not allow overloading already tracked functions () 2019-02-14 09:35:18 +05:30
Rakesh Emmadi
cba732d439 support column presets in update mutation (closes , closes ) ()
Also restricts altering type of columns which are used in presets
2019-02-11 18:15:30 +05:30
Tirumarai Selvan
9a6fa7fafc add delivery info to event payload (close ) ()
Adds the following to the event payload:
```
    "delivery_info": {
        "max_retries": 0,
        "current_retry": 0
    }
```
2019-02-07 18:07:28 +05:30
Anon Ray
4f6462e98f add config for stringified hasura claims in JWT (fix ) () 2019-02-05 17:34:16 +05:30
Rakesh Emmadi
96f8b05326 don't allow altering tracked SQL functions type to VOLATILE (fix ) () 2019-02-05 11:27:03 +05:30
nizar-m
68da491d9d Improve error message when no operation specs are provided during event trigger creation (close ) () 2019-02-01 15:07:38 +05:30
Rakesh Emmadi
4ef50d95c7 hdb_views should always be cleared before building schema cache () 2019-01-29 15:39:58 +05:30
Rakesh Emmadi
3caff9b924 support jsonb and postgis operators in permissions ()
* support jsonb and geometry operators on RQL bool exps, close 

* add tests for jsonb operators in /v1/query

TODO:-
-> add tests for geometry (postgis) operators

* support parsing session variables for st_d_within and has_key ops

-> Add tests for boolExp operators and select permissions

* improve parsing $st_d_within op's json value logic
2019-01-28 23:16:31 +05:30
Anon Ray
91c19ecf3d test jwt with invalid signtaure and expired token () 2019-01-28 22:22:43 +05:30
Anon Ray
4ae44f7b5d add functions to server telemetry () 2019-01-28 22:16:44 +05:30
nizar-m
32387ba964 support union and interface types in remote schema (close ) () 2019-01-28 22:15:10 +05:30
Anon Ray
39bc3acffd fix conversion when merging remote schema scalars with hasura (fix ) () 2019-01-28 21:01:37 +05:30
Shahidh K Muhammed
11e7c3f9d6 add anonymous telemetry () 2019-01-28 19:25:28 +05:30
nizar-m
8e3b8f51c9 Support default values (in inputvalue) from the remote schema (close ) () 2019-01-28 18:08:38 +05:30
Rakesh Emmadi
fc73d4d30a handle the absence of any update operators, fix () 2019-01-28 12:54:24 +05:30
Tirumarai Selvan
e590144d02 send session variables in event trigger payload (close ) () 2019-01-28 11:42:52 +05:30
Rakesh Emmadi
0bf2457e23 allow exposing postgres functions through GraphQL interface (close ) () 2019-01-25 09:01:54 +05:30
Rakesh Emmadi
ae63ed9603 simplify SQL generated for _eq and _neq operators in GraphQL API () 2019-01-25 00:04:44 +05:30
Vamshi Surabhi
5514b40de2
dependencies of object relationship now includes remote table, closes () 2019-01-24 18:56:13 +05:30
nizar-m
bf67e5e246 update Server Contributing.md (close ) () 2019-01-20 15:19:56 +05:30
nizar-m
916caf1575 add flag to disable prepared statements (close ) () 2019-01-18 19:50:41 +05:30
Rakesh Emmadi
d91d7e658a optimise 'run_sql' query, closes () 2019-01-18 16:15:59 +05:30
Rakesh Emmadi
7ff1c8829a add PostGIS operators in boolean expressions (closes ) () 2019-01-17 11:51:38 +05:30
Nathan Stitt
1b9540f996 allow specifying network interface with "server-host" option ()
* allow specifying network interface with "server-host" option

* store host value as a HostPreference

* document server-host options
2019-01-11 16:37:13 +05:30
Rakesh Emmadi
1008c08420 accept null and empty values for relationships during insert, closes 2019-01-11 12:52:58 +05:30
Anon Ray
e9121a903f fix typo in pgcrypto error message (fix ) () 2019-01-08 14:35:25 +05:30
Rakesh Emmadi
e2fe078b89 fix fetching primary key columns for non table owners (close ) () 2019-01-04 16:36:05 +05:30
Rakesh Emmadi
41e487d203 fix auth hook mode env var (fix ) ()
Support HASURA_GRAPHQL_AUTH_HOOK_MODE env var for --auth-hook-mode flag.
Drop support for HASURA_GRAPHQL_AUTH_HOOK_TYPE env var in next major
update (beta/stable)
2019-01-04 12:12:36 +05:30
Vamshi Surabhi
380fdad468 update constraint enum types when a new constraint is added ()
* update metadata when constraints on a table are altered, fix 

* capture only unique or primary constraints in tableinfo
2019-01-03 09:28:12 +05:30
Rakesh Emmadi
4d9d1505dd improve startup logging, close () 2019-01-02 16:54:17 +05:30
Vamshi Surabhi
be1d9414f8
diff's query should account for table having no columns () 2018-12-21 15:24:22 +05:30
Vamshi Surabhi
ea4d2644e8
local console during development ()
* console now works on local builds of the server

1. local console assets can be served at /static/ by a build time flag
'local-console'. This can be set with stack as follows:
   `stack build --flag graphql-engine:local-console`
2. the --root-dir option is removed which was used as a temporary hack
for serving graphiql
3. remove server's graphiql source code
2018-12-21 13:21:02 +05:30
Rakesh Emmadi
63acd0e7b2 generate aggregate order by types only if relevant columns are present, closes () 2018-12-20 19:31:54 +05:30
Rakesh Emmadi
d4e6ffcae8 revert back to older cli options parser type () 2018-12-19 17:08:33 +05:30
Vamshi Surabhi
c28fbd3f98
faster retrieval of table information from postgres () 2018-12-19 16:11:06 +05:30
Vamshi Surabhi
8feff0daca
clear event_triggers when clear_metadata is called, closes () 2018-12-19 12:04:27 +05:30
Rakesh Emmadi
b5bbb966f2 add consolePath in console.html template ()
Server templates `consolePath` key in `window.__env` object in console html template.
If server is hit at `/console/table/author` then `window.__env` in served html looks like
```
{
   consoleMode: "server",
   urlPrefix: "/console",
   consolePath: "/console/table/author",
   isAccessKeySet: true
}
```
2018-12-18 15:09:01 +05:30
Rakesh Emmadi
3026c49087 apply update permissions for upsert mutations () 2018-12-15 21:40:29 +05:30
Tirumarai Selvan
6de17b303f drop trigger functions on updating event triggers () 2018-12-15 10:35:29 +05:30
Anon Ray
2bcec7dca9 point jose version to 0.8.0.0 on github (closes ) () 2018-12-14 09:51:29 +05:30
Rakesh Emmadi
708a29fc89 refactor server cli code, add more cli options & version command (closes , , , ) () 2018-12-14 08:51:41 +05:30
Vamshi Surabhi
ec8b2c80b5
refactor to remove warnings especially with orphan instances ()
* remove phase one/two distinction and hdbquery typeclass

* move extensions to default-extensions

* switch to LazyTx which only acquires a connection if needed

* move defns from TH module into Ops module

* remove tojson orphan instance for http exception

* remove orphan instance for dmlp1

* getTopLevelNodes will not throw any exceptions
2018-12-13 12:56:15 +05:30
Rakesh Emmadi
ff6c95c2f8 allow ordering with aggregated fields (close ) () 2018-12-12 18:28:39 +05:30
Anon Ray
77cbf12bb7 merge types with same structure in remote schema (closes , ) () 2018-12-12 17:31:18 +05:30
Rakesh Emmadi
9fbd407374 parse graphql input objects and arrays as scalar values (close ) () 2018-12-04 19:51:58 +05:30
Rakesh Emmadi
29ba490296 conform to graphql subscription and error spec (close , close ) () 2018-12-04 19:07:38 +05:30
Rakesh Emmadi
3ea20bc4d7 allow authentication webhook with POST (close ) () 2018-12-03 16:49:08 +05:30
Vamshi Surabhi
db1f6c1a39
remove dependency on 'first' aggregate, closes () 2018-11-27 21:40:54 +05:30
Rakesh Emmadi
1e896a9c42 handle null values for input arguments, fix () 2018-11-27 17:54:51 +05:30
Anon Ray
0d14c13f98 metadata should be backwards compatible for remote schemas (fix ) () 2018-11-27 16:56:10 +05:30
Anon Ray
a509a86eaa implement internal graphql server for remote schema tests ()
* implement internal graphql server for remote schema tests

* add one more graphql endpoint and more tests

* add missing dependency
2018-11-26 18:38:16 +05:30
Rakesh Emmadi
8df23ad6c9 use postgres IN experssion for _in operator (fix ) () 2018-11-26 15:39:55 +05:30
Anon Ray
512ee6fb9f adds basic support for remote schemas/schema stitching () 2018-11-23 18:32:46 +05:30
Shahidh K Muhammed
6fb24d5bf0 update server dockerfile, install manifests and docs () 2018-11-23 14:47:31 +05:30
Rakesh Emmadi
58fe579497 support Postgres's DISTINCT ON (close ) () 2018-11-23 07:23:56 +05:30
Dimitrios Mavrommatis
ef6e53a407 change descending ordering to nulls first (fix ) () 2018-11-22 10:28:18 +05:30
Rakesh Emmadi
030f094de9 handle empty array for _in and _nin operators, fix () 2018-11-21 12:28:29 +05:30
Vamshi Surabhi
47dcae1614
fix sql generation for boolean expressions, closes ()
When using self referential relationships in boolean expressions, the exists clause incorrectly uses the table names to qualify columns which will be the same for parent table and the child table. This is now fixed by generating unique aliases as we traverse down the relationships.
2018-11-16 18:10:23 +05:30
Rakesh Emmadi
1539d6b5a6 server port can be set with HASURA_GRAPHQL_SERVER_PORT env variable, closes () 2018-11-15 10:25:39 +05:30
Rakesh Emmadi
b719e82e89 add statistical aggregate operations and count on columns (close ) () 2018-11-14 18:29:59 +05:30
Tirumarai Selvan
317efb81f1 event triggers: take webhook url from env (close ) () 2018-11-14 12:43:01 +05:30
Rakesh Emmadi
9af591e2cb remove x-hasura-access-key header from logs (fix ) () 2018-11-13 14:05:44 +05:30
Tirumarai Selvan
d4d31838cb quote function and trigger names, allow hyphen in trigger name () 2018-11-13 11:28:55 +05:30
Rakesh Emmadi
8c1700e76f improve SQL generation for '_in' operation (close ) () 2018-11-12 18:57:47 +05:30
Rakesh Emmadi
80de0e019a do not generate prefix for column identifiers in agg select, fix () 2018-11-12 12:58:46 +05:30
Abhinav Srivastava
c776cd84a6 update multiple files () 2018-11-08 12:02:57 +05:30
Anupam Dagar
e1253e595a add missing serve command to server contributing guide () 2018-11-04 08:11:06 +05:30
Rakesh Emmadi
999580481c allow specifying a list of columns that can be inserted (close ) () 2018-11-02 20:38:38 +05:30
Rakesh Emmadi
0e9d6994ac refactor nested insert mutation and fix returning (fix ) ()
* improved nested insert execution logic

* integrate error path, improve executing 'withExp' and improve tests

* add more readable types in '/Resolve/Insert.hs'

* set conflict context just before executing WITH expression
2018-11-02 19:31:01 +05:30
Shahidh K Muhammed
f7da89e10a
remove enable console from docker cmd and add it as env var (close ) () 2018-11-02 15:59:01 +05:30
Rakesh Emmadi
1a91399298 extract session variables from relational bool expression (fix ) () 2018-11-02 15:06:33 +05:30
Rakesh Emmadi
0803738df1 refactor select query generation () 2018-10-31 18:21:20 +05:30
Tirumarai Selvan
c5c2ed2389 give precedence to retry-after header over retry conf () 2018-10-31 17:22:41 +05:30
Tirumarai Selvan
b40807c9ec change type of fetch interval to milliseconds () 2018-10-30 20:50:18 +05:30
Mohammed Rishad
58ccddc76e pep8 fixes for python files () 2018-10-30 14:51:58 +05:30
nizar-m
4f091e5e5b gitignore generated .tix files in pytest folder () 2018-10-29 19:55:37 +05:30
nizar-m
0ffb0478b9 Tests for server with access control, and some more tests ()
* 1) Tests for creating permissions
2) Test for constraint_on with GraphQL insert on_conflict

* Run tests with access key and webhook

* Tests for GraphQL query with quoted columns

* Rewrite test-server.sh so that it can be run locally

* JWT based tests

* Tests with various postgres types

* For tests on select queries, run setup only once per class

* Tests for v1 count queries

* Skip teardown for tests that does not modify data

* Workaround for hpc 'parse error when reading .tix file'

* Move GeoJson tests to the new structure

* Basic tests for v1 queries

* Tests for column, table or operator not found error cases on GraphQL queries

* Skip test teardown for mutation tests which does not change database state, even when it returns 200.
2018-10-28 23:57:49 +05:30
Vamshi Surabhi
58582be644
fix parsing webhook response, closes () 2018-10-28 22:01:24 +05:30
Tirumarai Selvan
baf7c493bc respect retry-after header on event trigger response () 2018-10-26 21:58:03 +05:30
Vamshi Surabhi
8b0082eac1
clean up user variables parsing logic and fix explain api () 2018-10-26 21:27:22 +05:30
Rakesh Emmadi
fb842fde6f optional 'set' field in insert permissions, closes () 2018-10-26 20:28:20 +05:30
Rakesh Emmadi
f6ed169219 allow ordering using columns from object relationships (closes ) ()
* allow ordering using columns from object relationships, close 

* validate table fields in nested insert

* add tests

* add docs

* change 'table_order_by' type from enums to ordered map

* remove unwanted code from 'Schema.hs' file

* 'AnnGObject' is not list of field name and value tuple

* update docs for new order_by type

* use 'InsOrdHashMap' for 'AnnGObj'

* handle empty fields in order_by

* remove '_' prefixes for asc/desc

* fix the changed order_by syntax across the repo
2018-10-26 17:27:33 +05:30
Rakesh Emmadi
a8cee16ab5 support aggregations (closes ) ()
* support for count and aggregations on columns, close 

* support explain query for aggregations

* '<arr-rel>_agg' in '<table>' type, fix order by for aggregations

* add 'allow_aggregations' key in select permissions

* Add checkbox to toggle count and aggregations on columns on select permission

* align aggregation checkbox with columns div

* improve readability of the generated sql

* alias is needed at the top level aggregation

* throw internal errors for unexpected fields

* rename SelFld to more readable TableAggFld

* rename agg to aggregate
2018-10-26 14:32:43 +05:30
Rakesh Emmadi
10d8529d28 allow unauthorized role in accesskey and JWT modes (closes ) () 2018-10-25 23:46:25 +05:30
Vamshi Surabhi
199531cbd9
http and websocket logs now correctly have user information, closes () 2018-10-25 15:07:57 +05:30
Tirumarai Selvan
810b440089 trigger webhooks on column level changes instead of row (close , close ) () 2018-10-25 12:52:51 +05:30
Vamshi Surabhi
ab9692da4d
set all session data in a single paramater, 'hasura.user' (closes ) 2018-10-24 16:09:47 +05:30
nizar-m
cd030068c2 GeoJSON: Fix MultiPolygon parse error (closes ) 2018-10-24 13:51:37 +05:30
Spencer Ng
a0a97d709d improve documentation (fix ) () 2018-10-19 22:29:18 +05:30
Vamshi Surabhi
ac537330d0 explain a graphql query, similar to explain of an sql statement (close ) () 2018-10-19 07:45:28 +05:30
Vamshi Surabhi
67168b3632 send 'completed' after an error when handling start in ws (close ) () 2018-10-16 17:19:24 +05:30
Rakesh Emmadi
45691e3509 for views consider only insertable ones in generating nested insert input objects (fix ) () 2018-10-16 15:55:41 +05:30
Rakesh Emmadi
49dd7bf98b allow mutations on views only if they are allowed by postgres (fix ) () 2018-10-12 17:36:12 +05:30
Rakesh Emmadi
37e848ccca fix input object validation logic (fix ) () 2018-10-12 16:06:47 +05:30
Vamshi Surabhi
ecf8c760ec workaround postgres default limit of 63 chars for identifiers (close ) () 2018-10-12 14:58:43 +05:30
Rakesh Emmadi
be28f8c947 add env var to enable console (close ) () 2018-10-10 12:16:38 +05:30
Vamshi Surabhi
8970518bdb upgrade stackage to 12.12 () 2018-10-10 12:03:00 +05:30
Vamshi Surabhi
603461ad8f track connection_init error on each ws connection (close ) () 2018-10-09 15:51:05 +05:30
Rakesh Emmadi
d57be587b3 format schema name and table name as identifiers in event triggers (fix ) () 2018-10-09 12:09:20 +05:30
Rakesh Emmadi
00d5a5c1a3 insert mutations can now handle nested-data/relationsips (close ) () 2018-10-05 20:43:51 +05:30
Anon Ray
7d9851b0a9 generate coverage report for server tests (close ) () 2018-10-05 18:07:19 +05:30
Vamshi Surabhi
32ae105279 improved sql generation for select queries (closes , , ) ()
Better SQL generation for select queries (the query plans will be the same but much more readable). This closes some long standing issues (, , ).
2018-10-05 14:26:47 +05:30
Rakesh Emmadi
91376316f2 breaking: encode bigint and bigserial postgres types as strings in response (fix ) ()
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  where JavaScript cannot decode 64 bit Integers.
2018-10-05 10:46:21 +05:30
Gaurav Sachdeva
d02361ce14 fix typos, punctuation, etc in docs () 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 ) () 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 ) ()
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 ) ()
Fix migration logic to accommodate for non superuser permissions. Closes  

- [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 ) ()
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 ) ()
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 ) ()
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 ) ()
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 () 2018-09-24 17:20:11 +05:30
Rakesh Emmadi
8f6b19d6f1 quote constraint name for non-admin inserts (fix ) ()
### Description
What component does this PR affect? 

- [x] Server
### Related Issue
 

### 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 ) ()
### Description
Fixes  

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 () 2018-09-20 07:16:03 +05:30
Tirumarai Selvan
c42af444f7 implement query to update an event trigger () 2018-09-19 17:42:57 +05:30
Rakesh Emmadi
ec516ce55b allow _is_null operator for filter/check permissions (close ) () 2018-09-18 17:15:35 +05:30
nizar-m
cde559fe58 dont set non-null constraint for manual object relationships (close ) 2018-09-18 17:01:16 +05:30
Vamshi Surabhi
85df9ac1e8 payload is now optional in connection_init message (close ) () 2018-09-18 13:13:30 +05:30
Vamshi Surabhi
534f23d1a6 python based tests () 2018-09-18 11:51:57 +05:30
Rakesh Emmadi
e6c5aa5b43 indicate access key is set in the console context (close ) () 2018-09-14 18:57:46 +05:30
Tirumarai Selvan
f94de38e4c dont reload schema cache for event deliveries () 2018-09-14 18:13:42 +05:30
Anon Ray
4b4c675ab7 better handling for pgcrypto extension (fix ) () 2018-09-14 17:11:51 +05:30
Anon Ray
af6121f83d jwt claims check should be case-insensitive (fix ) () 2018-09-13 18:34:50 +05:30
Tirumarai Selvan
c3a38517cd dont retry http requests in the client (close ) () 2018-09-13 17:22:11 +05:30
Shahidh K Muhammed
be20a11d37
update checks on ci systems (close ) () 2018-09-12 16:33:36 +05:30
Anon Ray
a5930edd8a uri-decode database uri strings (fix ) () 2018-09-12 11:49:08 +05:30
Rakesh Emmadi
86b769c8e5 returning on json queries now returns only affected row (fix ) () 2018-09-08 23:02:58 +05:30
Vamshi Surabhi
dd8e09d6cb add jsonb boolean operators (close ) () 2018-09-07 17:45:28 +05:30
Tirumarai Selvan
e905535beb implement api to deliver a particular event (close ) () 2018-09-07 17:21:01 +05:30
Tirumarai Selvan
2814e87e37 make sure only events for existing triggers are fetched () 2018-09-07 13:53:56 +05:30
Anon Ray
f726bb549d add custom namespace in jwt claims (close ) () 2018-09-07 11:30:50 +05:30
Karthik Venkateswaran
e3102dfd5e ui buttons to export and import metadata, reload metadata api (close ) () 2018-09-05 20:55:30 +05:30
Tirumarai Selvan
e402d11318 update catalog version to 2 () 2018-09-05 17:12:20 +05:30
Tirumarai Selvan
82e09efce6 add event triggers () 2018-09-05 16:56:46 +05:30
Rakesh Emmadi
0a3f68a6eb allow selectively updating columns on a conflict during insert (fix )
* fix primary key changing on upsert, fix 

* 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 ) () 2018-09-03 12:35:00 +05:30
Anon Ray
b2f88ff28a add support for jwt authorization (close ) ()
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 
2018-08-30 16:02:09 +05:30
Rakesh Emmadi
daf01c2b9d mutation return type and query type are same (close ) () 2018-08-30 15:19:21 +05:30
Rakesh Emmadi
f72d8de87a fix insert fails for non-admin roles on v1/query (fix ) ()
* fix insert fails for non-admin roles on v1/query, fix 

* 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 ) () 2018-08-29 11:17:13 +05:30
Rakesh Emmadi
efc9fc7ba9 simpler root level select fields using primary keys (fix ) ()
* select fields by primary key col values as argument values, fix 

* 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 () 2018-08-27 17:20:18 +05:30
Rakesh Emmadi
a0574307c3 set header variables in subscription transaction, fix () 2018-08-22 13:53:53 +05:30
Rakesh Emmadi
e3b56ac368 fix upsert queries to work on non admin roles (fix ) () 2018-08-17 20:14:43 +05:30
Shahidh K Muhammed
0ea2ab45f8
add default cmd to dockerfile (close ) () 2018-08-13 15:58:22 +05:30
Rakesh Emmadi
0797407dbf respect the nullability of columns in generated schema (fix ) () 2018-08-10 18:14:44 +05:30
Rakesh Emmadi
adf973dee5 better error code when insertion check constraint fails (fix ) () 2018-08-10 17:35:07 +05:30
Vamshi Surabhi
c901767cd1
update packages ()
* move to stackage 12.4

* upgrade pg-client

* docker build improvements
2018-08-08 13:10:13 +05:30
Rakesh Emmadi
cffa808d19 returning returns [] when mutations affect no rows (fix ) ()
* fix returning returns null, fix 

* add a test case for delete mutation with returning
2018-08-08 12:31:49 +05:30
Rakesh Emmadi
8ecb80d2da accept null values for input values, closes () 2018-08-07 16:13:42 +05:30
Vamshi Surabhi
dcde969d66 ignore certain headers from the request when calling the webhook (close ) () 2018-08-06 19:36:48 +05:30
Rakesh Emmadi
9c55490e98 add limit in select permission which overrides limit in query (close ) () 2018-08-06 17:45:08 +05:30
Rakesh Emmadi
c94640a377 don't allow creating relationships from/to a table that isn't tracked (fix ) ()
* don't allow fkey based relations from/to a table that isn't tracked, fix 

Check if remote table exist in metadata when creating foreign-key
based object relationship.

* add tests for adding object relation using fkey if remote table is untracked
2018-08-03 15:04:37 +05:30
Rakesh Emmadi
8ef2692eb7 improve logs on webhook errors (closes , ) ()
* logging for webhook IO exceptions, fix log request for errors, fix 

* log status code and response in case of any error for webhook
2018-08-03 14:13:35 +05:30
Rakesh Emmadi
a0590598e5 filter schema identifiers to conform to graphql naming scheme (close ) ()
* filter schema identifiers to conform to graphql naming scheme,closes 

Filter out tables, columns, relationships etc which does not conform to
graphql naming scheme.
This ensures GraphiQL initialisation works properly for existing
databases.

* rename `isGraphQLConform` to `isValidName`

* rename all graphQL validators
2018-07-27 15:20:12 +05:30
Anon Ray
62b7b800c5 check for updates every 24 hrs in background (fix ) () 2018-07-27 15:04:50 +05:30
Anon Ray
c747971f2d server tests now run across supported postgres versions >= 9.5 (fix ) () 2018-07-26 11:17:21 +05:30
Rakesh Emmadi
ad31f02b51 add ca certificates to packager (fix ) () 2018-07-24 13:17:09 +05:30
Rakesh Emmadi
27e2d647bb add _inc and jsonb operators to update_mutation (close ) () 2018-07-20 16:21:20 +05:30
Anon Ray
07ac9fe345 add more tests () 2018-07-20 13:49:06 +05:30
Vamshi Surabhi
e3f960da96 initial support for livequeries ()
fix 
2018-07-20 12:52:46 +05:30
Aravind Shankar
5985bf8e9e deploy script enhancements () 2018-07-17 22:30:26 +05:30
Vamshi Surabhi
679310b008
accomodate for the precedence of IS before 9.5, closes 2018-07-17 22:26:47 +05:30
Rakesh Emmadi
5efa366b49 add 'on_conflict' argument to insert mutation (closes )
* add 'on_conflict' condition to allow upsert mutation, closes 

* check for empty unique or primary key constraints

* add 'on_conflict' condition test cases and introspection test case

* update 'conflict_action' enum values' description
2018-07-17 18:53:23 +05:30
Earl St Sauver
6d68a819e0 update path in server contributing guide ()
update path in server contributing guide
2018-07-16 19:27:13 +05:30
rakeshkky
a094394f38 server: add _is_null operator, closes 2018-07-12 19:33:02 +05:30
Anon Ray
79d7b497c9 add contributing guidelines for server () 2018-07-11 16:04:29 +05:30
Rakesh Emmadi
6160e24085 rename 'raven' to 'graphql-engine' in help text, closes 2018-07-11 13:54:13 +05:30
Anon Ray
4270529c11 basic test suite ()
* server: basic test setup

* server: use the default transaction mode

* server: basic tests in yaml files

* server: restructure test setup and some more tests
2018-07-11 12:43:07 +05:30
Rakesh Emmadi
4a76c7e89e server: throw 401 exception for accesskey mismatch/notfound, fix ()
return 401 when access key does not match or is not found, closes 
2018-07-11 11:07:53 +05:30
Shahidh K Muhammed
83ab85fb04
update readme and contributing guides () 2018-07-11 10:27:03 +05:30
dsandip
29654fa883
remove license file reference 2018-07-10 20:57:20 +05:30
dsandip
467988c4b4
Changes license 2018-07-10 19:48:54 +05:30
Shahidh K Muhammed
50165fc1ed circleci integration () 2018-07-10 10:01:02 +00:00
rakeshkky
82e81cd540 server: use row expressions instead of json_build_object 2018-07-09 12:55:49 +05:30
Rakesh Emmadi
38c91e2b9e catch and log http exceptions from auth webhook, closes 2018-07-09 11:34:41 +05:30
Rakesh Emmadi
b9ff99329a server: process headers only for known urls, fixes 2018-07-06 10:46:42 +05:30
Rakesh Emmadi
e834bc51a6 server: try environment variables if flags are missing, closes 2018-07-06 10:43:46 +05:30
Rakesh Emmadi
b9dd3b2ab2 server: close render console assets version as v[maj.min] () 2018-07-04 18:15:34 +05:30
Shahidh K Muhammed
98c827449b
build: integrate circleci
integration with circleci for various workflows
2018-07-03 22:40:13 +05:30
Rakesh Emmadi
400a0e3f16 server: add v1/version api, fix () 2018-07-03 21:04:25 +05:30
Anon Ray
9d2d158532 server: build now is multi-stage builds (fix )
- Change the build flow to use docker multi-stage builds
2018-07-02 16:40:13 +00:00
Vamshi Surabhi
9a845b4932 server: mutationRoot is optional in __schema 2018-06-29 17:32:59 +05:30
Rakesh Emmadi
128ed2388b server: console is served at /console Closes () 2018-06-29 16:35:09 +05:30
Vamshi Surabhi
db1a098b3b server: do not publish schema for system defined tables 2018-06-29 16:30:54 +05:30
Vamshi Surabhi
114418c378 server: support @skip and @include directives. closes 2018-06-29 14:50:49 +05:30
Vamshi Surabhi
f6bb130240 server: improved error messages. closes 2018-06-29 12:51:04 +05:30
Vamshi Surabhi
c09725ba79 server: coerce 'a' to '[a]' for list input types 2018-06-29 10:17:53 +05:30
Vamshi Surabhi
7e0bb03f17 server: map pgvarchar to GraphQL String 2018-06-29 10:17:53 +05:30
Rakesh Emmadi
a4dbe58c15 server: Disallow untrack_table for system defined tables. Fix () 2018-06-28 17:26:40 +05:30
Rakesh Emmadi
f625882199 [server] allow only one of db url or conn params. Closes () 2018-06-28 16:19:40 +05:30
Vamshi Surabhi
47c73f750f server: use insert-ordered-containers for ordered map 2018-06-28 13:49:52 +05:30
Vamshi Surabhi
3b8c5a1848 server: use attoparsec-iso8601 for parsing time information 2018-06-28 13:49:52 +05:30
Vamshi Surabhi
e637f3dd7b server: packaging now works 2018-06-28 13:49:52 +05:30
Vamshi Surabhi
530027cf20 move raven into graphql-engine repo 2018-06-28 00:32:00 +05:30