docs: prep for v2 documentation (#6710)

This PR includes documentation that preps for v2 docs (but doesn't introduce new docs).

_Note: The number of file changes in the PR is due to find-and-replace within the `references` which is unavoidable. Let me know if I should move it to another PR._

## Changes

- Change Medusa version in base OAS used for v2.
- Fix to docblock generator related to not catching all path parameters.
- Added typedoc plugin that generates ER Diagrams, which will be used specifically for data model references in commerce modules.
- Changed OAS tool to output references in `www/apps/api-reference/specs-v2` directory when the `--v2` option is used.
- Added a version switcher to the API reference to switch between V1 and V2. This switcher is enabled by an environment variable, so it won't be visible/usable at the moment.
- Upgraded docusaurus to v3.0.1
- Added new Vale rules to ensure correct spelling of Medusa Admin and module names.
- Added new components to the `docs-ui` package that will be used in future documentation changes.
This commit is contained in:
Shahed Nasser
2024-03-18 09:47:35 +02:00
committed by GitHub
parent 56a6ec0227
commit bb87db8342
2008 changed files with 15716 additions and 10536 deletions
@@ -4,7 +4,7 @@ slug: /references/workflows/createStep
sidebar_label: createStep
---
import ParameterTypes from "@site/src/components/ParameterTypes"
import TypeList from "@site/src/components/TypeList"
# createStep - Workflows API Reference
@@ -56,12 +56,12 @@ export const createProductStep = createStep(
## Type Parameters
<ParameterTypes parameters={[{"name":"TInvokeInput","type":"`object`","description":"The type of the expected input parameter to the invocation function.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"TInvokeResultOutput","type":"`object`","description":"The type of the expected output parameter of the invocation function.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"TInvokeResultCompensateInput","type":"`object`","description":"The type of the expected input parameter to the compensation function.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="createStep"/>
<TypeList types={[{"name":"TInvokeInput","type":"`object`","description":"The type of the expected input parameter to the invocation function.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"TInvokeResultOutput","type":"`object`","description":"The type of the expected output parameter of the invocation function.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"TInvokeResultCompensateInput","type":"`object`","description":"The type of the expected input parameter to the compensation function.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="createStep"/>
## Parameters
<ParameterTypes parameters={[{"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.mdx). The constructor of [StepResponse](../classes/workflows.StepResponse.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.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&#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.mdx). The constructor of [StepResponse](../classes/workflows.StepResponse.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.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
<ParameterTypes parameters={[{"name":"StepFunction","type":"[StepFunction](../types/workflows.StepFunction.mdx)&#60;TInvokeInput, TInvokeResultOutput&#62;","optional":false,"defaultValue":"","description":"A step function to be used in a workflow.","expandable":false,"children":[]}]} sectionTitle="createStep"/>
<TypeList types={[{"name":"StepFunction","type":"[StepFunction](../types/workflows.StepFunction.mdx)&#60;TInvokeInput, TInvokeResultOutput&#62;","optional":false,"defaultValue":"","description":"A step function to be used in a workflow.","expandable":false,"children":[]}]} sectionTitle="createStep"/>
@@ -4,7 +4,7 @@ slug: /references/workflows/createWorkflow
sidebar_label: createWorkflow
---
import ParameterTypes from "@site/src/components/ParameterTypes"
import TypeList from "@site/src/components/TypeList"
# createWorkflow - Workflows API Reference
@@ -62,12 +62,12 @@ export async function GET(
## Type Parameters
<ParameterTypes parameters={[{"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":"`Record<string, Function>`","description":"The type of hooks defined in the workflow.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="createWorkflow"/>
## Parameters
<ParameterTypes parameters={[{"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.mdx)&#60;TData&#62;) => `void` \\| [WorkflowData](../types/workflows.WorkflowData.mdx)&#60;TResult&#62; \\| &#123; [K in string \\| number \\| symbol]: 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.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.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.mdx)&#60;TData&#62;) => `void` \\| [WorkflowData](../types/workflows.WorkflowData.mdx)&#60;TResult&#62; \\| &#123; [K in string \\| number \\| symbol]: 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.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.mdx) function if you need to directly manipulate data.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="createWorkflow"/>
## Returns
<ParameterTypes parameters={[{"name":"ReturnWorkflow","type":"[ReturnWorkflow](../types/workflows.ReturnWorkflow.mdx)&#60;TData, TResult, THooks&#62;","optional":false,"defaultValue":"","description":"The created workflow. You can later execute the workflow by invoking it, then using its `run` method.","expandable":false,"children":[]}]} sectionTitle="createWorkflow"/>
<TypeList types={[{"name":"ReturnWorkflow","type":"[ReturnWorkflow](../types/workflows.ReturnWorkflow.mdx)&#60;TData, TResult, THooks&#62;","optional":false,"defaultValue":"","description":"The created workflow. You can later execute the workflow by invoking it, then using its `run` method.","expandable":false,"children":[]}]} sectionTitle="createWorkflow"/>
@@ -4,7 +4,7 @@ slug: /references/workflows/parallelize
sidebar_label: parallelize
---
import ParameterTypes from "@site/src/components/ParameterTypes"
import TypeList from "@site/src/components/TypeList"
# parallelize - Workflows API Reference
@@ -49,12 +49,12 @@ const myWorkflow = createWorkflow<
## Type Parameters
<ParameterTypes parameters={[{"name":"TResult","type":"[WorkflowData](../types/workflows.WorkflowData.mdx)[]","description":"The type of the expected result.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="parallelize"/>
<TypeList types={[{"name":"TResult","type":"[WorkflowData](../types/workflows.WorkflowData.mdx)[]","description":"The type of the expected result.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="parallelize"/>
## Parameters
<ParameterTypes parameters={[{"name":"steps","type":"TResult","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="parallelize"/>
<TypeList types={[{"name":"steps","type":"TResult","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="parallelize"/>
## Returns
<ParameterTypes parameters={[{"name":"TResult","type":"TResult","optional":false,"defaultValue":"","description":"The step results. The results are ordered in the array by the order they're passed in the function's parameter.","expandable":false,"children":[]}]} sectionTitle="parallelize"/>
<TypeList types={[{"name":"TResult","type":"TResult","optional":false,"defaultValue":"","description":"The step results. The results are ordered in the array by the order they're passed in the function's parameter.","expandable":false,"children":[]}]} sectionTitle="parallelize"/>
@@ -4,7 +4,7 @@ slug: /references/workflows/transform
sidebar_label: transform
---
import ParameterTypes from "@site/src/components/ParameterTypes"
import TypeList from "@site/src/components/TypeList"
# transform - Workflows API Reference
@@ -55,12 +55,12 @@ const myWorkflow = createWorkflow<
## Type Parameters
<ParameterTypes parameters={[{"name":"T","type":"`object` \\| [WorkflowData](../types/workflows.WorkflowData.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"RFinal","type":"`object`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="transform"/>
<TypeList types={[{"name":"T","type":"`object` \\| [WorkflowData](../types/workflows.WorkflowData.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"RFinal","type":"`object`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="transform"/>
## Parameters
<ParameterTypes parameters={[{"name":"values","type":"T","description":"The output(s) of other step functions.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"func","type":"[Func1&#60;T, RFinal&#62;]","description":"The transform function used to perform action on the runtime values of the provided `values`.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="transform"/>
<TypeList types={[{"name":"values","type":"T","description":"The output(s) of other step functions.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"func","type":"[Func1&#60;T, RFinal&#62;]","description":"The transform function used to perform action on the runtime values of the provided `values`.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="transform"/>
## Returns
<ParameterTypes parameters={[{"name":"WorkflowData","type":"[WorkflowData](../types/workflows.WorkflowData.mdx)&#60;RFinal&#62;","optional":false,"defaultValue":"","description":"There's no expected value to be returned by the `transform` function.","expandable":false,"children":[]}]} sectionTitle="transform"/>
<TypeList types={[{"name":"WorkflowData","type":"[WorkflowData](../types/workflows.WorkflowData.mdx)&#60;RFinal&#62;","optional":false,"defaultValue":"","description":"There's no expected value to be returned by the `transform` function.","expandable":false,"children":[]}]} sectionTitle="transform"/>