Skip to content

Releases: tirumaraiselvan/graphql-engine

v1.3.0

16 Jul 08:50
f8a7312
Compare
Choose a tag to compare
v1.3.0 Pre-release
Pre-release

Changelog

New features and highlights

Remote Joins

Remote Joins generalizes the concept of joining data between tables in Postgres, to being able to join data across any part of your GraphQL schema. The schema's underlying source can be anything: Postgres or REST APIs (via Actions) or other GraphQL services (via Remote Schemas), but you can still do a join across them by simply creating relationships via Hasura metadata.

Remote Joins enables complete data federation as your data sources can evolve independently while Hasura provides a unified GraphQL API over them with authorization and schema integrity enabled from get-go.

In this release, you can create relationships from tables to Remote Schemas. This works similar to table relationships. Head to the Relationship tab in your table page and define a Remote Relationship:

  • give a name for the relationship
  • select the remote schema
  • give the join configuration from table columns to remote schema fields.

remote-relationships

The join configuration can refer to any field in the remote schema that takes an input argument. It can also take static values.

remote-rel-configuration

Once this is done, head to GraphiQL and make your query with the remote relationship! Note: Action relationships are kind of a reverse join of this where you can create a relationship from your REST API to a table.

(hasura#2392)

Relay

The Hasura GraphQL Engine now serves a Relay schema for Postgres tables which have a primary key defined. Relay allows you to combine React and GraphQL to build highly modular and performant javascript applications.

The Relay schema can be accessed through /v1beta1/relay endpoint.

relay

(hasura#4458)

Scheduled Triggers

Scheduled Triggers can be used to invoke webhooks based on a cron schedule or timestamp. Head to the Events page on the console and check it out.

A Cron Trigger can be used to invoke webhooks on a fixed schedule. For example, you can create a Cron Trigger to generate an end-of-day sales report every weekday at 10 pm.

Selection_355

You can also schedule one-off events based on a timestamp. For example, a scheduled event can be created to send a feedback email to a user 2 days after sign-up (note: this would typically be done using the metadata API in your code).

Selection_356

(hasura#3553, hasura#4732)

Data Triggers

With the introduction of additional events like "one-off scheduled events", Event Triggers has now been renamed to Data Triggers for clarity.

Allow access to session variables in computed fields

Sometimes it is useful for computed fields to have access to the Hasura session variables directly. For example, suppose you want to fetch some articles but also get related user info, say likedByMe. Now, you can define a function like:

CREATE OR REPLACE FUNCTION article_liked(article_row article, hasura_session json)
RETURNS boolean AS $$
  SELECT EXISTS (
    SELECT 1
    FROM liked_article A
    WHERE A.user_id = hasura_session ->> 'x-hasura-user-id' AND A.article_id = article_row.id
  );
$$ LANGUAGE sql STABLE;

and make a query like:

query {
  articles {
    title
    content
    likedByMe
  }
}

Support for this is now added through the add_computed_field API.

Read more about the session argument for computed fields in the docs.

(fix hasura#3846)

Manage seed migrations as SQL files

A new seeds command is introduced in CLI, this will allow managing seed migrations as SQL files

Creating seed

# create a new seed file and use editor to add SQL content
hasura seeds create new_table_seed

# create a new seed by exporting data from tables already present in the database
hasura seeds create table1_seed --from-table table1

# create from data in multiple tables:
hasura seeds create tables_seed --from-table table1 --from-table table2

Applying seed

# apply all seeds on the database:
hasura seeds apply

# apply only a particular seed
hasura seeds apply --file 1234_add_some_seed_data.sql

Other fixes and improvements

  • server: fix explain queries with role permissions (fix hasura#4816)
  • server: compile with GHC 8.10.1, closing a space leak with subscriptions. (close hasura#4517) (hasura#3388)
  • server: fixes an issue where introspection queries with variables would fail because of caching (fix hasura#4547)
  • server: avoid loss of precision when passing values in scientific notation (fix hasura#4733)
  • server: fix mishandling of GeoJSON inputs in subscriptions (fix hasura#3239)
  • server: fix importing of allow list query from metadata (fix hasura#4687)
  • server: flush log buffer during shutdown (hasura#4800)
  • server: raise error on startup when --unauthorized-role is ignored (hasura#4736)
  • server: fix edge case with printing logs on startup failure (fix hasura#4772)
  • server: add new --conn-lifetime and HASURA_GRAPHQL_PG_CONN_LIFETIME options for expiring connections after some amount of active time (hasura#5087)
  • server: shrink libpq connection request/response buffers back to 1MB if they grow beyond 2MB, fixing leak-like behavior on active servers (hasura#5087)
  • server: add --pg-connection-options command-line flag for passing parameters to PostgreSQL (close hasura#5092) (hasura#5187)
  • server: adjustments to idle GC to try to free memory more eagerly (related to hasura#3388)
  • console: allow entering big int values in the console (close hasura#3667) (hasura#4775)
  • console: add support for subscriptions analyze in API explorer (close hasura#2541) (hasura#2541)
  • console: avoid count queries for large tables (hasura#4692)
  • console: add read replica support section to pro popup (hasura#4118)
  • console: fix regression in editing permissions manually (fix hasura#4683) (hasura#4826)
  • console: allow modifying default value for PK (fix hasura#4075) (hasura#4679)
  • console: fix checkbox for forwarding client headers in actions (hasura#4595)
  • console: re-enable foreign tables to be listed as views (fix hasura#4714) (hasura#4742)
  • console: display rows limit in permissions editor if set to zero (fix hasura#4559)
  • console: fix inconsistency between selected rows state and displayed rows (fix hasura#4654) (hasura#4673)
  • console: fix displaying boolean values in Edit Row tab (hasura#4682)
  • console: fix underscores not being displayed on raw sql page (close hasura#4754) (hasura#4799)
  • console: fix visiting view modify page overwriting raw sql content (fix hasura#4798) (hasura#4810)
  • console: add help button and move about page to settings (hasura#4848)
  • console: add new sidebar icon that separates enums from tables (fix hasura#4984) (hasura#4992)
  • console: provide option to cascade metadata on dependency conflicts on console (fix hasura#1593)
  • console: fix enum tables reload data button UI (hasura#4647)
  • console: fix "Cannot read property 'foldable'" runtime error in Browse Rows page (fix hasura#4907) (hasura#5016)
  • console: respect read-only mode in actions pages (fix hasura#4656) (hasura#4764)
  • console: allow configuring session_argument for custom functions (close hasura#4499) (hasura#4922)
  • console: allow manual edit of column types and handle array data types (close hasura#2544, hasura#3335, hasura#2583) (hasura#4546)
  • console: add the ability to delete a role in permissions summary page (close hasura#3353) (hasura#4987)
  • console: fix styling of table row contents on tables on relationship page (hasura#4974)
  • console: allow configuring statement timeout on console RawSQL page (close hasura#4998) (hasura#5045)
  • console: support tracking partitioned tables (close hasura#5071) (hasura#5258)
  • console: handle generated and identity columns in console data section (close hasura#4552, hasura#4863) (hasura#4761)
  • console: display line number that error originated from in GraphQL editor (close hasura#4849) (hasura#4942)
  • cli: list all available commands in root command help (fix hasura#4623) (hasura#4446
  • cli: fix bug with squashing event triggers (close hasura#4883)
  • cli: add support for skipping execution while generating migrations through the migrate REST API
  • cli: add dry run flag in hasura migrate apply command (fix hasura#3128) (hasura#3499)
  • cli: load assets from server when HASURA_GRAPHQL_CONSOLE_ASSETS_DIR is set (close hasura#3382)
  • cli: add new flags up-sql and down-sql to generate sql based migrations from the CLI (hasura#5026)
  • cli: handle missing files during metadata apply (close hasura#5163) (hasura#5170)
  • cli: fix plugins install failing due to permission issues on windows (close hasura#5111)
  • docs: add section on actions vs. remote schemas to actions documentation (hasura#4284)
  • docs: fix wrong info about excluding scheme in CORS config (hasura#4685)
  • docs: add single object mutations docs (close hasura#4622) (hasura#4625)
  • docs: add docs page on query performance (close hasura#2316) (hasura#3693)
  • docs: add a sample Caddyfile for Caddy 2 in enable-https section (hasura#4710)
  • docs: add disabling dev mode to production checklist (hasura#4715)
  • docs: add integration guide for AWS Cognito (hasura#4822, hasura#4843)
  • docs: update troubleshooting section with reference on debugging errors (close hasura#4052) (hasura#4825)
  • docs: add page for procuring custom docker images and binaries (hasura#4828)
  • docs: add content on how to secure action handlers and other actions docs improvements (hasura#4743)
  • docs: make header common with other hasura.io/ pages (hasura#4957)
  • docs: add page on setting up v2 migrations (close hasura#4746) (...
Read more