Commit Graph

1710 Commits

Author SHA1 Message Date
Puru Gupta
ebc8cd5134 server: do not serialize env vars in logs or errors: PR III - Event Triggers
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4521
Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com>
Co-authored-by: Brandon Simmons <210815+jberryman@users.noreply.github.com>
GitOrigin-RevId: c7702e8f3da466dc108936328de30ceb87df258a
2022-06-05 20:28:13 +00:00
pranshi06
056765578f server: add support for custom scalar in action output types
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4185
GitOrigin-RevId: 16a24fdcdbd195b4b59bcca7957c469ba073dabb
2022-06-03 09:48:26 +00:00
David Overton
6586053296 Gdw 85/capabilities endpoint
>

## Description ✍️

- Creates a new `/capabilities` endpoint for the GDC agent API
- Removes capabilities from the `/schema` endpoint
- Removes the `/config-schema` endpoint and includes the `ConfigSchemaResponse` within the `CapabilitiesResponse`

### Related Issues ✍
->

https://hasurahq.atlassian.net/browse/GDW-85

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4478
GitOrigin-RevId: 426662ee9e751343d94207d439a5025df65d2de7
2022-06-03 08:08:23 +00:00
Daniel Chambers
e5c1106864 server: Send source name as a header to Data Connector agents [GDW-110]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4614
GitOrigin-RevId: f7828d4c0bbf4c46059b08b86b22915cc8de3cbf
2022-06-02 05:23:51 +00:00
Daniel Chambers
1dbdb0236c server: Data Connector IR refactor, support for column boolean comparison expressions [GDW-114]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4579
GitOrigin-RevId: 84da015123a53124488b88ce66bde26113625754
2022-06-02 02:07:57 +00:00
hasura-bot
e48f3cbef1 Add _cast support for other postgres datatypes fix #6050 and fix #5426
GITHUB_PR_NUMBER: 8524
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/8524

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4551
Co-authored-by: Abdullah Saleem <5978905+abdullah2993@users.noreply.github.com>
Co-authored-by: Abby Sassel <3883855+sassela@users.noreply.github.com>
GitOrigin-RevId: f85742318167d1e51f463c45fcd00f26269c2555
2022-06-01 16:41:49 +00:00
Tom Harding
a3031aed03 Add Weeder, begin weeding (1/?)
## Description

This PR adds a config file for [`weeder`](https://github.com/ocharles/weeder) to the `-mono` repository. `weeder` checks for dead code by building a call graph from the given entry points (currently every module named `Main` with a `main` function) and then marking every function _not_ in that call graph as dead code.

To avoid very large PRs, I'm going to tackle this in a series. This first PR adds the basic configuration, plus removes as many weeds as it took for me to realise this was going to become a very big PR. The PRs after this will largely be removing dead code, until the final PR that will add Weeder to the CI pipeline.

### Related Issues

This closes #2973.

## Affected components

- Server

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4572
GitOrigin-RevId: ac8eaa9473e5ac1f16babcb35388694392d0d7dc
2022-05-31 15:43:34 +00:00
Naveen Naidu
11867b50a4 server: extend backend_only setting for update and delete permissions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4530
Co-authored-by: Karthikeyan Chinnakonda <15602904+codingkarthik@users.noreply.github.com>
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: c4c1a3bd9736ec275e77c6f55c76049c550443f9
2022-05-31 14:42:14 +00:00
paritosh-08
e053ffe8ec server: hotfix for default naming convention issue
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4585
GitOrigin-RevId: 8e9e7eef0017e9c634167b08c4d2a61ee7ac1fdf
2022-05-31 09:09:04 +00:00
pranshi06
cd0f674821 server: Adds support to return array of scalars in Actions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3661
GitOrigin-RevId: bc37e7aa0cb861069536aa97aa4dff1fdc05e08b
2022-05-31 05:23:47 +00:00
Auke Booij
13fc1c62d1 Move Hasura.GraphQL.Parser.Column to .RQL.IR. and .GraphQL.Schema.
This is a first step towards clarifying the role of `UnpreparedValue` as part of the IR. It certainly does not belong in the parser framework.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4588
GitOrigin-RevId: d1582a0b266729b79e00d31057178a4099168e6d
2022-05-30 22:07:57 +00:00
Abby Sassel
1f68bd3c03 server/docs: add error message to troubleshooting.md
for easier searchability. from discussion at https://hasurahq.slack.com/archives/CV3UR1MT2/p1653911179537459?thread_ts=1653656301.295359&cid=CV3UR1MT2

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4586
GitOrigin-RevId: d0df3eade14050f99d549dc004372a4fb0ec378a
2022-05-30 15:28:35 +00:00
Rakesh Emmadi
af6eb1232e server/bigquery: computed fields SQL generation and execution
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4555
GitOrigin-RevId: c668cb6bd76ed646b9449d8037c2f9038c99e3a8
2022-05-30 15:24:33 +00:00
Tom Harding
59df4dffb3 [gh-pages] Remove broken haddock links from hasura.github.io
Hello!

I noticed that on [the deployed docs](https://hasura.github.io/graphql-engine/server/), [the first Haddock link](https://hasura.github.io/graphql-engine/server/haddock) and alpha/beta links were broken. I've removed the broken links and checked the other two.

Thanks!

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4536
GitOrigin-RevId: 52d575996c01c2ebf2396987b39474013c93812d
2022-05-30 12:22:49 +00:00
Gil Mizrahi
ae0dae0eed fix insertion of multiple empty objects
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4583
GitOrigin-RevId: a4eebf7d734c6556c2509ac66ccafbdb520189ba
2022-05-30 12:18:36 +00:00
Antoine Leblanc
8a999bd44d Structural updates to the server's engineering documentation
### Description

This PR does several things:
- it cleans up some structural issues with the engineering documentation:
  - it harmonizes the table of contents structure across different files
  - adds a link to the bigquery documentation
  - moves some files to a new `deep-dives` subfolder
  - puts a title at the top of each page to avoid github assuming their title is "table of contents"
- it pre-fills the glossary with a long list of words that could use an entry (all empty for now)
- it adds the only remaining relevant server file from [hasura-internal's wiki](https://github.com/hasura/graphql-engine-internal/wiki): the old "multiple backends architecture" file

### Discussion

A few things worth discussing in the scope of this PR:
- is it worth migrating old documentation such as the multiple backends architecture, that document a decision process rather instead of being up-to-date reflections of the code? are we planning to delete hasura-internal?
- should we focus instead on _new_ documentation, aimed to be kept up to date?
- are there other old documents we want to move in here, or is that it?
- is this glossary structure ok, or would a purely alphabetical structure make sense?
- does it make sense to have the glossary only in the engineering section? more generally, _what's our broader plan for documentation_?

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4537
GitOrigin-RevId: c2b674657b19af7a75f66a2a304c80c30f5b0afb
2022-05-30 09:46:06 +00:00
Abby Sassel
2518d16191 Create troubleshooting.md
Documenting a workaround discussed at https://hasurahq.slack.com/archives/C03263T1L9W/p1653561662369129 in a new Troubleshooting doc

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4575
GitOrigin-RevId: eb80662b93f157d363cd0b53993fc5bb5972b546
2022-05-30 09:18:44 +00:00
Antoine Leblanc
cdf5e3b5f0 Specialize RQL.DML to postgres.
### Description

When generalizing the code, back in late 2020, we over-eagerly generalized parts of the code that are specific to RQL's DML. This was in part due to the fact that, at the time, the DML types were all mixed alongside other types in `RQL.Types`. As a result, a lot of `RQL.DML.Internal` was generic over the backend type, instead of being specialized to `'Postgres 'Vanilla`.

A consequence of this is that, before this PR, `DML.Internal` ended up having a dependency on non-Postgres backends, due to the use of `annBoolExp`, which requires a `BackendMetadata` instance. Since the code was written in a generic manner, `DML.Internal` in turn depended on having the metadata instances in scope... This PR changes that to, instead, explicitly import the Postgres instance.

(Note that this module didn't import `RQL.Types.Metadata.Instances`, but depends on a module that imports it, and **orphan instances are transitively imported**, as evidenced by the need for that explicit import in #4568.)

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4573
GitOrigin-RevId: 7b82b5d7c23c03654518a1816802d400f37c3c64
2022-05-27 18:23:19 +00:00
Antoine Leblanc
498442b1d3 Remove circular dependency in schema building code
### Description

The main goal of this PR is, as stated, to remove the circular dependency in the schema building code. This cycle arises from the existence of remote relationships: when we build the schema for a source A, a remote relationship might force us to jump to the schema of a source B, or some remote schema. As a result, we end up having to do a dispatch from a "leaf" of the schema, similar to the one done at the root. In turn, this forces us to carry along in the schema a lot of information required for that dispatch, AND it forces us to import the instances in scope, creating an import loop.

As discussed in #4489, this PR implements the "dependency injection" solution: we pass to the schema a function to call to do the dispatch, and to get a generated field for a remote relationship. That way, this function can be chosen at the root level, and the leaves need not be aware of the overall context.

This PR grew a bit bigger than that, however; in an attempt to try and remove the `SourceCache` from the schema altogether, it changed a lot of functions across the schema building code, to thread along the `SourceInfo b` of the source being built. This avoids having to do cache lookups within a given source. A few cases remain, such as relay, that we might try to tackle in a subsequent PR.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4557
GitOrigin-RevId: 9388e48372877520a72a9fd1677005df9f7b2d72
2022-05-27 17:22:38 +00:00
Antoine Leblanc
cbe0479406 Remove unrelated functions from GraphQL.Schema.Common
### Description

There were several functions in `GraphQL.Schema.Common` that were unrelated to the schema building process, and were about metadata manipulation or dependency computation. Having those functions in the schema part of the code forces several places in the code to depend on the schema code, despite being completely unrelated.

This PR moves those functions where they make sense: alongside similar functions in `RQL.Types.*`, and rewrites `getRemoteDependencies` for clarity (it was using the term "indirect dependency" in a way that was inconsistent with the rest of the code).

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4568
GitOrigin-RevId: 948a18cebbb337a8bb6367c1f2d2ef5628209d96
2022-05-27 15:41:06 +00:00
Auke Booij
cda117a4a9 Add unless/when related hints
Example:

```
server/src-lib/Hasura/RQL/DDL/Schema/Table.hs:(200,15)-(205,28): Warning: Use when
Found:
  if tnGQL `elem` ns then
      throw400 RemoteSchemaConflicts
        $ "node " <> tnGQL <> " already exists in current graphql schema"
  else
      pure ()
Perhaps:
  when
    (tnGQL `elem` ns)
    (throw400 RemoteSchemaConflicts
       $ "node " <> tnGQL <> " already exists in current graphql schema")
```

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4570
GitOrigin-RevId: 1b04e5e39d20c99643220154c03dae82a025f0f1
2022-05-27 13:34:42 +00:00
Antoine Leblanc
9308c92e8d Fix a /= [] and add hint.
### Description

Several places in the code used `a /= []`, which is inelegant. To my surprise, hlint did not warn about this, despite the fact that it forces an `Eq` instance on the elements. This PR replaces all occurrences of that pattern with `not (null a)` and adds a lint warning for it.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4569
GitOrigin-RevId: 6471e75ade9e71e5d583a0dac7815c01870c696b
2022-05-27 12:28:24 +00:00
paritosh-08
42da1dbc2e server/docs: follow up on the naming convention
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4563
GitOrigin-RevId: 0ae1f226a63dae34e6cb0d001b4915c05b0974cf
2022-05-27 05:56:52 +00:00
Gil Mizrahi
2b3d7c407b server/mssql: drop the temp table after delete
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4562
GitOrigin-RevId: f5f5815d9e2f58912a294cf564cfdc38995263d3
2022-05-26 15:21:54 +00:00
Evie Ciobanu
a8c0137f21 server: add infrastructure to write runit tests for update parsers
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4533
GitOrigin-RevId: d094149d6cbdeebe152c58032715bad725480d9b
2022-05-26 14:06:24 +00:00
paritosh-08
fd30fb343b server: naming conventions for auto generated fields
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3982
Co-authored-by: Brandon Simmons <210815+jberryman@users.noreply.github.com>
GitOrigin-RevId: f90b2e8f394e7bd69780f003d2d980475f104f42
2022-05-26 11:55:29 +00:00
Vishnu Bharathi
0d1f1aad9a ci: tag release v2.7.0
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4553
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: 6b822051ab9b72b2de93a0367a8fedaef544fab3
2022-05-25 10:55:59 +00:00
Rakesh Emmadi
acde210fdc server/bigquery: generate graphql schema for table computed fields
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4460
GitOrigin-RevId: 7b772cd9fba6b612ad05eb1aca1fa13e6ae8556d
2022-05-25 10:25:38 +00:00
Abby Sassel
45843b94d9 server/tests: fix Bigquery HTTP request failed with status code 400 and status message "Bad Request"
Fixes https://github.com/hasura/graphql-engine-mono/issues/4546

Error: `Bigquery HTTP request failed with status code 400 and status message "Bad Request" `

Likely fix: untrack `author` table before dropping it in `SerializationSpec`. [This is the main change](fadbbfe8f2), the rest is cleanup.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4548
GitOrigin-RevId: 36be213d8ccfeb2dbb6b797225dc07e6e3dc83ba
2022-05-24 17:08:52 +00:00
Auke Booij
cb67ad5e95 server: Clean up some deriving statements
By generalizing the instances, they can be written as attached instance derivations, rather than standalone ones.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4518
GitOrigin-RevId: 7a387911cf6ad46fe6acd36648275d6c2c68ffe3
2022-05-24 07:22:55 +00:00
Daniel Chambers
9e5f860a29 server: Default SourceMetadata's kind to Postgres Vanilla
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4514
Co-authored-by: David Overton <7734777+dmoverton@users.noreply.github.com>
GitOrigin-RevId: 37572758c3722a85ac005f5bd13a9bf6a407bad4
2022-05-24 04:16:44 +00:00
Auke Booij
82ceafaf44 Remove unused schema.graphql resource
This file was no longer needed after the PDV refactor (hasura/graphql-engine#4111). It was replaced by `Hasura.GraphQL.Schema.Introspect`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4532
GitOrigin-RevId: 61a5f44a9e68238d61095a3f176b2d5847c63307
2022-05-23 16:44:20 +00:00
Puru Gupta
d5e46b6041 server: do not serialize env vars in logs or errors: PR II - Actions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4486
Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com>
Co-authored-by: Brandon Simmons <210815+jberryman@users.noreply.github.com>
GitOrigin-RevId: 35bb05f9a3c98689c05f2865e0923c00b46e5419
2022-05-23 11:13:49 +00:00
Puru Gupta
5501f686df server: do not serialize env vars in logs or errors: PR I - Remote Schemas
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4463
Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com>
Co-authored-by: Brandon Simmons <210815+jberryman@users.noreply.github.com>
GitOrigin-RevId: 71c6824130d71312f5bd5ae94fc268c0544c6ca3
2022-05-21 09:05:59 +00:00
Vamshi Surabhi
73b161b2bc move action IR types to IR.Actions module
A very minor cleanup (came out of documenting the architecture of actions). Does what's mentioned in the title.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4451
GitOrigin-RevId: d480ff438256df468df65b43d15f92a30b14b997
2022-05-14 11:10:42 +00:00
Vishnu Bharathi
b6eb71ae07 ci: tag release for v2.6.2 and v2.7.0-beta.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4499
GitOrigin-RevId: 8c4c6256ea953c55f8db03460e32d0a775d0d2ea
2022-05-12 17:45:42 +00:00
Lyndon Maydwell
5d5552f185 Fix for too much information in Pro PSQL exceptions wrt. Certificates
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4475
GitOrigin-RevId: 8a64b4387c559ca447252dcadf6c5e231b079c65
2022-05-12 14:30:35 +00:00
Gil Mizrahi
cd38a9a1fc server/postgres + server/mssql: Insert empty objects with default values
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4487
Co-authored-by: Abby Sassel <3883855+sassela@users.noreply.github.com>
GitOrigin-RevId: 3413f0b5dbe6ec42fff360d83b5202e4aa4aa86e
2022-05-11 16:01:57 +00:00
Solomon
b4f89569c8 GDC: Integration Tests and Servant Agent
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4467
GitOrigin-RevId: 5e81d8581197c90ad2de9106e724c63d7592ae72
2022-05-11 06:15:27 +00:00
Tom Harding
3db241155d Make ForeignKey mappings non-empty
Previously, these were represented with a HashMap, but supposedly that map can never be empty. Now, it uses NEHashMap, which carries the non-empty invariant behind a smart constructor.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4481
GitOrigin-RevId: 93ad9aaa9354f25a1ba10e8207ae19614e1e439e
2022-05-10 15:44:46 +00:00
Karthikeyan Chinnakonda
ce9912ff8c server: run_sql to not drop the SQL triggers created by the graphql-engine
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4397
GitOrigin-RevId: dcd43fc31f64af8c6c9c92c66d46a593d5b12fbd
2022-05-10 13:47:16 +00:00
Antoine Leblanc
697137dd77 Fix Postgres not padding timestamps correctly (fix hasura/graphql-engine#8096)
## Description

As identified in hasura/graphql-engine#8096, the format string we used for timestamps was incorrect; we were using `%F`, which expands to `%Y-%m-%d`; but that meant that the year was not padded to four digits: `0001` would be represented simply as `1`. However, Postgres inteprets that `1` as `2001`, probably due to interpretation rules about two-digit years (in `25/12/01`, `01` is indeed `2001`).

```
# create table timestamp_test ( test timestamptz );
CREATE TABLE
# insert into timestamp_test values ('1-01-01T00:00:57Z');
INSERT 0 1
# select * from timestamp_test;
          test
------------------------
 2001-01-01 00:00:57+00
(1 row)
```

To fix this, this PR changes the format string to use `%0Y`, which always pads the year number with zeroes.

## Remaining work

- [x] write Changelog entry
- [ ] copy timestamp tests from the python suite into the hspec tests

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3536
GitOrigin-RevId: fa144111358339fd4a35b32d888c1d2c5b418ea6
2022-05-09 12:18:18 +00:00
Evie Ciobanu
d1f8b9a87d server: further improve anybackend module docs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4465
GitOrigin-RevId: fda2b45468a94d5b25f9d5aed8199502ee9370ad
2022-05-09 10:12:59 +00:00
hasura-bot
8bf2dd0c65 Improve COMPILING-ON-MACOS.md
GITHUB_PR_NUMBER: 8472
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/8472

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4466
Co-authored-by: Nico Burns <1007307+nicoburns@users.noreply.github.com>
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: dae49cafaba8492224d70df4624ad36888e0e3ab
2022-05-09 08:32:56 +00:00
Antoine Leblanc
04d8f068b6 Remove explicit case on the backend tag in Cache
### Description

As part of the cache building process, we create / update / migrate the catalog that each DB uses as a place to store event trigger information. The function that decides how this should be done was doing an explicit `case ... of` on the backend tag, instead of delegating to one of the backend classes. The downsides of this is that:
- it adds a "friction point" where the backend matters in the core of the engine, which is otherwise written to be almost entirely backend-agnostic
- it creates imports from deep in the engine to the `Backends`, which we try to restrict to a very small set of clearly identified files (the `Instances` files)
- it is currently implemented using a "catch all" default case, which might not always be correct for new backends

This PR makes the catalog updating process a part of `BackendMetadata`, and cleans the corresponding schema cache code.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4457
GitOrigin-RevId: 592f0eaa97a7c38f4e6d4400e1d2353aab12c97e
2022-05-05 13:44:56 +00:00
Daniel Chambers
97ac9cbcdc Data Connector Agent Configuration Schema [GDW-103]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4450
GitOrigin-RevId: 2dce6e901c9734407d084d57166039fd94394279
2022-05-05 05:19:46 +00:00
Sibi Prabakaran
a06abcea86 docs: Add Debugging section for hspec
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4448
GitOrigin-RevId: 57aff86ebd0ef0ec90fa4ba11f5a7a83cf4e9c27
2022-05-04 14:57:15 +00:00
Rakesh Emmadi
7474f50ef0 server/bigquery: enable metadata API to add/drop computed fields to BigQuery tables
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4414
GitOrigin-RevId: 7899824a49ba9fd479f4cf08789450153f454168
2022-05-04 14:53:31 +00:00
paritosh-08
fb4f745f74 server: refactor Hasura.GraphQL.Analyse
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4310
GitOrigin-RevId: 36bd42476724cc6b94987a4362c2a46616be4f0c
2022-05-04 10:57:55 +00:00
Sibi Prabakaran
49f2e0f4a3 Unify hspec test for SelectSpec and DirectiveSpec
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4387
GitOrigin-RevId: 890d07ebda838a4c6dc4221908bacba2ee75a0a2
2022-05-04 09:59:29 +00:00