docs: fix tsdocs following typedoc update + 1.20 release (#6033)

* docs: fix tsdocs following typedoc update + 1.20 release

* Fix OAS validation errors

* fixes to react-docs-generator

* fix content linting
This commit is contained in:
Shahed Nasser
2024-01-09 17:15:29 +02:00
committed by GitHub
parent 125879ada4
commit 18de90e603
32 changed files with 460 additions and 111 deletions

View File

@@ -39,7 +39,76 @@ export class StepResponse<TOutput, TCompensateInput = TOutput> {
/**
* Creates a StepResponse that indicates that the step has failed and the retry mechanism should not kick in anymore.
*
* @param message - An optional message to be logged. Default to `Permanent failure`.
* @param message - An optional message to be logged.
*
* @example
* import { Product } from "@medusajs/medusa"
* import {
* createStep,
* StepResponse,
* createWorkflow
* } from "@medusajs/workflows-sdk"
*
* interface CreateProductInput {
* title: string
* }
*
* export const createProductStep = createStep(
* "createProductStep",
* async function (
* input: CreateProductInput,
* context
* ) {
* const productService = context.container.resolve(
* "productService"
* )
*
* try {
* const product = await productService.create(input)
* return new StepResponse({
* product
* }, {
* product_id: product.id
* })
* } catch (e) {
* return StepResponse.permanentFailure(`Couldn't create the product: ${e}`)
* }
* }
* )
*
* interface WorkflowInput {
* title: string
* }
*
* const myWorkflow = createWorkflow<
* WorkflowInput,
* Product
* >("my-workflow", (input) => {
* // Everything here will be executed and resolved later
* // during the execution. Including the data access.
*
* const product = createProductStep(input)
* }
* )
*
* myWorkflow()
* .run({
* input: {
* title: "Shirt"
* }
* })
* .then(({ errors, result }) => {
* if (errors.length) {
* errors.forEach((err) => {
* if (typeof err.error === "object" && "message" in err.error) {
* console.error(err.error.message)
* } else {
* console.error(err.error)
* }
* })
* }
* console.log(result)
* })
*/
static permanentFailure(message = "Permanent failure"): never {
throw new PermanentStepFailureError(message)