diff --git a/docs/graphql/manual/actions/action-handlers.rst b/docs/graphql/manual/actions/action-handlers.rst new file mode 100644 index 00000000000..f4b94bab7ca --- /dev/null +++ b/docs/graphql/manual/actions/action-handlers.rst @@ -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": "", + "input": { + "arg1": "", + "arg2": "" + }, + "session_variables": { + "x-hasura-user-id": "", + "x-hasura-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": "" + } + +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" + } diff --git a/docs/graphql/manual/actions/async-actions.rst b/docs/graphql/manual/actions/async-actions.rst new file mode 100644 index 00000000000..afbe42986fc --- /dev/null +++ b/docs/graphql/manual/actions/async-actions.rst @@ -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 + } + } + diff --git a/docs/graphql/manual/actions/codegen.rst b/docs/graphql/manual/actions/codegen.rst new file mode 100644 index 00000000000..f4eba750cfe --- /dev/null +++ b/docs/graphql/manual/actions/codegen.rst @@ -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 + + 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 `_. + + + \ No newline at end of file diff --git a/docs/graphql/manual/actions/create.rst b/docs/graphql/manual/actions/create.rst new file mode 100644 index 00000000000..9f144c5b7d8 --- /dev/null +++ b/docs/graphql/manual/actions/create.rst @@ -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 ` 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! \ No newline at end of file diff --git a/docs/graphql/manual/actions/index.rst b/docs/graphql/manual/actions/index.rst new file mode 100644 index 00000000000..82862228570 --- /dev/null +++ b/docs/graphql/manual/actions/index.rst @@ -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`. + +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`. + +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 ` 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 + Custom types + Action handlers + Async actions + Codegen diff --git a/docs/graphql/manual/actions/types/index.rst b/docs/graphql/manual/actions/types/index.rst new file mode 100644 index 00000000000..0afdba5181e --- /dev/null +++ b/docs/graphql/manual/actions/types/index.rst @@ -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) + diff --git a/docs/graphql/manual/api-reference/explain.rst b/docs/graphql/manual/api-reference/explain.rst index 27e8468ee0b..0c2769c1a91 100644 --- a/docs/graphql/manual/api-reference/explain.rst +++ b/docs/graphql/manual/api-reference/explain.rst @@ -32,7 +32,7 @@ The request expects a JSON object with the following keys: Content-Type: application/json { - "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", diff --git a/docs/graphql/manual/api-reference/graphql-api/index.rst b/docs/graphql/manual/api-reference/graphql-api/index.rst index fe18556c23c..6d7ec8e6ef2 100644 --- a/docs/graphql/manual/api-reference/graphql-api/index.rst +++ b/docs/graphql/manual/api-reference/graphql-api/index.rst @@ -88,4 +88,3 @@ query operations in one request: Query / Subscription Mutation - Batching operations diff --git a/docs/graphql/manual/api-reference/schema-metadata-api/actions.rst b/docs/graphql/manual/api-reference/schema-metadata-api/actions.rst new file mode 100644 index 00000000000..e84ac83ce67 --- /dev/null +++ b/docs/graphql/manual/api-reference/schema-metadata-api/actions.rst @@ -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 ` + - 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 ` + - 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 ` | :ref:`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 ` + - 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 ` + - Type of the argument + +.. note:: + + The ``GraphQL Types`` used in creating an action must be defined before via :doc:`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 ` + - 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 ` + - 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 ` + - Name of the action + * - role + - true + - :ref:`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 ` + - Name of the action + * - role + - true + - :ref:`RoleName ` + - Name of the role diff --git a/docs/graphql/manual/api-reference/schema-metadata-api/index.rst b/docs/graphql/manual/api-reference/schema-metadata-api/index.rst index b67b72ca6cf..ce30129cb5a 100644 --- a/docs/graphql/manual/api-reference/schema-metadata-api/index.rst +++ b/docs/graphql/manual/api-reference/schema-metadata-api/index.rst @@ -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 ` + - 1 + - Create an action + + * - :ref:`drop_action` + - :ref:`drop_action_args ` + - 1 + - Drop an action + + * - :ref:`update_action` + - :ref:`update_action_args ` + - 1 + - Update an action + + * - :ref:`create_action_permission` + - :ref:`create_action_permission_args ` + - 1 + - Create an action permission + + * - :ref:`drop_action_permission` + - :ref:`drop_action_permission_args ` + - 1 + - Drop an action permission + **See:** - :doc:`Run SQL ` @@ -313,6 +338,7 @@ The various types of queries are listed in the following table: - :doc:`Remote Schemas ` - :doc:`Query Collections ` - :doc:`Custom Types ` +- :doc:`Actions ` - :doc:`Manage Metadata ` Response structure @@ -398,5 +424,6 @@ See :doc:`../../deployment/graphql-engine-flags/reference` for info on setting t Remote Schemas Query Collections Custom Types + Actions Manage Metadata Common syntax definitions diff --git a/docs/graphql/manual/guides/data-modelling/soft-deletes.rst b/docs/graphql/manual/guides/data-modelling/soft-deletes.rst index c384c9b5836..912d1648af1 100644 --- a/docs/graphql/manual/guides/data-modelling/soft-deletes.rst +++ b/docs/graphql/manual/guides/data-modelling/soft-deletes.rst @@ -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 diff --git a/docs/graphql/manual/hasura-cli/hasura.rst b/docs/graphql/manual/hasura-cli/hasura.rst index 7cd854c79d6..d545695471e 100644 --- a/docs/graphql/manual/hasura-cli/hasura.rst +++ b/docs/graphql/manual/hasura-cli/hasura.rst @@ -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 ` - Manage actions on hasura * :ref:`hasura completion ` - Generate auto completion code * :ref:`hasura console ` - Open console to manage database and try out APIs * :ref:`hasura init ` - Initialize directory for Hasura GraphQL engine migrations * :ref:`hasura metadata ` - Manage Hasura GraphQL engine metadata saved in the database * :ref:`hasura migrate ` - Manage migrations on the database -* :ref:`hasura update-cli ` - Update the CLI to the latest version +* :ref:`hasura plugins ` - Manage hasura plugins +* :ref:`hasura scripts ` - +* :ref:`hasura update-cli ` - Update the CLI to latest version * :ref:`hasura version ` - Print the CLI version *Auto generated by spf13/cobra* diff --git a/docs/graphql/manual/hasura-cli/hasura_actions.rst b/docs/graphql/manual/hasura-cli/hasura_actions.rst new file mode 100644 index 00000000000..4c2b36d469b --- /dev/null +++ b/docs/graphql/manual/hasura-cli/hasura_actions.rst @@ -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 GraphQL engine command line tool +* :ref:`hasura actions codegen ` - Generate code for actions +* :ref:`hasura actions create ` - Create a hasura action +* :ref:`hasura actions use-codegen ` - Use the codegen to generate code for hasura actions + +*Auto generated by spf13/cobra* diff --git a/docs/graphql/manual/hasura-cli/hasura_actions_codegen.rst b/docs/graphql/manual/hasura-cli/hasura_actions_codegen.rst new file mode 100644 index 00000000000..58fc5d88806 --- /dev/null +++ b/docs/graphql/manual/hasura-cli/hasura_actions_codegen.rst @@ -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 ` - Manage actions on hasura + +*Auto generated by spf13/cobra* diff --git a/docs/graphql/manual/hasura-cli/hasura_actions_create.rst b/docs/graphql/manual/hasura-cli/hasura_actions_create.rst new file mode 100644 index 00000000000..c0dab346832 --- /dev/null +++ b/docs/graphql/manual/hasura-cli/hasura_actions_create.rst @@ -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 ` - Manage actions on hasura + +*Auto generated by spf13/cobra* diff --git a/docs/graphql/manual/hasura-cli/hasura_actions_use-codegen.rst b/docs/graphql/manual/hasura-cli/hasura_actions_use-codegen.rst new file mode 100644 index 00000000000..8ba1fd556b4 --- /dev/null +++ b/docs/graphql/manual/hasura-cli/hasura_actions_use-codegen.rst @@ -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 ` - Manage actions on hasura + +*Auto generated by spf13/cobra* diff --git a/docs/graphql/manual/hasura-cli/hasura_completion.rst b/docs/graphql/manual/hasura-cli/hasura_completion.rst index 02be6929acd..5b6925ca478 100644 --- a/docs/graphql/manual/hasura-cli/hasura_completion.rst +++ b/docs/graphql/manual/hasura-cli/hasura_completion.rst @@ -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 ~~~~~~~~ diff --git a/docs/graphql/manual/hasura-cli/hasura_console.rst b/docs/graphql/manual/hasura-cli/hasura_console.rst index 4e5d1f44de0..dcc705067da 100644 --- a/docs/graphql/manual/hasura-cli/hasura_console.rst +++ b/docs/graphql/manual/hasura-cli/hasura_console.rst @@ -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 "" + + # Connect to an instance specified by the flag, overrides the one mentioned in config.yaml: + hasura console --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 ~~~~~~~~ diff --git a/docs/graphql/manual/hasura-cli/hasura_init.rst b/docs/graphql/manual/hasura-cli/hasura_init.rst index 12ac9b750e5..f098140d913 100644 --- a/docs/graphql/manual/hasura-cli/hasura_init.rst +++ b/docs/graphql/manual/hasura-cli/hasura_init.rst @@ -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 /config.yaml to add endpoint and admin secret # Create a directory with endpoint and admin secret configured: - hasura init --directory --endpoint https://my-graphql-engine.com --admin-secret adminsecretkey + hasura init --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 ~~~~~~~~ diff --git a/docs/graphql/manual/hasura-cli/hasura_metadata.rst b/docs/graphql/manual/hasura-cli/hasura_metadata.rst index ddc029f5954..f537c7b6970 100644 --- a/docs/graphql/manual/hasura-cli/hasura_metadata.rst +++ b/docs/graphql/manual/hasura-cli/hasura_metadata.rst @@ -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 ` - Clear Hasura GraphQL engine metadata on the database * :ref:`hasura metadata diff ` - (PREVIEW) Show a highlighted diff of Hasura metadata * :ref:`hasura metadata export ` - Export Hasura GraphQL engine metadata from the database +* :ref:`hasura metadata inconsistency ` - Manage inconsistent objects in Hasura Metadata * :ref:`hasura metadata reload ` - Reload Hasura GraphQL engine metadata on the database *Auto generated by spf13/cobra* diff --git a/docs/graphql/manual/hasura-cli/hasura_metadata_apply.rst b/docs/graphql/manual/hasura-cli/hasura_metadata_apply.rst index 873740f59be..b9efcaa282c 100644 --- a/docs/graphql/manual/hasura-cli/hasura_metadata_apply.rst +++ b/docs/graphql/manual/hasura-cli/hasura_metadata_apply.rst @@ -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 "" + + # Apply metadata to an instance specified by the flag: + hasura metadata apply --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 ~~~~~~~~ diff --git a/docs/graphql/manual/hasura-cli/hasura_metadata_clear.rst b/docs/graphql/manual/hasura-cli/hasura_metadata_clear.rst index bbee52a39d6..0b2c41f92a2 100644 --- a/docs/graphql/manual/hasura-cli/hasura_metadata_clear.rst +++ b/docs/graphql/manual/hasura-cli/hasura_metadata_clear.rst @@ -29,24 +29,30 @@ Examples # Clear all the metadata information from database: hasura metadata clear + # Use with admin secret: + hasura metadata clear --admin-secret "" + + # Clear metadata on a different Hasura instance: + hasura metadata clear --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 ~~~~~~~~ diff --git a/docs/graphql/manual/hasura-cli/hasura_metadata_diff.rst b/docs/graphql/manual/hasura-cli/hasura_metadata_diff.rst index 489acc3d5ec..5fb0a3de4f0 100644 --- a/docs/graphql/manual/hasura-cli/hasura_metadata_diff.rst +++ b/docs/graphql/manual/hasura-cli/hasura_metadata_diff.rst @@ -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 "" + + # Diff metadata on a different Hasura instance: + hasura metadata diff --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 ~~~~~~~~ diff --git a/docs/graphql/manual/hasura-cli/hasura_metadata_export.rst b/docs/graphql/manual/hasura-cli/hasura_metadata_export.rst index fcb60b0c55d..388bb928e42 100644 --- a/docs/graphql/manual/hasura-cli/hasura_metadata_export.rst +++ b/docs/graphql/manual/hasura-cli/hasura_metadata_export.rst @@ -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 "" + + # Export metadata to another instance specified by the flag: + hasura metadata export --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 ~~~~~~~~ diff --git a/docs/graphql/manual/hasura-cli/hasura_metadata_inconsistency.rst b/docs/graphql/manual/hasura-cli/hasura_metadata_inconsistency.rst new file mode 100644 index 00000000000..7c5cb9a0651 --- /dev/null +++ b/docs/graphql/manual/hasura-cli/hasura_metadata_inconsistency.rst @@ -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 ` - Manage Hasura GraphQL engine metadata saved in the database +* :ref:`hasura metadata inconsistency drop ` - Drop inconsistent objects from the metadata +* :ref:`hasura metadata inconsistency list ` - List all inconsistent objects from the metadata +* :ref:`hasura metadata inconsistency status ` - Check if the metadata is inconsistent or not + +*Auto generated by spf13/cobra* diff --git a/docs/graphql/manual/hasura-cli/hasura_metadata_inconsistency_drop.rst b/docs/graphql/manual/hasura-cli/hasura_metadata_inconsistency_drop.rst new file mode 100644 index 00000000000..6874e3bf1cd --- /dev/null +++ b/docs/graphql/manual/hasura-cli/hasura_metadata_inconsistency_drop.rst @@ -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 ` - Manage inconsistent objects in Hasura Metadata + +*Auto generated by spf13/cobra* diff --git a/docs/graphql/manual/hasura-cli/hasura_metadata_inconsistency_list.rst b/docs/graphql/manual/hasura-cli/hasura_metadata_inconsistency_list.rst new file mode 100644 index 00000000000..86b82e04b01 --- /dev/null +++ b/docs/graphql/manual/hasura-cli/hasura_metadata_inconsistency_list.rst @@ -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 ` - Manage inconsistent objects in Hasura Metadata + +*Auto generated by spf13/cobra* diff --git a/docs/graphql/manual/hasura-cli/hasura_metadata_inconsistency_status.rst b/docs/graphql/manual/hasura-cli/hasura_metadata_inconsistency_status.rst new file mode 100644 index 00000000000..d617b785311 --- /dev/null +++ b/docs/graphql/manual/hasura-cli/hasura_metadata_inconsistency_status.rst @@ -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 ` - Manage inconsistent objects in Hasura Metadata + +*Auto generated by spf13/cobra* diff --git a/docs/graphql/manual/hasura-cli/hasura_metadata_reload.rst b/docs/graphql/manual/hasura-cli/hasura_metadata_reload.rst index 810fd701fac..d2b6e1647f0 100644 --- a/docs/graphql/manual/hasura-cli/hasura_metadata_reload.rst +++ b/docs/graphql/manual/hasura-cli/hasura_metadata_reload.rst @@ -27,24 +27,30 @@ Examples # Reload all the metadata information from database: hasura metadata reload + # Use with admin secret: + hasura metadata reload --admin-secret "" + + # Reload metadata on a different instance: + hasura metadata export --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 ~~~~~~~~ diff --git a/docs/graphql/manual/hasura-cli/hasura_migrate.rst b/docs/graphql/manual/hasura-cli/hasura_migrate.rst index a17b6d530f2..9a245cb9299 100644 --- a/docs/graphql/manual/hasura-cli/hasura_migrate.rst +++ b/docs/graphql/manual/hasura-cli/hasura_migrate.rst @@ -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 ~~~~~~~~ diff --git a/docs/graphql/manual/hasura-cli/hasura_migrate_apply.rst b/docs/graphql/manual/hasura-cli/hasura_migrate_apply.rst index d16d82a0f7b..2b0fd60fded 100644 --- a/docs/graphql/manual/hasura-cli/hasura_migrate_apply.rst +++ b/docs/graphql/manual/hasura-cli/hasura_migrate_apply.rst @@ -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 "" + + # Apply migrations on another Hasura instance: + hasura migrate apply --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 "" + + # 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 "" + + # 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 "" + + # 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 ~~~~~~~~ diff --git a/docs/graphql/manual/hasura-cli/hasura_migrate_create.rst b/docs/graphql/manual/hasura-cli/hasura_migrate_create.rst index ff97d753eb8..dcea81e493d 100644 --- a/docs/graphql/manual/hasura-cli/hasura_migrate_create.rst +++ b/docs/graphql/manual/hasura-cli/hasura_migrate_create.rst @@ -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 "" + + # Setup migration files from an instance mentioned by the flag: + hasura migrate create init --from-server --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 ~~~~~~~~ diff --git a/docs/graphql/manual/hasura-cli/hasura_migrate_squash.rst b/docs/graphql/manual/hasura-cli/hasura_migrate_squash.rst index 2dccb133a34..7c185b68b60 100644 --- a/docs/graphql/manual/hasura-cli/hasura_migrate_squash.rst +++ b/docs/graphql/manual/hasura-cli/hasura_migrate_squash.rst @@ -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 "" --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 ~~~~~~~~ diff --git a/docs/graphql/manual/hasura-cli/hasura_migrate_status.rst b/docs/graphql/manual/hasura-cli/hasura_migrate_status.rst index 03d3730a084..f7820703f7f 100644 --- a/docs/graphql/manual/hasura-cli/hasura_migrate_status.rst +++ b/docs/graphql/manual/hasura-cli/hasura_migrate_status.rst @@ -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 "" + + # Check status on a different server: + hasura migrate status --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 ~~~~~~~~ diff --git a/docs/graphql/manual/hasura-cli/hasura_plugins.rst b/docs/graphql/manual/hasura-cli/hasura_plugins.rst new file mode 100644 index 00000000000..0b10472375a --- /dev/null +++ b/docs/graphql/manual/hasura-cli/hasura_plugins.rst @@ -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 GraphQL engine command line tool +* :ref:`hasura plugins install ` - Install a hasura plugin +* :ref:`hasura plugins list ` - List all hasura plugin +* :ref:`hasura plugins uninstall ` - Uninstall a hasura plugin +* :ref:`hasura plugins upgrade ` - Upgrade a hasura plugin + +*Auto generated by spf13/cobra* diff --git a/docs/graphql/manual/hasura-cli/hasura_plugins_install.rst b/docs/graphql/manual/hasura-cli/hasura_plugins_install.rst new file mode 100644 index 00000000000..7359e7701fc --- /dev/null +++ b/docs/graphql/manual/hasura-cli/hasura_plugins_install.rst @@ -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 ` - Manage hasura plugins + +*Auto generated by spf13/cobra* diff --git a/docs/graphql/manual/hasura-cli/hasura_plugins_list.rst b/docs/graphql/manual/hasura-cli/hasura_plugins_list.rst new file mode 100644 index 00000000000..b7f2f94779c --- /dev/null +++ b/docs/graphql/manual/hasura-cli/hasura_plugins_list.rst @@ -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 ` - Manage hasura plugins + +*Auto generated by spf13/cobra* diff --git a/docs/graphql/manual/hasura-cli/hasura_plugins_uninstall.rst b/docs/graphql/manual/hasura-cli/hasura_plugins_uninstall.rst new file mode 100644 index 00000000000..1382e8d51ea --- /dev/null +++ b/docs/graphql/manual/hasura-cli/hasura_plugins_uninstall.rst @@ -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 ` - Manage hasura plugins + +*Auto generated by spf13/cobra* diff --git a/docs/graphql/manual/hasura-cli/hasura_plugins_upgrade.rst b/docs/graphql/manual/hasura-cli/hasura_plugins_upgrade.rst new file mode 100644 index 00000000000..7c5cac520d9 --- /dev/null +++ b/docs/graphql/manual/hasura-cli/hasura_plugins_upgrade.rst @@ -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 ` - Manage hasura plugins + +*Auto generated by spf13/cobra* diff --git a/docs/graphql/manual/hasura-cli/hasura_scripts.rst b/docs/graphql/manual/hasura-cli/hasura_scripts.rst new file mode 100644 index 00000000000..ca58ee915d3 --- /dev/null +++ b/docs/graphql/manual/hasura-cli/hasura_scripts.rst @@ -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 GraphQL engine command line tool +* :ref:`hasura scripts update-config-v2 ` - Upgrade config from v1 to v2 + +*Auto generated by spf13/cobra* diff --git a/docs/graphql/manual/hasura-cli/hasura_scripts_update-config-v2.rst b/docs/graphql/manual/hasura-cli/hasura_scripts_update-config-v2.rst new file mode 100644 index 00000000000..575a9e05f72 --- /dev/null +++ b/docs/graphql/manual/hasura-cli/hasura_scripts_update-config-v2.rst @@ -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 ` - + +*Auto generated by spf13/cobra* diff --git a/docs/graphql/manual/hasura-cli/hasura_update-cli.rst b/docs/graphql/manual/hasura-cli/hasura_update-cli.rst index e044988fe4c..ad036ccd480 100644 --- a/docs/graphql/manual/hasura-cli/hasura_update-cli.rst +++ b/docs/graphql/manual/hasura-cli/hasura_update-cli.rst @@ -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 ~~~~~~~~ diff --git a/docs/graphql/manual/hasura-cli/hasura_version.rst b/docs/graphql/manual/hasura-cli/hasura_version.rst index c2079fdce9f..38b613f0350 100644 --- a/docs/graphql/manual/hasura-cli/hasura_version.rst +++ b/docs/graphql/manual/hasura-cli/hasura_version.rst @@ -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 ~~~~~~~~ diff --git a/docs/graphql/manual/hasura-cli/index.rst b/docs/graphql/manual/hasura-cli/index.rst index bc21530f421..c566c4ef61a 100644 --- a/docs/graphql/manual/hasura-cli/index.rst +++ b/docs/graphql/manual/hasura-cli/index.rst @@ -28,20 +28,35 @@ Commands -------- - :doc:`hasura ` +- :doc:`hasura actions ` +- :doc:`hasura actions codegen ` +- :doc:`hasura actions create ` +- :doc:`hasura actions use-codegen ` - :doc:`hasura completion ` - :doc:`hasura console ` - :doc:`hasura init ` - :doc:`hasura metadata ` - :doc:`hasura metadata apply ` -- :doc:`hasura metadata export ` -- :doc:`hasura metadata reload ` - :doc:`hasura metadata clear ` - :doc:`hasura metadata diff ` +- :doc:`hasura metadata export ` +- :doc:`hasura metadata inconsistency ` +- :doc:`hasura metadata inconsistency drop ` +- :doc:`hasura metadata inconsistency list ` +- :doc:`hasura metadata inconsistency status ` +- :doc:`hasura metadata reload ` - :doc:`hasura migrate ` - :doc:`hasura migrate apply ` - :doc:`hasura migrate create ` - :doc:`hasura migrate squash ` - :doc:`hasura migrate status ` +- :doc:`hasura plugins ` +- :doc:`hasura plugins install ` +- :doc:`hasura plugins list ` +- :doc:`hasura plugins uninstall ` +- :doc:`hasura plugins upgrade ` +- :doc:`hasura scripts ` +- :doc:`hasura scripts update-config-v2 ` - :doc:`hasura update-cli ` - :doc:`hasura version ` @@ -57,20 +72,35 @@ Refer to :doc:`uninstall-hasura-cli`. install-hasura-cli hasura + hasura actions + hasura actions codegen + hasura actions create + hasura actions use-codegen hasura completion hasura console hasura init hasura metadata hasura metadata apply - hasura metadata export - hasura metadata reload hasura metadata clear hasura metadata diff + hasura metadata export + hasura metadata inconsistency + hasura metadata inconsistency drop + hasura metadata inconsistency list + hasura metadata inconsistency status + hasura metadata reload hasura migrate hasura migrate apply hasura migrate create hasura migrate squash hasura migrate status + hasura plugins + hasura plugins install + hasura plugins list + hasura plugins uninstall + hasura plugins upgrade + hasura scripts + hasura scripts update-config-v2 hasura update-cli hasura version - uninstall-hasura-cli + uninstall-hasura-cli \ No newline at end of file diff --git a/docs/graphql/manual/index.rst b/docs/graphql/manual/index.rst index 44c40d726f6..daef8077749 100644 --- a/docs/graphql/manual/index.rst +++ b/docs/graphql/manual/index.rst @@ -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 diff --git a/docs/graphql/manual/migrations/reference/metadata-file-format.rst b/docs/graphql/manual/migrations/reference/metadata-file-format.rst index 33cd1a438cd..91af99f8556 100644 --- a/docs/graphql/manual/migrations/reference/metadata-file-format.rst +++ b/docs/graphql/manual/migrations/reference/metadata-file-format.rst @@ -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 diff --git a/docs/graphql/manual/schema/computed-fields.rst b/docs/graphql/manual/schema/computed-fields.rst index 22c54fd6c37..0c8823b68d7 100644 --- a/docs/graphql/manual/schema/computed-fields.rst +++ b/docs/graphql/manual/schema/computed-fields.rst @@ -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 diff --git a/docs/img/graphql/manual/actions/action-create-page.png b/docs/img/graphql/manual/actions/action-create-page.png new file mode 100644 index 00000000000..709886146e7 Binary files /dev/null and b/docs/img/graphql/manual/actions/action-create-page.png differ diff --git a/docs/img/graphql/manual/actions/actions-hl-arch.png b/docs/img/graphql/manual/actions/actions-hl-arch.png new file mode 100644 index 00000000000..eb3d6878ce2 Binary files /dev/null and b/docs/img/graphql/manual/actions/actions-hl-arch.png differ diff --git a/docs/img/graphql/manual/actions/codegen/cli-framework-prompt.png b/docs/img/graphql/manual/actions/codegen/cli-framework-prompt.png new file mode 100644 index 00000000000..fa6bbc1d37e Binary files /dev/null and b/docs/img/graphql/manual/actions/codegen/cli-framework-prompt.png differ diff --git a/docs/img/graphql/manual/actions/codegen/cli-output-dir-prompt.png b/docs/img/graphql/manual/actions/codegen/cli-output-dir-prompt.png new file mode 100644 index 00000000000..5b636eeb727 Binary files /dev/null and b/docs/img/graphql/manual/actions/codegen/cli-output-dir-prompt.png differ diff --git a/docs/img/graphql/manual/actions/codegen/cli-starter-kit-prompt.png b/docs/img/graphql/manual/actions/codegen/cli-starter-kit-prompt.png new file mode 100644 index 00000000000..8d3f41bb380 Binary files /dev/null and b/docs/img/graphql/manual/actions/codegen/cli-starter-kit-prompt.png differ diff --git a/docs/img/graphql/manual/actions/codegen/console-codegen-tab.png b/docs/img/graphql/manual/actions/codegen/console-codegen-tab.png new file mode 100644 index 00000000000..8ec290c81b0 Binary files /dev/null and b/docs/img/graphql/manual/actions/codegen/console-codegen-tab.png differ