docs: use tooling convention across docs (#10512)

This commit is contained in:
Shahed Nasser
2024-12-09 19:15:29 +02:00
committed by GitHub
parent 7c76ee24cb
commit 3409953c4f
76 changed files with 283 additions and 265 deletions
@@ -26,7 +26,7 @@ Modules are created in a sub-directory of `src/modules`. So, start by creating t
## 2. Create Data Model
A data model represents a table in the database. You create data models using Medusa's data modeling utility, which is built to improve readability and provide an intuitive developer experience.
A data model represents a table in the database. You create data models using Medusa's Data Model Language (DML). It simplifies defining a table's columns, relations, and indexes with straightforward methods and configurations.
<Note>
@@ -49,7 +49,7 @@ export const Brand = model.define("brand", {
You create a `Brand` data model which has an `id` primary key property, and a `name` text property.
You define the data model using the `define` method of the `model` utility imported from `@medusajs/framework/utils`. It accepts two parameters:
You define the data model using the `define` method of the DML. It accepts two parameters:
1. The first one is the name of the data model's table in the database. Use snake-case names.
2. The second is an object, which is the data model's schema.
@@ -95,7 +95,7 @@ class BrandModuleService extends MedusaService({
export default BrandModuleService
```
The `BrandModuleService` extends a class returned by the `MedusaService` function imported from `@medusajs/framework/utils`. This function generates a class with data-management methods for your module's data models.
The `BrandModuleService` extends a class returned by `MedusaService` from the Modules SDK. This function generates a class with data-management methods for your module's data models.
The `MedusaService` function receives an object of the module's data models as a parameter, and generates methods to manage those data models. So, the `BrandModuleService` now has methods like `createBrands` and `retrieveBrand` to manage the `Brand` data model.
@@ -128,7 +128,7 @@ export default Module(BRAND_MODULE, {
})
```
You use the `Module` function imported from `@medusajs/framework/utils` to create the module's definition. It accepts two parameters:
You use `Module` from the Modules SDK to create the module's definition. It accepts two parameters:
1. The module's name (`brand`). You'll use this name when you use this module in other customizations.
2. An object with a required property `service` indicating the module's main service.
@@ -31,7 +31,7 @@ Learn more about workflows in [this chapter](../../../fundamentals/workflows/pag
## 1. Create createBrandStep
A workflow consists of a series of steps, each step created in a TypeScript or JavaScript file under the `src/workflows` directory. A step is defined using the `createStep` utility function imported from `@medusajs/framework/workflows-sdk`.
A workflow consists of a series of steps, each step created in a TypeScript or JavaScript file under the `src/workflows` directory. A step is defined using `createStep` from the Workflows SDK
The workflow you're creating in this guide has one step to create the brand. So, create the file `src/workflows/create-brand.ts` with the following content:
@@ -120,7 +120,7 @@ So, if an error occurs during the workflow's execution, the brand that was creat
## 2. Create createBrandWorkflow
You can now create the workflow that runs the `createBrandStep`. A workflow is created in a TypeScript or JavaScript file under the `src/workflows` directory. In the file, you use the `createWorkflow` function imported from `@medusajs/framework/workflows-sdk` to create the workflow.
You can now create the workflow that runs the `createBrandStep`. A workflow is created in a TypeScript or JavaScript file under the `src/workflows` directory. In the file, you use `createWorkflow` from the Workflows SDK to create the workflow.
Add the following content in the same `src/workflows/create-brand.ts` file:
@@ -125,7 +125,7 @@ export default defineMiddlewares({
You apply the `validateAndTransformQuery` middleware on the `GET /admin/brands` API route. The middleware accepts two parameters:
- A [Zod](https://zod.dev/) schema that a request's query parameters must satisfy. Medusa provides a `createFindParams` utility that generates a Zod schema with the following properties:
- A [Zod](https://zod.dev/) schema that a request's query parameters must satisfy. Medusa provides `createFindParams` that generates a Zod schema with the following properties:
- `fields`: A comma-separated string indicating the fields to retrieve.
- `limit`: The maximum number of items to retrieve.
- `offset`: The number of items to skip before retrieving the returned items.
@@ -75,7 +75,7 @@ In the `instrumentation.ts` file, you export a `register` function that uses Med
You also initialize an instance of the exporter, such as Zipkin, and pass it to the `registerOtel` function.
The `registerOtel` utility function accepts an object having the following properties:
`registerOtel` accepts an object having the following properties:
<TypeList
types={[
@@ -6,7 +6,7 @@ export const metadata = {
# {metadata.title}
In this chapter, you'll learn how to write integration tests for API routes using the [medusaIntegrationTestRunner utility function](../page.mdx).
In this chapter, you'll learn how to write integration tests for API routes using [medusaIntegrationTestRunner](../page.mdx) from Medusa's Testing Framework.
<Prerequisites
items={[
@@ -6,7 +6,7 @@ export const metadata = {
# {metadata.title}
In this chapter, you'll learn about the `medusaIntegrationTestRunner` utility function used to write integration tests.
In this chapter, you'll learn about `medusaIntegrationTestRunner` from Medusa's Testing Framework and how to use it to write integration tests.
<Prerequisites
items={[
@@ -19,7 +19,7 @@ In this chapter, you'll learn about the `medusaIntegrationTestRunner` utility fu
## medusaIntegrationTestRunner Utility
The `medusaIntegrationTestRunner` utility function is provided by the `@medusajs/test-utils` package to create integration tests in your Medusa project. It runs a full Medusa application, allowing you test API routes, workflows, or other customizations.
The `medusaIntegrationTestRunner` is from Medusa's Testing Framework and it's used to create integration tests in your Medusa project. It runs a full Medusa application, allowing you test API routes, workflows, or other customizations.
For example:
@@ -6,7 +6,7 @@ export const metadata = {
# {metadata.title}
In this chapter, you'll learn how to write integration tests for workflows using the [medusaIntegrationTestRunner utility function](../page.mdx).
In this chapter, you'll learn how to write integration tests for workflows using [medusaIntegrationTestRunner](../page.mdx) from Medusa's Testing Framwork.
<Prerequisites
items={[
@@ -6,7 +6,7 @@ export const metadata = {
# {metadata.title}
In this chapter, find an example of writing an integration test for a module using the [moduleIntegrationTestRunner utility function](../page.mdx).
In this chapter, find an example of writing an integration test for a module using [moduleIntegrationTestRunner](../page.mdx) from Medusa's Testing Framework.
<Prerequisites
items={[
@@ -6,7 +6,7 @@ export const metadata = {
# {metadata.title}
In this chapter, you'll learn about the `moduleIntegrationTestRunner` utility function and how to use it to write integration tests for a module's main service.
In this chapter, you'll learn about `moduleIntegrationTestRunner` from Medusa's Testing Framework and how to use it to write integration tests for a module's main service.
<Prerequisites
items={[
@@ -19,7 +19,7 @@ In this chapter, you'll learn about the `moduleIntegrationTestRunner` utility fu
## moduleIntegrationTestRunner Utility
The `moduleIntegrationTestRunner` utility function is provided by the `@medusajs/test-utils` package to create integration tests for a module. The integration tests run on a test Medusa application with only the specified module enabled.
`moduleIntegrationTestRunner` creates integration tests for a module. The integration tests run on a test Medusa application with only the specified module enabled.
For example, assuming you have a `hello` module, create a test file at `src/modules/hello/__tests__/service.spec.ts`:
@@ -8,11 +8,9 @@ In this chapter, you'll learn about Medusa's testing tools and how to install an
## @medusajs/test-utils Package
Medusa provides a `@medusajs/test-utils` package with utility tools to create integration tests for your custom API routes, modules, or other Medusa customizations.
Medusa provides a Testing Framework to create integration tests for your custom API routes, modules, or other Medusa customizations.
### Install @medusajs/test-utils
To use the `@medusajs/test-utils` package, install it as a `devDependency`:
To use the Testing Framework, install `@medusajs/test-utils` as a `devDependency`:
```bash npm2yarn
npm install --save-dev @medusajs/test-utils@latest
@@ -92,7 +90,7 @@ You now have two commands:
<Note>
Medusa provides utility tools for integration tests only. You can write unit tests using Jest.
Medusa's Testing Framework works for integration tests only. You can write unit tests using Jest.
</Note>
@@ -101,7 +101,7 @@ export const config = defineRouteConfig({
export default CustomPage
```
The configuration object is created using the `defineRouteConfig` function imported from `@medusajs/admin-sdk`. It accepts the following properties:
The configuration object is created using `defineRouteConfig` from the Medusa Framework. It accepts the following properties:
- `label`: the sidebar items label.
- `icon`: an optional React component used as an icon in the sidebar.
@@ -61,7 +61,7 @@ export default ProductWidget
You export the `ProductWidget` component, which shows the heading `Product Widget`. In the widget, you use [Medusa UI](!ui!), a package that Medusa maintains to allow you to customize the dashboard with the same components used to build it.
To export the widget's configurations, you use the `defineWidgetConfig` function imported from `@medusajs/admin-sdk`. It accepts as a parameter an object with the `zone` property, whose value is a string or an array of strings, each being the name of the zone to inject the widget into.
To export the widget's configurations, you use `defineWidgetConfig` from the Admin Extension SDK. It accepts as a parameter an object with the `zone` property, whose value is a string or an array of strings, each being the name of the zone to inject the widget into.
In the example above, the widget is injected at the top of a products details.
@@ -10,7 +10,7 @@ In this guide, you'll learn how to throw errors in your Medusa application, how
## Throw MedusaError
When throwing an error in your API routes, middlewares, workflows, or any customization, throw a `MedusaError`, which is imported from `@medusajs/framework/utils`.
When throwing an error in your API routes, middlewares, workflows, or any customization, throw a `MedusaError` from the Medusa Framework.
The Medusa application's API route error handler then wraps your thrown error in a uniform object and returns it in the response.
@@ -28,7 +28,7 @@ Refer to the API Reference for [Admin](!api!/admin#authentication) and [Store](!
## Protect Custom API Routes
To protect custom API Routes to only allow authenticated customer or admin users, use the `authenticate` middleware imported from `@medusajs/medusa`.
To protect custom API Routes to only allow authenticated customer or admin users, use the `authenticate` middleware from the Medusa Framework.
For example:
@@ -187,7 +187,7 @@ You use Query to retrieve the stock location, to use the first location in the a
Then, you generate inventory levels for each inventory item, associating it with the first stock location.
Finally, you use the `createInventoryLevelsWorkflow` imported from `@medusajs/medusa/core-flows` to create the inventory levels.
Finally, you use the `createInventoryLevelsWorkflow` from Medusa's core workflows to create the inventory levels.
### Test Script
@@ -10,7 +10,7 @@ In this chapter, you'll learn how to infer the type of a data model.
Consider you have a `MyCustom` data model. You can't reference this data model in a type, such as a workflow input or service method output types, since it's a variable.
Instead, Medusa provides an `InferTypeOf` utility imported from `@medusajs/framework/types` that transforms your data model to a type.
Instead, Medusa provides `InferTypeOf` that transforms your data model to a type.
For example:
@@ -21,7 +21,7 @@ import { MyCustom } from "../models/my-custom" // relative path to the model
export type MyCustom = InferTypeOf<typeof MyCustom>
```
The `InferTypeOf` utility accepts as a type argument the type of the data model.
`InferTypeOf` accepts as a type argument the type of the data model.
Since the `MyCustom` data model is a variable, use the `typeof` operator to pass the data model as a type argument to `InferTypeOf`.
@@ -6,8 +6,6 @@ export const metadata = {
In this chapter, youll learn about the types of properties in a data models schema.
These types are available as methods on the `model` utility imported from `@medusajs/framework/utils`.
## id
The `id` method defines an automatically generated string ID property. The generated ID is a unique string that has a mix of letters and numbers.
@@ -8,7 +8,7 @@ In this chapter, youll learn how to define relationships between data models
## What is a Relationship Property?
A relationship property defines an association in the database between two models. It's created using methods on the `models` utility, such as `hasOne` or `belongsTo`.
A relationship property defines an association in the database between two models. It's created using the Data Model Language (DML) methods, such as `hasOne` or `belongsTo`.
When you generate a migration for these data models, the migrations include foreign key columns or pivot tables, based on the relationship's type.
@@ -18,7 +18,7 @@ Instead, you use a module link. A module link forms an association between two d
### 1. Create Link File
Links are defined in a TypeScript or JavaScript file under the `src/links` directory. The file defines the link using the `defineLink` function imported from `@medusajs/framework/utils` and exports it.
Links are defined in a TypeScript or JavaScript file under the `src/links` directory. The file defines the link using `defineLink` from the Modules SDK and exports it.
For example:
@@ -6,7 +6,7 @@ export const metadata = {
# {metadata.title}
In this chapter, youll learn about the Query utility and how to use it to fetch data from modules.
In this chapter, youll learn about Query and how to use it to fetch data from modules.
## What is Query?
@@ -18,12 +18,12 @@ This chapter is intended for more advanced database use-cases where you need mor
[MikroORM's entity manager](https://mikro-orm.io/docs/entity-manager) is a class that has methods to run queries on the database and perform operations.
Medusa provides an `InjectManager` decorator imported from `@medusajs/utils` that injects a service's method with a [forked entity manager](https://mikro-orm.io/docs/identity-map#forking-entity-manager).
Medusa provides an `InjectManager` decorator from the Modules SDK that injects a service's method with a [forked entity manager](https://mikro-orm.io/docs/identity-map#forking-entity-manager).
So, to run database queries in a service:
1. Add the `InjectManager` decorator to the method.
2. Add as a last parameter an optional `sharedContext` parameter that has the `MedusaContext` decorator imported from `@medusajs/utils`. This context holds database-related context, including the manager injected by `InjectManager`
2. Add as a last parameter an optional `sharedContext` parameter that has the `MedusaContext` decorator from the Modules SDK. This context holds database-related context, including the manager injected by `InjectManager`
For example, in your service, add the following methods:
@@ -81,10 +81,10 @@ Refer to [MikroORM's reference](https://mikro-orm.io/api/5.9/knex/class/EntityMa
To wrap database operations in a transaction, you create two methods:
1. A private or protected method that's wrapped in a transaction. To wrap it in a transaction, you use the `InjectTransactionManager` decorator imported from `@medusajs/utils`.
1. A private or protected method that's wrapped in a transaction. To wrap it in a transaction, you use the `InjectTransactionManager` decorator from the Modules SDK.
2. A public method that calls the transactional method. You use on it the `InjectManager` decorator as explained in the previous section.
Both methods must accept as a last parameter an optional `sharedContext` parameter that has the `MedusaContext` decorator imported from `@medusajs/utils`. It holds database-related contexts passed through the Medusa application.
Both methods must accept as a last parameter an optional `sharedContext` parameter that has the `MedusaContext` decorator from the Modules SDK. It holds database-related contexts passed through the Medusa application.
For example:
@@ -28,7 +28,7 @@ Modules are created in a sub-directory of `src/modules`. So, start by creating t
### 1. Create Data Model
A data model represents a table in the database. You create data models using Medusa's data modeling utility. It simplifies defining a table's columns, relations, and indexes with straightforward methods and configurations.
A data model represents a table in the database. You create data models using Medusa's data modeling language (DML). It simplifies defining a table's columns, relations, and indexes with straightforward methods and configurations.
You create a data model in a TypeScript or JavaScript file under the `models` directory of a module. So, to create a `Post` data model in the Blog Module, create the file `src/modules/blog/models/post.ts` with the following content:
@@ -45,7 +45,7 @@ const Post = model.define("post", {
export default Post
```
You define the data model using the `define` method of the `model` utility imported from `@medusajs/framework/utils`. It accepts two parameters:
You define the data model using the `define` method of the DML. It accepts two parameters:
1. The first one is the name of the data model's table in the database. Use snake-case names.
2. The second is an object, which is the data model's schema. The schema's properties are defined using the `model`'s methods, such as `text` and `id`.
@@ -84,7 +84,7 @@ class BlogModuleService extends MedusaService({
export default BlogModuleService
```
Your module's service extends a class generated by the `MedusaService` utility function. This class comes with generated methods for data-management Create, Read, Update, and Delete (CRUD) operations on each of your modules, saving your time that can be spent on building custom business logic.
Your module's service extends a class generated by `MedusaService` from the Modules SDK. This class comes with generated methods for data-management Create, Read, Update, and Delete (CRUD) operations on each of your modules, saving your time that can be spent on building custom business logic.
The `MedusaService` function accepts an object of data models to generate methods for. You can pass all data models in your module in this object.
@@ -123,7 +123,7 @@ export default Module(BLOG_MODULE, {
})
```
You use the `Module` function imported from `@medusajs/framework/utils` to create the module's definition. It accepts two parameters:
You use `Module` from the Modules SDK to create the module's definition. It accepts two parameters:
1. The name that the module's main service is registered under (`blog`).
2. An object with a required property `service` indicating the module's main service.
@@ -24,7 +24,7 @@ Your workflow isn't reusable by other applications. Use a step that performs wha
## How to Expose a Hook in a Workflow?
To expose a hook in your workflow, use the `createHook` function imported from `@medusajs/framework/workflows-sdk`.
To expose a hook in your workflow, use `createHook` from the Workflows SDK.
For example:
@@ -4,7 +4,7 @@ export const metadata = {
# {metadata.title}
In this chapter, you'll learn how to execute an action based on a condition in a workflow using the when-then utility.
In this chapter, you'll learn how to execute an action based on a condition in a workflow using when-then from the Workflows SDK.
## Why If-Conditions Aren't Allowed in Workflows?
@@ -14,15 +14,13 @@ At that point, variables in the workflow don't have any values. They only do whe
So, you can't use an if-condition that checks a variable's value, as the condition will be evaluated when Medusa creates the internal representation of the workflow, rather than during execution.
Instead, use the when-then utility.
Instead, use when-then from the Workflows SDK.
---
## What is the When-Then Utility?
The when-then utility functions execute an action if a condition is satisfied.
The `when` function accepts as a parameter a function that returns a boolean value, and the `then` function is chained to `when`. `then` accepts as a parameter a function that's executed if `when`'s parameter function returns a `true` value.
when-then from the Workflows SDK executes an action if a condition is satisfied. The `when` function accepts as a parameter a function that returns a boolean value, and the `then` function is chained to `when`. `then` accepts as a parameter a function that's executed if `when`'s parameter function returns a `true` value.
For example:
@@ -70,7 +68,7 @@ In this code snippet, you execute the `isActiveStep` only if the `input.is_activ
### When Parameters
`when` utility is a function imported from `@medusajs/framework/workflows-sdk`. It accepts the following parameters:
`when` accepts the following parameters:
1. The first parameter is either an object or the workflow's input. This data is passed as a parameter to the function in `when`'s second parameter.
2. The second parameter is a function that returns a boolean indicating whether to execute the action in `then`.
@@ -38,7 +38,7 @@ Learn more about why you can't manipulate variables [in this chapter](../variabl
</Note>
Instead, use the `transform` utility function imported from `@medusajs/framework/workflows-sdk`:
Instead, use `transform` from the Workflows SDK:
export const highlights = [
["9", "", "Don't manipulate variables directly."],
@@ -132,7 +132,7 @@ Learn more about why you can't use if-conditions [in this chapter](../conditions
</Note>
Instead, use the when-then utility function imported from `@medusajs/framework/workflows-sdk`:
Instead, use when-then from the Workflows SDK:
```ts
// Don't
@@ -49,11 +49,11 @@ The object has an `input` property to pass input to the workflow.
## Preparing Input Data
If you need to perform some data manipulation to prepare the other workflow's input data, use the `transform` utility function imported from `@medusajs/framework/workflows-sdk`.
If you need to perform some data manipulation to prepare the other workflow's input data, use `transform` from the Workflows SDK.
<Note>
Learn about the transform utility in [this chapter](../variable-manipulation/page.mdx).
Learn about transform in [this chapter](../variable-manipulation/page.mdx).
</Note>
@@ -105,11 +105,11 @@ In this example, you use the `transform` function to prepend `Hello` to the titl
## Run Workflow Conditionally
To run a workflow in another based on a condition, use the when-then utility functions imported from `@medusajs/framework/workflows-sdk`.
To run a workflow in another based on a condition, use when-then from the Workflows SDK.
<Note>
Learn about the when-then utility in [this chapter](../conditions/page.mdx).
Learn about when-then in [this chapter](../conditions/page.mdx).
</Note>
@@ -152,4 +152,4 @@ const workflow = createWorkflow(
)
```
In this example, you use the `when` utility to run the `createProductsWorkflow` only if `should_create` (passed in the `input`) is enabled.
In this example, you use when-then to run the `createProductsWorkflow` only if `should_create` (passed in the `input`) is enabled.
@@ -30,7 +30,7 @@ You implement all custom flows within workflows, then execute them from [API rou
### 1. Create the Steps
A workflow is made of a series of steps. A step is created using the `createStep` utility function imported from `@medusajs/framework/workflows-sdk`.
A workflow is made of a series of steps. A step is created using `createStep` from the Workflows SDK.
Create the file `src/workflows/hello-world.ts` with the following content:
@@ -245,7 +245,7 @@ export const highlights = [
[
"11",
`"product"`,
"The resource registration name imported from `@medusajs/framework/utils`.",
"The resource registration name.",
],
]
@@ -8,7 +8,7 @@ In this chapter, youll learn how to run workflow steps in parallel.
## parallelize Utility Function
If your workflow has steps that dont rely on one anothers results, run them in parallel using the `parallelize` utility function imported from the `@medusajs/framework/workflows-sdk`.
If your workflow has steps that dont rely on one anothers results, run them in parallel using `parallelize` from the Workflows SDK.
The workflow waits until all steps passed to the `parallelize` function finish executing before continuing to the next step.
@@ -4,7 +4,7 @@ export const metadata = {
# {metadata.title}
In this chapter, you'll learn how to use the `transform` utility to manipulate variables in a workflow.
In this chapter, you'll learn how to use `transform` from the Workflows SDK to manipulate variables in a workflow.
## Why Variable Manipulation isn't Allowed in Workflows
@@ -14,13 +14,13 @@ At that point, variables in the workflow don't have any values. They only do whe
So, you can only pass variables as parameters to steps. But, in a workflow, you can't change a variable's value or, if the variable is an array, loop over its items.
Instead, use the transform utility.
Instead, use `transform` from the Workflows SDK.
---
## What is the transform Utility?
The `transform` utility function creates a new variable as the result of manipulating other variables.
`transform` creates a new variable as the result of manipulating other variables.
For example, consider you have two strings as the output of two steps:
@@ -62,7 +62,7 @@ const myWorkflow = createWorkflow(
)
```
The `transform` utility function is imported from `@medusajs/framework/workflows-sdk`. It accepts two parameters:
`transform` accepts two parameters:
1. The first parameter is an object of variables to manipulate. The object is passed as a parameter to `transform`'s second parameter function.
2. The second parameter is the function performing the variable manipulation.
@@ -111,7 +111,7 @@ const myWorkflow = createWorkflow(
This workflow receives an `items` array in its input.
You use the `transform` utility to create an `ids` variable, which is an array of strings holding the `id` of each item in the `items` array.
You use `transform` to create an `ids` variable, which is an array of strings holding the `id` of each item in the `items` array.
You then pass the `ids` variable as a parameter to the `doSomethingStep`.
@@ -144,7 +144,7 @@ In this workflow, `today` is only evaluated when the workflow is executed.
### Transform Evaluation
The transform utility's value is only evaluated if you pass its output to a step or in the workflow response.
`transform`'s value is only evaluated if you pass its output to a step or in the workflow response.
For example, if you have the following workflow:
@@ -166,9 +166,9 @@ Since `str`'s value isn't used as a step's input or passed to `WorkflowResponse`
### Data Validation
The `transform` utility should only be used to perform variable or data manipulation.
`transform` should only be used to perform variable or data manipulation.
If you want to perform some validation on the data, use a step or the [when-then utility](../conditions/page.mdx) instead.
If you want to perform some validation on the data, use a step or [when-then](../conditions/page.mdx) instead.
For example:
@@ -50,7 +50,7 @@ const HomepageCodeTabs = () => {
[
"5",
`query`,
"Query utility to retrieve data from a graph of\nall data models and their relations.",
"use Query that retrieves data from a graph of\nall data models and their relations.",
],
["8", `"company"`, "Retrieve records of the `company` data model"],
["13", "res.json", "Return a JSON response"],
+29 -29
View File
@@ -1,6 +1,6 @@
export const generatedEditDates = {
"app/learn/fundamentals/scheduled-jobs/page.mdx": "2024-12-09T10:51:40.570Z",
"app/learn/fundamentals/workflows/page.mdx": "2024-12-09T10:52:19.379Z",
"app/learn/fundamentals/workflows/page.mdx": "2024-12-09T14:45:17.837Z",
"app/learn/deployment/page.mdx": "2024-11-25T14:32:44.949Z",
"app/learn/page.mdx": "2024-11-28T14:17:53.023Z",
"app/learn/fundamentals/modules/commerce-modules/page.mdx": "2024-12-09T10:46:29.339Z",
@@ -13,7 +13,7 @@ export const generatedEditDates = {
"app/learn/fundamentals/page.mdx": "2024-07-04T17:26:03+03:00",
"app/learn/fundamentals/admin-customizations/page.mdx": "2024-10-07T12:41:39.218Z",
"app/learn/fundamentals/workflows/workflow-timeout/page.mdx": "2024-10-21T13:30:21.372Z",
"app/learn/fundamentals/workflows/parallel-steps/page.mdx": "2024-10-21T13:30:21.372Z",
"app/learn/fundamentals/workflows/parallel-steps/page.mdx": "2024-12-09T14:45:13.801Z",
"app/learn/debugging-and-testing/page.mdx": "2024-05-03T17:36:38+03:00",
"app/learn/fundamentals/medusa-container/page.mdx": "2024-12-09T11:02:38.225Z",
"app/learn/fundamentals/api-routes/page.mdx": "2024-12-04T11:02:57.134Z",
@@ -21,27 +21,27 @@ export const generatedEditDates = {
"app/learn/fundamentals/workflows/access-workflow-errors/page.mdx": "2024-10-21T13:30:21.371Z",
"app/learn/fundamentals/events-and-subscribers/page.mdx": "2024-12-09T10:48:09.285Z",
"app/learn/fundamentals/modules/container/page.mdx": "2024-11-21T09:22:27.898Z",
"app/learn/fundamentals/workflows/execute-another-workflow/page.mdx": "2024-10-23T07:08:55.900Z",
"app/learn/fundamentals/workflows/execute-another-workflow/page.mdx": "2024-12-09T15:56:22.895Z",
"app/learn/fundamentals/modules/loaders/page.mdx": "2024-12-09T10:32:29.221Z",
"app/learn/fundamentals/admin/widgets/page.mdx": "2024-12-04T11:02:57.133Z",
"app/learn/fundamentals/admin/widgets/page.mdx": "2024-12-09T16:43:24.260Z",
"app/learn/fundamentals/data-models/page.mdx": "2024-12-09T11:34:51.065Z",
"app/learn/fundamentals/modules/remote-link/page.mdx": "2024-09-30T08:43:53.127Z",
"app/learn/fundamentals/api-routes/protected-routes/page.mdx": "2024-12-09T13:04:03.071Z",
"app/learn/fundamentals/workflows/add-workflow-hook/page.mdx": "2024-10-21T13:30:21.371Z",
"app/learn/fundamentals/api-routes/protected-routes/page.mdx": "2024-12-09T16:44:32.277Z",
"app/learn/fundamentals/workflows/add-workflow-hook/page.mdx": "2024-12-09T14:42:39.693Z",
"app/learn/fundamentals/events-and-subscribers/data-payload/page.mdx": "2024-10-21T13:30:21.369Z",
"app/learn/fundamentals/data-models/default-properties/page.mdx": "2024-10-21T13:30:21.368Z",
"app/learn/fundamentals/workflows/advanced-example/page.mdx": "2024-09-11T10:46:59.975Z",
"app/learn/fundamentals/events-and-subscribers/emit-event/page.mdx": "2024-11-25T16:19:32.168Z",
"app/learn/fundamentals/workflows/conditions/page.mdx": "2024-10-21T13:30:21.371Z",
"app/learn/fundamentals/workflows/conditions/page.mdx": "2024-12-09T15:55:51.565Z",
"app/learn/fundamentals/modules/module-link-directions/page.mdx": "2024-07-24T09:16:01+02:00",
"app/learn/fundamentals/admin/page.mdx": "2024-10-23T07:08:55.898Z",
"app/learn/fundamentals/workflows/long-running-workflow/page.mdx": "2024-12-04T07:37:59.822Z",
"app/learn/fundamentals/workflows/constructor-constraints/page.mdx": "2024-11-25T16:19:32.168Z",
"app/learn/fundamentals/workflows/constructor-constraints/page.mdx": "2024-12-09T14:43:35.160Z",
"app/learn/fundamentals/data-models/write-migration/page.mdx": "2024-11-11T15:27:59.794Z",
"app/learn/fundamentals/data-models/manage-relationships/page.mdx": "2024-10-28T04:22:21.328Z",
"app/learn/fundamentals/modules/remote-query/page.mdx": "2024-07-21T21:20:24+02:00",
"app/learn/fundamentals/modules/options/page.mdx": "2024-11-19T16:37:47.253Z",
"app/learn/fundamentals/data-models/relationships/page.mdx": "2024-12-06T14:34:50.384Z",
"app/learn/fundamentals/data-models/relationships/page.mdx": "2024-12-09T15:54:30.304Z",
"app/learn/fundamentals/workflows/compensation-function/page.mdx": "2024-12-06T14:34:50.384Z",
"app/learn/fundamentals/modules/service-factory/page.mdx": "2024-10-21T13:30:21.371Z",
"app/learn/fundamentals/data-models/primary-key/page.mdx": "2024-10-21T13:30:21.368Z",
@@ -52,44 +52,44 @@ export const generatedEditDates = {
"app/learn/fundamentals/api-routes/http-methods/page.mdx": "2024-10-21T13:30:21.367Z",
"app/learn/fundamentals/admin/tips/page.mdx": "2024-11-19T16:43:01.662Z",
"app/learn/fundamentals/api-routes/cors/page.mdx": "2024-12-09T13:04:04.357Z",
"app/learn/fundamentals/admin/ui-routes/page.mdx": "2024-12-04T11:02:57.133Z",
"app/learn/fundamentals/admin/ui-routes/page.mdx": "2024-12-09T16:44:40.198Z",
"app/learn/fundamentals/api-routes/middlewares/page.mdx": "2024-12-09T13:04:03.712Z",
"app/learn/fundamentals/modules/isolation/page.mdx": "2024-12-09T11:02:38.087Z",
"app/learn/fundamentals/data-models/configure-properties/page.mdx": "2024-10-21T13:30:21.368Z",
"app/learn/fundamentals/data-models/index/page.mdx": "2024-10-21T13:30:21.368Z",
"app/learn/fundamentals/custom-cli-scripts/page.mdx": "2024-10-23T07:08:55.898Z",
"app/learn/fundamentals/data-models/property-types/page.mdx": "2024-10-28T04:22:27.540Z",
"app/learn/debugging-and-testing/testing-tools/integration-tests/api-routes/page.mdx": "2024-09-30T08:43:53.136Z",
"app/learn/debugging-and-testing/testing-tools/integration-tests/page.mdx": "2024-09-10T11:39:51.170Z",
"app/learn/debugging-and-testing/testing-tools/integration-tests/workflows/page.mdx": "2024-09-30T08:43:53.139Z",
"app/learn/debugging-and-testing/testing-tools/page.mdx": "2024-09-30T08:43:53.139Z",
"app/learn/fundamentals/data-models/property-types/page.mdx": "2024-12-09T14:39:01.906Z",
"app/learn/debugging-and-testing/testing-tools/integration-tests/api-routes/page.mdx": "2024-12-09T15:34:08.049Z",
"app/learn/debugging-and-testing/testing-tools/integration-tests/page.mdx": "2024-12-09T15:52:01.019Z",
"app/learn/debugging-and-testing/testing-tools/integration-tests/workflows/page.mdx": "2024-12-09T15:51:15.422Z",
"app/learn/debugging-and-testing/testing-tools/page.mdx": "2024-12-09T15:53:56.878Z",
"app/learn/debugging-and-testing/testing-tools/unit-tests/module-example/page.mdx": "2024-09-02T11:04:27.232Z",
"app/learn/debugging-and-testing/testing-tools/unit-tests/page.mdx": "2024-09-02T11:03:26.997Z",
"app/learn/fundamentals/modules/service-constraints/page.mdx": "2024-11-19T16:37:47.253Z",
"app/learn/fundamentals/api-routes/responses/page.mdx": "2024-10-21T13:30:21.367Z",
"app/learn/fundamentals/api-routes/validation/page.mdx": "2024-12-09T13:04:02.426Z",
"app/learn/fundamentals/api-routes/errors/page.mdx": "2024-10-21T13:30:21.367Z",
"app/learn/fundamentals/api-routes/errors/page.mdx": "2024-12-09T16:44:19.781Z",
"app/learn/fundamentals/admin/constraints/page.mdx": "2024-10-21T13:30:21.366Z",
"app/learn/debugging-and-testing/testing-tools/modules-tests/module-example/page.mdx": "2024-10-16T08:50:03.061Z",
"app/learn/debugging-and-testing/testing-tools/modules-tests/page.mdx": "2024-10-16T08:50:23.232Z",
"app/learn/debugging-and-testing/testing-tools/modules-tests/module-example/page.mdx": "2024-12-09T15:52:22.185Z",
"app/learn/debugging-and-testing/testing-tools/modules-tests/page.mdx": "2024-12-09T15:52:57.091Z",
"app/learn/fundamentals/module-links/custom-columns/page.mdx": "2024-11-20T14:32:09.764Z",
"app/learn/fundamentals/module-links/directions/page.mdx": "2024-10-21T13:30:21.369Z",
"app/learn/fundamentals/module-links/page.mdx": "2024-10-28T04:22:27.541Z",
"app/learn/fundamentals/module-links/query/page.mdx": "2024-12-09T13:04:01.779Z",
"app/learn/fundamentals/module-links/page.mdx": "2024-12-09T14:39:26.668Z",
"app/learn/fundamentals/module-links/query/page.mdx": "2024-12-09T15:54:44.798Z",
"app/learn/fundamentals/module-links/remote-link/page.mdx": "2024-10-28T04:22:21.328Z",
"app/learn/fundamentals/modules/db-operations/page.mdx": "2024-12-04T11:02:57.134Z",
"app/learn/fundamentals/modules/db-operations/page.mdx": "2024-12-09T14:40:50.581Z",
"app/learn/fundamentals/modules/multiple-services/page.mdx": "2024-10-21T13:30:21.370Z",
"app/learn/fundamentals/modules/page.mdx": "2024-12-09T11:02:37.696Z",
"app/learn/debugging-and-testing/instrumentation/page.mdx": "2024-09-17T08:53:15.910Z",
"app/learn/fundamentals/modules/page.mdx": "2024-12-09T15:55:25.858Z",
"app/learn/debugging-and-testing/instrumentation/page.mdx": "2024-12-09T15:33:05.121Z",
"app/learn/fundamentals/api-routes/additional-data/page.mdx": "2024-12-09T13:04:04.995Z",
"app/learn/fundamentals/workflows/variable-manipulation/page.mdx": "2024-11-19T16:43:01.663Z",
"app/learn/fundamentals/workflows/variable-manipulation/page.mdx": "2024-12-09T15:57:54.506Z",
"app/learn/customization/custom-features/api-route/page.mdx": "2024-12-09T10:39:30.046Z",
"app/learn/customization/custom-features/module/page.mdx": "2024-12-09T11:02:39.826Z",
"app/learn/customization/custom-features/workflow/page.mdx": "2024-12-09T10:46:47.051Z",
"app/learn/customization/custom-features/module/page.mdx": "2024-12-09T14:36:02.100Z",
"app/learn/customization/custom-features/workflow/page.mdx": "2024-12-09T14:36:29.482Z",
"app/learn/customization/extend-features/extend-create-product/page.mdx": "2024-12-09T12:59:23.364Z",
"app/learn/customization/custom-features/page.mdx": "2024-12-09T10:46:28.593Z",
"app/learn/customization/customize-admin/page.mdx": "2024-12-09T11:02:38.801Z",
"app/learn/customization/customize-admin/route/page.mdx": "2024-12-09T11:02:38.969Z",
"app/learn/customization/customize-admin/route/page.mdx": "2024-12-09T15:32:46.656Z",
"app/learn/customization/customize-admin/widget/page.mdx": "2024-12-09T11:02:39.108Z",
"app/learn/customization/extend-features/define-link/page.mdx": "2024-12-09T11:02:39.346Z",
"app/learn/customization/extend-features/page.mdx": "2024-12-09T11:02:39.244Z",
@@ -101,8 +101,8 @@ export const generatedEditDates = {
"app/learn/customization/next-steps/page.mdx": "2024-12-06T14:34:53.356Z",
"app/learn/fundamentals/modules/architectural-modules/page.mdx": "2024-10-21T13:30:21.367Z",
"app/learn/introduction/architecture/page.mdx": "2024-10-21T13:30:21.368Z",
"app/learn/fundamentals/data-models/infer-type/page.mdx": "2024-10-21T13:30:21.368Z",
"app/learn/fundamentals/custom-cli-scripts/seed-data/page.mdx": "2024-10-21T13:30:21.368Z",
"app/learn/fundamentals/data-models/infer-type/page.mdx": "2024-12-09T15:54:08.713Z",
"app/learn/fundamentals/custom-cli-scripts/seed-data/page.mdx": "2024-12-09T14:38:06.385Z",
"app/learn/fundamentals/environment-variables/page.mdx": "2024-12-09T11:00:57.428Z",
"app/learn/build/page.mdx": "2024-12-09T11:05:17.383Z",
"app/learn/deployment/general/page.mdx": "2024-11-25T14:33:50.439Z",
@@ -18,7 +18,7 @@ Start by creating a new directory for your module. For example, `src/modules/my-
Create the file `src/modules/my-event/service.ts` that holds the implementation of the event service.
The Event Module's main service must extend the `AbstractEventBusModuleService` class imported from `@medusajs/framework/utils`:
The Event Module's main service must extend the `AbstractEventBusModuleService` class from the Medusa Framework:
```ts title="src/modules/my-event/service.ts"
import { AbstractEventBusModuleService } from "@medusajs/framework/utils"
@@ -10,7 +10,7 @@ The API Key Module provides API-key-related features in your Medusa and Node.js
## How to Use API Key Module's Service
Use the API Key Module's main service by resolving from the Medusa container the resource `Modules.API_KEY` imported from `@medusajs/framework/utils`.
Use the API Key Module's main service by resolving from the Medusa container the resource `Modules.API_KEY`.
For example:
@@ -112,7 +112,7 @@ This workflow accepts the managers data and the associated auth identitys
The workflow has two steps:
1. Create the manager using the `createManagerStep`.
2. Set the `app_metadata` property of the associated auth identity using the `setAuthAppMetadataStep` step imported from `@medusajs/medusa/core-flows`. You specify the actor type `manager` in the `actorType` property of the steps input.
2. Set the `app_metadata` property of the associated auth identity using the `setAuthAppMetadataStep` from Medusa's core workflows. You specify the actor type `manager` in the `actorType` property of the steps input.
---
@@ -10,7 +10,7 @@ The Auth Module provides authentication-related features in your Medusa and Node
## How to Use Auth Module's Service
Use the Auth Module's main service by resolving from the Medusa container the resource `Modules.AUTH` imported from `@medusajs/framework/utils`.
Use the Auth Module's main service by resolving from the Medusa container the resource `Modules.AUTH`.
For example:
@@ -144,7 +144,7 @@ export default defineMiddlewares({
})
```
The `additional_data` parameter validation is customized using the `defineMiddlewares` utility function. In the routes middleware configuration object, the `additionalDataValidator` property accepts [Zod](https://zod.dev/) validaiton rules.
The `additional_data` parameter validation is customized using `defineMiddlewares`. In the routes middleware configuration object, the `additionalDataValidator` property accepts [Zod](https://zod.dev/) validaiton rules.
In the snippet above, you add a validation rule indicating that `custom_name` is a string that can be passed in the `additional_data` object.
@@ -260,9 +260,9 @@ The workflow accepts as an input the created cart and the `additional_data` para
In the workflow, you:
1. Use the `transform` utility to get the value of `custom_name` based on whether it's set in `additional_data`. Learn more about why you can't use conditional operators in a workflow without using `transform` in [this guide](!docs!/learn/fundamentals/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
1. Use `transform` to get the value of `custom_name` based on whether it's set in `additional_data`. Learn more about why you can't use conditional operators in a workflow without using `transform` in [this guide](!docs!/learn/fundamentals/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
2. Create the `Custom` record using the `createCustomStep`.
3. Use the `when-then` utility to link the cart to the `Custom` record if it was created. Learn more about why you can't use if-then conditions in a workflow without using `when-then` in [this guide](!docs!/learn/fundamentals/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
3. Use `when-then` to link the cart to the `Custom` record if it was created. Learn more about why you can't use if-then conditions in a workflow without using `when-then` in [this guide](!docs!/learn/fundamentals/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
You'll next call the workflow in the hook handler.
@@ -556,7 +556,7 @@ const created = when({
// TODO update, or delete Custom record
```
Using the `when-then` utility, you check if the cart doesn't have a linked `Custom` record and the `custom_name` property is set. If so, you create a `Custom` record and link it to the cart.
Using `when-then`, you check if the cart doesn't have a linked `Custom` record and the `custom_name` property is set. If so, you create a `Custom` record and link it to the cart.
To create the `Custom` record, you use the `createCustomStep` you created in an earlier section.
@@ -589,7 +589,7 @@ const deleted = when({
// TODO delete Custom record
```
Using the `when-then` utility, you check if the cart has a linked `Custom` record and `custom_name` is `null` or an empty string. If so, you delete the linked `Custom` record and dismiss its links.
Using `when-then`, you check if the cart has a linked `Custom` record and `custom_name` is `null` or an empty string. If so, you delete the linked `Custom` record and dismiss its links.
Finally, replace the new `TODO` with the following:
@@ -614,7 +614,7 @@ return new WorkflowResponse({
})
```
Using the `when-then` utility, you check if the cart has a linked `Custom` record and `custom_name` is passed in the `additional_data`. If so, you update the linked `Custom` record.
Using `when-then`, you check if the cart has a linked `Custom` record and `custom_name` is passed in the `additional_data`. If so, you update the linked `Custom` record.
You return in the workflow response the created, updated, and deleted `Custom` record.
@@ -10,7 +10,7 @@ The Cart Module provides cart-related features in your Medusa and Node.js applic
## How to Use Cart Module's Service
You can use the Cart Module's main service by resolving from the Medusa container the resource `Modules.CART` imported from `@medusajs/framework/utils`.
You can use the Cart Module's main service by resolving from the Medusa container the resource `Modules.CART`.
For example:
@@ -10,7 +10,7 @@ The Currency Module provides currency-related features in your Medusa and Node.j
## How to Use Currency Module's Service
You can use the Currency Module's main service by resolving from the Medusa container the resource `Modules.CURRENCY` imported from `@medusajs/framework/utils`.
You can use the Currency Module's main service by resolving from the Medusa container the resource `Modules.CURRENCY`.
For example:
@@ -150,7 +150,7 @@ export default defineMiddlewares({
})
```
The `additional_data` parameter validation is customized using the `defineMiddlewares` utility function. In the routes middleware configuration object, the `additionalDataValidator` property accepts [Zod](https://zod.dev/) validaiton rules.
The `additional_data` parameter validation is customized using `defineMiddlewares`. In the routes middleware configuration object, the `additionalDataValidator` property accepts [Zod](https://zod.dev/) validaiton rules.
In the snippet above, you add a validation rule indicating that `custom_name` is a string that can be passed in the `additional_data` object.
@@ -266,9 +266,9 @@ The workflow accepts as an input the created customer and the `additional_data`
In the workflow, you:
1. Use the `transform` utility to get the value of `custom_name` based on whether it's set in `additional_data`. Learn more about why you can't use conditional operators in a workflow without using `transform` in [this guide](!docs!/learn/fundamentals/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
1. Use `transform` to get the value of `custom_name` based on whether it's set in `additional_data`. Learn more about why you can't use conditional operators in a workflow without using `transform` in [this guide](!docs!/learn/fundamentals/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
2. Create the `Custom` record using the `createCustomStep`.
3. Use the `when-then` utility to link the customer to the `Custom` record if it was created. Learn more about why you can't use if-then conditions in a workflow without using `when-then` in [this guide](!docs!/learn/fundamentals/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
3. Use `when-then` to link the customer to the `Custom` record if it was created. Learn more about why you can't use if-then conditions in a workflow without using `when-then` in [this guide](!docs!/learn/fundamentals/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
You'll next execute the workflow in the hook handler.
@@ -568,7 +568,7 @@ const created = when({
// TODO update, or delete Custom record
```
Using the `when-then` utility, you check if the customer doesn't have a linked `Custom` record and the `custom_name` property is set. If so, you create a `Custom` record and link it to the customer.
Using `when-then`, you check if the customer doesn't have a linked `Custom` record and the `custom_name` property is set. If so, you create a `Custom` record and link it to the customer.
To create the `Custom` record, you use the `createCustomStep` you created in an earlier section.
@@ -601,7 +601,7 @@ const deleted = when({
// TODO delete Custom record
```
Using the `when-then` utility, you check if the customer has a linked `Custom` record and `custom_name` is `null` or an empty string. If so, you delete the linked `Custom` record and dismiss its links.
Using `when-then`, you check if the customer has a linked `Custom` record and `custom_name` is `null` or an empty string. If so, you delete the linked `Custom` record and dismiss its links.
Finally, replace the new `TODO` with the following:
@@ -626,7 +626,7 @@ return new WorkflowResponse({
})
```
Using the `when-then` utility, you check if the customer has a linked `Custom` record and `custom_name` is passed in the `additional_data`. If so, you update the linked `Custom` record.
Using `when-then`, you check if the customer has a linked `Custom` record and `custom_name` is passed in the `additional_data`. If so, you update the linked `Custom` record.
You return in the workflow response the created, updated, and deleted `Custom` record.
@@ -10,7 +10,7 @@ The Customer Module provides customer-related features in your Medusa and Node.j
## How to Use Customer Module's Service
You can use the Customer Module's main service by resolving from the Medusa container the resource `Modules.CUSTOMER` imported from `@medusajs/framework/utils`.
You can use the Customer Module's main service by resolving from the Medusa container the resource `Modules.CUSTOMER`.
For example:
@@ -10,7 +10,7 @@ The Fulfillment Module provides fulfillment-related features in your Medusa and
## How to Use Fulfillment Module's Service
You can use the Fulfillment Module's main service by resolving from the Medusa container the resource `Modules.FULFILLMENT` imported from `@medusajs/framework/utils`.
You can use the Fulfillment Module's main service by resolving from the Medusa container the resource `Modules.FULFILLMENT`.
For example:
@@ -10,7 +10,7 @@ The Inventory Module provides inventory-related features in your Medusa and Node
## How to Use Inventory Module's Service
You can use the Inventory Module's main service by resolving from the Medusa container the resource `Modules.INVENTORY` imported from `@medusajs/framework/utils`.
You can use the Inventory Module's main service by resolving from the Medusa container the resource `Modules.INVENTORY`.
For example:
@@ -10,7 +10,7 @@ The Order Module provides order-related features in your Medusa and Node.js appl
## How to Use Order Module's Service
You can use the Order Module's main service by resolving from the Medusa container the resource `Modules.ORDER` imported from `@medusajs/framework/utils`.
You can use the Order Module's main service by resolving from the Medusa container the resource `Modules.ORDER`.
For example:
@@ -11,7 +11,7 @@ The Payment Module provides payment-related features in your Medusa and Node.js
## How to Use Payment Module's Service
You can use the Payment Module's main service by resolving from the Medusa container the resource `Modules.PAYMENT` imported from `@medusajs/framework/utils`.
You can use the Payment Module's main service by resolving from the Medusa container the resource `Modules.PAYMENT`.
For example:
@@ -10,7 +10,7 @@ The Pricing Module provides pricing-related features in your Medusa and Node.js
## How to Use Pricing Module's Service
You can use the Pricing Module's main service by resolving from the Medusa container the resource `Modules.PRICING` imported from `@medusajs/framework/utils`.
You can use the Pricing Module's main service by resolving from the Medusa container the resource `Modules.PRICING`.
For example:
@@ -150,7 +150,7 @@ export default defineMiddlewares({
})
```
The `additional_data` parameter validation is customized using the `defineMiddlewares` utility function. In the routes middleware configuration object, the `additionalDataValidator` property accepts [Zod](https://zod.dev/) validaiton rules.
The `additional_data` parameter validation is customized using `defineMiddlewares`. In the routes middleware configuration object, the `additionalDataValidator` property accepts [Zod](https://zod.dev/) validaiton rules.
In the snippet above, you add a validation rule indicating that `custom_name` is a string that can be passed in the `additional_data` object.
@@ -266,9 +266,9 @@ The workflow accepts as an input the created product and the `additional_data` p
In the workflow, you:
1. Use the `transform` utility to get the value of `custom_name` based on whether it's set in `additional_data`. Learn more about why you can't use conditional operators in a workflow without using `transform` in [this guide](!docs!/learn/fundamentals/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
1. Use `transform` to get the value of `custom_name` based on whether it's set in `additional_data`. Learn more about why you can't use conditional operators in a workflow without using `transform` in [this guide](!docs!/learn/fundamentals/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
2. Create the `Custom` record using the `createCustomStep`.
3. Use the `when-then` utility to link the product to the `Custom` record if it was created. Learn more about why you can't use if-then conditions in a workflow without using `when-then` in [this guide](!docs!/learn/fundamentals/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
3. Use `when-then` to link the product to the `Custom` record if it was created. Learn more about why you can't use if-then conditions in a workflow without using `when-then` in [this guide](!docs!/learn/fundamentals/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
You'll next execute the workflow in the hook handler.
@@ -574,7 +574,7 @@ const created = when({
// TODO update, or delete Custom record
```
Using the `when-then` utility, you check if the product doesn't have a linked `Custom` record and the `custom_name` property is set. If so, you create a `Custom` record and link it to the product.
Using `when-then`, you check if the product doesn't have a linked `Custom` record and the `custom_name` property is set. If so, you create a `Custom` record and link it to the product.
To create the `Custom` record, you use the `createCustomStep` you created in an earlier section.
@@ -607,7 +607,7 @@ const deleted = when({
// TODO delete Custom record
```
Using the `when-then` utility, you check if the product has a linked `Custom` record and `custom_name` is `null` or an empty string. If so, you delete the linked `Custom` record and dismiss its links.
Using `when-then`, you check if the product has a linked `Custom` record and `custom_name` is `null` or an empty string. If so, you delete the linked `Custom` record and dismiss its links.
Finally, replace the new `TODO` with the following:
@@ -632,7 +632,7 @@ return new WorkflowResponse({
})
```
Using the `when-then` utility, you check if the product has a linked `Custom` record and `custom_name` is passed in the `additional_data`. If so, you update the linked `Custom` record.
Using `when-then`, you check if the product has a linked `Custom` record and `custom_name` is passed in the `additional_data`. If so, you update the linked `Custom` record.
You return in the workflow response the created, updated, and deleted `Custom` record.
@@ -204,7 +204,7 @@ products.forEach((product) => {
For each product variant, you:
1. Retrieve its tax lines from the `taxLinesMap`.
2. Calculate its prices with and without taxes using the `calculateAmountsWithTax` function imported from `@medusajs/framework/utils`.
2. Calculate its prices with and without taxes using the `calculateAmountsWithTax` from the Medusa Framework.
3. The `calculateAmountsWithTax` function returns an object having two properties:
- `priceWithTax`: The variant's price with the taxes applied.
- `priceWithoutTax`: The variant's price without taxes applied.
@@ -89,6 +89,6 @@ const { data: products } = await query.graph({
For the context of the product variant's calculated price, you pass an object to `context` with the property `variants`, whose value is another object with the property `calculated_price`.
`calculated_price`'s value is created using the `QueryContext` utility function, passing it a [calculation context object](../../../pricing/price-calculation/page.mdx#calculation-context).
`calculated_price`'s value is created using `QueryContext` from the Modules SDK, passing it a [calculation context object](../../../pricing/price-calculation/page.mdx#calculation-context).
Each variant in the retrieved products has a `calculated_price` object. Learn more about its properties in [this Pricing Module guide](../../../pricing/price-calculation/page.mdx#returned-price-object).
@@ -10,7 +10,7 @@ The Product Module provides product-related features in your Medusa and Node.js
## How to Use Product Module's Service
You can use the Product Module's main service by resolving from the Medusa container the resource `Modules.PRODUCT` imported from `@medusajs/framework/utils`.
You can use the Product Module's main service by resolving from the Medusa container the resource `Modules.PRODUCT`.
For example:
@@ -150,7 +150,7 @@ export default defineMiddlewares({
})
```
The `additional_data` parameter validation is customized using the `defineMiddlewares` utility function. In the routes middleware configuration object, the `additionalDataValidator` property accepts [Zod](https://zod.dev/) validaiton rules.
The `additional_data` parameter validation is customized using `defineMiddlewares`. In the routes middleware configuration object, the `additionalDataValidator` property accepts [Zod](https://zod.dev/) validaiton rules.
In the snippet above, you add a validation rule indicating that `custom_name` is a string that can be passed in the `additional_data` object.
@@ -266,9 +266,9 @@ The workflow accepts as an input the created promotion and the `additional_data`
In the workflow, you:
1. Use the `transform` utility to get the value of `custom_name` based on whether it's set in `additional_data`. Learn more about why you can't use conditional operators in a workflow without using `transform` in [this guide](!docs!/learn/fundamentals/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
1. Use `transform` to get the value of `custom_name` based on whether it's set in `additional_data`. Learn more about why you can't use conditional operators in a workflow without using `transform` in [this guide](!docs!/learn/fundamentals/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
2. Create the `Custom` record using the `createCustomStep`.
3. Use the `when-then` utility to link the promotion to the `Custom` record if it was created. Learn more about why you can't use if-then conditions in a workflow without using `when-then` in [this guide](!docs!/learn/fundamentals/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
3. Use `when-then` to link the promotion to the `Custom` record if it was created. Learn more about why you can't use if-then conditions in a workflow without using `when-then` in [this guide](!docs!/learn/fundamentals/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
You'll next execute the workflow in the hook handler.
@@ -580,7 +580,7 @@ const created = when({
// TODO update, or delete Custom record
```
Using the `when-then` utility, you check if the promotion doesn't have a linked `Custom` record and the `custom_name` property is set. If so, you create a `Custom` record and link it to the promotion.
Using `when-then`, you check if the promotion doesn't have a linked `Custom` record and the `custom_name` property is set. If so, you create a `Custom` record and link it to the promotion.
To create the `Custom` record, you use the `createCustomStep` you created in an earlier section.
@@ -613,7 +613,7 @@ const deleted = when({
// TODO delete Custom record
```
Using the `when-then` utility, you check if the promotion has a linked `Custom` record and `custom_name` is `null` or an empty string. If so, you delete the linked `Custom` record and dismiss its links.
Using `when-then`, you check if the promotion has a linked `Custom` record and `custom_name` is `null` or an empty string. If so, you delete the linked `Custom` record and dismiss its links.
Finally, replace the new `TODO` with the following:
@@ -638,7 +638,7 @@ return new WorkflowResponse({
})
```
Using the `when-then` utility, you check if the promotion has a linked `Custom` record and `custom_name` is passed in the `additional_data`. If so, you update the linked `Custom` record.
Using `when-then`, you check if the promotion has a linked `Custom` record and `custom_name` is passed in the `additional_data`. If so, you update the linked `Custom` record.
You return in the workflow response the created, updated, and deleted `Custom` record.
@@ -10,7 +10,7 @@ The Promotion Module provides promotion-related features in your Medusa and Node
## How to Use the Promotion Module's Service
You can use the Promotion Module's main service by resolving from the Medusa container the resource `Modules.PROMOTION` imported from `@medusajs/framework/utils`.
You can use the Promotion Module's main service by resolving from the Medusa container the resource `Modules.PROMOTION`.
For example:
@@ -10,7 +10,7 @@ The Region Module provides region-related features in your Medusa and Node.js ap
## How to Use Region Module's Service
You can use the Region Module's main service by resolving from the Medusa container the resource `Modules.REGION` imported from `@medusajs/framework/utils`.
You can use the Region Module's main service by resolving from the Medusa container the resource `Modules.REGION`.
For example:
@@ -10,7 +10,7 @@ The Sales Channel Module provides sales-channel-related features in your Medusa
## How to Use Sales Channel Module's Service
You can use the Sales Channel Module's main service by resolving from the Medusa container the resource `Modules.SALES_CHANNEL` imported from `@medusajs/framework/utils`.
You can use the Sales Channel Module's main service by resolving from the Medusa container the resource `Modules.SALES_CHANNEL`.
For example:
@@ -10,7 +10,7 @@ The Stock Location Module provides stock-location-related features in your Medus
## How to Use Stock Location Module's Service
You can use the Stock Location Module's main service by resolving from the Medusa container the resource `Modules.STOCK_LOCATION` imported from `@medusajs/framework/utils`.
You can use the Stock Location Module's main service by resolving from the Medusa container the resource `Modules.STOCK_LOCATION`.
For example:
@@ -10,7 +10,7 @@ The Store Module provides store-related features in your Medusa and Node.js appl
## How to Use Store Module's Service
You can use the Store Module's main service by resolving from the Medusa container the resource `Modules.STORE` imported from `@medusajs/framework/utils`.
You can use the Store Module's main service by resolving from the Medusa container the resource `Modules.STORE`.
For example:
@@ -10,7 +10,7 @@ The Tax Module provides tax-related features in your Medusa and Node.js applicat
## How to Use Tax Module's Service
You can use the Tax Module's main service by resolving from the Medusa container the resource `Modules.TAX` imported from `@medusajs/framework/utils`.
You can use the Tax Module's main service by resolving from the Medusa container the resource `Modules.TAX`.
For example:
@@ -10,7 +10,7 @@ The User Module provides user-related features in your Medusa and Node.js applic
## How to Use User Module's Service
You can use the User Module's main service by resolving from the Medusa container the resource `Modules.USER` imported from `@medusajs/framework/utils`.
You can use the User Module's main service by resolving from the Medusa container the resource `Modules.USER`.
For example:
+4 -4
View File
@@ -566,7 +566,7 @@ Learn more in [this documentation](!docs!/learn/fundamentals/api-routes/protecte
### Throw Errors in API Route
To throw errors in an API route, use the `MedusaError` utility:
To throw errors in an API route, use `MedusaError` from the Medusa Framework:
```ts highlights={[["9", "MedusaError"]]}
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
@@ -2244,7 +2244,7 @@ Learn more in [this documentation](!docs!/learn/fundamentals/workflows/compensat
### Manipulate Variables in Workflow
To manipulate variables within a workflow's constructor function, use the `transform` utility:
To manipulate variables within a workflow's constructor function, use `transform` from the Workflows SDK:
```ts highlights={[["14", "transform"]]}
import {
@@ -2274,7 +2274,7 @@ Learn more in [this documentation](!docs!/learn/fundamentals/workflows/variable-
### Using Conditions in Workflow
To perform steps or set a variable's value based on a condition, use the `when-then` utility:
To perform steps or set a variable's value based on a condition, use `when-then` from the Workflows SDK:
```ts highlights={[["14", "when"]]}
import {
@@ -2418,7 +2418,7 @@ Learn more in [this documentation](!docs!/learn/fundamentals/workflows/retry-fai
### Run Steps in Parallel
If steps in a workflow don't depend on one another, run them in parallel using the `parallel` utility:
If steps in a workflow don't depend on one another, run them in parallel using `parallel` from the Workflows SDK:
```ts highlights={[["22", "parallelize"]]}
import {
@@ -287,7 +287,7 @@ class ResendNotificationProviderService extends AbstractNotificationProviderServ
}
```
In the `validateOptions` method, you throw an error if the `api_key` or `from` options aren't passed to the module. To throw errors, you use Medusa's `MedusaError` utility imported from `@medusajs/framework/utils`. This ensures errors follow Medusa's conventions and are displayed similar to Medusa's errors.
In the `validateOptions` method, you throw an error if the `api_key` or `from` options aren't passed to the module. To throw errors, you use `MedusaError` from the Modules SDK. This ensures errors follow Medusa's conventions and are displayed similar to Medusa's errors.
#### Implement Template Methods
@@ -449,7 +449,7 @@ export default ModuleProvider(Modules.NOTIFICATION, {
})
```
You export the module provider's definition using the `ModuleProvider` utility function. It accepts as a first parameter the name of the module that this provider belongs to, which is the Notification Module. It also accepts as a second parameter an object having a `service` property indicating the provider's service.
You export the module provider's definition using `ModuleProvider` from the Modules SDK. It accepts as a first parameter the name of the module that this provider belongs to, which is the Notification Module. It also accepts as a second parameter an object having a `service` property indicating the provider's service.
### Add Module to Configurations
@@ -737,7 +737,7 @@ export const sendOrderConfirmationWorkflow = createWorkflow(
)
```
You create a workflow using the `createWorkflow` function imported from `@medusajs/framework/workflows-sdk`. It accepts the workflow's unique name as a first parameter.
You create a workflow using `createWorkflow` from the Workflows SDK. It accepts the workflow's unique name as a first parameter.
It accepts as a second parameter a constructor function, which is the workflow's implementation. The workflow has the following steps:
@@ -511,7 +511,7 @@ export default Module(SANITY_MODULE, {
In the file, you export the `SANITY_MODULE` which is the Module's name. You'll use it later when you resolve the module from the Medusa container.
You also export the module definition using the `Module` utility function, which accepts as a first parameter the module's name, and as a second parameter an object having a `service` property, indicating the module's service.
You also export the module definition using `Module` from the Modueles SDK, which accepts as a first parameter the module's name, and as a second parameter an object having a `service` property, indicating the module's service.
### Add Module to Configurations
@@ -634,7 +634,7 @@ defineLink(
)
```
You define a link using the `defineLink` utility. It accepts three parameters:
You define a link using `defineLink` from the Modules SDK. It accepts three parameters:
1. The first data model part of the link. In this case, it's the Product Module's `product` data model. A module has a special `linkable` property that contain link configurations for its data models.
2. The second data model part of the link. Since the Sanity Module doesn't have a Medusa data model, you specify the configurations in a `linkable` object that has the following properties:
@@ -887,7 +887,7 @@ export const sanitySyncProductsWorkflow = createWorkflow(
)
```
You create a workflow using the `createWorkflow` function imported from `@medusajs/framework/workflows-sdk`. It accepts an object of options as a first parameter, where the `name` property is required and indicates the workflow's unique name.
You create a workflow using the `createWorkflow` from the Workflows SDK. It accepts an object of options as a first parameter, where the `name` property is required and indicates the workflow's unique name.
The `retentionTime` property indicates how long should the workflow's progress be saved in the database. This is useful if you later want to track whether the workflow is successfully executing.
@@ -1638,7 +1638,7 @@ export const config = defineWidgetConfig({
export default ProductWidget
```
The file exports a `ProductWidget` component and a `config` object created with the `defineWidgetConfig` utility function. In the `config` object, you specify the zone to inject the widget into in the `zone` property.
The file exports a `ProductWidget` component and a `config` object created with `defineWidgetConfig` from the Admin Extension SDK. In the `config` object, you specify the zone to inject the widget into in the `zone` property.
<Note title="Tip">
@@ -1910,7 +1910,7 @@ export default SanityRoute
The file's path relative to the `src/admin/routes` directory indicates its path in the admin dashboard. So, this adds a new route at the path `http://localhost:9000/app/sanity`.
The file must export the UI route's component. Also, to add an item in the sidebar for the UI route, you export a configuration object, created with the `defineRouteConfig` utility function. The function accepts the following properties:
The file must export the UI route's component. Also, to add an item in the sidebar for the UI route, you export a configuration object, created with `defineRouteConfig` from the Admin Extension SDK. The function accepts the following properties:
- `label`: The sidebar item's label.
- `icon`: The icon to the show in the sidebar.
@@ -90,7 +90,7 @@ Use the `ContainerRegistrationKeys` enum imported from `@medusajs/framework/util
</Table.Cell>
<Table.Cell>
The Query utility methods.
Query to retrieve data across modules.
</Table.Cell>
<Table.Cell>
@@ -1,13 +1,13 @@
import { ChildDocs } from "docs-ui"
export const metadata = {
title: `Medusa Workflows Reference`,
title: `Medusa Core Workflows Reference`,
}
# {metadata.title}
This section of the documentation provides a reference to the workflows created by Medusa. These workflows are used in the Store and Admin API routes.
This section of the documentation provides a reference to the core workflows created by Medusa. These workflows are used in the Store and Admin API routes, and you can use them in your customizations.
You can use these workflows in your customizations as well. They're available in the `@medusajs/medusa/core-flows` package.
All workflows and steps in this reference are exported by the `@medusajs/medusa/core-flows` package.
<ChildDocs childLevel={2} hideItems={["Overview", "Steps"]} />
@@ -796,7 +796,7 @@ export const POST = async (
This adds a `POST` API route at `/admin/digital-products/upload/[type]` where `[type]` is either `preview` or `main`.
In the route handler, you use the `uploadFilesWorkflow` imported from `@medusajs/medusa/core-flows` to upload the file. If the file type is `main`, its uploaded with private access, as only customers who purchased it can download it. Otherwise, its uploaded with `public` access.
In the route handler, you use `uploadFilesWorkflow` from Medusa's core workflows to upload the file. If the file type is `main`, its uploaded with private access, as only customers who purchased it can download it. Otherwise, its uploaded with `public` access.
Next, add to the file `src/api/middlewares.ts` the `multer` middleware on this API route:
@@ -1846,7 +1846,7 @@ In this step, you'll create a workflow that fulfills a digital order by sending
The workflow has the following steps:
1. Retrieve the digital product order's details. For this, you'll use the `useQueryGraphStep` imported from `@medusajs/medusa/core-flows`.
1. Retrieve the digital product order's details. For this, you'll use `useQueryGraphStep` from Medusa's core workflows.
2. Send a notification to the customer with the digital products to download.
So, you only need to implement the second step.
@@ -1869,7 +1869,7 @@ export type DigitalProductOrder =
This adds a type for a digital product order, which you'll use next.
You use the `InferTypeOf` utility to infer the type of the `DigitalProductOrder` data model, and add to it the optional `order` property, which is the linked order.
You use `InferTypeOf` to infer the type of the `DigitalProductOrder` data model, and add to it the optional `order` property, which is the linked order.
### Create sendDigitalOrderNotificationStep
@@ -2013,7 +2013,7 @@ export const fulfillDigitalOrderWorkflow = createWorkflow(
In the workflow, you:
1. Retrieve the digital product order's details using the `useQueryGraphStep` imported from `@medusajs/medusa/core-flows`.
1. Retrieve the digital product order's details using `useQueryGraphStep` from Medusa's core workflows.
2. Send a notification to the customer with the digital product download links using the `sendDigitalOrderNotificationStep`.
### Configure Notification Module Provider
@@ -470,7 +470,7 @@ This adds a type used for inputs in creating a restaurant. It also adds a type f
<Note title="Tip">
Since the `Restaurant` data model is a variable, use the `InferTypeOf` utility imported from `@medusajs/framework/types` to infer its type.
Since the `Restaurant` data model is a variable, use `InferTypeOf` to infer its type.
</Note>
@@ -726,7 +726,7 @@ To implement and expose a feature that manipulates data, you create a workflow t
So, you'll start by implementing the functionality to create a user in a workflow. The workflow has two steps:
1. Create the user in the database.
2. Set the actor type of the users authentication identity (created by the `/auth/{actor_type}/{provider}/register` API route). For this step, youll use the `setAuthAppMetadataStep` step imported from the `@medusajs/medusa/core-flows` package.
2. Set the actor type of the users authentication identity (created by the `/auth/{actor_type}/{provider}/register` API route). For this step, youll use `setAuthAppMetadataStep` from Medusa's core workflows.
To implement the first step, create the file `src/workflows/user/steps/create-user.ts` with the following content:
@@ -895,8 +895,8 @@ return new WorkflowResponse(user)
In the workflow, you:
1. Use the `createUserStep` to create the user.
2. Use the `transform` utility function to create the input to be passed to the next step.
3. Use the `setAuthAppMetadataStep` imported from `@medusajs/medusa/core-flows` to update the authentication identity and associate it with the new user.
2. Use `transform` to create the input to be passed to the next step.
3. Use `setAuthAppMetadataStep` from Medusa's core workflows to update the authentication identity and associate it with the new user.
4. Return the created user.
### Create API Route
@@ -984,7 +984,7 @@ export default defineMiddlewares({
})
```
This applies the `authenticate` middleware imported from `@medusajs/medusa` on the `POST /users` API routes.
This applies the `authenticate` middleware from the Medusa Framework on the `POST /users` API routes.
### Test it Out: Create Restaurant Admin
@@ -1182,8 +1182,8 @@ return new WorkflowResponse(input.id)
After deleting the restaurant admin, you:
1. Retrieve its auth identity using Query. To do that, you filter its `app_metadata` property by checking that its `restaurant_id` property's value is the admin's ID. For drivers, you replace `restaurant_id` with `driver_id`.
2. Check that the auth identity exists using the `transform` utility. Otherwise, throw an error.
3. Unset the association between the auth identity and the restaurant admin using the `setAuthAppMetadataStep` imported from `@medusajs/medusa/core-flows`.
2. Check that the auth identity exists using `transform`. Otherwise, throw an error.
3. Unset the association between the auth identity and the restaurant admin using `setAuthAppMetadataStep` from Medusa's core workflows.
### Create API Route
@@ -1258,8 +1258,8 @@ In this step, youll create the API route that creates a product for a restaur
Youll start by creating a workflow that creates the restaurants products. It has two steps:
1. Create the product using Medusas `createProductsWorkflow` as a step. Its imported from the `@medusajs/medusa/core-flows` package.
2. Create a link between the restaurant and the products using the `createRemoateLinkStep` imported from the `@medusajs/medusa/core-flows` package.
1. Create the product using Medusas `createProductsWorkflow` as a step. This workflow is available through Medusa's core workflows.
2. Create a link between the restaurant and the products using `createRemoateLinkStep` from Medusa's core workflows.
So, create the workflow in the file `src/workflows/restaurant/workflows/create-restaurant-products.ts` with the following content:
@@ -1320,7 +1320,7 @@ export const createRestaurantProductsWorkflow = createWorkflow(
In the workflow, you:
1. Execute the `createProductsWorkflow` as a step, passing the workflows input as the details of the product.
2. Use the `transform` utility to create a `links` object used to specify the links to create in the next step.
2. Use `transform` to create a `links` object used to specify the links to create in the next step.
3. Use the `createRemoteLinkStep` to create the links between the restaurant and the products.
4. Return the created products.
@@ -1410,7 +1410,7 @@ The workflow to create a delivery has three steps:
1. `validateRestaurantStep` that checks whether a restaurant with the specified ID exists.
2. `createDeliveryStep` that creates the delivery.
3. `createRemoteLinkStep` that creates links between the different data model records. This step is imported from `@medusajs/medusa/core-flows`.
3. `createRemoteLinkStep` that creates links between the different data model records. This step is from Medusa's core workflows.
### Create validateRestaurantStep
@@ -1549,7 +1549,7 @@ In the workflow, you:
1. Use the `validateRestaurantStep` to validate that the restaurant exists.
2. Use the `createDeliveryStep` to create the delivery.
3. Use the `transform` utility to specify the links to be created in the next step. You specify links between the delivery and cart, and between the restaurant and delivery.
3. Use `transform` to specify the links to be created in the next step. You specify links between the delivery and cart, and between the restaurant and delivery.
4. Use the `createRemoteLinkStep` to create the links.
5. Return the created delivery.
@@ -1607,7 +1607,7 @@ Steps that have a `*` next to their names are async steps.
{
type: "step",
name: "createRemoteLinkStep",
description: "Creates the links returned by the previous step between the order and delivery. This is imported from `@medusajs/medusa/core-flows`.",
description: "Creates the links returned by the previous step between the order and delivery. This is from Medusa's core workflows.",
link: "/references/helper-steps/createRemoteLinkStep"
},
{
@@ -2296,7 +2296,7 @@ These types are useful in the upcoming implementation steps.
<Note title="Tip">
Since the `Delivery` data model is a variable, use the `InferTypeOf` utility imported from `@medusajs/framework/types` to infer its type.
Since the `Delivery` data model is a variable, use `InferTypeOf` to infer its type.
</Note>
@@ -298,7 +298,7 @@ Then, create the workflow at `src/workflows/marketplace/create-vendor-admin/inde
export const vendorAdminWorkflowHighlights = [
["23", "createVendorAdminStep", "Create the vendor admin."],
["27", "setAuthAppMetadataStep", "Step is imported from `@medusajs/medusa/core-flows`."]
["27", "setAuthAppMetadataStep", "Step is from Medusa's core workflows"]
]
```ts title="src/workflows/marketplace/create-vendor-admin/index.ts" highlights={vendorAdminWorkflowHighlights}
@@ -1045,7 +1045,7 @@ try {
In this snippet, you create multiple child orders for each vendor and link the orders to the vendors.
You use the `promiseAll` utility imported from `@medusajs/framework/utils` that loops over an array of promises and ensures that all transactions within these promises are rolled back in case an error occurs. You also wrap `promiseAll` in a try-catch block, and in the catch block you invoke and return `StepResponse.permanentFailure` which indicates that the step has failed but still invokes the compensation function that you'll implement in a bit. The first parameter of `permanentFailure` is the error message, and the second is the data to pass to the compensation function.
You use `promiseAll` from the Workflows SDK that loops over an array of promises and ensures that all transactions within these promises are rolled back in case an error occurs. You also wrap `promiseAll` in a try-catch block, and in the catch block you invoke and return `StepResponse.permanentFailure` which indicates that the step has failed but still invokes the compensation function that you'll implement in a bit. The first parameter of `permanentFailure` is the error message, and the second is the data to pass to the compensation function.
If an error occurs, the created orders in the `createdOrders` array are canceled using Medusa's `cancelOrderWorkflow` from the `@medusajs/medusa/core-flows` package.
@@ -395,7 +395,7 @@ export type SubscriptionData = InferTypeOf<typeof Subscription>
<Note title="Tip">
Since the `Subscription` data model is a variable, use the `InferTypeOf` utility imported from `@medusajs/framework/types` to infer its type.
Since the `Subscription` data model is a variable, use `InferTypeOf` to infer its type.
</Note>
@@ -1,11 +1,11 @@
import { ChildDocs } from "docs-ui"
export const metadata = {
title: `Medusa Test Functions Reference`,
title: `Medusa's Testing Framework Reference`,
}
# {metadata.title}
This section of the documentation provides a reference to the testing functions provided by the `@medusajs/test-utils` package.
This section of the documentation provides a reference to Medusa's Testing Framework provided by the `@medusajs/test-utils` package.
<ChildDocs />
+37 -36
View File
@@ -4,23 +4,23 @@ export const generatedEditDates = {
"app/commerce-modules/auth/authentication-route/page.mdx": "2024-09-05T12:06:38.155Z",
"app/commerce-modules/auth/examples/page.mdx": "2024-10-15T15:02:13.794Z",
"app/commerce-modules/auth/module-options/page.mdx": "2024-10-15T12:52:08.930Z",
"app/commerce-modules/auth/page.mdx": "2024-10-08T07:38:27.522Z",
"app/commerce-modules/auth/page.mdx": "2024-12-09T14:46:55.446Z",
"app/commerce-modules/cart/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/cart/_events/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/cart/concepts/page.mdx": "2024-10-08T07:49:03.737Z",
"app/commerce-modules/cart/examples/page.mdx": "2024-10-15T14:59:11.331Z",
"app/commerce-modules/cart/promotions/page.mdx": "2024-10-08T07:54:31.120Z",
"app/commerce-modules/cart/tax-lines/page.mdx": "2024-10-08T07:57:19.168Z",
"app/commerce-modules/cart/page.mdx": "2024-10-08T07:41:22.711Z",
"app/commerce-modules/cart/page.mdx": "2024-12-09T14:47:07.204Z",
"app/commerce-modules/currency/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/currency/_events/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/currency/examples/page.mdx": "2024-10-15T14:59:18.466Z",
"app/commerce-modules/currency/page.mdx": "2024-10-08T15:03:00.907Z",
"app/commerce-modules/currency/page.mdx": "2024-12-09T14:47:12.300Z",
"app/commerce-modules/customer/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/customer/_events/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/customer/customer-accounts/page.mdx": "2024-10-08T12:20:44.769Z",
"app/commerce-modules/customer/examples/page.mdx": "2024-10-15T14:59:26.644Z",
"app/commerce-modules/customer/page.mdx": "2024-10-08T15:03:12.597Z",
"app/commerce-modules/customer/page.mdx": "2024-12-09T14:47:17.248Z",
"app/commerce-modules/fulfillment/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/fulfillment/_events/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/fulfillment/concepts/page.mdx": "2024-06-19T13:02:16+00:00",
@@ -28,13 +28,13 @@ export const generatedEditDates = {
"app/commerce-modules/fulfillment/item-fulfillment/page.mdx": "2024-10-08T14:38:15.496Z",
"app/commerce-modules/fulfillment/module-options/page.mdx": "2024-10-15T12:51:56.118Z",
"app/commerce-modules/fulfillment/shipping-option/page.mdx": "2024-10-08T14:36:02.660Z",
"app/commerce-modules/fulfillment/page.mdx": "2024-10-08T15:03:27.436Z",
"app/commerce-modules/fulfillment/page.mdx": "2024-12-09T14:47:23.482Z",
"app/commerce-modules/inventory/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/inventory/_events/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/inventory/concepts/page.mdx": "2024-10-08T15:11:27.634Z",
"app/commerce-modules/inventory/examples/page.mdx": "2024-10-15T14:59:45.389Z",
"app/commerce-modules/inventory/inventory-in-flows/page.mdx": "2024-10-08T15:14:07.327Z",
"app/commerce-modules/inventory/page.mdx": "2024-10-08T15:02:50.635Z",
"app/commerce-modules/inventory/page.mdx": "2024-12-09T14:47:28.150Z",
"app/commerce-modules/order/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/order/_events/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/order/claim/page.mdx": "2024-10-09T10:11:12.090Z",
@@ -45,7 +45,7 @@ export const generatedEditDates = {
"app/commerce-modules/order/return/page.mdx": "2024-10-09T10:19:40.731Z",
"app/commerce-modules/order/tax-lines/page.mdx": "2024-10-09T10:22:49.335Z",
"app/commerce-modules/order/transactions/page.mdx": "2024-10-09T10:23:36.485Z",
"app/commerce-modules/order/page.mdx": "2024-10-09T10:27:06.773Z",
"app/commerce-modules/order/page.mdx": "2024-12-09T14:47:32.415Z",
"app/commerce-modules/payment/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/payment/_events/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/payment/examples/page.mdx": "2024-10-15T14:59:55.208Z",
@@ -57,7 +57,7 @@ export const generatedEditDates = {
"app/commerce-modules/payment/payment-provider/page.mdx": "2024-10-09T11:07:27.269Z",
"app/commerce-modules/payment/payment-session/page.mdx": "2024-10-09T10:58:00.960Z",
"app/commerce-modules/payment/webhook-events/page.mdx": "2024-11-19T11:45:02.167Z",
"app/commerce-modules/payment/page.mdx": "2024-10-09T10:39:37.362Z",
"app/commerce-modules/payment/page.mdx": "2024-12-09T14:47:57.842Z",
"app/commerce-modules/pricing/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/pricing/_events/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/pricing/concepts/page.mdx": "2024-10-09T13:37:25.678Z",
@@ -65,13 +65,13 @@ export const generatedEditDates = {
"app/commerce-modules/pricing/price-calculation/page.mdx": "2024-10-09T13:43:14.038Z",
"app/commerce-modules/pricing/price-rules/page.mdx": "2024-10-09T13:38:47.112Z",
"app/commerce-modules/pricing/tax-inclusive-pricing/page.mdx": "2024-10-09T13:48:23.261Z",
"app/commerce-modules/pricing/page.mdx": "2024-10-09T13:26:26.401Z",
"app/commerce-modules/pricing/page.mdx": "2024-12-09T14:48:02.172Z",
"app/commerce-modules/product/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/product/_events/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/product/examples/page.mdx": "2024-10-09T13:59:32.887Z",
"app/commerce-modules/product/guides/price/page.mdx": "2024-10-09T14:02:24.737Z",
"app/commerce-modules/product/guides/price-with-taxes/page.mdx": "2024-10-09T14:04:20.900Z",
"app/commerce-modules/product/page.mdx": "2024-10-09T13:59:11.554Z",
"app/commerce-modules/product/guides/price/page.mdx": "2024-12-09T16:15:12.846Z",
"app/commerce-modules/product/guides/price-with-taxes/page.mdx": "2024-12-09T14:48:15.107Z",
"app/commerce-modules/product/page.mdx": "2024-12-09T14:48:26.091Z",
"app/commerce-modules/promotion/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/promotion/_events/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/promotion/actions/page.mdx": "2024-10-09T14:49:01.645Z",
@@ -79,25 +79,25 @@ export const generatedEditDates = {
"app/commerce-modules/promotion/campaign/page.mdx": "2024-05-29T11:08:06+00:00",
"app/commerce-modules/promotion/concepts/page.mdx": "2024-10-09T14:50:50.255Z",
"app/commerce-modules/promotion/examples/page.mdx": "2024-10-09T14:46:47.191Z",
"app/commerce-modules/promotion/page.mdx": "2024-10-09T14:46:26.982Z",
"app/commerce-modules/promotion/page.mdx": "2024-12-09T14:48:30.816Z",
"app/commerce-modules/region/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/region/_events/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/region/examples/page.mdx": "2024-10-15T15:00:24.388Z",
"app/commerce-modules/region/page.mdx": "2024-10-15T13:44:19.394Z",
"app/commerce-modules/region/page.mdx": "2024-12-09T14:48:34.729Z",
"app/commerce-modules/sales-channel/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/sales-channel/_events/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/sales-channel/examples/page.mdx": "2024-10-15T15:00:33.322Z",
"app/commerce-modules/sales-channel/publishable-api-keys/page.mdx": "2024-10-15T14:21:38.353Z",
"app/commerce-modules/sales-channel/page.mdx": "2024-10-15T14:12:30.285Z",
"app/commerce-modules/sales-channel/page.mdx": "2024-12-09T14:48:38.646Z",
"app/commerce-modules/stock-location/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/stock-location/_events/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/stock-location/concepts/page.mdx": "2024-10-15T14:32:21.875Z",
"app/commerce-modules/stock-location/examples/page.mdx": "2024-10-15T15:00:41.265Z",
"app/commerce-modules/stock-location/page.mdx": "2024-10-15T14:29:34.571Z",
"app/commerce-modules/stock-location/page.mdx": "2024-12-09T14:48:42.516Z",
"app/commerce-modules/store/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/store/_events/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/store/examples/page.mdx": "2024-10-15T15:00:47.283Z",
"app/commerce-modules/store/page.mdx": "2024-10-15T14:44:35.707Z",
"app/commerce-modules/store/page.mdx": "2024-12-09T14:48:46.363Z",
"app/commerce-modules/tax/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/tax/_events/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/tax/examples/page.mdx": "2024-10-15T15:00:52.899Z",
@@ -105,13 +105,13 @@ export const generatedEditDates = {
"app/commerce-modules/tax/tax-calculation-with-provider/page.mdx": "2024-10-15T14:43:00.700Z",
"app/commerce-modules/tax/tax-rates-and-rules/page.mdx": "2024-10-15T14:38:06.889Z",
"app/commerce-modules/tax/tax-region/page.mdx": "2024-10-15T14:36:47.028Z",
"app/commerce-modules/tax/page.mdx": "2024-10-15T14:44:27.953Z",
"app/commerce-modules/tax/page.mdx": "2024-12-09T14:48:50.327Z",
"app/commerce-modules/user/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/user/_events/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/user/examples/page.mdx": "2024-10-15T15:00:59.626Z",
"app/commerce-modules/user/module-options/page.mdx": "2024-09-30T08:43:53.171Z",
"app/commerce-modules/user/user-creation-flows/page.mdx": "2024-10-15T14:51:37.311Z",
"app/commerce-modules/user/page.mdx": "2024-10-15T14:44:19.628Z",
"app/commerce-modules/user/page.mdx": "2024-12-09T14:48:54.225Z",
"app/commerce-modules/page.mdx": "2024-10-07T13:55:08.014Z",
"app/contribution-guidelines/docs/page.mdx": "2024-10-16T15:48:04.071Z",
"app/create-medusa-app/page.mdx": "2024-08-05T11:10:55+03:00",
@@ -121,23 +121,23 @@ export const generatedEditDates = {
"app/deployment/page.mdx": "2024-11-25T14:31:45.277Z",
"app/integrations/page.mdx": "2024-11-19T10:09:54.075Z",
"app/medusa-cli/page.mdx": "2024-08-28T11:25:32.382Z",
"app/medusa-container-resources/page.mdx": "2024-11-21T08:59:01.120Z",
"app/medusa-workflows-reference/page.mdx": "2024-09-30T08:43:53.174Z",
"app/medusa-container-resources/page.mdx": "2024-12-09T16:18:38.852Z",
"app/medusa-workflows-reference/page.mdx": "2024-12-09T16:22:32.129Z",
"app/nextjs-starter/page.mdx": "2024-07-01T10:21:19+03:00",
"app/recipes/b2b/page.mdx": "2024-10-03T13:07:44.153Z",
"app/recipes/commerce-automation/page.mdx": "2024-10-16T08:52:01.585Z",
"app/recipes/digital-products/examples/standard/page.mdx": "2024-12-09T12:57:50.356Z",
"app/recipes/digital-products/examples/standard/page.mdx": "2024-12-09T16:18:45.973Z",
"app/recipes/digital-products/page.mdx": "2024-10-03T13:07:44.147Z",
"app/recipes/ecommerce/page.mdx": "2024-10-22T11:01:01.218Z",
"app/recipes/integrate-ecommerce-stack/page.mdx": "2024-12-09T13:03:35.846Z",
"app/recipes/marketplace/examples/vendors/page.mdx": "2024-12-09T13:03:48.165Z",
"app/recipes/marketplace/examples/vendors/page.mdx": "2024-12-09T15:31:38.266Z",
"app/recipes/marketplace/page.mdx": "2024-10-03T13:07:44.153Z",
"app/recipes/multi-region-store/page.mdx": "2024-10-03T13:07:13.813Z",
"app/recipes/omnichannel/page.mdx": "2024-10-03T13:07:14.384Z",
"app/recipes/oms/page.mdx": "2024-07-01T10:21:19+03:00",
"app/recipes/personalized-products/page.mdx": "2024-10-03T13:07:44.153Z",
"app/recipes/pos/page.mdx": "2024-10-03T13:07:13.964Z",
"app/recipes/subscriptions/examples/standard/page.mdx": "2024-10-16T08:52:27.606Z",
"app/recipes/subscriptions/examples/standard/page.mdx": "2024-12-09T15:31:52.311Z",
"app/recipes/subscriptions/page.mdx": "2024-10-03T13:07:44.155Z",
"app/recipes/page.mdx": "2024-07-11T15:56:41+00:00",
"app/service-factory-reference/methods/create/page.mdx": "2024-07-31T17:01:33+03:00",
@@ -209,8 +209,8 @@ export const generatedEditDates = {
"app/commerce-modules/auth/auth-flows/page.mdx": "2024-09-05T08:50:11.671Z",
"app/commerce-modules/auth/_events/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/auth/auth-identity-and-actor-types/page.mdx": "2024-12-09T13:04:01.129Z",
"app/commerce-modules/api-key/page.mdx": "2024-10-07T13:57:33.042Z",
"app/commerce-modules/auth/create-actor-type/page.mdx": "2024-12-09T13:04:00.460Z",
"app/commerce-modules/api-key/page.mdx": "2024-12-09T14:47:01.509Z",
"app/commerce-modules/auth/create-actor-type/page.mdx": "2024-12-09T15:32:07.594Z",
"app/architectural-modules/page.mdx": "2024-05-28T13:25:03+03:00",
"app/architectural-modules/workflow-engine/redis/page.mdx": "2024-10-15T12:50:59.507Z",
"app/commerce-modules/api-key/examples/page.mdx": "2024-10-15T14:58:58.994Z",
@@ -235,7 +235,7 @@ export const generatedEditDates = {
"app/architectural-modules/cache/create/page.mdx": "2024-10-16T08:51:35.074Z",
"app/admin-widget-injection-zones/page.mdx": "2024-11-22T11:00:30.159Z",
"app/architectural-modules/notification/page.mdx": "2024-10-15T12:51:28.735Z",
"app/architectural-modules/event/create/page.mdx": "2024-11-12T11:54:51.583Z",
"app/architectural-modules/event/create/page.mdx": "2024-12-09T14:46:40.248Z",
"references/core_flows/Order/functions/core_flows.Order.orderEditUpdateItemQuantityValidationStep/page.mdx": "2024-08-20T00:10:58.913Z",
"references/core_flows/Order/functions/core_flows.Order.orderEditUpdateItemQuantityWorkflow/page.mdx": "2024-08-20T00:10:58.949Z",
"references/core_flows/Order/functions/core_flows.Order.updateOrderEditItemQuantityValidationStep/page.mdx": "2024-08-20T00:10:59.121Z",
@@ -624,7 +624,7 @@ export const generatedEditDates = {
"app/medusa-cli/commands/start/page.mdx": "2024-08-28T10:44:19.952Z",
"app/medusa-cli/commands/telemtry/page.mdx": "2024-08-28T11:25:08.553Z",
"app/medusa-cli/commands/user/page.mdx": "2024-08-28T10:44:52.489Z",
"app/recipes/marketplace/examples/restaurant-delivery/page.mdx": "2024-12-09T13:03:42.960Z",
"app/recipes/marketplace/examples/restaurant-delivery/page.mdx": "2024-12-09T16:19:05.709Z",
"references/types/HttpTypes/interfaces/types.HttpTypes.AdminCreateCustomerGroup/page.mdx": "2024-12-09T13:21:33.569Z",
"references/types/HttpTypes/interfaces/types.HttpTypes.AdminCreateReservation/page.mdx": "2024-12-09T13:21:34.505Z",
"references/types/HttpTypes/interfaces/types.HttpTypes.AdminCustomerGroup/page.mdx": "2024-12-09T13:21:33.569Z",
@@ -748,7 +748,7 @@ export const generatedEditDates = {
"references/types/interfaces/types.BaseReturnItem/page.mdx": "2024-12-09T13:21:35.009Z",
"app/test-tools-reference/medusaIntegrationTestRunner/page.mdx": "2024-10-16T15:47:38.579Z",
"app/test-tools-reference/moduleIntegrationTestRunner/page.mdx": "2024-10-16T15:47:38.504Z",
"app/test-tools-reference/page.mdx": "2024-10-16T15:47:38.429Z",
"app/test-tools-reference/page.mdx": "2024-12-09T16:23:04.825Z",
"references/types/HttpTypes/interfaces/types.HttpTypes.AdminGetInvitesParams/page.mdx": "2024-12-09T13:21:33.813Z",
"references/types/HttpTypes/interfaces/types.HttpTypes.AdminInventoryLevel/page.mdx": "2024-12-09T13:21:33.789Z",
"references/types/HttpTypes/interfaces/types.HttpTypes.BaseAddress/page.mdx": "2024-12-09T13:21:33.325Z",
@@ -2189,15 +2189,15 @@ export const generatedEditDates = {
"app/commerce-modules/auth/reset-password/page.mdx": "2024-11-27T13:33:55.940Z",
"app/storefront-development/customers/reset-password/page.mdx": "2024-09-25T10:21:46.647Z",
"app/commerce-modules/api-key/links-to-other-modules/page.mdx": "2024-10-08T08:05:36.596Z",
"app/commerce-modules/cart/extend/page.mdx": "2024-12-09T13:03:59.728Z",
"app/commerce-modules/cart/extend/page.mdx": "2024-12-09T16:11:39.857Z",
"app/commerce-modules/cart/links-to-other-modules/page.mdx": "2024-10-08T08:22:35.190Z",
"app/commerce-modules/customer/extend/page.mdx": "2024-12-09T13:03:59.045Z",
"app/commerce-modules/customer/extend/page.mdx": "2024-12-09T16:15:01.163Z",
"app/commerce-modules/fulfillment/links-to-other-modules/page.mdx": "2024-10-08T14:58:24.935Z",
"app/commerce-modules/inventory/links-to-other-modules/page.mdx": "2024-10-08T15:18:30.109Z",
"app/commerce-modules/pricing/links-to-other-modules/page.mdx": "2024-10-09T13:51:49.986Z",
"app/commerce-modules/product/extend/page.mdx": "2024-12-09T13:03:58.313Z",
"app/commerce-modules/product/extend/page.mdx": "2024-12-09T16:15:01.163Z",
"app/commerce-modules/product/links-to-other-modules/page.mdx": "2024-10-09T14:14:09.401Z",
"app/commerce-modules/promotion/extend/page.mdx": "2024-12-09T13:03:57.544Z",
"app/commerce-modules/promotion/extend/page.mdx": "2024-12-09T16:19:19.364Z",
"app/commerce-modules/promotion/links-to-other-modules/page.mdx": "2024-10-09T14:51:37.194Z",
"app/commerce-modules/order/edit/page.mdx": "2024-10-09T08:50:05.334Z",
"app/commerce-modules/order/links-to-other-modules/page.mdx": "2024-10-09T11:23:05.488Z",
@@ -2255,7 +2255,7 @@ export const generatedEditDates = {
"app/commerce-modules/sales-channel/links-to-other-modules/page.mdx": "2024-10-15T14:25:29.097Z",
"app/commerce-modules/stock-location/links-to-other-modules/page.mdx": "2024-10-15T14:33:11.483Z",
"app/commerce-modules/store/links-to-other-modules/page.mdx": "2024-06-26T07:19:49.931Z",
"app/examples/page.mdx": "2024-12-09T13:03:13.773Z",
"app/examples/page.mdx": "2024-12-09T16:19:18.598Z",
"app/medusa-cli/commands/build/page.mdx": "2024-11-11T11:00:49.665Z",
"app/js-sdk/page.mdx": "2024-10-16T12:12:34.512Z",
"references/js_sdk/admin/Admin/properties/js_sdk.admin.Admin.apiKey/page.mdx": "2024-12-09T13:21:58.136Z",
@@ -3229,7 +3229,7 @@ export const generatedEditDates = {
"references/types/HttpTypes/interfaces/types.HttpTypes.AdminBatchProductVariantRequest/page.mdx": "2024-12-09T13:21:34.309Z",
"references/types/WorkflowTypes/ProductWorkflow/interfaces/types.WorkflowTypes.ProductWorkflow.ExportProductsDTO/page.mdx": "2024-12-09T13:21:35.797Z",
"app/contribution-guidelines/admin-translations/page.mdx": "2024-11-14T08:54:15.369Z",
"app/integrations/guides/sanity/page.mdx": "2024-12-03T14:14:11.347Z",
"app/integrations/guides/sanity/page.mdx": "2024-12-09T16:18:07.779Z",
"references/api_key/types/api_key.FindConfigOrder/page.mdx": "2024-11-25T17:49:28.715Z",
"references/auth/types/auth.FindConfigOrder/page.mdx": "2024-11-25T17:49:28.887Z",
"references/cart/types/cart.FindConfigOrder/page.mdx": "2024-11-25T17:49:29.455Z",
@@ -5658,5 +5658,6 @@ export const generatedEditDates = {
"references/workflows/classes/workflows.StepResponse/page.mdx": "2024-12-09T13:22:04.816Z",
"references/workflows/classes/workflows.WorkflowResponse/page.mdx": "2024-12-09T13:22:04.820Z",
"references/workflows/interfaces/workflows.ApplyStepOptions/page.mdx": "2024-12-09T13:22:04.808Z",
"references/workflows/types/workflows.WorkflowData/page.mdx": "2024-12-09T13:22:04.836Z"
"references/workflows/types/workflows.WorkflowData/page.mdx": "2024-12-09T13:22:04.836Z",
"app/integrations/guides/resend/page.mdx": "2024-12-09T16:19:17.798Z"
}
+6 -5
View File
@@ -9486,7 +9486,8 @@ export const generatedSidebar = [
"isPathHref": true,
"type": "link",
"path": "/references/workflows",
"title": "Workflow API",
"title": "Workflows SDK",
"childSidebarTitle": "Workflows SDK Reference",
"isChildSidebar": true,
"children": [
{
@@ -9553,8 +9554,8 @@ export const generatedSidebar = [
"isPathHref": true,
"type": "link",
"path": "/references/data-model",
"title": "Data Model API",
"childSidebarTitle": "Data Model API Reference",
"title": "Data Model Language",
"childSidebarTitle": "Data Model Language Reference",
"isChildSidebar": true,
"children": [
{
@@ -9937,7 +9938,7 @@ export const generatedSidebar = [
"loaded": true,
"isPathHref": true,
"type": "link",
"title": "Medusa Workflows Reference",
"title": "Core Workflows Reference",
"path": "/medusa-workflows-reference",
"isChildSidebar": true,
"custom_autogenerate": "core-flows",
@@ -15075,7 +15076,7 @@ export const generatedSidebar = [
"loaded": true,
"isPathHref": true,
"type": "link",
"title": "Testing Tools Reference",
"title": "Testing Framework Reference",
"path": "/test-tools-reference",
"isChildSidebar": true,
"children": [
+6 -5
View File
@@ -2326,7 +2326,8 @@ export const sidebar = sidebarAttachHrefCommonOptions([
{
type: "link",
path: "/references/workflows",
title: "Workflow API",
title: "Workflows SDK",
childSidebarTitle: "Workflows SDK Reference",
isChildSidebar: true,
children: [
{
@@ -2339,8 +2340,8 @@ export const sidebar = sidebarAttachHrefCommonOptions([
{
type: "link",
path: "/references/data-model",
title: "Data Model API",
childSidebarTitle: "Data Model API Reference",
title: "Data Model Language",
childSidebarTitle: "Data Model Language Reference",
isChildSidebar: true,
children: [
{
@@ -2401,14 +2402,14 @@ export const sidebar = sidebarAttachHrefCommonOptions([
},
{
type: "link",
title: "Medusa Workflows Reference",
title: "Core Workflows Reference",
path: "/medusa-workflows-reference",
isChildSidebar: true,
custom_autogenerate: "core-flows",
},
{
type: "link",
title: "Testing Tools Reference",
title: "Testing Framework Reference",
path: "/test-tools-reference",
isChildSidebar: true,
children: [
+22 -22
View File
@@ -107,33 +107,43 @@ export const navDropdownItems: NavigationItem[] = [
children: [
{
type: "link",
title: "API Routes",
link: "/learn/basics/api-routes",
title: "Modules",
link: "/learn/fundamentals/modules",
},
{
type: "link",
title: "Modules",
link: "/learn/basics/modules",
title: "API Routes",
link: "/learn/fundamentals/api-routes",
},
{
type: "link",
title: "Workflows",
link: "/learn/fundamentals/workflows",
},
{
type: "link",
title: "Data Models",
link: "/learn/fundamentals/data-models",
},
{
type: "link",
title: "Subscribers",
link: "/learn/basics/events-and-subscribers",
link: "/learn/fundamentals/events-and-subscribers",
},
{
type: "link",
title: "Scheduled Jobs",
link: "/learn/basics/scheduled-jobs",
link: "/learn/fundamentals/scheduled-jobs",
},
{
type: "link",
title: "Loaders",
link: "/learn/basics/loaders",
link: "/learn/fundamentals/modules/loaders",
},
{
type: "link",
title: "Admin Customizations",
link: "/learn/basics/admin-customizations",
link: "/learn/fundamentals/admin",
},
{
type: "divider",
@@ -141,22 +151,12 @@ export const navDropdownItems: NavigationItem[] = [
{
type: "link",
title: "Links",
link: "/learn/advanced-development/module-links",
link: "/learn/fundamentals/module-links",
},
{
type: "link",
title: "Query",
link: "/learn/advanced-development/module-links/query",
},
{
type: "link",
title: "Data Models",
link: "/learn/advanced-development/data-models",
},
{
type: "link",
title: "Workflows",
link: "/learn/basics/workflows",
link: "/learn/fundamentals/module-links/query",
},
],
},
@@ -179,12 +179,12 @@ export const navDropdownItems: NavigationItem[] = [
},
{
type: "link",
title: "Workflows",
title: "Core Workflows",
link: "/resources/medusa-workflows-reference",
},
{
type: "link",
title: "Data Model API",
title: "Data Model Language",
link: "/resources/references/data-model",
},
{
@@ -51,7 +51,7 @@ const coreFlowsOptions: FormattingOptionsType = {
reflectionTitle: {
kind: false,
typeParameters: false,
suffix: "- Medusa Workflows API Reference",
suffix: "- Medusa Core Workflows Reference",
},
},
"^core_flows/.*/Steps_.*/functions/.*/page\\.mdx": {
@@ -64,7 +64,7 @@ const coreFlowsOptions: FormattingOptionsType = {
reflectionTitle: {
kind: false,
typeParameters: false,
suffix: "- Medusa Workflows API Reference",
suffix: "- Medusa Core Workflows Reference",
},
},
}
@@ -12,7 +12,7 @@ const dmlOptions: FormattingOptionsType = {
},
"^modules/dml/page\\.mdx": {
reflectionDescription:
"This section of the documentation provides an API reference to the property types and methods used to create a data model.",
"This section of the documentation to Medusa's Data Model Language (DML). Refer to it for all methods and options relevant to creating data models.",
reflectionGroups: {
Classes: false,
Variables: false,
@@ -23,7 +23,7 @@ const dmlOptions: FormattingOptionsType = {
slug: "/references/data-model",
},
reflectionTitle: {
fullReplacement: "Data Models API Reference",
fullReplacement: "Medusa Data Model Language Reference",
},
hideTocHeaders: true,
},
@@ -32,7 +32,7 @@ const dmlOptions: FormattingOptionsType = {
slug: "/references/data-model/define",
},
reflectionTitle: {
suffix: "Method - API Reference",
suffix: "Method - DML Reference",
},
},
"^dml/.*Property_Types/page\\.mdx": {
@@ -42,7 +42,7 @@ const dmlOptions: FormattingOptionsType = {
reflectionDescription:
"The following methods are used to define the type of a property in a data model.",
reflectionTitle: {
suffix: "- API Reference",
suffix: "- DML Reference",
},
},
"^dml/Property_Types": {
@@ -51,7 +51,7 @@ const dmlOptions: FormattingOptionsType = {
sidebar_label: "{{alias}}",
},
reflectionTitle: {
suffix: "Property Method - API Reference",
suffix: "Property Method - DML Reference",
},
},
"^dml/.*Relationship_Methods/page\\.mdx": {
@@ -61,7 +61,7 @@ const dmlOptions: FormattingOptionsType = {
reflectionDescription:
"The following methods are used to define a relationship between two data models.",
reflectionTitle: {
suffix: "- API Reference",
suffix: "- DML Reference",
},
},
"^dml/Relationship_Methods": {
@@ -70,7 +70,7 @@ const dmlOptions: FormattingOptionsType = {
sidebar_label: "{{alias}}",
},
reflectionTitle: {
suffix: "Relationship Method - API Reference",
suffix: "Relationship Method - DML Reference",
},
},
"^dml/.*Model_Methods/page\\.mdx": {
@@ -80,7 +80,7 @@ const dmlOptions: FormattingOptionsType = {
reflectionDescription:
"The following methods are used on a module to configure it.",
reflectionTitle: {
suffix: "- API Reference",
suffix: "- DML Reference",
},
},
"^dml/Model_Methods": {
@@ -89,7 +89,7 @@ const dmlOptions: FormattingOptionsType = {
sidebar_label: "{{alias}}",
},
reflectionTitle: {
suffix: "Method - API Reference",
suffix: "Method - DML Reference",
},
},
"^dml/.*Property_Configuration_Methods/page\\.mdx": {
@@ -99,7 +99,7 @@ const dmlOptions: FormattingOptionsType = {
reflectionDescription:
"The following methods are used on a property to configure it.",
reflectionTitle: {
suffix: "- API Reference",
suffix: "- DML Reference",
},
},
"^dml/Property_Configuration_Methods": {
@@ -108,7 +108,7 @@ const dmlOptions: FormattingOptionsType = {
sidebar_label: "{{alias}}",
},
reflectionTitle: {
suffix: "Method - API Reference",
suffix: "Method - DML Reference",
},
},
"^dml/.*/types/.*": {
@@ -12,7 +12,7 @@ const workflowsOptions: FormattingOptionsType = {
},
"^modules/workflows/page\\.mdx": {
reflectionDescription:
"This section of the documentation provides a reference to the utility functions of the `@medusajs/framework/workflows-sdk` package.",
"This section of the documentation provides a reference to Medusa's Workflows SDK, where you can find all accepted inputs, expected output, and example code snippets.",
reflectionGroups: {
Namespaces: false,
Enumerations: false,
@@ -26,13 +26,13 @@ const workflowsOptions: FormattingOptionsType = {
slug: "/references/workflows",
},
reflectionTitle: {
fullReplacement: "Workflows API Reference",
fullReplacement: "Workflows SDK Reference",
},
},
"^workflows/functions": {
maxLevel: 1,
reflectionDescription:
"This documentation provides a reference to the `{{alias}}` {{kind}}. It belongs to the `@medusajs/framework/workflows-sdk` package.",
"This documentation provides a reference to the `{{alias}}` {{kind}}. It belongs to the Workflows SDK.",
frontmatterData: {
slug: "/references/workflows/{{alias}}",
sidebar_label: "{{alias}}",
@@ -40,7 +40,7 @@ const workflowsOptions: FormattingOptionsType = {
reflectionTitle: {
kind: false,
typeParameters: false,
suffix: "- Workflows API Reference",
suffix: "- Workflows SDK Reference",
},
},
"^workflows/.*classes/.*StepResponse": {
+12
View File
@@ -0,0 +1,12 @@
extends: substitution
message: "Use '%s' instead of '%s'."
level: error
action:
name: replace
swap:
"Workflow SDK": Workflows SDK
"Admin Extensions SDK": Admin Extension SDK
"Module SDK": Modules SDK
"Data Modeling Language": "Data Model Language"
"Medusa's Framework": "Medusa Framework"
@@ -0,0 +1,9 @@
extends: existence
message: Use correct capitalization of tooling.
level: error
ignorecase: false
tokens:
- workflows (sdk|SDK)
- modules (sdk|SDK)
- admin extension (sdk|SDK)
- Admin extension (sdk|SDK)