Skip to content

TailorGraphql Operation

The TailorGraphql operation enables interaction with TailorDB to perform operations such as querying data or making changes (mutations). This operation type is ideal for database operations triggered by events, webhooks, or schedules.

Configuration Example

typescript
import { createExecutor, recordCreatedTrigger } from "@tailor-platform/core/executor";
import { product } from "./tailordb/product";

export const tailorGraphqlExecutor = createExecutor({
  name: "tailor-graphql-executor",
  description: "Execute GraphQL operations",
  trigger: recordCreatedTrigger({ type: product }),
  operation: {
    kind: "graphql",
    appName: "ims",
    invoker: "eventUser",
    query: `
        mutation createProduct($categoryID: ID!, $title: String!) {
          createProduct(input: {
            categoryID: $categoryID
            title: $title
          }) {
            id
          }
        }
      `,
    variables: ({ newRecord }) => ({
      categoryID: newRecord.id,
      title: newRecord.name + " Product",
    }),
  },
});

Properties

Executor Properties

PropertyTypeRequiredDescription
namestringYesThe name of the executor. The name field has the validation rule ^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$, and it does not allow capital letters
descriptionstringNoThe description of the executor
triggerobjectYesThe type of trigger (webhook, event, or schedule)

GraphQL Operation Properties

PropertyTypeRequiredDescription
kindstringYesMust be "graphql" for TailorGraphql operations
appNamestringYesThe name of the TailorDB application
querystringYesThe GraphQL query or mutation to execute
variablesfunctionNoA function that returns the variables to pass to the GraphQL operation
invokerstringNoThe invoker of the operation (e.g., "eventUser")

Executor Properties

PropertyTypeRequiredDescription
namestringYesThe name of the executor. The name field has the validation rule ^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$, and it does not allow capital letters
workspace_idstringYesThe ID of the workspace that the executor namespace belongs to
descriptionstringNoThe description of the executor
triggerobjectYesThe type of trigger (webhook, event, or schedule)

TailorGraphql Operation Properties

PropertyTypeSupports ScriptingRequiredDescription
app_namestring-YesThe name of the TailorDB application
querystringJavaScript / CELYesThe GraphQL query or mutation to execute
variablesstringJavaScript / CELNoThe variables to pass to the GraphQL operation
invokerobject-NoThe invoker of the operation

Refer to the Tailor Platform Provider documentation for more details on executor properties.

Executor Properties

PropertyTypeRequiredDescription
NamestringYesThe name of the executor. The name field has the validation rule ^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$, and it does not allow capital letters
DescriptionstringNoThe description of the executor
TriggerobjectYesThe type of trigger (e.g., #TriggerIncomingWebhook, #TriggerEvent, #TriggerSchedule)

TargetTailorGraphql Properties

PropertyTypeSupports ScriptingRequiredDescription
AppNamestring-YesThe name of the TailorDB application
QuerystringJavaScript / CELYesThe GraphQL query or mutation to execute
VariablesstringJavaScript / CELNoThe variables to pass to the GraphQL operation
Invokerobject-NoThe invoker of the operation