docs: update imports and package names across docs (#9375)

* docs: update imports and package names across docs
+ reference configs

* generate files

* fix import

* change preview to rc
This commit is contained in:
Shahed Nasser
2024-10-01 11:03:42 +02:00
committed by GitHub
parent c726ed54f5
commit 2e16949979
196 changed files with 1379 additions and 1491 deletions
@@ -94,7 +94,7 @@ import { Container, Heading } from "@medusajs/ui"
import {
DetailWidgetProps,
AdminProduct,
} from "@medusajs/types"
} from "@medusajs/framework/types"
// The widget
const ProductWidget = ({
@@ -135,9 +135,9 @@ For example, consider you want to store the data passed in `additional_data` in
To do that, create the file `src/workflows/hooks/product-created.ts` with the following content:
```ts title="src/workflows/hooks/product-created.ts"
import { StepResponse } from "@medusajs/workflows-sdk"
import { createProductsWorkflow } from "@medusajs/core-flows"
import { Modules } from "@medusajs/utils"
import { StepResponse } from "@medusajs/framework/workflows-sdk"
import { createProductsWorkflow } from "@medusajs/medusa/core-flows"
import { Modules } from "@medusajs/framework/utils"
createProductsWorkflow.hooks.productsCreated(
async ({ products, additional_data }, { container }) => {
@@ -87,8 +87,8 @@ import type {
MedusaRequest,
MedusaResponse,
} from "@medusajs/medusa"
import { ConfigModule } from "@medusajs/types"
import { parseCorsOrigins } from "@medusajs/utils"
import { ConfigModule } from "@medusajs/framework/types"
import { parseCorsOrigins } from "@medusajs/framework/utils"
import cors from "cors"
export default defineMiddlewares({
@@ -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/utils`.
When throwing an error in your API routes, middlewares, workflows, or any customization, throw a `MedusaError`, which is imported from `@medusajs/framework/utils`.
The Medusa application's API route error handler then wraps your thrown error in a uniform object and returns it in the response.
@@ -18,7 +18,7 @@ For example:
```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { MedusaError } from "@medusajs/utils"
import { MedusaError } from "@medusajs/framework/utils"
export const GET = async (
req: MedusaRequest,
@@ -258,7 +258,7 @@ import {
MedusaRequest,
MedusaResponse,
} from "@medusajs/medusa"
import { MedusaError } from "@medusajs/utils"
import { MedusaError } from "@medusajs/framework/utils"
export default defineMiddlewares({
errorHandler: (
@@ -125,8 +125,8 @@ import type {
AuthenticatedMedusaRequest,
MedusaResponse,
} from "@medusajs/medusa"
import { Modules } from "@medusajs/utils"
import { ICustomerModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/framework/utils"
import { ICustomerModuleService } from "@medusajs/framework/types"
export const GET = async (
req: AuthenticatedMedusaRequest,
@@ -160,8 +160,8 @@ import type {
AuthenticatedMedusaRequest,
MedusaResponse,
} from "@medusajs/medusa"
import { Modules } from "@medusajs/utils"
import { IUserModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/framework/utils"
import { IUserModuleService } from "@medusajs/framework/types"
export const GET = async (
req: AuthenticatedMedusaRequest,
@@ -22,8 +22,8 @@ For example, create the file `src/scripts/my-script.ts` with the following conte
import {
ExecArgs,
IProductModuleService,
} from "@medusajs/types"
import { Modules } from "@medusajs/utils"
} from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
export default async function myScript({ container }: ExecArgs) {
const productModuleService: IProductModuleService = container.resolve(
@@ -58,7 +58,7 @@ Your script can accept arguments from the command line. Arguments are passed to
For example:
```ts
import { ExecArgs } from "@medusajs/types"
import { ExecArgs } from "@medusajs/framework/types"
export default async function myScript({ args }: ExecArgs) {
console.log(`The arguments you passed: ${args}`)
@@ -18,7 +18,7 @@ export const defaultHighlights = [
]
```ts highlights={defaultHighlights}
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", {
color: model
@@ -48,7 +48,7 @@ export const nullableHighlights = [
]
```ts highlights={nullableHighlights}
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", {
price: model.bigNumber().nullable(),
@@ -71,7 +71,7 @@ export const uniqueHighlights = [
]
```ts highlights={uniqueHighlights}
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const User = model.define("user", {
email: model.text().unique(),
@@ -18,7 +18,7 @@ export const highlights = [
]
```ts highlights={highlights}
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", {
id: model.id().primaryKey(),
@@ -48,7 +48,7 @@ export const dataModelIndexHighlights = [
]
```ts highlights={dataModelIndexHighlights}
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", {
id: model.id().primaryKey(),
@@ -77,7 +77,7 @@ export const conditionHighlights = [
]
```ts highlights={conditionHighlights}
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", {
id: model.id().primaryKey(),
@@ -106,7 +106,7 @@ export const negationHighlights = [
]
```ts highlights={negationHighlights}
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", {
id: model.id().primaryKey(),
@@ -141,7 +141,7 @@ export const uniqueHighlights = [
]
```ts highlights={uniqueHighlights}
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", {
id: model.id().primaryKey(),
@@ -10,12 +10,12 @@ 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/types` that transforms your data model to a type.
Instead, Medusa provides an `InferTypeOf` utility imported from `@medusajs/framework/types` that transforms your data model to a type.
For example:
```ts
import { InferTypeOf } from "@medusajs/types"
import { InferTypeOf } from "@medusajs/framework/types"
import { MyCustom } from "../models/my-custom" // relative path to the model
export type MyCustom = InferTypeOf<typeof MyCustom>
@@ -29,7 +29,7 @@ You can now use the `MyCustom` type to reference a data model in other types, su
```ts title="Example Service"
// other imports...
import { InferTypeOf } from "@medusajs/types"
import { InferTypeOf } from "@medusajs/framework/types"
import { MyCustom } from "../models/my-custom"
type MyCustom = InferTypeOf<typeof MyCustom>
@@ -17,7 +17,7 @@ export const highlights = [
]
```ts highlights={highlights}
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", {
id: model.id().primaryKey(),
@@ -6,7 +6,7 @@ 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/utils`.
These types are available as methods on the `model` utility imported from `@medusajs/framework/utils`.
## id
@@ -17,7 +17,7 @@ For example:
export const idHighlights = [["4", ".id()", "Define an `id` property."]]
```ts highlights={idHighlights}
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", {
id: model.id(),
@@ -38,7 +38,7 @@ For example:
export const textHighlights = [["4", "text", "Define a `text` property."]]
```ts highlights={textHighlights}
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", {
name: model.text(),
@@ -59,7 +59,7 @@ For example:
export const numberHighlights = [["4", "number", "Define a `number` property."]]
```ts highlights={numberHighlights}
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", {
age: model.number(),
@@ -80,7 +80,7 @@ For example:
export const bigNumberHighlights = [["4", "bigNumber", "Define a `bigNumber` property."]]
```ts highlights={bigNumberHighlights}
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", {
price: model.bigNumber(),
@@ -101,7 +101,7 @@ For example:
export const booleanHighlights = [["4", "boolean", "Define a `boolean` property."]]
```ts highlights={booleanHighlights}
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", {
hasAccount: model.boolean(),
@@ -122,7 +122,7 @@ For example:
export const enumHighlights = [["4", "enum", "Define a `enum` property."]]
```ts highlights={enumHighlights}
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", {
color: model.enum(["black", "white"]),
@@ -145,7 +145,7 @@ For example:
export const dateTimeHighlights = [["4", "dateTime", "Define a `dateTime` property."]]
```ts highlights={dateTimeHighlights}
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", {
date_of_birth: model.dateTime(),
@@ -166,7 +166,7 @@ For example:
export const jsonHighlights = [["4", "json", "Define a `json` property."]]
```ts highlights={jsonHighlights}
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", {
metadata: model.json(),
@@ -187,7 +187,7 @@ For example:
export const arrHightlights = [["4", "array", "Define an `array` property."]]
```ts highlights={arrHightlights}
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", {
names: model.array(),
@@ -46,7 +46,7 @@ export const oneToOneHighlights = [
]
```ts highlights={oneToOneHighlights}
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const User = model.define("user", {
id: model.id().primaryKey(),
@@ -100,7 +100,7 @@ export const oneToManyHighlights = [
]
```ts highlights={oneToManyHighlights}
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const Store = model.define("store", {
id: model.id().primaryKey(),
@@ -146,7 +146,7 @@ export const manyToManyHighlights = [
]
```ts highlights={manyToManyHighlights}
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const Order = model.define("order", {
id: model.id().primaryKey(),
@@ -193,7 +193,7 @@ export const relationNameHighlights = [
]
```ts highlights={relationNameHighlights}
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const User = model.define("user", {
id: model.id().primaryKey(),
@@ -229,7 +229,7 @@ export const highlights = [
]
```ts highlights={highlights}
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const Store = model.define("store", {
id: model.id().primaryKey(),
@@ -25,7 +25,7 @@ export const searchableHighlights = [
]
```ts highlights={searchableHighlights}
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", {
name: model.text().searchable(),
@@ -8,7 +8,7 @@ In this chapter, you'll learn how to emit an event in a workflow.
## Emit Event Step
Medusa provides an `emitEventStep` helper step in the `@medusajs/core-flows` package that emits an event.
Medusa provides an `emitEventStep` helper step in the `@medusajs/medusa/core-flows` package that emits an event.
When you emit an event, you specify the event's name and data payload to pass with the event.
@@ -23,10 +23,10 @@ export const highlights = [
```ts highlights={highlights}
import {
createWorkflow,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import {
emitEventStep,
} from "@medusajs/core-flows"
} from "@medusajs/medusa/core-flows"
const helloWorldWorkflow = createWorkflow(
"hello-world",
@@ -53,7 +53,7 @@ For example:
```ts highlights={[["9"]]}
import {
LoaderOptions,
} from "@medusajs/modules-sdk"
} from "@medusajs/framework/modules-sdk"
import { Logger } from "@medusajs/medusa"
export default async function helloWorldLoader({
@@ -32,7 +32,7 @@ You want to create a relationship between data models in the same module. Use da
### 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/utils` and exports it.
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.
For example:
@@ -43,8 +43,8 @@ export const highlights = [
```ts title="src/links/hello-product.ts" highlights={highlights}
import HelloModule from "../modules/hello"
import ProductModule from "@medusajs/product"
import { defineLink } from "@medusajs/utils"
import ProductModule from "@medusajs/medusa/product"
import { defineLink } from "@medusajs/framework/utils"
export default defineLink(
ProductModule.linkable.product,
@@ -84,8 +84,8 @@ For example:
```ts
import HelloModule from "../modules/hello"
import ProductModule from "@medusajs/product"
import { defineLink } from "@medusajs/utils"
import ProductModule from "@medusajs/medusa/product"
import { defineLink } from "@medusajs/framework/utils"
export default defineLink(
ProductModule.linkable.product,
@@ -130,8 +130,8 @@ For example:
```ts
import HelloModule from "../modules/hello"
import ProductModule from "@medusajs/product"
import { defineLink } from "@medusajs/utils"
import ProductModule from "@medusajs/medusa/product"
import { defineLink } from "@medusajs/framework/utils"
export default defineLink(
ProductModule.linkable.product,
@@ -47,7 +47,7 @@ The modules main service receives the module options as a second parameter.
For example:
```ts title="src/modules/hello/service.ts" highlights={[["12"], ["14", "options?: ModuleOptions"], ["17"], ["18"], ["19"]]}
import { MedusaService } from "@medusajs/utils"
import { MedusaService } from "@medusajs/framework/utils"
import MyCustom from "./models/my-custom"
// recommended to define type in another file
@@ -83,7 +83,7 @@ For example:
```ts title="src/modules/hello/loaders/hello-world.ts" highlights={[["11"], ["12", "ModuleOptions", "The type of expected module options."], ["16"]]}
import {
LoaderOptions,
} from "@medusajs/modules-sdk"
} from "@medusajs/framework/modules-sdk"
// recommended to define type in another file
type ModuleOptions = {
@@ -40,7 +40,7 @@ import {
} from "@medusajs/medusa"
import {
ContainerRegistrationKeys,
} from "@medusajs/utils"
} from "@medusajs/framework/utils"
export const GET = async (
req: MedusaRequest,
@@ -21,10 +21,10 @@ import {
} from "@medusajs/medusa"
import {
ContainerRegistrationKeys,
} from "@medusajs/utils"
} from "@medusajs/framework/utils"
import {
RemoteLink,
} from "@medusajs/modules-sdk"
} from "@medusajs/framework/modules-sdk"
export async function POST(
req: MedusaRequest,
@@ -49,7 +49,7 @@ To create a link between records of two data models, use the `create` method of
For example:
```ts
import { Modules } from "@medusajs/utils"
import { Modules } from "@medusajs/framework/utils"
// ...
@@ -84,7 +84,7 @@ To remove a link between records of two data models, use the `dismiss` method of
For example:
```ts
import { Modules } from "@medusajs/utils"
import { Modules } from "@medusajs/framework/utils"
// ...
@@ -115,7 +115,7 @@ If a record is deleted, use the `delete` method of the remote link to delete all
For example:
```ts
import { Modules } from "@medusajs/utils"
import { Modules } from "@medusajs/framework/utils"
// ...
@@ -139,7 +139,7 @@ If a record that was previously soft-deleted is now restored, use the `restore`
For example:
```ts
import { Modules } from "@medusajs/utils"
import { Modules } from "@medusajs/framework/utils"
// ...
@@ -13,7 +13,7 @@ Medusa wraps adds wrappers around your service's methods and executes them as as
So, make sure your service's methods are always async to avoid unexpected errors or behavior.
```ts highlights={[["8", "", "Method must be async."], ["13", "async", "Correct way of defining the method."]]}
import { MedusaService } from "@medusajs/utils"
import { MedusaService } from "@medusajs/framework/utils"
import MyCustom from "./models/my-custom"
class HelloModuleService extends MedusaService({
@@ -34,7 +34,7 @@ export const highlights = [
]
```ts title="src/modules/hello/service.ts" highlights={highlights}
import { MedusaService } from "@medusajs/utils"
import { MedusaService } from "@medusajs/framework/utils"
import MyCustom from "./models/my-custom"
class HelloModuleService extends MedusaService({
@@ -284,7 +284,7 @@ If you implement the `constructor` of your service, make sure to call `super` pa
For example:
```ts highlights={[["8"]]}
import { MedusaService } from "@medusajs/utils"
import { MedusaService } from "@medusajs/framework/utils"
import MyCustom from "./models/my-custom"
class HelloModuleService extends MedusaService({
@@ -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/workflows-sdk`.
To expose a hook in your workflow, use the `createHook` function imported from `@medusajs/framework/workflows-sdk`.
For example:
@@ -41,7 +41,7 @@ import {
createHook,
createWorkflow,
WorkflowResponse,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import { createProductStep } from "./steps/create-product"
export const myWorkflow = createWorkflow(
@@ -26,7 +26,7 @@ For example, create the file `src/workflows/hello-world.ts` with the following c
import {
createStep,
StepResponse,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
const step1 = createStep(
"step-1",
@@ -66,7 +66,7 @@ Then, create a workflow that uses the steps:
import {
createWorkflow,
WorkflowResponse,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
// other imports...
// steps...
@@ -135,7 +135,7 @@ export const inputHighlights = [
import {
createStep,
StepResponse,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
const step1 = createStep(
"step-1",
@@ -172,8 +172,8 @@ export const containerHighlights = [
import {
createStep,
StepResponse,
} from "@medusajs/workflows-sdk"
import { ContainerRegistrationKeys } from "@medusajs/utils"
} from "@medusajs/framework/workflows-sdk"
import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
const step1 = createStep(
"step-1",
@@ -37,7 +37,7 @@ import {
createWorkflow,
WorkflowResponse,
when,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
// step imports...
const workflow = createWorkflow(
@@ -70,7 +70,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/workflows-sdk`. It accepts the following parameters:
`when` utility is a function imported from `@medusajs/framework/workflows-sdk`. It 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](../conditi
</Note>
Instead, use the `transform` utility function imported from `@medusajs/workflows-sdk`:
Instead, use the `transform` utility function imported from `@medusajs/framework/workflows-sdk`:
export const highlights = [
["9", "", "Don't manipulate variables directly."],
@@ -89,7 +89,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/workflows-sdk`:
Instead, use the when-then utility function imported from `@medusajs/framework/workflows-sdk`:
```ts
// Don't
@@ -129,7 +129,7 @@ Values of other types, such as Maps, aren't allowed.
import {
createStep,
StepResponse,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
const step1 = createStep(
"step-1",
@@ -148,7 +148,7 @@ const step1 = createStep(
import {
createStep,
StepResponse,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
const step1 = createStep(
"step-1",
@@ -20,10 +20,10 @@ export const workflowsHighlights = [
```ts highlights={workflowsHighlights} collapsibleLines="1-7" expandMoreButton="Show Imports"
import {
createWorkflow,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import {
createProductsWorkflow,
} from "@medusajs/core-flows"
} from "@medusajs/medusa/core-flows"
const workflow = createWorkflow(
"hello-world",
@@ -49,7 +49,7 @@ 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/workflows-sdk`.
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`.
<Note>
@@ -68,10 +68,10 @@ export const transformHighlights = [
import {
createWorkflow,
transform,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import {
createProductsWorkflow,
} from "@medusajs/core-flows"
} from "@medusajs/medusa/core-flows"
type WorkflowInput = {
title: string
@@ -105,7 +105,7 @@ 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/workflows-sdk`.
To run a workflow in another based on a condition, use the when-then utility functions imported from `@medusajs/framework/workflows-sdk`.
<Note>
@@ -124,13 +124,13 @@ export const whenHighlights = [
import {
createWorkflow,
when,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import {
createProductsWorkflow,
} from "@medusajs/core-flows"
} from "@medusajs/medusa/core-flows"
import {
CreateProductWorkflowInputDTO,
} from "@medusajs/types"
} from "@medusajs/framework/types"
type WorkflowInput = {
product?: CreateProductWorkflowInputDTO
@@ -35,7 +35,7 @@ import {
createWorkflow,
WorkflowResponse,
StepResponse,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
const step1 = createStep("step-1", async () => {
return new StepResponse({})
@@ -114,11 +114,11 @@ export const successStatusHighlights = [
import {
Modules,
TransactionHandlerType,
} from "@medusajs/utils"
} from "@medusajs/framework/utils"
import {
StepResponse,
createStep,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
type SetStepSuccessStepInput = {
transactionId: string
@@ -232,11 +232,11 @@ export const failureStatusHighlights = [
import {
Modules,
TransactionHandlerType,
} from "@medusajs/utils"
} from "@medusajs/framework/utils"
import {
StepResponse,
createStep,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
type SetStepFailureStepInput = {
transactionId: string
@@ -288,8 +288,8 @@ import type { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import myWorkflow from "../../../workflows/hello-world"
import {
IWorkflowEngineService,
} from "@medusajs/types"
import { Modules } from "@medusajs/utils"
} from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
export async function GET(req: MedusaRequest, res: MedusaResponse) {
const { transaction, result } = await myWorkflow(req.scope).run()
@@ -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/workflows-sdk`.
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`.
The workflow waits until all steps passed to the `parallelize` function finish executing before continuing to the next step.
@@ -24,7 +24,7 @@ import {
createWorkflow,
WorkflowResponse,
parallelize,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import {
createProductStep,
getProductStep,
@@ -19,7 +19,7 @@ import {
createStep,
createWorkflow,
WorkflowResponse,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
const step1 = createStep(
{
@@ -43,7 +43,7 @@ import {
createWorkflow,
WorkflowResponse,
transform,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
// step imports...
const myWorkflow = createWorkflow(
@@ -62,7 +62,7 @@ const myWorkflow = createWorkflow(
)
```
The `transform` utility function is imported from `@medusajs/workflows-sdk`. It accepts two parameters:
The `transform` utility function is imported from `@medusajs/framework/workflows-sdk`. It 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.
@@ -84,7 +84,7 @@ import {
createWorkflow,
WorkflowResponse,
transform,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
// step imports...
type WorkflowInput = {
@@ -43,7 +43,7 @@ export const handlerHighlights = [
]
```ts title="src/workflows/hooks/product-created.ts" highlights={handlerHighlights}
import { createProductsWorkflow } from "@medusajs/core-flows"
import { createProductsWorkflow } from "@medusajs/medusa/core-flows"
createProductsWorkflow.hooks.productsCreated(
async ({ products }, { container }) => {
@@ -83,7 +83,7 @@ Since the hook handler is a step function, you can set its compensation function
For example:
```ts title="src/workflows/hooks/product-created.ts"
import { createProductsWorkflow } from "@medusajs/core-flows"
import { createProductsWorkflow } from "@medusajs/medusa/core-flows"
createProductsWorkflow.productCreated(
async ({ productId }, { container }) => {
@@ -108,7 +108,7 @@ It also accepts as a second parameter an object holding a `container` property t
Medusa's workflows pass in the hook's input an `additional_data` property:
```ts title="src/workflows/hooks/product-created.ts" highlights={[["4", "additional_data"]]}
import { createProductsWorkflow } from "@medusajs/core-flows"
import { createProductsWorkflow } from "@medusajs/medusa/core-flows"
createProductsWorkflow.hooks.productsCreated(
async ({ products, additional_data }, { container }) => {
@@ -131,7 +131,7 @@ You can also pass that additional data when executing the workflow. Pass it as a
```ts title="src/workflows/hooks/product-created.ts" highlights={[["10", "additional_data"]]}
import type { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { createProductsWorkflow } from "@medusajs/core-flows"
import { createProductsWorkflow } from "@medusajs/medusa/core-flows"
export async function POST(req: MedusaRequest, res: MedusaResponse) {
await createProductsWorkflow(req.scope).run({
@@ -31,7 +31,7 @@ import {
createStep,
createWorkflow,
WorkflowResponse,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
const step1 = createStep(
"step-1",
@@ -26,8 +26,8 @@ For example, you saw this code snippet in the [Medusa container chapter](../medu
```ts highlights={[["10"]]}
import type { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IProductModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { IProductModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
export const GET = async (
req: MedusaRequest,
@@ -50,6 +50,6 @@ When you resolve the `Modules.PRODUCT` (or `productModuleService`) registration
<Note title="Tip">
To resolve the main service of any commerce module, use the registration name defined in the `Modules` enum imported from `@medusajs/utils`.
To resolve the main service of any commerce module, use the registration name defined in the `Modules` enum imported from `@medusajs/framework/utils`.
</Note>
@@ -16,12 +16,12 @@ A data model is created in a module, and its record are managed in the database
## How to Create a Data Model?
A data model is created in a TypeScript or JavaScript file under a module's `models` directory. It's defined using the `model` utility imported from `@medusajs/utils`.
A data model is created in a TypeScript or JavaScript file under a module's `models` directory. It's defined using the `model` utility imported from `@medusajs/framework/utils`.
For example, create the file `src/modules/hello/models/my-custom.ts` with the following content:
```ts title="src/modules/hello/models/my-custom.ts"
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", {
id: model.id().primaryKey(),
@@ -85,13 +85,13 @@ For example:
export const highlights = [
["7", "container", "Recieve the Medusa Container in the object parameter."],
["10", "resolve", "Resolve the Product Module's main service."],
["10", "Modules.PRODUCT", "The module's registration name imported from `@medusajs/utils`."]
["10", "Modules.PRODUCT", "The module's registration name imported from `@medusajs/framework/utils`."]
]
```ts title="src/subscribers/product-created.ts" highlights={highlights}
import { SubscriberArgs, type SubscriberConfig } from "@medusajs/medusa"
import { IProductModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { IProductModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
export default async function productCreateHandler({
event: { data },
@@ -19,14 +19,14 @@ export const highlights = [
[
"10",
"Modules.PRODUCT",
"The resource registration name imported from `@medusajs/utils`.",
"The resource registration name imported from `@medusajs/framework/utils`.",
],
]
```ts highlights={highlights}
import type { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IProductModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { IProductModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
export const GET = async (
req: MedusaRequest,
@@ -52,7 +52,7 @@ For example, create the file `src/modules/hello/index.ts` with the following con
```ts title="src/modules/hello/index.ts" highlights={[["7", "", "The main service of the module."]]}
import HelloModuleService from "./service"
import { Module } from "@medusajs/utils"
import { Module } from "@medusajs/framework/utils"
export const HELLO_MODULE = "helloModuleService"
@@ -61,7 +61,7 @@ export default Module(HELLO_MODULE, {
})
```
You use the `Module` function imported from `@medusajs/utils` to create the module definition. It requires two parameters:
You use the `Module` function imported from `@medusajs/framework/utils` to create the module definition. It requires two parameters:
1. The module's name.
2. An object with a required property `service` indicating the module's main service.
@@ -87,15 +87,15 @@ For example:
export const highlights = [
["11", "resolve", "Resolve the Product Module's main service."],
["11", "Modules.PRODUCT", "The module's registration name imported from `@medusajs/utils`."]
["11", "Modules.PRODUCT", "The module's registration name imported from `@medusajs/framework/utils`."]
]
```ts title="src/jobs/hello-world.ts" highlights={highlights}
import {
IProductModuleService,
MedusaContainer,
} from "@medusajs/types"
import { Modules } from "@medusajs/utils"
} from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
export default async function myCustomJob(
container: MedusaContainer
+10 -10
View File
@@ -22,12 +22,12 @@ By using a workflow, you can track its execution's progress, provide roll-back l
### 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/workflows-sdk`.
A workflow is made of a series of steps. A step is created using the `createStep` utility function imported from `@medusajs/framework/workflows-sdk`.
Create the file `src/workflows/hello-world.ts` with the following content:
```ts title="src/workflows/hello-world.ts"
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
const step1 = createStep("step-1", async () => {
return new StepResponse(`Hello from step one!`)
@@ -59,7 +59,7 @@ import {
// other imports...
createWorkflow,
WorkflowResponse,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
// ...
@@ -127,8 +127,8 @@ To execute the workflow, invoke it passing the Medusa container as a parameter.
type SubscriberArgs,
} from "@medusajs/medusa"
import myWorkflow from "../workflows/hello-world"
import { Modules } from "@medusajs/utils"
import { IUserModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/framework/utils"
import { IUserModuleService } from "@medusajs/framework/types"
export default async function handleCustomerCreate({
event: { data },
@@ -160,7 +160,7 @@ To execute the workflow, invoke it passing the Medusa container as a parameter.
<CodeTab label="Scheduled Job" value="scheduled-job">
```ts title="src/jobs/message-daily.ts" highlights={[["7"], ["8"], ["9"], ["10"], ["11"], ["12"]]}
import { MedusaContainer } from "@medusajs/types"
import { MedusaContainer } from "@medusajs/framework/types"
import myWorkflow from "../workflows/hello-world"
export default async function myCustomJob(
@@ -230,7 +230,7 @@ export const highlights = [
[
"12",
"Modules.PRODUCT",
"The resource registration name imported from `@medusajs/utils`.",
"The resource registration name imported from `@medusajs/framework/utils`.",
],
]
@@ -240,9 +240,9 @@ import {
StepResponse,
createWorkflow,
WorkflowResponse,
} from "@medusajs/workflows-sdk"
import { IProductModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
} from "@medusajs/framework/workflows-sdk"
import { IProductModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
const step1 = createStep("step-1", async (_, context) => {
const productModuleService: IProductModuleService =
@@ -21,7 +21,7 @@ Start by creating the directory `src/modules/brand` that will hold the Brand Mod
To create a data model that represents a new `brand` table in the database, create the file `src/modules/brand/models/brand.ts` with the following content:
```ts title="src/modules/brand/models/brand.ts"
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
export const Brand = model.define("brand", {
id: model.id().primaryKey(),
@@ -44,7 +44,7 @@ export const serviceHighlights = [
]
```ts title="src/modules/brand/service.ts" highlights={serviceHighlights}
import { MedusaService } from "@medusajs/utils"
import { MedusaService } from "@medusajs/framework/utils"
import { Brand } from "./models/brand"
class BrandModuleService extends MedusaService({
@@ -56,7 +56,7 @@ class BrandModuleService extends MedusaService({
export default BrandModuleService
```
The `BrandModuleService` extends a `MedusaService` function imported from `@medusajs/utils` which is a service factory.
The `BrandModuleService` extends a `MedusaService` function imported from `@medusajs/framework/utils` which is a service factory.
The `MedusaService` function receives an object of the module's data models as a parameter, and generates methods to manage those data models, such as `createBrands` and `updateBrands`.
@@ -75,7 +75,7 @@ Find a reference of the generated methods in [this guide](!resources!/service-fa
To export the module's definition, create the file `src/modules/brand/index.ts` with the following content:
```ts title="src/modules/brand/index.ts"
import { Module } from "@medusajs/utils"
import { Module } from "@medusajs/framework/utils"
import BrandModuleService from "./service"
export const BRAND_MODULE = "brandModuleService"
@@ -45,7 +45,7 @@ Create the file `src/workflows/create-brand/index.ts` with the following content
import {
createWorkflow,
WorkflowResponse,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
export type CreateBrandInput = {
name: string
@@ -71,7 +71,7 @@ Create the file `src/workflows/create-brand/steps/create-brand.ts` with the foll
import {
createStep,
StepResponse,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import { CreateBrandInput } from ".."
import { BRAND_MODULE } from "../../../modules/brand"
import BrandModuleService from "../../../modules/brand/service"
@@ -34,7 +34,7 @@ export const highlights = [
```tsx title="src/admin/widgets/product-brand.tsx" highlights={highlights}
import { defineWidgetConfig } from "@medusajs/admin-sdk"
import { DetailWidgetProps, AdminProduct } from "@medusajs/types"
import { DetailWidgetProps, AdminProduct } from "@medusajs/framework/types"
import { useEffect, useState } from "react"
import { Container, Heading } from "@medusajs/ui"
@@ -29,11 +29,11 @@ export const stepHighlights = [
import {
createStep,
StepResponse,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import {
Modules,
ContainerRegistrationKeys,
} from "@medusajs/utils"
} from "@medusajs/framework/utils"
import { BRAND_MODULE } from "../../modules/brand"
type LinkProductToBrandStepInput = {
@@ -71,7 +71,7 @@ The `create` method accepts as a parameter an object whose properties are the na
<Note title="Tip">
Use the `Modules` enum imported from `@medusajs/utils` to for the commerce module's names.
Use the `Modules` enum imported from `@medusajs/framework/utils` to for the commerce module's names.
</Note>
@@ -23,7 +23,7 @@ This chapter covers how to define a link between the `Brand` and `Product`data m
]}
/>
Links are defined in a TypeScript or JavaScript file under the `src/links` directory. The file defines and exports the link using the `defineLink` function imported from `@medusajs/utils`.
Links are defined in a TypeScript or JavaScript file under the `src/links` directory. The file defines and exports the link using the `defineLink` function imported from `@medusajs/framework/utils`.
So, create the file `src/links/product-brand.ts` with the following content:
@@ -34,8 +34,8 @@ export const highlights = [
```ts title="src/links/product-brand.ts" highlights={highlights}
import BrandModule from "../modules/brand"
import ProductModule from "@medusajs/product"
import { defineLink } from "@medusajs/utils"
import ProductModule from "@medusajs/medusa/product"
import { defineLink } from "@medusajs/framework/utils"
export default defineLink(
{
@@ -86,9 +86,9 @@ export const hookHighlights = [
]
```ts title="src/workflows/hooks/created-product.ts" highlights={hookHighlights}
import { createProductsWorkflow } from "@medusajs/core-flows"
import { StepResponse } from "@medusajs/workflows-sdk"
import { Modules, ContainerRegistrationKeys } from "@medusajs/utils"
import { createProductsWorkflow } from "@medusajs/medusa/core-flows"
import { StepResponse } from "@medusajs/framework/workflows-sdk"
import { Modules, ContainerRegistrationKeys } from "@medusajs/framework/utils"
import { BRAND_MODULE } from "../../modules/brand"
import BrandModuleService from "../../modules/brand/service"
@@ -52,7 +52,7 @@ import {
} from "@medusajs/medusa"
import {
ContainerRegistrationKeys,
} from "@medusajs/utils"
} from "@medusajs/framework/utils"
export const GET = async (
req: MedusaRequest,
@@ -25,7 +25,7 @@ This chapter covers how to emit an event when a brand is created, listen to that
To handle brand-creation event, you'll emit a custom event when a brand is created.
In the `createBrandWorkflow` defined in `src/workflows/create-brand/index.ts`, use the `emitEventStep` helper step imported from `@medusajs/core-flows` after the `createBrandStep`:
In the `createBrandWorkflow` defined in `src/workflows/create-brand/index.ts`, use the `emitEventStep` helper step imported from `@medusajs/medusa/core-flows` after the `createBrandStep`:
export const eventHighlights = [
["13", "emitEventStep", "Emit an event."],
@@ -37,7 +37,7 @@ export const eventHighlights = [
// other imports...
import {
emitEventStep,
} from "@medusajs/core-flows"
} from "@medusajs/medusa/core-flows"
// ...
@@ -75,7 +75,7 @@ Create the file `src/workflows/sync-brand-to-system/index.ts` with the following
import {
createWorkflow,
WorkflowResponse,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
export type SyncBrandToSystemInput = {
id: string
@@ -104,7 +104,7 @@ export const stepHighlights = [
import {
createStep,
StepResponse,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import { SyncBrandToSystemInput } from ".."
import BrandModuleService from "../../../modules/brand/service"
import { BRAND_MODULE } from "../../../modules/brand"
@@ -39,7 +39,7 @@ To create the step that retrieves the brands from the third-party service, creat
import {
createStep,
StepResponse,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import BrandModuleService from "../../../modules/brand/service"
import { BRAND_MODULE } from "../../../modules/brand"
@@ -74,8 +74,8 @@ export const createBrandsHighlights = [
import {
createStep,
StepResponse,
} from "@medusajs/workflows-sdk"
import { InferTypeOf } from "@medusajs/types"
} from "@medusajs/framework/workflows-sdk"
import { InferTypeOf } from "@medusajs/framework/types"
import BrandModuleService from "../../../modules/brand/service"
import { BRAND_MODULE } from "../../../modules/brand"
import { Brand } from "../../../modules/brand/models/brand"
@@ -109,7 +109,7 @@ This step receives the brands to create as input.
<Note title="Tip">
Since a data model is a variable, use the `InferTypeOf` utility imported from `@medusajs/types` to infer its type.
Since a data model is a variable, use the `InferTypeOf` utility imported from `@medusajs/framework/types` to infer its type.
</Note>
@@ -131,8 +131,8 @@ export const updateBrandsHighlights = [
import {
createStep,
StepResponse,
} from "@medusajs/workflows-sdk"
import { InferTypeOf } from "@medusajs/types"
} from "@medusajs/framework/workflows-sdk"
import { InferTypeOf } from "@medusajs/framework/types"
import BrandModuleService from "../../../modules/brand/service"
import { BRAND_MODULE } from "../../../modules/brand"
import { Brand } from "../../../modules/brand/models/brand"
@@ -181,8 +181,8 @@ import {
createWorkflow,
WorkflowResponse,
transform,
} from "@medusajs/workflows-sdk"
import { InferTypeOf } from "@medusajs/types"
} from "@medusajs/framework/workflows-sdk"
import { InferTypeOf } from "@medusajs/framework/types"
import { retrieveBrandsFromSystemStep } from "./steps/retrieve-brands-from-system"
import { createBrandsStep } from "./steps/create-brands"
import { updateBrandsStep } from "./steps/update-brands"
@@ -206,7 +206,7 @@ Next, you need to identify which brands must be created or updated.
Since workflows are constructed internally and are only evaluated during execution, you can't access any data's value to perform data manipulation or checks.
Instead, use the `transform` utility function imported from `@medusajs/workflows-sdk`, which gives you access to the real-time values of the data to perfrom actions on them.
Instead, use the `transform` utility function imported from `@medusajs/framework/workflows-sdk`, which gives you access to the real-time values of the data to perfrom actions on them.
So, replace the `TODO` with the following:
@@ -275,7 +275,7 @@ Then, you return the created and updated brands.
To schedule a task that syncs brands from the third-party system, create a scheduled job at `src/jobs/sync-brands-from-system.ts`:
```ts title="src/jobs/sync-brands-from-system.ts"
import { MedusaContainer } from "@medusajs/types"
import { MedusaContainer } from "@medusajs/framework/types"
import { syncBrandsFromSystemWorkflow } from "../workflows/sync-brands-from-system"
export default async function (container: MedusaContainer) {
@@ -32,7 +32,7 @@ export const serviceHighlights = [
]
```ts title="src/modules/brand/services/client.ts" highlights={serviceHighlights}
import { Logger, ConfigModule } from "@medusajs/types"
import { Logger, ConfigModule } from "@medusajs/framework/types"
import { BRAND_MODULE } from ".."
export type BrandClientOptions = {
@@ -88,7 +88,7 @@ export const methodsHighlights = [
```ts title="src/modules/brand/services/client.ts" highlights={methodsHighlights}
// other imports...
import { InferTypeOf } from "@medusajs/types"
import { InferTypeOf } from "@medusajs/framework/types"
import { Brand } from "../models/brand"
export class BrandClient {
@@ -125,7 +125,7 @@ The `sendRequest` method is a dummy method to simulate sending a request to a th
You also add three methods that use the `sendRequest` method:
- `createBrand` that creates a brand in the third-party system. To reference a brand's type, you use the `InferTypeOf` utility imported from `@medusajs/types`. This transforms a data model, which is a variable, to its equivalent type.
- `createBrand` that creates a brand in the third-party system. To reference a brand's type, you use the `InferTypeOf` utility imported from `@medusajs/framework/types`. This transforms a data model, which is a variable, to its equivalent type.
- `deleteBrand` that deletes the brand in the third-party system.
- `retrieveBrands` to retrieve a brand from the third-party system.
@@ -27,7 +27,7 @@ export const highlights = [
```ts title="src/jobs/log-message.ts" highlights={highlights}
import { Logger } from "@medusajs/medusa"
import { MedusaContainer } from "@medusajs/types"
import { MedusaContainer } from "@medusajs/framework/types"
export default async function myCustomJob(
container: MedusaContainer
@@ -93,7 +93,7 @@ This runs your Medusa application and runs the tests available under the `src/in
Suppose you have a `hello` module whose main service extends the service factory, and that has the following model:
```ts title="src/modules/hello/models/my-custom.ts"
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", {
id: model.id().primaryKey(),
@@ -27,7 +27,7 @@ import {
createStep,
StepResponse,
WorkflowResponse,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
const step1 = createStep("step-1", () => {
return new StepResponse("Hello, World!")
@@ -22,7 +22,7 @@ In this chapter, find an example of writing an integration test for a module usi
Consider a `hello` module with a `HelloModuleService` that has a `getMessage` method:
```ts title="src/modules/hello/service.ts"
import { MedusaService } from "@medusajs/utils"
import { MedusaService } from "@medusajs/framework/utils"
import MyCustom from "./models/my-custom"
class HelloModuleService extends MedusaService({
@@ -105,7 +105,7 @@ For example:
```ts
import { moduleIntegrationTestRunner } from "medusa-test-utils"
import HelloModuleService from "../service"
import { model } from "@medusajs/utils"
import { model } from "@medusajs/framework/utils"
const DummyModel = model.define("dummy_model", {
id: model.id().primaryKey(),
@@ -15,7 +15,7 @@ Medusa provides a `medusa-test-utils` package with utility tools to create integ
To use the `medusa-test-utils` package, install it as a `devDependency`:
```bash npm2yarn
npm install --save-dev medusa-test-utils@preview
npm install --save-dev medusa-test-utils@rc
```
---
@@ -41,7 +41,7 @@ npm install --save-dev jest @types/jest @swc/jest
Then, create the file `jest.config.js` with the following content:
```js title="jest.config.js"
const { loadEnv } = require("@medusajs/utils")
const { loadEnv } = require("@medusajs/framework/utils")
loadEnv("test", process.cwd())
module.exports = {
+1 -1
View File
@@ -39,7 +39,7 @@ With these tools, you save time you would spend with other platforms on maintain
Create your first Medusa store by running the following command:
```bash
npx create-medusa-app@preview
npx create-medusa-app@rc
```
---
+55 -55
View File
@@ -1,110 +1,110 @@
export const generatedEditDates = {
"app/basics/scheduled-jobs/page.mdx": "2024-08-05T07:24:27+00:00",
"app/basics/workflows/page.mdx": "2024-09-18T08:01:24.328Z",
"app/basics/scheduled-jobs/page.mdx": "2024-09-30T08:43:53.132Z",
"app/basics/workflows/page.mdx": "2024-09-30T08:43:53.132Z",
"app/deployment/page.mdx": "2024-08-05T07:24:05+00:00",
"app/page.mdx": "2024-09-03T07:09:09.034Z",
"app/basics/modules-and-services/page.mdx": "2024-09-11T10:48:35.195Z",
"app/basics/commerce-modules/page.mdx": "2024-09-03T07:48:48.148Z",
"app/advanced-development/workflows/retry-failed-steps/page.mdx": "2024-07-31T17:01:33+03:00",
"app/advanced-development/workflows/workflow-hooks/page.mdx": "2024-09-18T12:27:15.321Z",
"app/basics/modules-and-services/page.mdx": "2024-09-30T08:43:53.132Z",
"app/basics/commerce-modules/page.mdx": "2024-09-30T08:43:53.131Z",
"app/advanced-development/workflows/retry-failed-steps/page.mdx": "2024-09-30T08:43:53.130Z",
"app/advanced-development/workflows/workflow-hooks/page.mdx": "2024-09-30T08:43:53.131Z",
"app/cheatsheet/page.mdx": "2024-07-11T13:53:40+03:00",
"app/debugging-and-testing/logging/page.mdx": "2024-07-04T17:26:03+03:00",
"app/debugging-and-testing/logging/page.mdx": "2024-09-30T08:43:53.135Z",
"app/more-resources/page.mdx": "2024-07-04T17:26:03+03:00",
"app/storefront-development/page.mdx": "2024-09-11T10:58:59.290Z",
"app/storefront-development/nextjs-starter/page.mdx": "2024-07-04T17:26:03+03:00",
"app/basics/page.mdx": "2024-09-03T07:11:06.879Z",
"app/basics/admin-customizations/page.mdx": "2024-09-03T08:07:35.584Z",
"app/advanced-development/workflows/workflow-timeout/page.mdx": "2024-09-18T13:03:13.095Z",
"app/advanced-development/workflows/parallel-steps/page.mdx": "2024-09-18T12:56:50.436Z",
"app/advanced-development/workflows/workflow-timeout/page.mdx": "2024-09-30T08:43:53.131Z",
"app/advanced-development/workflows/parallel-steps/page.mdx": "2024-09-30T08:43:53.130Z",
"app/advanced-development/page.mdx": "2024-07-04T17:26:03+03:00",
"app/first-customizations/page.mdx": "2024-09-11T10:48:42.374Z",
"app/debugging-and-testing/page.mdx": "2024-05-03T17:36:38+03:00",
"app/basics/medusa-container/page.mdx": "2024-09-03T07:31:40.214Z",
"app/basics/medusa-container/page.mdx": "2024-09-30T08:43:53.132Z",
"app/basics/project-directories-files/page.mdx": "2024-07-04T17:26:03+03:00",
"app/basics/api-routes/page.mdx": "2024-09-11T10:48:31.777Z",
"app/basics/modules-directory-structure/page.mdx": "2024-05-07T18:00:28+02:00",
"app/advanced-development/workflows/access-workflow-errors/page.mdx": "2024-09-18T12:54:04.695Z",
"app/basics/events-and-subscribers/page.mdx": "2024-09-03T08:01:30.986Z",
"app/advanced-development/modules/container/page.mdx": "2024-08-05T07:23:49+00:00",
"app/basics/data-models/page.mdx": "2024-09-19T07:24:38.584Z",
"app/advanced-development/workflows/execute-another-workflow/page.mdx": "2024-09-18T13:29:11.644Z",
"app/basics/events-and-subscribers/page.mdx": "2024-09-30T08:43:53.131Z",
"app/advanced-development/modules/container/page.mdx": "2024-09-30T08:43:53.125Z",
"app/basics/data-models/page.mdx": "2024-09-30T08:43:53.131Z",
"app/advanced-development/workflows/execute-another-workflow/page.mdx": "2024-09-30T08:43:53.129Z",
"app/basics/loaders/page.mdx": "2024-09-03T08:00:45.993Z",
"app/advanced-development/admin/widgets/page.mdx": "2024-08-06T09:44:22+02:00",
"app/advanced-development/admin/widgets/page.mdx": "2024-09-30T08:43:53.120Z",
"app/advanced-development/data-models/page.mdx": "2024-09-19T07:26:43.535Z",
"app/advanced-development/modules/remote-link/page.mdx": "2024-07-24T09:16:01+02:00",
"app/advanced-development/api-routes/protected-routes/page.mdx": "2024-09-11T10:45:44.293Z",
"app/advanced-development/workflows/add-workflow-hook/page.mdx": "2024-09-18T12:52:24.511Z",
"app/advanced-development/modules/remote-link/page.mdx": "2024-09-30T08:43:53.127Z",
"app/advanced-development/api-routes/protected-routes/page.mdx": "2024-09-30T08:43:53.121Z",
"app/advanced-development/workflows/add-workflow-hook/page.mdx": "2024-09-30T08:43:53.128Z",
"app/advanced-development/events-and-subscribers/data-payload/page.mdx": "2024-07-16T17:12:05+01:00",
"app/advanced-development/data-models/default-properties/page.mdx": "2024-09-19T07:32:06.118Z",
"app/advanced-development/workflows/advanced-example/page.mdx": "2024-09-11T10:46:59.975Z",
"app/advanced-development/events-and-subscribers/emit-event/page.mdx": "2024-09-10T11:39:51.168Z",
"app/advanced-development/workflows/conditions/page.mdx": "2024-09-18T08:52:40.755Z",
"app/advanced-development/events-and-subscribers/emit-event/page.mdx": "2024-09-30T08:43:53.125Z",
"app/advanced-development/workflows/conditions/page.mdx": "2024-09-30T08:43:53.128Z",
"app/advanced-development/modules/module-link-directions/page.mdx": "2024-07-24T09:16:01+02:00",
"app/advanced-development/admin/page.mdx": "2024-05-29T13:50:19+03:00",
"app/advanced-development/workflows/long-running-workflow/page.mdx": "2024-09-18T13:26:19.706Z",
"app/advanced-development/workflows/constructor-constraints/page.mdx": "2024-09-18T08:58:08.705Z",
"app/advanced-development/workflows/long-running-workflow/page.mdx": "2024-09-30T08:43:53.129Z",
"app/advanced-development/workflows/constructor-constraints/page.mdx": "2024-09-30T08:43:53.128Z",
"app/advanced-development/data-models/write-migration/page.mdx": "2024-07-15T17:46:10+02:00",
"app/advanced-development/data-models/manage-relationships/page.mdx": "2024-09-10T11:39:51.167Z",
"app/advanced-development/modules/remote-query/page.mdx": "2024-07-21T21:20:24+02:00",
"app/advanced-development/modules/options/page.mdx": "2024-08-05T07:23:49+00:00",
"app/advanced-development/data-models/relationships/page.mdx": "2024-09-11T11:28:55.494Z",
"app/advanced-development/workflows/compensation-function/page.mdx": "2024-09-18T09:13:11.941Z",
"app/advanced-development/modules/service-factory/page.mdx": "2024-07-26T14:40:56+00:00",
"app/advanced-development/data-models/primary-key/page.mdx": "2024-07-02T12:34:44+03:00",
"app/advanced-development/modules/module-links/page.mdx": "2024-07-24T09:16:01+02:00",
"app/advanced-development/data-models/searchable-property/page.mdx": "2024-09-19T08:48:53.599Z",
"app/advanced-development/modules/options/page.mdx": "2024-09-30T08:43:53.126Z",
"app/advanced-development/data-models/relationships/page.mdx": "2024-09-30T08:43:53.125Z",
"app/advanced-development/workflows/compensation-function/page.mdx": "2024-09-30T08:43:53.128Z",
"app/advanced-development/modules/service-factory/page.mdx": "2024-09-30T08:43:53.127Z",
"app/advanced-development/data-models/primary-key/page.mdx": "2024-09-30T08:43:53.123Z",
"app/advanced-development/modules/module-links/page.mdx": "2024-09-30T08:43:53.126Z",
"app/advanced-development/data-models/searchable-property/page.mdx": "2024-09-30T08:43:53.125Z",
"app/advanced-development/scheduled-jobs/execution-number/page.mdx": "2024-07-02T09:41:15+00:00",
"app/advanced-development/api-routes/parameters/page.mdx": "2024-09-11T10:44:13.491Z",
"app/advanced-development/api-routes/http-methods/page.mdx": "2024-09-11T10:43:33.169Z",
"app/advanced-development/admin/tips/page.mdx": "2024-09-10T11:39:51.165Z",
"app/advanced-development/api-routes/cors/page.mdx": "2024-09-04T08:24:47.068Z",
"app/advanced-development/api-routes/cors/page.mdx": "2024-09-30T08:43:53.121Z",
"app/advanced-development/admin/ui-routes/page.mdx": "2024-08-06T09:44:22+02:00",
"app/advanced-development/api-routes/middlewares/page.mdx": "2024-09-11T10:45:31.861Z",
"app/advanced-development/modules/isolation/page.mdx": "2024-07-04T17:26:03+03:00",
"app/advanced-development/data-models/configure-properties/page.mdx": "2024-07-04T17:26:03+03:00",
"app/advanced-development/data-models/index/page.mdx": "2024-09-19T08:47:12.961Z",
"app/advanced-development/custom-cli-scripts/page.mdx": "2024-07-04T17:26:03+03:00",
"app/advanced-development/data-models/property-types/page.mdx": "2024-09-19T07:31:20.696Z",
"app/debugging-and-testing/testing-tools/integration-tests/api-routes/page.mdx": "2024-09-11T10:48:09.593Z",
"app/advanced-development/data-models/configure-properties/page.mdx": "2024-09-30T08:43:53.122Z",
"app/advanced-development/data-models/index/page.mdx": "2024-09-30T08:43:53.122Z",
"app/advanced-development/custom-cli-scripts/page.mdx": "2024-09-30T08:43:53.122Z",
"app/advanced-development/data-models/property-types/page.mdx": "2024-09-30T08:43:53.124Z",
"app/debugging-and-testing/testing-tools/integration-tests/api-routes/page.mdx": "2024-09-30T08:43:53.136Z",
"app/debugging-and-testing/testing-tools/integration-tests/page.mdx": "2024-09-10T11:39:51.170Z",
"app/debugging-and-testing/testing-tools/integration-tests/workflows/page.mdx": "2024-09-10T11:39:51.171Z",
"app/debugging-and-testing/testing-tools/page.mdx": "2024-09-10T11:39:51.172Z",
"app/debugging-and-testing/testing-tools/integration-tests/workflows/page.mdx": "2024-09-30T08:43:53.139Z",
"app/debugging-and-testing/testing-tools/page.mdx": "2024-09-30T08:43:53.139Z",
"app/debugging-and-testing/testing-tools/unit-tests/module-example/page.mdx": "2024-09-02T11:04:27.232Z",
"app/debugging-and-testing/testing-tools/unit-tests/page.mdx": "2024-09-02T11:03:26.997Z",
"app/advanced-development/modules/service-constraints/page.mdx": "2024-09-04T15:37:04.166Z",
"app/advanced-development/modules/service-constraints/page.mdx": "2024-09-30T08:43:53.127Z",
"app/advanced-development/api-routes/page.mdx": "2024-09-04T09:36:33.961Z",
"app/advanced-development/api-routes/responses/page.mdx": "2024-09-11T10:44:37.016Z",
"app/advanced-development/api-routes/validation/page.mdx": "2024-09-11T10:46:31.476Z",
"app/advanced-development/api-routes/errors/page.mdx": "2024-09-10T11:39:51.166Z",
"app/advanced-development/api-routes/errors/page.mdx": "2024-09-30T08:43:53.121Z",
"app/advanced-development/admin/constraints/page.mdx": "2024-09-10T11:39:51.165Z",
"app/advanced-development/modules/query/page.mdx": "2024-09-11T10:46:49.512Z",
"app/debugging-and-testing/testing-tools/modules-tests/module-example/page.mdx": "2024-09-10T11:39:51.171Z",
"app/debugging-and-testing/testing-tools/modules-tests/page.mdx": "2024-09-10T11:39:51.171Z",
"app/advanced-development/modules/query/page.mdx": "2024-09-30T08:43:53.127Z",
"app/debugging-and-testing/testing-tools/modules-tests/module-example/page.mdx": "2024-09-30T08:43:53.139Z",
"app/debugging-and-testing/testing-tools/modules-tests/page.mdx": "2024-09-30T08:43:53.139Z",
"app/debugging-and-testing/instrumentation/page.mdx": "2024-09-17T08:53:15.910Z",
"app/advanced-development/api-routes/additional-data/page.mdx": "2024-09-18T12:22:26.063Z",
"app/advanced-development/api-routes/additional-data/page.mdx": "2024-09-30T08:43:53.120Z",
"app/advanced-development/workflows/page.mdx": "2024-09-18T08:00:57.364Z",
"app/advanced-development/workflows/variable-manipulation/page.mdx": "2024-09-18T09:03:20.805Z",
"app/advanced-development/workflows/variable-manipulation/page.mdx": "2024-09-30T08:43:53.130Z",
"app/customization/custom-features/api-route/page.mdx": "2024-09-12T12:42:34.201Z",
"app/customization/custom-features/module/page.mdx": "2024-09-12T12:39:37.928Z",
"app/customization/custom-features/workflow/page.mdx": "2024-09-12T12:40:39.582Z",
"app/customization/extend-models/create-links/page.mdx": "2024-09-26T08:31:08.177Z",
"app/customization/extend-models/extend-create-product/page.mdx": "2024-09-12T12:43:57.702Z",
"app/customization/custom-features/module/page.mdx": "2024-09-30T08:43:53.133Z",
"app/customization/custom-features/workflow/page.mdx": "2024-09-30T08:43:53.133Z",
"app/customization/extend-models/create-links/page.mdx": "2024-09-30T08:43:53.133Z",
"app/customization/extend-models/extend-create-product/page.mdx": "2024-09-30T08:43:53.134Z",
"app/customization/custom-features/page.mdx": "2024-09-12T11:18:13.271Z",
"app/customization/customize-admin/page.mdx": "2024-09-12T12:25:29.853Z",
"app/customization/customize-admin/route/page.mdx": "2024-09-12T12:45:39.258Z",
"app/customization/customize-admin/widget/page.mdx": "2024-09-12T12:26:36.013Z",
"app/customization/extend-models/define-link/page.mdx": "2024-09-12T12:38:53.230Z",
"app/customization/customize-admin/widget/page.mdx": "2024-09-30T08:43:53.133Z",
"app/customization/extend-models/define-link/page.mdx": "2024-09-30T08:43:53.134Z",
"app/customization/extend-models/page.mdx": "2024-09-12T12:38:57.394Z",
"app/customization/extend-models/query-linked-records/page.mdx": "2024-09-12T12:44:41.089Z",
"app/customization/integrate-systems/handle-event/page.mdx": "2024-09-26T08:34:57.278Z",
"app/customization/extend-models/query-linked-records/page.mdx": "2024-09-30T08:43:53.134Z",
"app/customization/integrate-systems/handle-event/page.mdx": "2024-09-30T08:43:53.135Z",
"app/customization/integrate-systems/page.mdx": "2024-09-12T12:33:29.827Z",
"app/customization/integrate-systems/schedule-task/page.mdx": "2024-09-26T08:40:26.509Z",
"app/customization/integrate-systems/service/page.mdx": "2024-09-26T08:34:30.313Z",
"app/customization/integrate-systems/schedule-task/page.mdx": "2024-09-30T08:43:53.135Z",
"app/customization/integrate-systems/service/page.mdx": "2024-09-30T08:43:53.135Z",
"app/customization/next-steps/page.mdx": "2024-09-12T10:50:04.873Z",
"app/customization/page.mdx": "2024-09-12T11:16:18.504Z",
"app/more-resources/cheatsheet/page.mdx": "2024-07-11T16:11:26.480Z",
"app/more-resources/examples/page.mdx": "2024-09-19T10:30:30.398Z",
"app/architecture/architectural-modules/page.mdx": "2024-09-23T12:51:04.520Z",
"app/architecture/overview/page.mdx": "2024-09-23T12:55:01.339Z",
"app/advanced-development/data-models/infer-type/page.mdx": "2024-09-26T08:28:13.041Z"
"app/advanced-development/data-models/infer-type/page.mdx": "2024-09-30T08:43:53.123Z"
}