mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-11-13 09:17:21 +03:00
docs: add actions docs (#3907)
This commit is contained in:
parent
bb63d7e60e
commit
048c1de414
123
docs/graphql/manual/actions/action-handlers.rst
Normal file
123
docs/graphql/manual/actions/action-handlers.rst
Normal file
@ -0,0 +1,123 @@
|
||||
Action handlers
|
||||
===============
|
||||
|
||||
|
||||
.. contents:: Table of contents
|
||||
:backlinks: none
|
||||
:depth: 1
|
||||
:local:
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
Actions need to be backed by custom business logic. This business logic can be
|
||||
defined in a handler which is an HTTP webhook.
|
||||
|
||||
|
||||
HTTP handler
|
||||
------------
|
||||
|
||||
When the action mutation is called, Hasura makes a ``POST`` request to the
|
||||
handler with the mutation arguments and the session variables.
|
||||
|
||||
The request payload is of the format:
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"action": "<action-name>",
|
||||
"input": {
|
||||
"arg1": "<value>",
|
||||
"arg2": "<value>"
|
||||
},
|
||||
"session_variables": {
|
||||
"x-hasura-user-id": "<session user id>",
|
||||
"x-hasura-role": "<session user role>"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Returning a success response
|
||||
----------------------------
|
||||
|
||||
To return a success response, you must send back a response payload of action's
|
||||
response type. The HTTP status code must be ``2xx`` for a successful response.
|
||||
|
||||
Returning an error response
|
||||
---------------------------
|
||||
|
||||
To return an error response, you must send back an error object or a list of
|
||||
error objects. An error object looks like:
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"message": "<error message>"
|
||||
}
|
||||
|
||||
The HTTP status code must be ``4xx`` for an error response.
|
||||
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
For example, consider the following mutation.
|
||||
|
||||
.. code-block:: graphql
|
||||
|
||||
extend type Mutation {
|
||||
UserLogin (username: String!, email: String!): UserInfo
|
||||
}
|
||||
|
||||
type UserInfo {
|
||||
accessToken: String!
|
||||
userId: Int!
|
||||
}
|
||||
|
||||
Let's say, the following mutation is executed:
|
||||
|
||||
.. code-block:: graphql
|
||||
|
||||
mutation {
|
||||
UserLogin (username: "jake", password: "secretpassword") {
|
||||
accessToken
|
||||
userId
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Hasura will call the handler with the following payload:
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"action": "UserInfo",
|
||||
"input": {
|
||||
"username": "jake",
|
||||
"password": "secretpassword"
|
||||
},
|
||||
"session_variables": {
|
||||
"x-hasura-user-id": "423",
|
||||
"x-hasura-role": "user"
|
||||
}
|
||||
}
|
||||
|
||||
To return a success response, you must send the response of the action's output
|
||||
type (in this case, ``UserInfo``) with a status code ``2xx``. So a sample
|
||||
response would be:
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVC",
|
||||
"userId": 4829
|
||||
}
|
||||
|
||||
To throw an error, you must a response payload of the followin type while
|
||||
setting the status code as ``4xx``.
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"message": "invalid credentials"
|
||||
}
|
48
docs/graphql/manual/actions/async-actions.rst
Normal file
48
docs/graphql/manual/actions/async-actions.rst
Normal file
@ -0,0 +1,48 @@
|
||||
Async actions
|
||||
=============
|
||||
|
||||
.. contents:: Table of contents
|
||||
:backlinks: none
|
||||
:depth: 1
|
||||
:local:
|
||||
|
||||
Sometimes you may not want to wait for an action to complete before sending a
|
||||
response back to the client (say if the business logic takes a long time). In
|
||||
such cases you can create an **asynchronous** action, which returns an
|
||||
``action_id`` immediately to the client before contacting the handler.
|
||||
|
||||
If you mark an action as **asynchronous**, Hasura also generates a
|
||||
``query`` and a ``subscription`` field for the action so that you can
|
||||
query/subscribe to its status.
|
||||
|
||||
For example, let's say ``place_order`` is an asynchronous action
|
||||
|
||||
.. code-block:: graphql
|
||||
|
||||
mutation placeOrderRequest($order_input: place_order_input!) {
|
||||
place_order(input: $order_input)
|
||||
}
|
||||
|
||||
Executing this mutation will return a response like:
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"data": {
|
||||
"place_order": "23b1c256-7aff-4b95-95bd-68220d9f93f2"
|
||||
}
|
||||
}
|
||||
|
||||
The returned ``uuid`` is the ``action id`` of the async action. To get the actual
|
||||
response of the action, you can ``query`` or ``subscribe`` to the action
|
||||
using this ``action id``.
|
||||
|
||||
.. code-block:: graphql
|
||||
|
||||
subscription getPlaceOrderResponse {
|
||||
place_order (id: "23b1c256-7aff-4b95-95bd-68220d9f93f2") {
|
||||
output
|
||||
errors
|
||||
}
|
||||
}
|
||||
|
111
docs/graphql/manual/actions/codegen.rst
Normal file
111
docs/graphql/manual/actions/codegen.rst
Normal file
@ -0,0 +1,111 @@
|
||||
Actions codegen
|
||||
===============
|
||||
|
||||
.. contents:: Table of contents
|
||||
:backlinks: none
|
||||
:depth: 1
|
||||
:local:
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
Actions need HTTP handlers to run the business logic. It might be inconvenient
|
||||
to write the complete handler code for every action. Luckily, GraphQL's type
|
||||
system allows us to auto-generate the boilerplate code for actions.
|
||||
|
||||
|
||||
.. note::
|
||||
|
||||
Hasura currently has codegen set up for a few frameworks. The list of
|
||||
supported frameworks should grow with contributions from the
|
||||
community.
|
||||
|
||||
Generating handler code for your action
|
||||
---------------------------------------
|
||||
|
||||
.. rst-class:: api_tabs
|
||||
.. tabs::
|
||||
|
||||
.. tab:: Console
|
||||
|
||||
Head to the ``Actions -> [action-name] -> Codegen`` tab in the console
|
||||
|
||||
You can select the framework of your choice to get the corresponding
|
||||
handler boilerplate code.
|
||||
|
||||
.. thumbnail:: ../../../img/graphql/manual/actions/codegen/console-codegen-tab.png
|
||||
:alt: Console codegen tab
|
||||
|
||||
|
||||
.. tab:: CLI
|
||||
|
||||
**Configuration**
|
||||
|
||||
Before being able to codegen for actions, you have to configure your CLI.
|
||||
|
||||
Run:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
hasura actions use-codegen
|
||||
|
||||
1. Choose which framework you want to codegen for:
|
||||
|
||||
.. thumbnail:: ../../../img/graphql/manual/actions/codegen/cli-framework-prompt.png
|
||||
:alt: CLI Framework Prompt
|
||||
|
||||
2. Choose if you also wish to clone a starter kit for the chosen framework:
|
||||
|
||||
.. thumbnail:: ../../../img/graphql/manual/actions/codegen/cli-starter-kit-prompt.png
|
||||
:alt: CLI Starter Kit Prompt
|
||||
|
||||
3. Choose a path where you want to output the auto-generated code files
|
||||
|
||||
.. thumbnail:: ../../../img/graphql/manual/actions/codegen/cli-output-dir-prompt.png
|
||||
:alt: CLI Starter Kit Prompt
|
||||
|
||||
|
||||
This command will update your ``config.yaml`` with the codegen config as per
|
||||
your preferences. You can also set these values manually in ``config.yaml``.
|
||||
|
||||
For example:
|
||||
|
||||
.. code-block:: yaml
|
||||
:emphasize-lines: 8-10
|
||||
|
||||
version: "2"
|
||||
endpoint: http://localhost:8080
|
||||
metadata_directory: metadata
|
||||
migrations_directory: migrations
|
||||
actions:
|
||||
handler_webhook_baseurl: http://localhost:3000
|
||||
kind: synchronous
|
||||
codegen:
|
||||
framework: nodejs-express
|
||||
output_dir: ./nodejs-express/src/handlers/
|
||||
|
||||
|
||||
|
||||
**Codegen**
|
||||
|
||||
|
||||
To finally get auto-generated code for an action, run:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
hasura actions codegen <action-name>
|
||||
|
||||
The codegen files will be generated at the ``output_dir`` path from ``config.yaml``.
|
||||
|
||||
|
||||
Building a codegen for your framework
|
||||
-------------------------------------
|
||||
|
||||
As of now, Hasura provides codegen for a few frameworks (``nodejs-express``,
|
||||
``typescript-zeit``, etc).
|
||||
|
||||
If you wish to build a code generator for your framework
|
||||
`read the contrib guide <https://github.com/hasura/codegen-builder-contrib/>`_.
|
||||
|
||||
|
||||
|
212
docs/graphql/manual/actions/create.rst
Normal file
212
docs/graphql/manual/actions/create.rst
Normal file
@ -0,0 +1,212 @@
|
||||
Creating actions
|
||||
================
|
||||
|
||||
.. contents:: Table of contents
|
||||
:backlinks: none
|
||||
:depth: 1
|
||||
:local:
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
An action is a GraphQL mutation. You have to define the GraphQL type of the
|
||||
arguments that the mutation accepts and the GraphQL type of the its response.
|
||||
|
||||
To create an action, you have to:
|
||||
|
||||
1. Define the mutation
|
||||
2. Define the required types
|
||||
3. Create a handler
|
||||
|
||||
**For example**, let's start with a basic mutation that accepts a list of numbers and returns
|
||||
their sum. We'll call this mutation ``addNumbers``.
|
||||
|
||||
Step 0: Setup
|
||||
-------------
|
||||
|
||||
.. rst-class:: api_tabs
|
||||
.. tabs::
|
||||
|
||||
.. tab:: CLI
|
||||
|
||||
:ref:`Install <install_hasura_cli>` the latest version of Hasura CLI.
|
||||
|
||||
You can either get started with an existing project or create a new project.
|
||||
|
||||
**For a new project**
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
hasura init
|
||||
|
||||
This will create a new project. You can set up your GraphQL engine endpoint
|
||||
(and admin secret if it exists) in the ``config.yaml``.
|
||||
|
||||
Run ``hasura metadata export`` so that you get server's metadata into the
|
||||
``metadata/`` directory.
|
||||
|
||||
**For existing projects**
|
||||
|
||||
Actions are supported only in the v2 config of the CLI. Check the ``config.yaml``
|
||||
of your Hasura project for the ``version`` key.
|
||||
|
||||
If you are in ``version: 1``, actions commands are not supported. Upgrade to
|
||||
version 2 by running:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
hasura scripts update-config-v2
|
||||
|
||||
Run ``hasura metadata export`` so that you get server's metadata into the
|
||||
``metadata/`` directory.
|
||||
|
||||
|
||||
Step 1: Define your mutation and associated types
|
||||
-------------------------------------------------
|
||||
|
||||
.. rst-class:: api_tabs
|
||||
.. tabs::
|
||||
|
||||
.. tab:: Console
|
||||
|
||||
Go to the ``Actions`` tab on the console and click on ``Create``. This will
|
||||
take you to a page like this:
|
||||
|
||||
.. thumbnail:: ../../../img/graphql/manual/actions/action-create-page.png
|
||||
:alt: Console action create
|
||||
|
||||
Define the action as follows in the ``Action Definition`` editor.
|
||||
|
||||
.. code-block:: graphql
|
||||
|
||||
type Mutation {
|
||||
addNumbers (numbers: [Int]): AddResult
|
||||
}
|
||||
|
||||
In the above action, we called the returning object type to be ``AddResult``.
|
||||
Define it in the ``New types definition`` as:
|
||||
|
||||
.. code-block:: graphql
|
||||
|
||||
type AddResult {
|
||||
sum: Int
|
||||
}
|
||||
|
||||
.. tab:: CLI
|
||||
|
||||
To create an action, run
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
hasura actions create addNumbers
|
||||
|
||||
This will open up an editor with ``metadata/actions.graphql``. You can enter
|
||||
the action's mutation definition and the required types in this file. For your
|
||||
``addNumbers`` mutation, replace the content of this file with the following
|
||||
and save:
|
||||
|
||||
.. code-block:: graphql
|
||||
|
||||
type Mutation {
|
||||
addNumbers (numbers: [Int]): AddResult
|
||||
}
|
||||
|
||||
type AddResult {
|
||||
sum: Int
|
||||
}
|
||||
|
||||
The above definition means:
|
||||
|
||||
* This action will be available in your GraphQL schema as a mutation called ``addNumbers``
|
||||
* It accepts an argument called ``numbers`` which is a list of integers.
|
||||
* It returns an output type called ``AddResult``.
|
||||
* ``AddResult`` is a simple object type with a field called ``sum`` of type integer.
|
||||
|
||||
Step 2: Create the action handler
|
||||
---------------------------------
|
||||
|
||||
A handler is an HTTP webhook where you can perform the custom logic for the
|
||||
action. In this case, it is the addition of the numbers. NodeJS/Express code
|
||||
for this handler would look something like:
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
const handler = (req, resp) => {
|
||||
// You can access ther arguments input at req.body.input
|
||||
const { numbers } = req.body.input;
|
||||
|
||||
// perform your custom business logic
|
||||
// return an error or response
|
||||
try {
|
||||
return resp.json({
|
||||
sum: numbers.reduce((s, n) => s + n, 0)
|
||||
});
|
||||
} catch(e) {
|
||||
console.error(e)
|
||||
return resp.status(500).json({
|
||||
message: 'unexpected'
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
You can deploy this code somewhere and get URI. For getting started quickly, we
|
||||
also have this handler ready at ``https://hasura-actions-starter-kit.glitch.me/addNumbers``.
|
||||
|
||||
Set the handler
|
||||
***************
|
||||
|
||||
Now, set the handler for the action:
|
||||
|
||||
.. rst-class:: api_tabs
|
||||
.. tabs::
|
||||
|
||||
.. tab:: Console
|
||||
|
||||
Set the value of the ``handler`` field to the above endpoint.
|
||||
|
||||
.. tab:: CLI
|
||||
|
||||
Go to ``metadata/actions.yaml``. You must see a handler like ``http://localhost:3000``
|
||||
or ``http://host.docker.internal:3000`` under the action named ``addNumbers``.
|
||||
This is a default value taken from ``config.yaml``.
|
||||
|
||||
Update the ``handler`` to the above endpoint.
|
||||
|
||||
Step 3: Finish action creation
|
||||
------------------------------
|
||||
|
||||
.. rst-class:: api_tabs
|
||||
.. tabs::
|
||||
|
||||
.. tab:: Console
|
||||
|
||||
Hit ``Create``.
|
||||
|
||||
.. tab:: CLI
|
||||
|
||||
Run ``hasura metadata apply``.
|
||||
|
||||
|
||||
Step 4: Try it out
|
||||
------------------
|
||||
|
||||
In the Hasura console, head to the ``GraphiQL`` tab and try out the new action.
|
||||
|
||||
.. graphiql::
|
||||
:view_only:
|
||||
:query:
|
||||
mutation MyMutation {
|
||||
addNumbers(numbers: [1, 2, 3, 4]) {
|
||||
sum
|
||||
}
|
||||
}
|
||||
:response:
|
||||
{
|
||||
"data": {
|
||||
"addNumbers": {
|
||||
"sum": 10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
And that's it. You have created your first action!
|
125
docs/graphql/manual/actions/index.rst
Normal file
125
docs/graphql/manual/actions/index.rst
Normal file
@ -0,0 +1,125 @@
|
||||
Actions (beta)
|
||||
==============
|
||||
|
||||
.. contents:: Table of contents
|
||||
:backlinks: none
|
||||
:depth: 2
|
||||
:local:
|
||||
|
||||
What are actions?
|
||||
-----------------
|
||||
|
||||
Actions are a way to extend Hasura's mutation root with an entirely custom
|
||||
mutation with custom business logic. Actions can be
|
||||
added to Hasura to handle various use cases such as data validation, data
|
||||
enrichment from external sources and any other complex business logic.
|
||||
|
||||
.. thumbnail:: ../../../img/graphql/manual/actions/actions-hl-arch.png
|
||||
:class: no-shadow
|
||||
:alt: Actions high level architecture
|
||||
|
||||
.. admonition:: Supported from
|
||||
|
||||
Actions are currently available for preview in the pre-release versions of
|
||||
``v1.2.0``
|
||||
|
||||
.. Actions are supported in versions ``v.1.2.0`` and above.
|
||||
|
||||
Action description
|
||||
------------------
|
||||
|
||||
An action consists of the following parts:
|
||||
|
||||
1. ``Definition``: The definition of the mutation
|
||||
2. ``Handler``: The logic to be run when the mutation is executed
|
||||
3. ``Kind``: Sync or async
|
||||
|
||||
Definition
|
||||
**********
|
||||
|
||||
The action definition consists of the following:
|
||||
|
||||
- ``Action Name``: The action will be available as a mutation in the GraphQL
|
||||
schema named as the action name
|
||||
- ``Arguments``: Arguments are used to pass dynamic values along with the
|
||||
mutation.
|
||||
- ``Response type``: The GraphQL type of the response that the mutation will
|
||||
return. Actions can only return object types.
|
||||
|
||||
For instance, consider this action definition:
|
||||
|
||||
.. code-block:: graphql
|
||||
|
||||
extend type Mutation {
|
||||
userLogin(username: String!, password: String!): UserInfo
|
||||
}
|
||||
|
||||
In this definition, we are extending the mutation root with an action called
|
||||
``userLogin``.
|
||||
|
||||
- ``userLogin`` is the action name
|
||||
- ``username`` and ``password`` are the arguments that accept non-nullable
|
||||
string values.
|
||||
- ``UserInfo`` is the response type of the action
|
||||
|
||||
**Custom Types**
|
||||
|
||||
An action must return an object type. This means, you will have to define your
|
||||
custom types like so:
|
||||
|
||||
.. code-block:: graphql
|
||||
|
||||
type UserInfo {
|
||||
accessToken: String!
|
||||
userId: Int!
|
||||
}
|
||||
|
||||
Read more about :doc:`custom types<types/index>`.
|
||||
|
||||
Handler
|
||||
*******
|
||||
|
||||
Once you define the action types, you also have to specify the logic to run
|
||||
when the action mutation is executed. This can be done in an HTTP webhook,
|
||||
also called the action handler. It could be a REST endpoint or a serverless
|
||||
function.
|
||||
|
||||
Learn more about :doc:`writing an action handler<action-handlers>`.
|
||||
|
||||
Kind
|
||||
****
|
||||
|
||||
Actions are of two kinds:
|
||||
|
||||
* **Synchronous actions**: Sync actions return a response to the client after
|
||||
receiving a response from the handler.
|
||||
* **Asynchronous actions**: :doc:`Async actions <async-actions>` return an
|
||||
``action id`` as response to the client before receiving a response from the
|
||||
handler and allow the client to subscribe to the actual response using the
|
||||
``action id``.
|
||||
|
||||
How it works?
|
||||
-------------
|
||||
|
||||
* Hasura receives the action GraphQL mutation and converts this request into an
|
||||
event payload.
|
||||
* The event is captured, persisted and then delivered to the action handler with
|
||||
the appropriate retry/delivery guarantees.
|
||||
* The action handler runs and returns a response that is captured as an event
|
||||
and again persisted to the event store.
|
||||
* The action response is returned to the client synchronously or asynchronously
|
||||
based on the kind.
|
||||
|
||||
|
||||
Learn more
|
||||
----------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:titlesonly:
|
||||
|
||||
Creating actions <create>
|
||||
Custom types <types/index>
|
||||
Action handlers <action-handlers>
|
||||
Async actions <async-actions>
|
||||
Codegen <codegen>
|
121
docs/graphql/manual/actions/types/index.rst
Normal file
121
docs/graphql/manual/actions/types/index.rst
Normal file
@ -0,0 +1,121 @@
|
||||
Custom GraphQL types
|
||||
====================
|
||||
|
||||
.. contents:: Table of contents
|
||||
:backlinks: none
|
||||
:depth: 1
|
||||
:local:
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
You can add custom GraphQL types in Hasura that you can utilise for
|
||||
defining your actions.
|
||||
|
||||
Object types
|
||||
------------
|
||||
|
||||
The most basic components of a GraphQL schema are object types,
|
||||
which just represent a kind of object a GraphQL query can return, and what
|
||||
fields it has. In the GraphQL SDL, we might represent it like this:
|
||||
|
||||
.. code-block:: graphql
|
||||
|
||||
type UserInfo {
|
||||
accessToken: String!
|
||||
userId: Int!
|
||||
}
|
||||
|
||||
This is an object type called ``UserInfo`` that has two fields:
|
||||
|
||||
* ``accessToken``: This field is of type ``String!`` (non-nullable ``String``)
|
||||
* ``userId``: This field is of type ``Int!`` (non-nullable ``Int``)
|
||||
|
||||
[Reference](https://graphql.org/learn/schema/#object-types-and-fields)
|
||||
|
||||
Limitation
|
||||
**********
|
||||
|
||||
Hasura does not allow a field of an object type to be another object type,
|
||||
i.e. the fields of an object type could be only ``scalars`` and ``enums``.
|
||||
|
||||
Input types
|
||||
-----------
|
||||
|
||||
You can pass complex objects as arguments to a mutation. This is particularly
|
||||
valuable in the case of mutations where you might want to pass in a whole
|
||||
object to be created. In the GraphQL SDL, input types look exactly the same as
|
||||
regular object types, but with the keyword input instead of type:
|
||||
|
||||
.. code-block:: graphql
|
||||
|
||||
input LoginInfo {
|
||||
username: String!
|
||||
password: String!
|
||||
}
|
||||
|
||||
A field of an input type could be a ``scalar``, an ``enum`` or another input type.
|
||||
|
||||
Scalar types
|
||||
------------
|
||||
|
||||
A GraphQL object type has a name and fields, but at some point those fields
|
||||
have to resolve to some concrete data. That's where the scalar types come
|
||||
in: they represent the leaves of the query.
|
||||
|
||||
Inbuilt scalars
|
||||
***************
|
||||
|
||||
Hasura comes with some default GraphQL scalars that you can directly start using
|
||||
while defining your actions:
|
||||
|
||||
* ``Int``: A signed 32‐bit integer.
|
||||
* ``Float``: A signed double-precision floating-point value.
|
||||
* ``String``: A UTF‐8 character sequence.
|
||||
* ``Boolean``: true or false.
|
||||
* ``ID``: The ID scalar type represents a unique identifier, often used to
|
||||
refetch an object or as the key for a cache. The ID type is serialized in
|
||||
the same way as a String; however, defining it as an ID signifies that it
|
||||
is not intended to be human‐readable.
|
||||
|
||||
|
||||
Custom scalars
|
||||
**************
|
||||
|
||||
Hasura allows you to define custom scalars. For example, if you want to define
|
||||
a scalar called ``Date``, you can define it like.
|
||||
|
||||
.. code-block:: graphql
|
||||
|
||||
scalar Date
|
||||
|
||||
These scalars can be used as arguments of the mutation or as fields of object
|
||||
types and input types.
|
||||
|
||||
[Reference](https://graphql.org/learn/schema/#scalar-types)
|
||||
|
||||
Enum types
|
||||
----------
|
||||
|
||||
Enums are a special kind of scalar that is restricted to a particular set of
|
||||
allowed values. This allows you to:
|
||||
|
||||
* Validate that any arguments of this type are one of the allowed values
|
||||
* Communicate through the type system that a field will always be one of a
|
||||
finite set of values
|
||||
|
||||
Here's what an enum definition might look like in the GraphQL schema language:
|
||||
|
||||
.. code-block:: graphql
|
||||
|
||||
enum Color {
|
||||
RED
|
||||
GREEN
|
||||
BLUE
|
||||
}
|
||||
|
||||
This means that wherever we use the type ``Color`` in our schema, we expect it
|
||||
to be exactly one of RED, GREEN, or BLUE.
|
||||
|
||||
[Reference](https://graphql.org/learn/schema/#enumeration-types)
|
||||
|
@ -32,7 +32,7 @@ The request expects a JSON object with the following keys:
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"query": <query>,
|
||||
"query": "<query>",
|
||||
"user": {
|
||||
"x-hasura-role" : "...",
|
||||
"x-hasura-session-var1" : "..."
|
||||
@ -60,7 +60,7 @@ Response
|
||||
|
||||
The response for a query is a list of plans:
|
||||
|
||||
.. code-block:: json
|
||||
.. code-block:: none
|
||||
|
||||
[
|
||||
{
|
||||
@ -72,7 +72,7 @@ The response for a query is a list of plans:
|
||||
|
||||
The response for a subscription is a single plan:
|
||||
|
||||
.. code-block:: json
|
||||
.. code-block:: none
|
||||
|
||||
{
|
||||
"sql": String -- "the generated SQL for the operation",
|
||||
|
@ -88,4 +88,3 @@ query operations in one request:
|
||||
|
||||
Query / Subscription <query>
|
||||
Mutation <mutation>
|
||||
Batching operations <batching>
|
||||
|
@ -0,0 +1,331 @@
|
||||
.. meta::
|
||||
:description: Manage actions with the Hasura schema/metadata API
|
||||
:keywords: hasura, docs, schema/metadata API, API reference, actions
|
||||
|
||||
Schema/Metadata API Reference: Actions
|
||||
======================================
|
||||
|
||||
.. contents:: Table of contents
|
||||
:backlinks: none
|
||||
:depth: 1
|
||||
:local:
|
||||
|
||||
**actions** are user defined mutations with custom business logic.
|
||||
|
||||
.. _create_action:
|
||||
|
||||
create_action
|
||||
-------------
|
||||
|
||||
``create_action`` is used to define an action. There shouldn't be an existing action with the same name.
|
||||
|
||||
Create a synchronous action with name ``create_user``:
|
||||
|
||||
.. code-block:: http
|
||||
|
||||
POST /v1/query HTTP/1.1
|
||||
Content-Type: application/json
|
||||
X-Hasura-Role: admin
|
||||
|
||||
{
|
||||
"type":"create_action",
|
||||
"args":{
|
||||
"name":"create_user",
|
||||
"definition":{
|
||||
"kind":"synchronous",
|
||||
"arguments":[
|
||||
{
|
||||
"name":"username",
|
||||
"type":"String!"
|
||||
},
|
||||
{
|
||||
"name":"email",
|
||||
"type":"String!"
|
||||
}
|
||||
],
|
||||
"output_type":"User",
|
||||
"handler":"https://action.my_app.com/create-user"
|
||||
},
|
||||
"comment": "Custom action to create user"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.. _create_action_syntax:
|
||||
|
||||
Args syntax
|
||||
^^^^^^^^^^^
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
|
||||
* - Key
|
||||
- Required
|
||||
- Schema
|
||||
- Description
|
||||
* - name
|
||||
- true
|
||||
- :ref:`ActionName <ActionName>`
|
||||
- Name of the action
|
||||
* - definition
|
||||
- true
|
||||
- ActionDefinition_
|
||||
- Definition of the action
|
||||
* - comment
|
||||
- false
|
||||
- text
|
||||
- comment
|
||||
|
||||
.. _ActionDefinition:
|
||||
|
||||
ActionDefinition
|
||||
&&&&&&&&&&&&&&&&
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
|
||||
* - Key
|
||||
- Required
|
||||
- Schema
|
||||
- Description
|
||||
* - arguments
|
||||
- true
|
||||
- Array of InputArgument_
|
||||
- Input arguments
|
||||
* - output_type
|
||||
- true
|
||||
- :ref:`GraphQLType <GraphQLType>`
|
||||
- The output type of the action. Only object and list of objects are allowed.
|
||||
* - kind
|
||||
- false
|
||||
- [ ``synchronous`` | ``asynchronous`` ]
|
||||
- The kind of the action (default: ``synchronous``)
|
||||
* - headers
|
||||
- false
|
||||
- [ :ref:`HeaderFromValue <HeaderFromValue>` | :ref:`HeaderFromEnv <HeaderFromEnv>` ]
|
||||
- List of defined headers to be sent to the handler
|
||||
* - forward_client_headers
|
||||
- false
|
||||
- boolean
|
||||
- If set to ``true`` the client headers are forwarded to the webhook handler (default: ``false``)
|
||||
* - handler
|
||||
- true
|
||||
- :ref:`WebhookURL <WebhookURL>`
|
||||
- The action's webhook URL
|
||||
|
||||
.. _InputArgument:
|
||||
|
||||
InputArgument
|
||||
&&&&&&&&&&&&&
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
|
||||
* - Key
|
||||
- Required
|
||||
- Schema
|
||||
- Description
|
||||
* - name
|
||||
- true
|
||||
- text
|
||||
- Name of the argument
|
||||
* - type
|
||||
- true
|
||||
- :ref:`GraphQLType <GraphQLType>`
|
||||
- Type of the argument
|
||||
|
||||
.. note::
|
||||
|
||||
The ``GraphQL Types`` used in creating an action must be defined before via :doc:`Custom Types <custom-types>`
|
||||
|
||||
.. _drop_action:
|
||||
|
||||
drop_action
|
||||
-----------
|
||||
|
||||
``drop_action`` is used to remove an action. Permissions defined on the actions are also dropped automatically.
|
||||
|
||||
Drop an action ``create_user``:
|
||||
|
||||
.. code-block:: http
|
||||
|
||||
POST /v1/query HTTP/1.1
|
||||
Content-Type: application/json
|
||||
X-Hasura-Role: admin
|
||||
|
||||
{
|
||||
"type":"drop_action",
|
||||
"args":{
|
||||
"name":"create_user",
|
||||
"clear_data": true
|
||||
}
|
||||
}
|
||||
|
||||
.. _drop_action_syntax:
|
||||
|
||||
Args syntax
|
||||
^^^^^^^^^^^
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
|
||||
* - Key
|
||||
- Required
|
||||
- Schema
|
||||
- Description
|
||||
* - name
|
||||
- true
|
||||
- :ref:`ActionName <ActionName>`
|
||||
- Name of the action
|
||||
* - clear_data
|
||||
- false
|
||||
- boolean
|
||||
- If set to ``true`` and action kind is ``asynchronous``, related data is deleted from catalog. (default: ``true``)
|
||||
|
||||
.. _update_action:
|
||||
|
||||
update_action
|
||||
-------------
|
||||
|
||||
``update_action`` is used to update the definition of the action. Definition thus provided is
|
||||
replaced with existing one.
|
||||
|
||||
Update an action ``create_user`` by making it's kind to ``asynchronous``:
|
||||
|
||||
.. code-block:: http
|
||||
|
||||
POST /v1/query HTTP/1.1
|
||||
Content-Type: application/json
|
||||
X-Hasura-Role: admin
|
||||
|
||||
{
|
||||
"type":"update_action",
|
||||
"args":{
|
||||
"name":"create_user",
|
||||
"definition":{
|
||||
"kind":"asynchronous",
|
||||
"arguments":[
|
||||
{
|
||||
"name":"username",
|
||||
"type":"String!"
|
||||
},
|
||||
{
|
||||
"name":"email",
|
||||
"type":"String!"
|
||||
}
|
||||
],
|
||||
"output_type":"User",
|
||||
"handler":"https://action.my_app.com/create-user"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.. _update_action_syntax:
|
||||
|
||||
Args syntax
|
||||
^^^^^^^^^^^
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
|
||||
* - Key
|
||||
- Required
|
||||
- Schema
|
||||
- Description
|
||||
* - name
|
||||
- true
|
||||
- :ref:`ActionName <ActionName>`
|
||||
- Name of the action
|
||||
* - definition
|
||||
- true
|
||||
- ActionDefinition_
|
||||
- Definition of the action to be replaced
|
||||
|
||||
.. _create_action_permission:
|
||||
|
||||
create_action_permission
|
||||
------------------------
|
||||
|
||||
``create_action_permission`` is used to define a permission to make action visible for a role.
|
||||
|
||||
.. code-block:: http
|
||||
|
||||
POST /v1/query HTTP/1.1
|
||||
Content-Type: application/json
|
||||
X-Hasura-Role: admin
|
||||
|
||||
{
|
||||
"type": "create_action_permission",
|
||||
"args": {
|
||||
"action": "create_user",
|
||||
"role": "user"
|
||||
}
|
||||
}
|
||||
|
||||
.. _create_action_permission_syntax:
|
||||
|
||||
Args syntax
|
||||
^^^^^^^^^^^
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
|
||||
* - Key
|
||||
- Required
|
||||
- Schema
|
||||
- Description
|
||||
* - name
|
||||
- true
|
||||
- :ref:`ActionName <ActionName>`
|
||||
- Name of the action
|
||||
* - role
|
||||
- true
|
||||
- :ref:`RoleName <RoleName>`
|
||||
- Name of the role
|
||||
* - comment
|
||||
- false
|
||||
- text
|
||||
- comment
|
||||
|
||||
.. _drop_action_permission:
|
||||
|
||||
drop_action_permission
|
||||
----------------------
|
||||
|
||||
``drop_action_permission`` is used to drop a permission defined on an action.
|
||||
|
||||
.. code-block:: http
|
||||
|
||||
POST /v1/query HTTP/1.1
|
||||
Content-Type: application/json
|
||||
X-Hasura-Role: admin
|
||||
|
||||
{
|
||||
"type": "drop_action_permission",
|
||||
"args": {
|
||||
"action": "create_user",
|
||||
"role": "user"
|
||||
}
|
||||
}
|
||||
|
||||
.. _drop_action_permission_syntax:
|
||||
|
||||
Args syntax
|
||||
^^^^^^^^^^^
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
|
||||
* - Key
|
||||
- Required
|
||||
- Schema
|
||||
- Description
|
||||
* - name
|
||||
- true
|
||||
- :ref:`ActionName <ActionName>`
|
||||
- Name of the action
|
||||
* - role
|
||||
- true
|
||||
- :ref:`RoleName <RoleName>`
|
||||
- Name of the role
|
@ -301,6 +301,31 @@ The various types of queries are listed in the following table:
|
||||
- 1
|
||||
- Set custom GraphQL types
|
||||
|
||||
* - :ref:`create_action`
|
||||
- :ref:`create_action_args <create_action_syntax>`
|
||||
- 1
|
||||
- Create an action
|
||||
|
||||
* - :ref:`drop_action`
|
||||
- :ref:`drop_action_args <drop_action_syntax>`
|
||||
- 1
|
||||
- Drop an action
|
||||
|
||||
* - :ref:`update_action`
|
||||
- :ref:`update_action_args <update_action_syntax>`
|
||||
- 1
|
||||
- Update an action
|
||||
|
||||
* - :ref:`create_action_permission`
|
||||
- :ref:`create_action_permission_args <create_action_permission_syntax>`
|
||||
- 1
|
||||
- Create an action permission
|
||||
|
||||
* - :ref:`drop_action_permission`
|
||||
- :ref:`drop_action_permission_args <drop_action_permission_syntax>`
|
||||
- 1
|
||||
- Drop an action permission
|
||||
|
||||
**See:**
|
||||
|
||||
- :doc:`Run SQL <run-sql>`
|
||||
@ -313,6 +338,7 @@ The various types of queries are listed in the following table:
|
||||
- :doc:`Remote Schemas <remote-schemas>`
|
||||
- :doc:`Query Collections <query-collections>`
|
||||
- :doc:`Custom Types <custom-types>`
|
||||
- :doc:`Actions <actions>`
|
||||
- :doc:`Manage Metadata <manage-metadata>`
|
||||
|
||||
Response structure
|
||||
@ -398,5 +424,6 @@ See :doc:`../../deployment/graphql-engine-flags/reference` for info on setting t
|
||||
Remote Schemas <remote-schemas>
|
||||
Query Collections <query-collections>
|
||||
Custom Types <custom-types>
|
||||
Actions <actions>
|
||||
Manage Metadata <manage-metadata>
|
||||
Common syntax definitions <syntax-defs>
|
||||
|
@ -72,7 +72,7 @@ the ``deleted_at`` field to the current timestamp:
|
||||
Step 3: Set up appropriate insert/update/delete permissions
|
||||
-----------------------------------------------------------
|
||||
|
||||
Now, we need to ensure that appropriate :doc:`permissions <../auth/authorization/index>` are set to avoid
|
||||
Now, we need to ensure that appropriate :doc:`permissions <../../auth/authorization/index>` are set to avoid
|
||||
actual deletes from happening and allowing update of the ``deleted_at`` field.
|
||||
|
||||
Here are some typical rules we should set:
|
||||
@ -97,7 +97,7 @@ Step 4: Restrict access to soft-deleted records
|
||||
Now that we have set up the soft deleting pattern for records, we need to ensure that we restrict the "deleted"
|
||||
records from being accessed.
|
||||
|
||||
We can achieve this by setting appropriate :doc:`permissions <../auth/authorization/index>` for roles which have
|
||||
We can achieve this by setting appropriate :doc:`permissions <../../auth/authorization/index>` for roles which have
|
||||
access to the ``todos`` table.
|
||||
|
||||
For example, let's say that a role ``user`` can only access non-deleted todos, we need to add the following
|
||||
|
@ -36,17 +36,20 @@ Options
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check Skip automatic update check on command execution
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
||||
* :ref:`hasura actions <hasura_actions>` - Manage actions on hasura
|
||||
* :ref:`hasura completion <hasura_completion>` - Generate auto completion code
|
||||
* :ref:`hasura console <hasura_console>` - Open console to manage database and try out APIs
|
||||
* :ref:`hasura init <hasura_init>` - Initialize directory for Hasura GraphQL engine migrations
|
||||
* :ref:`hasura metadata <hasura_metadata>` - Manage Hasura GraphQL engine metadata saved in the database
|
||||
* :ref:`hasura migrate <hasura_migrate>` - Manage migrations on the database
|
||||
* :ref:`hasura update-cli <hasura_update-cli>` - Update the CLI to the latest version
|
||||
* :ref:`hasura plugins <hasura_plugins>` - Manage hasura plugins
|
||||
* :ref:`hasura scripts <hasura_scripts>` -
|
||||
* :ref:`hasura update-cli <hasura_update-cli>` - Update the CLI to latest version
|
||||
* :ref:`hasura version <hasura_version>` - Print the CLI version
|
||||
|
||||
*Auto generated by spf13/cobra*
|
||||
|
58
docs/graphql/manual/hasura-cli/hasura_actions.rst
Normal file
58
docs/graphql/manual/hasura-cli/hasura_actions.rst
Normal file
@ -0,0 +1,58 @@
|
||||
.. meta::
|
||||
:description: Use hasura actions to manage actions on the Hasura CLI
|
||||
:keywords: hasura, docs, CLI, hasura actions
|
||||
|
||||
.. _hasura_actions:
|
||||
|
||||
Hasura CLI: hasura actions
|
||||
--------------------------
|
||||
|
||||
Manage actions on hasura.
|
||||
|
||||
Synopsis
|
||||
~~~~~~~~
|
||||
|
||||
Manage actions on hasura.
|
||||
|
||||
Examples
|
||||
~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
# Create an action
|
||||
hasura actions create [action-name]
|
||||
|
||||
# Generate code for an actions
|
||||
hasura actions codegen [action-name]
|
||||
|
||||
# Set a framework to be used by codegen
|
||||
hasura actions use-codegen
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
-h, --help help for actions
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
||||
* :ref:`hasura <hasura>` - Hasura GraphQL engine command line tool
|
||||
* :ref:`hasura actions codegen <hasura_actions_codegen>` - Generate code for actions
|
||||
* :ref:`hasura actions create <hasura_actions_create>` - Create a hasura action
|
||||
* :ref:`hasura actions use-codegen <hasura_actions_use-codegen>` - Use the codegen to generate code for hasura actions
|
||||
|
||||
*Auto generated by spf13/cobra*
|
64
docs/graphql/manual/hasura-cli/hasura_actions_codegen.rst
Normal file
64
docs/graphql/manual/hasura-cli/hasura_actions_codegen.rst
Normal file
@ -0,0 +1,64 @@
|
||||
.. meta::
|
||||
:description: Use hasura actions codegen to generate code for actions on the Hasura CLI
|
||||
:keywords: hasura, docs, CLI, hasura actions codegen
|
||||
|
||||
.. _hasura_actions_codegen:
|
||||
|
||||
Hasura CLI: hasura actions codegen
|
||||
----------------------------------
|
||||
|
||||
Generate code for actions.
|
||||
|
||||
Synopsis
|
||||
~~~~~~~~
|
||||
|
||||
|
||||
Generate code for actions.
|
||||
|
||||
::
|
||||
|
||||
hasura actions codegen [action-name] [flags]
|
||||
|
||||
Examples
|
||||
~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
# Generate code for all actions
|
||||
hasura actions codegen
|
||||
|
||||
# Generate code for an action
|
||||
hasura actions codegen [action-name]
|
||||
|
||||
# Generate code for two or more actions
|
||||
hasura actions codegen [action-name] [action-name...]
|
||||
|
||||
# Derive an action from a hasura operation
|
||||
hasura actions codegen [action-name] --derive-from ""
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--derive-from string derive action from a hasura operation
|
||||
-h, --help help for codegen
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
||||
* :ref:`hasura actions <hasura_actions>` - Manage actions on hasura
|
||||
|
||||
*Auto generated by spf13/cobra*
|
67
docs/graphql/manual/hasura-cli/hasura_actions_create.rst
Normal file
67
docs/graphql/manual/hasura-cli/hasura_actions_create.rst
Normal file
@ -0,0 +1,67 @@
|
||||
.. meta::
|
||||
:description: Use hasura actions create to create actions on the Hasura CLI
|
||||
:keywords: hasura, docs, CLI, hasura actions create
|
||||
|
||||
.. _hasura_actions_create:
|
||||
|
||||
Hasura CLI: hasura actions create
|
||||
---------------------------------
|
||||
|
||||
Create a Hasura action.
|
||||
|
||||
Synopsis
|
||||
~~~~~~~~
|
||||
|
||||
|
||||
Create a Hasura action.
|
||||
|
||||
::
|
||||
|
||||
hasura actions create [action-name] [flags]
|
||||
|
||||
Examples
|
||||
~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
# Create an action
|
||||
hasura actions create [action-name]
|
||||
|
||||
# Create an action with codegen
|
||||
hasura actions create [action-name] --with-codegen true
|
||||
|
||||
# Create an action by deriving from a hasura operation
|
||||
hasura actions create [action-name] --derive-from ''
|
||||
|
||||
# Create an action with a different kind or webhook
|
||||
hasura actions create [action-name] --kind [synchronous|asynchronous] --webhook [http://localhost:3000]
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--derive-from string derive action from a Hasura operation
|
||||
-h, --help help for create
|
||||
--kind string kind to use in action
|
||||
--webhook string webhook to use in action
|
||||
--with-codegen create action along with codegen
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
||||
* :ref:`hasura actions <hasura_actions>` - Manage actions on hasura
|
||||
|
||||
*Auto generated by spf13/cobra*
|
@ -0,0 +1,66 @@
|
||||
.. meta::
|
||||
:description: Use hasura actions use-codegen to generate code for actions on the Hasura CLI
|
||||
:keywords: hasura, docs, CLI, hasura actions use-codegen
|
||||
|
||||
.. _hasura_actions_use-codegen:
|
||||
|
||||
Hasura CLI: hasura actions use-codegen
|
||||
--------------------------------------
|
||||
|
||||
Use the codegen to generate code for hasura actions.
|
||||
|
||||
Synopsis
|
||||
~~~~~~~~
|
||||
|
||||
|
||||
Use the codegen to generate code for hasura actions.
|
||||
|
||||
::
|
||||
|
||||
hasura actions use-codegen [flags]
|
||||
|
||||
Examples
|
||||
~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
# Use codegen by providing framework
|
||||
hasura actions use-codegen --framework nodejs-express
|
||||
|
||||
# Use codegen from framework list
|
||||
hasura actions use-codegen
|
||||
|
||||
# Set output directory
|
||||
hasura actions use-codegen --output-dir codegen
|
||||
|
||||
# Use a codegen with a starter kit
|
||||
hasura actions use-codegen --with-starter-kit true
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--framework string framework to be used by codegen
|
||||
-h, --help help for use-codegen
|
||||
--output-dir string directory to create the codegen files
|
||||
--with-starter-kit clone starter kit for a framework
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
||||
* :ref:`hasura actions <hasura_actions>` - Manage actions on hasura
|
||||
|
||||
*Auto generated by spf13/cobra*
|
@ -70,7 +70,7 @@ Options inherited from parent commands
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check Skip automatic update check on command execution
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
@ -30,6 +30,15 @@ Examples
|
||||
# Start console on a different address and ports:
|
||||
hasura console --address 0.0.0.0 --console-port 8080 --api-port 8081
|
||||
|
||||
# Start console without opening the browser automatically
|
||||
hasura console --no-browser
|
||||
|
||||
# Use with admin secret:
|
||||
hasura console --admin-secret "<admin-secret>"
|
||||
|
||||
# Connect to an instance specified by the flag, overrides the one mentioned in config.yaml:
|
||||
hasura console --endpoint "<endpoint>"
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
@ -38,6 +47,7 @@ Options
|
||||
--address string address to serve console and migration API from (default "localhost")
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--api-port string port for serving migrate api (default "9693")
|
||||
--browser string open console in a specific browser
|
||||
--console-port string port for serving console (default "9695")
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
-h, --help help for console
|
||||
@ -52,7 +62,7 @@ Options inherited from parent commands
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check Skip automatic update check on command execution
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
@ -17,7 +17,7 @@ Create directories and files required for enabling migrations on the Hasura Grap
|
||||
|
||||
::
|
||||
|
||||
hasura init [flags]
|
||||
hasura init [directory-name] [flags]
|
||||
|
||||
Examples
|
||||
~~~~~~~~
|
||||
@ -25,12 +25,12 @@ Examples
|
||||
::
|
||||
|
||||
# Create a directory to store migrations
|
||||
hasura init
|
||||
hasura init [directory-name]
|
||||
|
||||
# Now, edit <my-directory>/config.yaml to add endpoint and admin secret
|
||||
|
||||
# Create a directory with endpoint and admin secret configured:
|
||||
hasura init --directory <my-project> --endpoint https://my-graphql-engine.com --admin-secret adminsecretkey
|
||||
hasura init <my-project> --endpoint https://my-graphql-engine.com --admin-secret adminsecretkey
|
||||
|
||||
# See https://docs.hasura.io/1.0/graphql/manual/migrations/index.html for more details
|
||||
|
||||
@ -39,10 +39,14 @@ Options
|
||||
|
||||
::
|
||||
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--directory string name of directory where files will be created
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
-h, --help help for init
|
||||
--action-handler-webhook-baseurl string webhook baseurl to be used for an action (default "http://localhost:3000")
|
||||
--action-kind string kind to be used for an action (default "synchronous")
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
-h, --help help for init
|
||||
--install-manifest string install manifest to be cloned
|
||||
--metadata-directory string name of directory where metadata files will be created (default "metadata")
|
||||
--version string config version to be used (default "2")
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@ -52,7 +56,7 @@ Options inherited from parent commands
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check Skip automatic update check on command execution
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
@ -15,12 +15,16 @@ Synopsis
|
||||
|
||||
Manage Hasura GraphQL engine metadata saved in the database.
|
||||
|
||||
Alias: md
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
-h, --help help for metadata
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
-h, --help help for metadata
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@ -30,7 +34,7 @@ Options inherited from parent commands
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check Skip automatic update check on command execution
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
@ -40,6 +44,7 @@ SEE ALSO
|
||||
* :ref:`hasura metadata clear <hasura_metadata_clear>` - Clear Hasura GraphQL engine metadata on the database
|
||||
* :ref:`hasura metadata diff <hasura_metadata_diff>` - (PREVIEW) Show a highlighted diff of Hasura metadata
|
||||
* :ref:`hasura metadata export <hasura_metadata_export>` - Export Hasura GraphQL engine metadata from the database
|
||||
* :ref:`hasura metadata inconsistency <hasura_metadata_inconsistency>` - Manage inconsistent objects in Hasura Metadata
|
||||
* :ref:`hasura metadata reload <hasura_metadata_reload>` - Reload Hasura GraphQL engine metadata on the database
|
||||
|
||||
*Auto generated by spf13/cobra*
|
||||
|
@ -27,25 +27,32 @@ Examples
|
||||
# Apply Hasura GraphQL engine metadata present in metadata.[yaml|json] file:
|
||||
hasura metadata apply
|
||||
|
||||
# Use with admin secret:
|
||||
hasura metadata apply --admin-secret "<admin-secret>"
|
||||
|
||||
# Apply metadata to an instance specified by the flag:
|
||||
hasura metadata apply --endpoint "<endpoint>"
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--dry-run show a diff instead of applying the metadata
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
-h, --help help for apply
|
||||
--dry-run show a diff instead of applying the metadata
|
||||
--from-file apply metadata from migrations/metadata.[yaml|json]
|
||||
-h, --help help for apply
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check Skip automatic update check on command execution
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
@ -29,24 +29,30 @@ Examples
|
||||
# Clear all the metadata information from database:
|
||||
hasura metadata clear
|
||||
|
||||
# Use with admin secret:
|
||||
hasura metadata clear --admin-secret "<admin-secret>"
|
||||
|
||||
# Clear metadata on a different Hasura instance:
|
||||
hasura metadata clear --endpoint "<endpoint>"
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
-h, --help help for clear
|
||||
-h, --help help for clear
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check Skip automatic update check on command execution
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
@ -36,24 +36,30 @@ Examples
|
||||
# Show changes between metadata from metadata.yaml and metadata_old.yaml:
|
||||
hasura metadata diff metadata.yaml metadata_old.yaml
|
||||
|
||||
# Apply admin secret for Hasura GraphQL engine:
|
||||
hasura metadata diff --admin-secret "<admin-secret>"
|
||||
|
||||
# Diff metadata on a different Hasura instance:
|
||||
hasura metadata diff --endpoint "<endpoint>"
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
-h, --help help for diff
|
||||
-h, --help help for diff
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
@ -31,24 +31,30 @@ Examples
|
||||
# Export metadata and save it in migrations/metadata.yaml file:
|
||||
hasura metadata export
|
||||
|
||||
# Use with admin secret:
|
||||
hasura metadata export --admin-secret "<admin-secret>"
|
||||
|
||||
# Export metadata to another instance specified by the flag:
|
||||
hasura metadata export --endpoint "<endpoint>"
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
-h, --help help for export
|
||||
-h, --help help for export
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check Skip automatic update check on command execution
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
@ -0,0 +1,47 @@
|
||||
.. meta::
|
||||
:description: Use hasura metadata inconsistency to export Hasura metadata from the database with the Hasura CLI
|
||||
:keywords: hasura, docs, CLI, hasura metadata inconsistency
|
||||
|
||||
.. _hasura_metadata_inconsistency:
|
||||
|
||||
Hasura CLI: hasura metadata inconsistency
|
||||
-----------------------------------------
|
||||
|
||||
Manage inconsistent objects in Hasura metadata.
|
||||
|
||||
Synopsis
|
||||
~~~~~~~~
|
||||
|
||||
|
||||
Manage inconsistent objects in Hasura metadata.
|
||||
|
||||
Alias: inconsistencies, ic
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
-h, --help help for inconsistency
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
||||
* :ref:`hasura metadata <hasura_metadata>` - Manage Hasura GraphQL engine metadata saved in the database
|
||||
* :ref:`hasura metadata inconsistency drop <hasura_metadata_inconsistency_drop>` - Drop inconsistent objects from the metadata
|
||||
* :ref:`hasura metadata inconsistency list <hasura_metadata_inconsistency_list>` - List all inconsistent objects from the metadata
|
||||
* :ref:`hasura metadata inconsistency status <hasura_metadata_inconsistency_status>` - Check if the metadata is inconsistent or not
|
||||
|
||||
*Auto generated by spf13/cobra*
|
@ -0,0 +1,46 @@
|
||||
.. meta::
|
||||
:description: Use hasura metadata inconsistency drop to drop Hasura metadata from the database with the Hasura CLI
|
||||
:keywords: hasura, docs, CLI, hasura metadata inconsistency drop
|
||||
|
||||
.. _hasura_metadata_inconsistency_drop:
|
||||
|
||||
Hasura CLI: hasura metadata inconsistency drop
|
||||
----------------------------------------------
|
||||
|
||||
Drop inconsistent objects from the metadata.
|
||||
|
||||
Synopsis
|
||||
~~~~~~~~
|
||||
|
||||
|
||||
Drop inconsistent objects from the metadata.
|
||||
|
||||
::
|
||||
|
||||
hasura metadata inconsistency drop [flags]
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
-h, --help help for drop
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
||||
* :ref:`hasura metadata inconsistency <hasura_metadata_inconsistency>` - Manage inconsistent objects in Hasura Metadata
|
||||
|
||||
*Auto generated by spf13/cobra*
|
@ -0,0 +1,48 @@
|
||||
.. meta::
|
||||
:description: Use hasura metadata inconsistency list to list Hasura metadata with the Hasura CLI
|
||||
:keywords: hasura, docs, CLI, hasura metadata inconsistency list
|
||||
|
||||
.. _hasura_metadata_inconsistency_list:
|
||||
|
||||
Hasura CLI: hasura metadata inconsistency list
|
||||
----------------------------------------------
|
||||
|
||||
List all inconsistent objects from the metadata.
|
||||
|
||||
Synopsis
|
||||
~~~~~~~~
|
||||
|
||||
|
||||
List all inconsistent objects from the metadata.
|
||||
|
||||
::
|
||||
|
||||
hasura metadata inconsistency list [flags]
|
||||
|
||||
Alias: ls
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
-h, --help help for list
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
||||
* :ref:`hasura metadata inconsistency <hasura_metadata_inconsistency>` - Manage inconsistent objects in Hasura Metadata
|
||||
|
||||
*Auto generated by spf13/cobra*
|
@ -0,0 +1,46 @@
|
||||
.. meta::
|
||||
:description: Use hasura metadata inconsistency status to show the status of Hasura metadata with the Hasura CLI
|
||||
:keywords: hasura, docs, CLI, hasura metadata inconsistency status
|
||||
|
||||
.. _hasura_metadata_inconsistency_status:
|
||||
|
||||
Hasura CLI: hasura metadata inconsistency status
|
||||
------------------------------------------------
|
||||
|
||||
Check if the metadata is inconsistent or not.
|
||||
|
||||
Synopsis
|
||||
~~~~~~~~
|
||||
|
||||
|
||||
Check if the metadata is inconsistent or not.
|
||||
|
||||
::
|
||||
|
||||
hasura metadata inconsistency status [flags]
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
-h, --help help for status
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
||||
* :ref:`hasura metadata inconsistency <hasura_metadata_inconsistency>` - Manage inconsistent objects in Hasura Metadata
|
||||
|
||||
*Auto generated by spf13/cobra*
|
@ -27,24 +27,30 @@ Examples
|
||||
# Reload all the metadata information from database:
|
||||
hasura metadata reload
|
||||
|
||||
# Use with admin secret:
|
||||
hasura metadata reload --admin-secret "<admin-secret>"
|
||||
|
||||
# Reload metadata on a different instance:
|
||||
hasura metadata export --endpoint "<endpoint>"
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
-h, --help help for reload
|
||||
-h, --help help for reload
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check Skip automatic update check on command execution
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
@ -20,7 +20,9 @@ Options
|
||||
|
||||
::
|
||||
|
||||
-h, --help help for migrate
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
-h, --help help for migrate
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@ -30,7 +32,7 @@ Options inherited from parent commands
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check Skip automatic update check on command execution
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
@ -19,29 +19,71 @@ Apply migrations on the database.
|
||||
|
||||
hasura migrate apply [flags]
|
||||
|
||||
Examples
|
||||
~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
# Apply all migrations
|
||||
hasura migrate apply
|
||||
|
||||
# Use with admin secret:
|
||||
hasura migrate apply --admin-secret "<admin-secret>"
|
||||
|
||||
# Apply migrations on another Hasura instance:
|
||||
hasura migrate apply --endpoint "<endpoint>"
|
||||
|
||||
# Mark migration as applied on the server and skip execution:
|
||||
hasura migrate apply --skip-execution
|
||||
|
||||
# Apply a particular migration version only:
|
||||
hasura migrate apply --version "<version>"
|
||||
|
||||
# Apply last 2 down migrations:
|
||||
hasura migrate apply --down 2
|
||||
|
||||
# Apply only 2 up migrations:
|
||||
hasura migrate apply --up 2
|
||||
|
||||
# Apply only a particular version
|
||||
hasura migrate apply --type up --version "<version>"
|
||||
|
||||
# Apply all up migrations upto version 125, last applied is 100
|
||||
hasura migrate apply --goto 125
|
||||
|
||||
# Apply all down migrations upto version 125, last applied is 150
|
||||
hasura migrate apply --goto 125
|
||||
|
||||
# Rollback a particular version:
|
||||
hasura migrate apply --type down --version "<version>"
|
||||
|
||||
# Rollback all migrations:
|
||||
hasura migrate apply --down all
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--down string apply all or N down migration steps
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
-h, --help help for apply
|
||||
--skip-execution skip executing the migration action, but mark them as applied
|
||||
--type string type of migration (up, down) to be used with version flag (default "up")
|
||||
--up string apply all or N up migration steps
|
||||
--version string only apply this particular migration
|
||||
--up string apply all or N up migration steps
|
||||
--down string apply all or N down migration steps
|
||||
--goto string apply migration chain up to to the version specified
|
||||
--version string only apply this particular migration
|
||||
--skip-execution skip executing the migration action, but mark them as applied
|
||||
--type string type of migration (up, down) to be used with version flag (default "up")
|
||||
-h, --help help for apply
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check Skip automatic update check on command execution
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
@ -24,16 +24,20 @@ Examples
|
||||
|
||||
::
|
||||
|
||||
# Set up migration files for the first time by introspecting a server:
|
||||
# Setup migration files for the first time by introspecting a server:
|
||||
hasura migrate create "init" --from-server
|
||||
|
||||
# Use with admin secret:
|
||||
hasura migrate create --admin-secret "<admin-secret>"
|
||||
|
||||
# Setup migration files from an instance mentioned by the flag:
|
||||
hasura migrate create init --from-server --endpoint "<endpoint>"
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
--from-server get SQL statements and Hasura metadata from the server
|
||||
-h, --help help for create
|
||||
--metadata-from-file string path to a hasura metadata file to be used for up actions
|
||||
@ -47,10 +51,12 @@ Options inherited from parent commands
|
||||
|
||||
::
|
||||
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check Skip automatic update check on command execution
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
@ -29,27 +29,30 @@ Examples
|
||||
# squash all migrations from version 123 to the latest one:
|
||||
hasura migrate squash --from 123
|
||||
|
||||
# Add a name for the new squashed migration
|
||||
hasura migrate squash --name "<name>" --from 123
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--delete-source delete the source files after squashing without any confirmation
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
--from uint start squashing form this version
|
||||
-h, --help help for squash
|
||||
--name string name for the new squashed migration (default "squashed")
|
||||
--delete-source delete the source files after squashing without any confirmation
|
||||
--from uint start squashing form this version
|
||||
-h, --help help for squash
|
||||
--name string name for the new squashed migration (default "squashed")
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
@ -19,24 +19,35 @@ Display current status of migrations on a database.
|
||||
|
||||
hasura migrate status [flags]
|
||||
|
||||
Examples
|
||||
~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
# Use with admin secret:
|
||||
hasura migrate status --admin-secret "<your-admin-secret>"
|
||||
|
||||
# Check status on a different server:
|
||||
hasura migrate status --endpoint "<endpoint>"
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
-h, --help help for status
|
||||
-h, --help help for status
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check Skip automatic update check on command execution
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
61
docs/graphql/manual/hasura-cli/hasura_plugins.rst
Normal file
61
docs/graphql/manual/hasura-cli/hasura_plugins.rst
Normal file
@ -0,0 +1,61 @@
|
||||
.. meta::
|
||||
:description: Use hasura plugins to manage Hasura plugins on the Hasura CLI
|
||||
:keywords: hasura, docs, CLI, hasura plugins
|
||||
|
||||
.. _hasura_plugins:
|
||||
|
||||
Hasura CLI: hasura plugins
|
||||
--------------------------
|
||||
|
||||
Manage Hasura plugins.
|
||||
|
||||
Synopsis
|
||||
~~~~~~~~
|
||||
|
||||
|
||||
Manage Hasura plugins.
|
||||
|
||||
Examples
|
||||
~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
# Install a plugin
|
||||
hasura plugins install [plugin-name]
|
||||
|
||||
# Uninstall a plugin
|
||||
hasura plugins uninstall [plugin-name]
|
||||
|
||||
# Upgrade a plugin
|
||||
hasura plugins upgrade [plugin-name]
|
||||
|
||||
# List all plugins
|
||||
hasura plugins list
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
-h, --help help for plugins
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
||||
* :ref:`hasura <hasura>` - Hasura GraphQL engine command line tool
|
||||
* :ref:`hasura plugins install <hasura_plugins_install>` - Install a hasura plugin
|
||||
* :ref:`hasura plugins list <hasura_plugins_list>` - List all hasura plugin
|
||||
* :ref:`hasura plugins uninstall <hasura_plugins_uninstall>` - Uninstall a hasura plugin
|
||||
* :ref:`hasura plugins upgrade <hasura_plugins_upgrade>` - Upgrade a hasura plugin
|
||||
|
||||
*Auto generated by spf13/cobra*
|
52
docs/graphql/manual/hasura-cli/hasura_plugins_install.rst
Normal file
52
docs/graphql/manual/hasura-cli/hasura_plugins_install.rst
Normal file
@ -0,0 +1,52 @@
|
||||
.. meta::
|
||||
:description: Use hasura plugins install to install Hasura plugins on the Hasura CLI
|
||||
:keywords: hasura, docs, CLI, hasura plugins install
|
||||
|
||||
.. _hasura_plugins_install:
|
||||
|
||||
Hasura CLI: hasura plugins install
|
||||
----------------------------------
|
||||
|
||||
Install a Hasura plugin.
|
||||
|
||||
Synopsis
|
||||
~~~~~~~~
|
||||
|
||||
|
||||
Install a Hasura plugin.
|
||||
|
||||
::
|
||||
|
||||
hasura plugins install [plugin-name] [flags]
|
||||
|
||||
Examples
|
||||
~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
# Install a plugin
|
||||
hasura plugins install [plugin-name]
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
-h, --help help for install
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
||||
* :ref:`hasura plugins <hasura_plugins>` - Manage hasura plugins
|
||||
|
||||
*Auto generated by spf13/cobra*
|
58
docs/graphql/manual/hasura-cli/hasura_plugins_list.rst
Normal file
58
docs/graphql/manual/hasura-cli/hasura_plugins_list.rst
Normal file
@ -0,0 +1,58 @@
|
||||
.. meta::
|
||||
:description: Use hasura plugins list to list Hasura plugins on the Hasura CLI
|
||||
:keywords: hasura, docs, CLI, hasura plugins list
|
||||
|
||||
.. _hasura_plugins_list:
|
||||
|
||||
Hasura CLI: hasura plugins list
|
||||
-------------------------------
|
||||
|
||||
List all Hasura plugins.
|
||||
|
||||
Synopsis
|
||||
~~~~~~~~
|
||||
|
||||
|
||||
List all Hasura plugins.
|
||||
|
||||
::
|
||||
|
||||
hasura plugins list [flags]
|
||||
|
||||
Alias: ls
|
||||
|
||||
Examples
|
||||
~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
# List all hasura plugins
|
||||
hasura plugins list
|
||||
|
||||
# List all hasura plugins without updating index
|
||||
hasura plugins list --update-index false
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
-h, --help help for list
|
||||
--update-index update plugin index (default true)
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
||||
* :ref:`hasura plugins <hasura_plugins>` - Manage hasura plugins
|
||||
|
||||
*Auto generated by spf13/cobra*
|
52
docs/graphql/manual/hasura-cli/hasura_plugins_uninstall.rst
Normal file
52
docs/graphql/manual/hasura-cli/hasura_plugins_uninstall.rst
Normal file
@ -0,0 +1,52 @@
|
||||
.. meta::
|
||||
:description: Use hasura plugins uninstall to uninstall a Hasura plugin on the Hasura CLI
|
||||
:keywords: hasura, docs, CLI, hasura plugins uninstall
|
||||
|
||||
.. _hasura_plugins_uninstall:
|
||||
|
||||
Hasura CLI: hasura plugins uninstall
|
||||
------------------------------------
|
||||
|
||||
Uninstall a Hasura plugin.
|
||||
|
||||
Synopsis
|
||||
~~~~~~~~
|
||||
|
||||
|
||||
Uninstall a Hasura plugin.
|
||||
|
||||
::
|
||||
|
||||
hasura plugins uninstall [plugin-name] [flags]
|
||||
|
||||
Examples
|
||||
~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
# Uninstall a plugin
|
||||
hasura plugins uninstall [plugin-name]
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
-h, --help help for uninstall
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
||||
* :ref:`hasura plugins <hasura_plugins>` - Manage hasura plugins
|
||||
|
||||
*Auto generated by spf13/cobra*
|
52
docs/graphql/manual/hasura-cli/hasura_plugins_upgrade.rst
Normal file
52
docs/graphql/manual/hasura-cli/hasura_plugins_upgrade.rst
Normal file
@ -0,0 +1,52 @@
|
||||
.. meta::
|
||||
:description: Use hasura plugins upgrade to upgrade a Hasura plugin on the Hasura CLI
|
||||
:keywords: hasura, docs, CLI, hasura plugins upgrade
|
||||
|
||||
.. _hasura_plugins_upgrade:
|
||||
|
||||
Hasura CLI: hasura plugins upgrade
|
||||
----------------------------------
|
||||
|
||||
Upgrade a Hasura plugin.
|
||||
|
||||
Synopsis
|
||||
~~~~~~~~
|
||||
|
||||
|
||||
Upgrade a Hasura plugin.
|
||||
|
||||
::
|
||||
|
||||
hasura plugins upgrade [flags]
|
||||
|
||||
Examples
|
||||
~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
# Upgrade a plugin
|
||||
hasura plugins upgrade [plugin-name]
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
-h, --help help for upgrade
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
||||
* :ref:`hasura plugins <hasura_plugins>` - Manage hasura plugins
|
||||
|
||||
*Auto generated by spf13/cobra*
|
41
docs/graphql/manual/hasura-cli/hasura_scripts.rst
Normal file
41
docs/graphql/manual/hasura-cli/hasura_scripts.rst
Normal file
@ -0,0 +1,41 @@
|
||||
.. meta::
|
||||
:description: Use hasura scripts to list scripts on the Hasura CLI
|
||||
:keywords: hasura, docs, CLI, hasura scripts
|
||||
|
||||
.. _hasura_scripts:
|
||||
|
||||
Hasura CLI: hasura scripts
|
||||
--------------------------
|
||||
|
||||
|
||||
|
||||
Synopsis
|
||||
~~~~~~~~
|
||||
|
||||
|
||||
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
-h, --help help for scripts
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
||||
* :ref:`hasura <hasura>` - Hasura GraphQL engine command line tool
|
||||
* :ref:`hasura scripts update-config-v2 <hasura_scripts_update-config-v2>` - Upgrade config from v1 to v2
|
||||
|
||||
*Auto generated by spf13/cobra*
|
@ -0,0 +1,58 @@
|
||||
.. meta::
|
||||
:description: Use hasura scripts for the update-config-v2 script on the Hasura CLI
|
||||
:keywords: hasura, docs, CLI, hasura scripts update-config-v2
|
||||
|
||||
.. _hasura_scripts_update-config-v2:
|
||||
|
||||
Hasura CLI: hasura scripts update-config-v2
|
||||
-------------------------------------------
|
||||
|
||||
Upgrade config from v1 to v2
|
||||
|
||||
Synopsis
|
||||
~~~~~~~~
|
||||
|
||||
|
||||
Upgrade config from v1 to v2
|
||||
|
||||
::
|
||||
|
||||
hasura scripts update-config-v2 [flags]
|
||||
|
||||
Examples
|
||||
~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
# Upgrade config from v1 to v2
|
||||
hasura scripts update-config-v2
|
||||
|
||||
# Upgrade to v2 config with metadata directory set
|
||||
hasura scripts update-config-v2 --metadata-dir metadata
|
||||
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--admin-secret string admin secret for Hasura GraphQL engine
|
||||
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
||||
-h, --help help for update-config-v2
|
||||
--metadata-dir string (default "metadata")
|
||||
|
||||
Options inherited from parent commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
||||
* :ref:`hasura scripts <hasura_scripts>` -
|
||||
|
||||
*Auto generated by spf13/cobra*
|
@ -47,7 +47,7 @@ Options inherited from parent commands
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check Skip automatic update check on command execution
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
@ -34,7 +34,7 @@ Options inherited from parent commands
|
||||
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
||||
--no-color do not colorize output (default: false)
|
||||
--project string directory where commands are executed (default: current dir)
|
||||
--skip-update-check Skip automatic update check on command execution
|
||||
--skip-update-check skip automatic update check on command execution
|
||||
|
||||
SEE ALSO
|
||||
~~~~~~~~
|
||||
|
@ -28,20 +28,35 @@ Commands
|
||||
--------
|
||||
|
||||
- :doc:`hasura <hasura>`
|
||||
- :doc:`hasura actions <hasura_actions>`
|
||||
- :doc:`hasura actions codegen <hasura_actions_codegen>`
|
||||
- :doc:`hasura actions create <hasura_actions_create>`
|
||||
- :doc:`hasura actions use-codegen <hasura_actions_use-codegen>`
|
||||
- :doc:`hasura completion <hasura_completion>`
|
||||
- :doc:`hasura console <hasura_console>`
|
||||
- :doc:`hasura init <hasura_init>`
|
||||
- :doc:`hasura metadata <hasura_metadata>`
|
||||
- :doc:`hasura metadata apply <hasura_metadata_apply>`
|
||||
- :doc:`hasura metadata export <hasura_metadata_export>`
|
||||
- :doc:`hasura metadata reload <hasura_metadata_reload>`
|
||||
- :doc:`hasura metadata clear <hasura_metadata_clear>`
|
||||
- :doc:`hasura metadata diff <hasura_metadata_diff>`
|
||||
- :doc:`hasura metadata export <hasura_metadata_export>`
|
||||
- :doc:`hasura metadata inconsistency <hasura_metadata_inconsistency>`
|
||||
- :doc:`hasura metadata inconsistency drop <hasura_metadata_inconsistency_drop>`
|
||||
- :doc:`hasura metadata inconsistency list <hasura_metadata_inconsistency_list>`
|
||||
- :doc:`hasura metadata inconsistency status <hasura_metadata_inconsistency_status>`
|
||||
- :doc:`hasura metadata reload <hasura_metadata_reload>`
|
||||
- :doc:`hasura migrate <hasura_migrate>`
|
||||
- :doc:`hasura migrate apply <hasura_migrate_apply>`
|
||||
- :doc:`hasura migrate create <hasura_migrate_create>`
|
||||
- :doc:`hasura migrate squash <hasura_migrate_squash>`
|
||||
- :doc:`hasura migrate status <hasura_migrate_status>`
|
||||
- :doc:`hasura plugins <hasura_plugins>`
|
||||
- :doc:`hasura plugins install <hasura_plugins_install>`
|
||||
- :doc:`hasura plugins list <hasura_plugins_list>`
|
||||
- :doc:`hasura plugins uninstall <hasura_plugins_uninstall>`
|
||||
- :doc:`hasura plugins upgrade <hasura_plugins_upgrade>`
|
||||
- :doc:`hasura scripts <hasura_scripts>`
|
||||
- :doc:`hasura scripts update-config-v2 <hasura_scripts_update-config-v2>`
|
||||
- :doc:`hasura update-cli <hasura_update-cli>`
|
||||
- :doc:`hasura version <hasura_version>`
|
||||
|
||||
@ -57,20 +72,35 @@ Refer to :doc:`uninstall-hasura-cli`.
|
||||
|
||||
install-hasura-cli
|
||||
hasura <hasura>
|
||||
hasura actions <hasura_actions>
|
||||
hasura actions codegen <hasura_actions_codegen>
|
||||
hasura actions create <hasura_actions_create>
|
||||
hasura actions use-codegen <hasura_actions_use-codegen>
|
||||
hasura completion <hasura_completion>
|
||||
hasura console <hasura_console>
|
||||
hasura init <hasura_init>
|
||||
hasura metadata <hasura_metadata>
|
||||
hasura metadata apply <hasura_metadata_apply>
|
||||
hasura metadata export <hasura_metadata_export>
|
||||
hasura metadata reload <hasura_metadata_reload>
|
||||
hasura metadata clear <hasura_metadata_clear>
|
||||
hasura metadata diff <hasura_metadata_diff>
|
||||
hasura metadata export <hasura_metadata_export>
|
||||
hasura metadata inconsistency <hasura_metadata_inconsistency>
|
||||
hasura metadata inconsistency drop <hasura_metadata_inconsistency_drop>
|
||||
hasura metadata inconsistency list <hasura_metadata_inconsistency_list>
|
||||
hasura metadata inconsistency status <hasura_metadata_inconsistency_status>
|
||||
hasura metadata reload <hasura_metadata_reload>
|
||||
hasura migrate <hasura_migrate>
|
||||
hasura migrate apply <hasura_migrate_apply>
|
||||
hasura migrate create <hasura_migrate_create>
|
||||
hasura migrate squash <hasura_migrate_squash>
|
||||
hasura migrate status <hasura_migrate_status>
|
||||
hasura plugins <hasura_plugins>
|
||||
hasura plugins install <hasura_plugins_install>
|
||||
hasura plugins list <hasura_plugins_list>
|
||||
hasura plugins uninstall <hasura_plugins_uninstall>
|
||||
hasura plugins upgrade <hasura_plugins_upgrade>
|
||||
hasura scripts <hasura_scripts>
|
||||
hasura scripts update-config-v2 <hasura_scripts_update-config-v2>
|
||||
hasura update-cli <hasura_update-cli>
|
||||
hasura version <hasura_version>
|
||||
uninstall-hasura-cli
|
||||
uninstall-hasura-cli
|
@ -24,6 +24,7 @@ The Hasura GraphQL engine lets you set up a GraphQL server and event triggers ov
|
||||
queries/index
|
||||
mutations/index
|
||||
subscriptions/index
|
||||
actions/index
|
||||
remote-schemas/index
|
||||
event-triggers/index
|
||||
auth/index
|
||||
|
@ -12,8 +12,19 @@ Metadata file format reference
|
||||
:depth: 1
|
||||
:local:
|
||||
|
||||
The CLI now supports two versions of configuration: ``v1`` and ``v2``
|
||||
|
||||
config v1
|
||||
---------
|
||||
|
||||
For ``config v1``, the ``config.yaml`` of your Hasura project would look like:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
endpoint: http://localhost:8080
|
||||
|
||||
The metadata file that is exported from the server is a JSON/YAML representation
|
||||
of the Hausra metadata stored in the ``hdb_catalog`` schema on the Postgres
|
||||
of the Hasura metadata stored in the ``hdb_catalog`` schema on the Postgres
|
||||
database.
|
||||
|
||||
The top level keys will be the following arrays:
|
||||
@ -131,3 +142,27 @@ defined for each table. Here is an example metadata file:
|
||||
|
||||
The schema for this file will mostly correspond to the table structure of the
|
||||
:doc:`metadata catalogue <../../how-it-works/metadata-schema>`
|
||||
|
||||
config v2
|
||||
---------
|
||||
|
||||
For ``config v1``, the ``config.yaml`` of your Hasura project would look like:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
actions:
|
||||
handler_webhook_baseurl: http://localhost:3000/api
|
||||
kind: synchronous
|
||||
endpoint: http://localhost:8080
|
||||
metadata_directory: metadata
|
||||
version: 2
|
||||
|
||||
With ``config v2``, the metadata that is exported from the server is a directory of multiple files. When you run ``hasura metadata export``, the following files will be generated in the ``metadata/`` directory of your project.
|
||||
|
||||
- ``version.yaml``: Contains the metadata version of the server
|
||||
- ``tables.yaml``: Contains the metadata related to tables.
|
||||
- ``remote_schemas.yaml``: Contains the metadata related to :doc:`remote schemas<../../remote-schemas/index>`
|
||||
- ``functions.yaml``: Contains the metadata related to :doc:`custom functions<../../schema/custom-functions>`
|
||||
- ``allow_list.yaml``: Contains the metadata related to :doc:`allow lists<../../deployment/allow-list>`
|
||||
- ``actions.yaml``: Contains the metadata related to :doc:`actions<../../actions/index>`
|
||||
- ``actions.graphql``: Contains all the action definition and custom type definitions
|
||||
|
@ -173,7 +173,7 @@ Adding a computed field to a table
|
||||
|
||||
.. thumbnail:: ../../../img/graphql/manual/schema/computed-field-create.png
|
||||
|
||||
.. note::
|
||||
.. admonition:: Supported from
|
||||
|
||||
Console support is available in ``v1.1.0`` and above
|
||||
|
||||
|
BIN
docs/img/graphql/manual/actions/action-create-page.png
Normal file
BIN
docs/img/graphql/manual/actions/action-create-page.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
docs/img/graphql/manual/actions/actions-hl-arch.png
Normal file
BIN
docs/img/graphql/manual/actions/actions-hl-arch.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.2 KiB |
BIN
docs/img/graphql/manual/actions/codegen/cli-framework-prompt.png
Normal file
BIN
docs/img/graphql/manual/actions/codegen/cli-framework-prompt.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 8.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
BIN
docs/img/graphql/manual/actions/codegen/console-codegen-tab.png
Normal file
BIN
docs/img/graphql/manual/actions/codegen/console-codegen-tab.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
Loading…
Reference in New Issue
Block a user