chore(docs): Generated References (#8383)

Generated the following references:
- `helper_steps`
- `modules`
- `types`
- `workflows`
This commit is contained in:
github-actions[bot]
2024-08-01 07:04:13 +00:00
committed by GitHub
parent da3da51000
commit 66cc7cfc1f
52 changed files with 23043 additions and 16549 deletions
@@ -0,0 +1,28 @@
---
slug: /references/workflows/createHook
sidebar_label: createHook
---
import { TypeList } from "docs-ui"
# createHook - Workflows API Reference
This documentation provides a reference to the `createHook` . It belongs to the `@medusajs/workflows-sdk` package.
Define a workflow hook to be executed within steps. The created hook
is exposed publicly for the workflow consumers to inject and run
custom logic.
Hooks behaves like steps
## Type Parameters
<TypeList types={[{"name":"Name","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"TInvokeInput","type":"`object`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="createHook"/>
## Parameters
<TypeList types={[{"name":"name","type":"Name","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"input","type":"TInvokeInput","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="createHook"/>
## Returns
<TypeList types={[{"name":"Hook","type":"[Hook](../../types/workflows.Hook/page.mdx)&#60;Name, TInvokeInput&#62;","optional":false,"defaultValue":"","description":"Define a workflow hook to be executed within steps. The created hook\nis exposed publicly for the workflow consumers to inject and run\ncustom logic.\n\nHooks behaves like steps","expandable":false,"children":[]}]} sectionTitle="createHook"/>
@@ -59,7 +59,7 @@ export const createProductStep = createStep(
## Parameters
<TypeList types={[{"name":"nameOrConfig","type":"`string` \\| `object` & Omit&#60;TransactionStepsDefinition, \"next\" \\| \"uuid\" \\| \"action\"&#62;","description":"The name of the step or its configuration.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"invokeFn","type":"InvokeFn&#60;TInvokeInput, TInvokeResultOutput, TInvokeResultCompensateInput&#62;","description":"An invocation function that will be executed when the workflow is executed. The function must return an instance of [StepResponse](../../classes/workflows.StepResponse/page.mdx). The constructor of [StepResponse](../../classes/workflows.StepResponse/page.mdx)\naccepts the output of the step as a first argument, and optionally as a second argument the data to be passed to the compensation function as a parameter.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"compensateFn","type":"CompensateFn&#60;TInvokeResultCompensateInput&#62;","description":"A compensation function that's executed if an error occurs in the workflow. It's used to roll-back actions when errors occur.\nIt accepts as a parameter the second argument passed to the constructor of the [StepResponse](../../classes/workflows.StepResponse/page.mdx) instance returned by the invocation function. If the\ninvocation function doesn't pass the second argument to `StepResponse` constructor, the compensation function receives the first argument\npassed to the `StepResponse` constructor instead.","optional":true,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="createStep"/>
<TypeList types={[{"name":"nameOrConfig","type":"`string` \\| `object` & Omit&#60;TransactionStepsDefinition, \"next\" \\| \"uuid\" \\| \"action\"&#62;","description":"The name of the step or its configuration.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"invokeFn","type":"[InvokeFn](../../types/workflows.InvokeFn/page.mdx)&#60;TInvokeInput, TInvokeResultOutput, TInvokeResultCompensateInput&#62;","description":"An invocation function that will be executed when the workflow is executed. The function must return an instance of [StepResponse](../../classes/workflows.StepResponse/page.mdx). The constructor of [StepResponse](../../classes/workflows.StepResponse/page.mdx)\naccepts the output of the step as a first argument, and optionally as a second argument the data to be passed to the compensation function as a parameter.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"compensateFn","type":"[CompensateFn](../../types/workflows.CompensateFn/page.mdx)&#60;TInvokeResultCompensateInput&#62;","description":"A compensation function that's executed if an error occurs in the workflow. It's used to roll-back actions when errors occur.\nIt accepts as a parameter the second argument passed to the constructor of the [StepResponse](../../classes/workflows.StepResponse/page.mdx) instance returned by the invocation function. If the\ninvocation function doesn't pass the second argument to `StepResponse` constructor, the compensation function receives the first argument\npassed to the `StepResponse` constructor instead.","optional":true,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="createStep"/>
## Returns
@@ -61,11 +61,11 @@ export async function GET(
## Type Parameters
<TypeList types={[{"name":"TData","type":"`object`","description":"The type of the input passed to the composer function.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"TResult","type":"`object`","description":"The type of the output returned by the composer function.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"THooks","type":"`Record<string, Function>`","description":"The type of hooks defined in the workflow.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="createWorkflow"/>
<TypeList types={[{"name":"TData","type":"`object`","description":"The type of the input passed to the composer function.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"TResult","type":"`object`","description":"The type of the output returned by the composer function.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"THooks","type":"`any`[]","description":"The type of hooks defined in the workflow.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="createWorkflow"/>
## Parameters
<TypeList types={[{"name":"nameOrConfig","type":"`string` \\| `object` & `TransactionModelOptions`","description":"The name of the workflow or its configuration.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"composer","type":"(`input`: [WorkflowData](../../types/workflows.WorkflowData/page.mdx)&#60;TData&#62;) => `void` \\| [WorkflowData](../../types/workflows.WorkflowData/page.mdx)&#60;TResult&#62; \\| &#123; [K in string \\| number \\| symbol]: TResult[K] \\| WorkflowDataProperties&#60;TResult[K]&#62; \\| WorkflowData&#60;TResult[K]&#62; &#125;","description":"The constructor function that is executed when the `run` method in [ReturnWorkflow](../../types/workflows.ReturnWorkflow/page.mdx) is used.\nThe function can't be an arrow function or an asynchronus function. It also can't directly manipulate data.\nYou'll have to use the [transform](../workflows.transform/page.mdx) function if you need to directly manipulate data.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="createWorkflow"/>
<TypeList types={[{"name":"nameOrConfig","type":"`string` \\| `object` & `TransactionModelOptions`","description":"The name of the workflow or its configuration.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"composer","type":"(`input`: [WorkflowData](../../types/workflows.WorkflowData/page.mdx)&#60;TData&#62;) => `void` \\| [WorkflowResponse](../../classes/workflows.WorkflowResponse/page.mdx)&#60;TResult, THooks&#62;","description":"The constructor function that is executed when the `run` method in [ReturnWorkflow](../../types/workflows.ReturnWorkflow/page.mdx) is used.\nThe function can't be an arrow function or an asynchronus function. It also can't directly manipulate data.\nYou'll have to use the [transform](../workflows.transform/page.mdx) function if you need to directly manipulate data.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="createWorkflow"/>
## Returns