chore(docs): Generated References (#8383)
Generated the following references: - `helper_steps` - `modules` - `types` - `workflows`
This commit is contained in:
@@ -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)<Name, TInvokeInput>","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<TransactionStepsDefinition, \"next\" \\| \"uuid\" \\| \"action\">","description":"The name of the step or its configuration.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"invokeFn","type":"InvokeFn<TInvokeInput, TInvokeResultOutput, TInvokeResultCompensateInput>","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<TInvokeResultCompensateInput>","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<TransactionStepsDefinition, \"next\" \\| \"uuid\" \\| \"action\">","description":"The name of the step or its configuration.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"invokeFn","type":"[InvokeFn](../../types/workflows.InvokeFn/page.mdx)<TInvokeInput, TInvokeResultOutput, TInvokeResultCompensateInput>","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)<TInvokeResultCompensateInput>","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)<TData>) => `void` \\| [WorkflowData](../../types/workflows.WorkflowData/page.mdx)<TResult> \\| { [K in string \\| number \\| symbol]: TResult[K] \\| WorkflowDataProperties<TResult[K]> \\| WorkflowData<TResult[K]> }","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)<TData>) => `void` \\| [WorkflowResponse](../../classes/workflows.WorkflowResponse/page.mdx)<TResult, THooks>","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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user