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 authored and GitHub committed 2024-10-01 11:03:42 +02:00
1 parent c726ed54f5
commit 2e16949979
196 files changed
+1379 -1491

No files matched your search

@@ -94,7 +94,7 @@ import { Container, Heading } from "@medusajs/ui"
import { import {
DetailWidgetProps, DetailWidgetProps,
AdminProduct, AdminProduct,
} from "@medusajs/types" } from "@medusajs/framework/types"
// The widget // The widget
const ProductWidget = ({ 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: To do that, create the file `src/workflows/hooks/product-created.ts` with the following content:
```ts title="src/workflows/hooks/product-created.ts" ```ts title="src/workflows/hooks/product-created.ts"
import { StepResponse } from "@medusajs/workflows-sdk" import { StepResponse } from "@medusajs/framework/workflows-sdk"
import { createProductsWorkflow } from "@medusajs/core-flows" import { createProductsWorkflow } from "@medusajs/medusa/core-flows"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
createProductsWorkflow.hooks.productsCreated( createProductsWorkflow.hooks.productsCreated(
async ({ products, additional_data }, { container }) => { async ({ products, additional_data }, { container }) => {
@@ -87,8 +87,8 @@ import type {
MedusaRequest, MedusaRequest,
MedusaResponse, MedusaResponse,
} from "@medusajs/medusa" } from "@medusajs/medusa"
import { ConfigModule } from "@medusajs/types" import { ConfigModule } from "@medusajs/framework/types"
import { parseCorsOrigins } from "@medusajs/utils" import { parseCorsOrigins } from "@medusajs/framework/utils"
import cors from "cors" import cors from "cors"
export default defineMiddlewares({ export default defineMiddlewares({
@@ -10,7 +10,7 @@ In this guide, you'll learn how to throw errors in your Medusa application, how
## Throw MedusaError ## 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. 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 ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { MedusaError } from "@medusajs/utils" import { MedusaError } from "@medusajs/framework/utils"
export const GET = async ( export const GET = async (
req: MedusaRequest, req: MedusaRequest,
@@ -258,7 +258,7 @@ import {
MedusaRequest, MedusaRequest,
MedusaResponse, MedusaResponse,
} from "@medusajs/medusa" } from "@medusajs/medusa"
import { MedusaError } from "@medusajs/utils" import { MedusaError } from "@medusajs/framework/utils"
export default defineMiddlewares({ export default defineMiddlewares({
errorHandler: ( errorHandler: (
@@ -125,8 +125,8 @@ import type {
AuthenticatedMedusaRequest, AuthenticatedMedusaRequest,
MedusaResponse, MedusaResponse,
} from "@medusajs/medusa" } from "@medusajs/medusa"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
import { ICustomerModuleService } from "@medusajs/types" import { ICustomerModuleService } from "@medusajs/framework/types"
export const GET = async ( export const GET = async (
req: AuthenticatedMedusaRequest, req: AuthenticatedMedusaRequest,
@@ -160,8 +160,8 @@ import type {
AuthenticatedMedusaRequest, AuthenticatedMedusaRequest,
MedusaResponse, MedusaResponse,
} from "@medusajs/medusa" } from "@medusajs/medusa"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
import { IUserModuleService } from "@medusajs/types" import { IUserModuleService } from "@medusajs/framework/types"
export const GET = async ( export const GET = async (
req: AuthenticatedMedusaRequest, req: AuthenticatedMedusaRequest,
@@ -22,8 +22,8 @@ For example, create the file `src/scripts/my-script.ts` with the following conte
import { import {
ExecArgs, ExecArgs,
IProductModuleService, IProductModuleService,
} from "@medusajs/types" } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export default async function myScript({ container }: ExecArgs) { export default async function myScript({ container }: ExecArgs) {
const productModuleService: IProductModuleService = container.resolve( const productModuleService: IProductModuleService = container.resolve(
@@ -58,7 +58,7 @@ Your script can accept arguments from the command line. Arguments are passed to
For example: For example:
```ts ```ts
import { ExecArgs } from "@medusajs/types" import { ExecArgs } from "@medusajs/framework/types"
export default async function myScript({ args }: ExecArgs) { export default async function myScript({ args }: ExecArgs) {
console.log(`The arguments you passed: ${args}`) console.log(`The arguments you passed: ${args}`)
@@ -18,7 +18,7 @@ export const defaultHighlights = [
] ]
```ts highlights={defaultHighlights} ```ts highlights={defaultHighlights}
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", { const MyCustom = model.define("my_custom", {
color: model color: model
@@ -48,7 +48,7 @@ export const nullableHighlights = [
] ]
```ts highlights={nullableHighlights} ```ts highlights={nullableHighlights}
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", { const MyCustom = model.define("my_custom", {
price: model.bigNumber().nullable(), price: model.bigNumber().nullable(),
@@ -71,7 +71,7 @@ export const uniqueHighlights = [
] ]
```ts highlights={uniqueHighlights} ```ts highlights={uniqueHighlights}
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const User = model.define("user", { const User = model.define("user", {
email: model.text().unique(), email: model.text().unique(),
@@ -18,7 +18,7 @@ export const highlights = [
] ]
```ts highlights={highlights} ```ts highlights={highlights}
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", { const MyCustom = model.define("my_custom", {
id: model.id().primaryKey(), id: model.id().primaryKey(),
@@ -48,7 +48,7 @@ export const dataModelIndexHighlights = [
] ]
```ts highlights={dataModelIndexHighlights} ```ts highlights={dataModelIndexHighlights}
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", { const MyCustom = model.define("my_custom", {
id: model.id().primaryKey(), id: model.id().primaryKey(),
@@ -77,7 +77,7 @@ export const conditionHighlights = [
] ]
```ts highlights={conditionHighlights} ```ts highlights={conditionHighlights}
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", { const MyCustom = model.define("my_custom", {
id: model.id().primaryKey(), id: model.id().primaryKey(),
@@ -106,7 +106,7 @@ export const negationHighlights = [
] ]
```ts highlights={negationHighlights} ```ts highlights={negationHighlights}
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", { const MyCustom = model.define("my_custom", {
id: model.id().primaryKey(), id: model.id().primaryKey(),
@@ -141,7 +141,7 @@ export const uniqueHighlights = [
] ]
```ts highlights={uniqueHighlights} ```ts highlights={uniqueHighlights}
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", { const MyCustom = model.define("my_custom", {
id: model.id().primaryKey(), 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. 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: For example:
```ts ```ts
import { InferTypeOf } from "@medusajs/types" import { InferTypeOf } from "@medusajs/framework/types"
import { MyCustom } from "../models/my-custom" // relative path to the model import { MyCustom } from "../models/my-custom" // relative path to the model
export type MyCustom = InferTypeOf<typeof MyCustom> 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" ```ts title="Example Service"
// other imports... // other imports...
import { InferTypeOf } from "@medusajs/types" import { InferTypeOf } from "@medusajs/framework/types"
import { MyCustom } from "../models/my-custom" import { MyCustom } from "../models/my-custom"
type MyCustom = InferTypeOf<typeof MyCustom> type MyCustom = InferTypeOf<typeof MyCustom>
@@ -17,7 +17,7 @@ export const highlights = [
] ]
```ts highlights={highlights} ```ts highlights={highlights}
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", { const MyCustom = model.define("my_custom", {
id: model.id().primaryKey(), id: model.id().primaryKey(),
@@ -6,7 +6,7 @@ export const metadata = {
In this chapter, you’ll learn about the types of properties in a data model’s schema. In this chapter, you’ll learn about the types of properties in a data model’s 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 ## id
@@ -17,7 +17,7 @@ For example:
export const idHighlights = [["4", ".id()", "Define an `id` property."]] export const idHighlights = [["4", ".id()", "Define an `id` property."]]
```ts highlights={idHighlights} ```ts highlights={idHighlights}
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", { const MyCustom = model.define("my_custom", {
id: model.id(), id: model.id(),
@@ -38,7 +38,7 @@ For example:
export const textHighlights = [["4", "text", "Define a `text` property."]] export const textHighlights = [["4", "text", "Define a `text` property."]]
```ts highlights={textHighlights} ```ts highlights={textHighlights}
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", { const MyCustom = model.define("my_custom", {
name: model.text(), name: model.text(),
@@ -59,7 +59,7 @@ For example:
export const numberHighlights = [["4", "number", "Define a `number` property."]] export const numberHighlights = [["4", "number", "Define a `number` property."]]
```ts highlights={numberHighlights} ```ts highlights={numberHighlights}
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", { const MyCustom = model.define("my_custom", {
age: model.number(), age: model.number(),
@@ -80,7 +80,7 @@ For example:
export const bigNumberHighlights = [["4", "bigNumber", "Define a `bigNumber` property."]] export const bigNumberHighlights = [["4", "bigNumber", "Define a `bigNumber` property."]]
```ts highlights={bigNumberHighlights} ```ts highlights={bigNumberHighlights}
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", { const MyCustom = model.define("my_custom", {
price: model.bigNumber(), price: model.bigNumber(),
@@ -101,7 +101,7 @@ For example:
export const booleanHighlights = [["4", "boolean", "Define a `boolean` property."]] export const booleanHighlights = [["4", "boolean", "Define a `boolean` property."]]
```ts highlights={booleanHighlights} ```ts highlights={booleanHighlights}
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", { const MyCustom = model.define("my_custom", {
hasAccount: model.boolean(), hasAccount: model.boolean(),
@@ -122,7 +122,7 @@ For example:
export const enumHighlights = [["4", "enum", "Define a `enum` property."]] export const enumHighlights = [["4", "enum", "Define a `enum` property."]]
```ts highlights={enumHighlights} ```ts highlights={enumHighlights}
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", { const MyCustom = model.define("my_custom", {
color: model.enum(["black", "white"]), color: model.enum(["black", "white"]),
@@ -145,7 +145,7 @@ For example:
export const dateTimeHighlights = [["4", "dateTime", "Define a `dateTime` property."]] export const dateTimeHighlights = [["4", "dateTime", "Define a `dateTime` property."]]
```ts highlights={dateTimeHighlights} ```ts highlights={dateTimeHighlights}
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", { const MyCustom = model.define("my_custom", {
date_of_birth: model.dateTime(), date_of_birth: model.dateTime(),
@@ -166,7 +166,7 @@ For example:
export const jsonHighlights = [["4", "json", "Define a `json` property."]] export const jsonHighlights = [["4", "json", "Define a `json` property."]]
```ts highlights={jsonHighlights} ```ts highlights={jsonHighlights}
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", { const MyCustom = model.define("my_custom", {
metadata: model.json(), metadata: model.json(),
@@ -187,7 +187,7 @@ For example:
export const arrHightlights = [["4", "array", "Define an `array` property."]] export const arrHightlights = [["4", "array", "Define an `array` property."]]
```ts highlights={arrHightlights} ```ts highlights={arrHightlights}
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", { const MyCustom = model.define("my_custom", {
names: model.array(), names: model.array(),
@@ -46,7 +46,7 @@ export const oneToOneHighlights = [
] ]
```ts highlights={oneToOneHighlights} ```ts highlights={oneToOneHighlights}
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const User = model.define("user", { const User = model.define("user", {
id: model.id().primaryKey(), id: model.id().primaryKey(),
@@ -100,7 +100,7 @@ export const oneToManyHighlights = [
] ]
```ts highlights={oneToManyHighlights} ```ts highlights={oneToManyHighlights}
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const Store = model.define("store", { const Store = model.define("store", {
id: model.id().primaryKey(), id: model.id().primaryKey(),
@@ -146,7 +146,7 @@ export const manyToManyHighlights = [
] ]
```ts highlights={manyToManyHighlights} ```ts highlights={manyToManyHighlights}
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const Order = model.define("order", { const Order = model.define("order", {
id: model.id().primaryKey(), id: model.id().primaryKey(),
@@ -193,7 +193,7 @@ export const relationNameHighlights = [
] ]
```ts highlights={relationNameHighlights} ```ts highlights={relationNameHighlights}
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const User = model.define("user", { const User = model.define("user", {
id: model.id().primaryKey(), id: model.id().primaryKey(),
@@ -229,7 +229,7 @@ export const highlights = [
] ]
```ts highlights={highlights} ```ts highlights={highlights}
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const Store = model.define("store", { const Store = model.define("store", {
id: model.id().primaryKey(), id: model.id().primaryKey(),
@@ -25,7 +25,7 @@ export const searchableHighlights = [
] ]
```ts highlights={searchableHighlights} ```ts highlights={searchableHighlights}
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", { const MyCustom = model.define("my_custom", {
name: model.text().searchable(), 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 ## 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. 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} ```ts highlights={highlights}
import { import {
createWorkflow, createWorkflow,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
import { import {
emitEventStep, emitEventStep,
} from "@medusajs/core-flows" } from "@medusajs/medusa/core-flows"
const helloWorldWorkflow = createWorkflow( const helloWorldWorkflow = createWorkflow(
"hello-world", "hello-world",
@@ -53,7 +53,7 @@ For example:
```ts highlights={[["9"]]} ```ts highlights={[["9"]]}
import { import {
LoaderOptions, LoaderOptions,
} from "@medusajs/modules-sdk" } from "@medusajs/framework/modules-sdk"
import { Logger } from "@medusajs/medusa" import { Logger } from "@medusajs/medusa"
export default async function helloWorldLoader({ 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 ### 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: For example:
@@ -43,8 +43,8 @@ export const highlights = [
```ts title="src/links/hello-product.ts" highlights={highlights} ```ts title="src/links/hello-product.ts" highlights={highlights}
import HelloModule from "../modules/hello" import HelloModule from "../modules/hello"
import ProductModule from "@medusajs/product" import ProductModule from "@medusajs/medusa/product"
import { defineLink } from "@medusajs/utils" import { defineLink } from "@medusajs/framework/utils"
export default defineLink( export default defineLink(
ProductModule.linkable.product, ProductModule.linkable.product,
@@ -84,8 +84,8 @@ For example:
```ts ```ts
import HelloModule from "../modules/hello" import HelloModule from "../modules/hello"
import ProductModule from "@medusajs/product" import ProductModule from "@medusajs/medusa/product"
import { defineLink } from "@medusajs/utils" import { defineLink } from "@medusajs/framework/utils"
export default defineLink( export default defineLink(
ProductModule.linkable.product, ProductModule.linkable.product,
@@ -130,8 +130,8 @@ For example:
```ts ```ts
import HelloModule from "../modules/hello" import HelloModule from "../modules/hello"
import ProductModule from "@medusajs/product" import ProductModule from "@medusajs/medusa/product"
import { defineLink } from "@medusajs/utils" import { defineLink } from "@medusajs/framework/utils"
export default defineLink( export default defineLink(
ProductModule.linkable.product, ProductModule.linkable.product,
@@ -47,7 +47,7 @@ The module’s main service receives the module options as a second parameter.
For example: For example:
```ts title="src/modules/hello/service.ts" highlights={[["12"], ["14", "options?: ModuleOptions"], ["17"], ["18"], ["19"]]} ```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" import MyCustom from "./models/my-custom"
// recommended to define type in another file // 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"]]} ```ts title="src/modules/hello/loaders/hello-world.ts" highlights={[["11"], ["12", "ModuleOptions", "The type of expected module options."], ["16"]]}
import { import {
LoaderOptions, LoaderOptions,
} from "@medusajs/modules-sdk" } from "@medusajs/framework/modules-sdk"
// recommended to define type in another file // recommended to define type in another file
type ModuleOptions = { type ModuleOptions = {
@@ -40,7 +40,7 @@ import {
} from "@medusajs/medusa" } from "@medusajs/medusa"
import { import {
ContainerRegistrationKeys, ContainerRegistrationKeys,
} from "@medusajs/utils" } from "@medusajs/framework/utils"
export const GET = async ( export const GET = async (
req: MedusaRequest, req: MedusaRequest,
@@ -21,10 +21,10 @@ import {
} from "@medusajs/medusa" } from "@medusajs/medusa"
import { import {
ContainerRegistrationKeys, ContainerRegistrationKeys,
} from "@medusajs/utils" } from "@medusajs/framework/utils"
import { import {
RemoteLink, RemoteLink,
} from "@medusajs/modules-sdk" } from "@medusajs/framework/modules-sdk"
export async function POST( export async function POST(
req: MedusaRequest, req: MedusaRequest,
@@ -49,7 +49,7 @@ To create a link between records of two data models, use the `create` method of
For example: For example:
```ts ```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: For example:
```ts ```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: For example:
```ts ```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: For example:
```ts ```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. 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."]]} ```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" import MyCustom from "./models/my-custom"
class HelloModuleService extends MedusaService({ class HelloModuleService extends MedusaService({
@@ -34,7 +34,7 @@ export const highlights = [
] ]
```ts title="src/modules/hello/service.ts" highlights={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" import MyCustom from "./models/my-custom"
class HelloModuleService extends MedusaService({ class HelloModuleService extends MedusaService({
@@ -284,7 +284,7 @@ If you implement the `constructor` of your service, make sure to call `super` pa
For example: For example:
```ts highlights={[["8"]]} ```ts highlights={[["8"]]}
import { MedusaService } from "@medusajs/utils" import { MedusaService } from "@medusajs/framework/utils"
import MyCustom from "./models/my-custom" import MyCustom from "./models/my-custom"
class HelloModuleService extends MedusaService({ 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? ## 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: For example:
@@ -41,7 +41,7 @@ import {
createHook, createHook,
createWorkflow, createWorkflow,
WorkflowResponse, WorkflowResponse,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
import { createProductStep } from "./steps/create-product" import { createProductStep } from "./steps/create-product"
export const myWorkflow = createWorkflow( export const myWorkflow = createWorkflow(
@@ -26,7 +26,7 @@ For example, create the file `src/workflows/hello-world.ts` with the following c
import { import {
createStep, createStep,
StepResponse, StepResponse,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
const step1 = createStep( const step1 = createStep(
"step-1", "step-1",
@@ -66,7 +66,7 @@ Then, create a workflow that uses the steps:
import { import {
createWorkflow, createWorkflow,
WorkflowResponse, WorkflowResponse,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
// other imports... // other imports...
// steps... // steps...
@@ -135,7 +135,7 @@ export const inputHighlights = [
import { import {
createStep, createStep,
StepResponse, StepResponse,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
const step1 = createStep( const step1 = createStep(
"step-1", "step-1",
@@ -172,8 +172,8 @@ export const containerHighlights = [
import { import {
createStep, createStep,
StepResponse, StepResponse,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
import { ContainerRegistrationKeys } from "@medusajs/utils" import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
const step1 = createStep( const step1 = createStep(
"step-1", "step-1",
@@ -37,7 +37,7 @@ import {
createWorkflow, createWorkflow,
WorkflowResponse, WorkflowResponse,
when, when,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
// step imports... // step imports...
const workflow = createWorkflow( const workflow = createWorkflow(
@@ -70,7 +70,7 @@ In this code snippet, you execute the `isActiveStep` only if the `input.is_activ
### When Parameters ### 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. 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`. 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> </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 = [ export const highlights = [
["9", "", "Don't manipulate variables directly."], ["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> </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 ```ts
// Don't // Don't
@@ -129,7 +129,7 @@ Values of other types, such as Maps, aren't allowed.
import { import {
createStep, createStep,
StepResponse, StepResponse,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
const step1 = createStep( const step1 = createStep(
"step-1", "step-1",
@@ -148,7 +148,7 @@ const step1 = createStep(
import { import {
createStep, createStep,
StepResponse, StepResponse,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
const step1 = createStep( const step1 = createStep(
"step-1", "step-1",
@@ -20,10 +20,10 @@ export const workflowsHighlights = [
```ts highlights={workflowsHighlights} collapsibleLines="1-7" expandMoreButton="Show Imports" ```ts highlights={workflowsHighlights} collapsibleLines="1-7" expandMoreButton="Show Imports"
import { import {
createWorkflow, createWorkflow,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
import { import {
createProductsWorkflow, createProductsWorkflow,
} from "@medusajs/core-flows" } from "@medusajs/medusa/core-flows"
const workflow = createWorkflow( const workflow = createWorkflow(
"hello-world", "hello-world",
@@ -49,7 +49,7 @@ The object has an `input` property to pass input to the workflow.
## Preparing Input Data ## 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> <Note>
@@ -68,10 +68,10 @@ export const transformHighlights = [
import { import {
createWorkflow, createWorkflow,
transform, transform,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
import { import {
createProductsWorkflow, createProductsWorkflow,
} from "@medusajs/core-flows" } from "@medusajs/medusa/core-flows"
type WorkflowInput = { type WorkflowInput = {
title: string title: string
@@ -105,7 +105,7 @@ In this example, you use the `transform` function to prepend `Hello` to the titl
## Run Workflow Conditionally ## 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> <Note>
@@ -124,13 +124,13 @@ export const whenHighlights = [
import { import {
createWorkflow, createWorkflow,
when, when,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
import { import {
createProductsWorkflow, createProductsWorkflow,
} from "@medusajs/core-flows" } from "@medusajs/medusa/core-flows"
import { import {
CreateProductWorkflowInputDTO, CreateProductWorkflowInputDTO,
} from "@medusajs/types" } from "@medusajs/framework/types"
type WorkflowInput = { type WorkflowInput = {
product?: CreateProductWorkflowInputDTO product?: CreateProductWorkflowInputDTO
@@ -35,7 +35,7 @@ import {
createWorkflow, createWorkflow,
WorkflowResponse, WorkflowResponse,
StepResponse, StepResponse,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
const step1 = createStep("step-1", async () => { const step1 = createStep("step-1", async () => {
return new StepResponse({}) return new StepResponse({})
@@ -114,11 +114,11 @@ export const successStatusHighlights = [
import { import {
Modules, Modules,
TransactionHandlerType, TransactionHandlerType,
} from "@medusajs/utils" } from "@medusajs/framework/utils"
import { import {
StepResponse, StepResponse,
createStep, createStep,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
type SetStepSuccessStepInput = { type SetStepSuccessStepInput = {
transactionId: string transactionId: string
@@ -232,11 +232,11 @@ export const failureStatusHighlights = [
import { import {
Modules, Modules,
TransactionHandlerType, TransactionHandlerType,
} from "@medusajs/utils" } from "@medusajs/framework/utils"
import { import {
StepResponse, StepResponse,
createStep, createStep,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
type SetStepFailureStepInput = { type SetStepFailureStepInput = {
transactionId: string transactionId: string
@@ -288,8 +288,8 @@ import type { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import myWorkflow from "../../../workflows/hello-world" import myWorkflow from "../../../workflows/hello-world"
import { import {
IWorkflowEngineService, IWorkflowEngineService,
} from "@medusajs/types" } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function GET(req: MedusaRequest, res: MedusaResponse) { export async function GET(req: MedusaRequest, res: MedusaResponse) {
const { transaction, result } = await myWorkflow(req.scope).run() const { transaction, result } = await myWorkflow(req.scope).run()
@@ -8,7 +8,7 @@ In this chapter, you’ll learn how to run workflow steps in parallel.
## parallelize Utility Function ## parallelize Utility Function
If your workflow has steps that don’t rely on one another’s results, run them in parallel using the `parallelize` utility function imported from the `@medusajs/workflows-sdk`. If your workflow has steps that don’t rely on one another’s 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. 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, createWorkflow,
WorkflowResponse, WorkflowResponse,
parallelize, parallelize,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
import { import {
createProductStep, createProductStep,
getProductStep, getProductStep,
@@ -19,7 +19,7 @@ import {
createStep, createStep,
createWorkflow, createWorkflow,
WorkflowResponse, WorkflowResponse,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
const step1 = createStep( const step1 = createStep(
{ {
@@ -43,7 +43,7 @@ import {
createWorkflow, createWorkflow,
WorkflowResponse, WorkflowResponse,
transform, transform,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
// step imports... // step imports...
const myWorkflow = createWorkflow( 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. 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. 2. The second parameter is the function performing the variable manipulation.
@@ -84,7 +84,7 @@ import {
createWorkflow, createWorkflow,
WorkflowResponse, WorkflowResponse,
transform, transform,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
// step imports... // step imports...
type WorkflowInput = { type WorkflowInput = {
@@ -43,7 +43,7 @@ export const handlerHighlights = [
] ]
```ts title="src/workflows/hooks/product-created.ts" highlights={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( createProductsWorkflow.hooks.productsCreated(
async ({ products }, { container }) => { async ({ products }, { container }) => {
@@ -83,7 +83,7 @@ Since the hook handler is a step function, you can set its compensation function
For example: For example:
```ts title="src/workflows/hooks/product-created.ts" ```ts title="src/workflows/hooks/product-created.ts"
import { createProductsWorkflow } from "@medusajs/core-flows" import { createProductsWorkflow } from "@medusajs/medusa/core-flows"
createProductsWorkflow.productCreated( createProductsWorkflow.productCreated(
async ({ productId }, { container }) => { 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: 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"]]} ```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( createProductsWorkflow.hooks.productsCreated(
async ({ products, additional_data }, { container }) => { 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"]]} ```ts title="src/workflows/hooks/product-created.ts" highlights={[["10", "additional_data"]]}
import type { MedusaRequest, MedusaResponse } from "@medusajs/medusa" 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) { export async function POST(req: MedusaRequest, res: MedusaResponse) {
await createProductsWorkflow(req.scope).run({ await createProductsWorkflow(req.scope).run({
@@ -31,7 +31,7 @@ import {
createStep, createStep,
createWorkflow, createWorkflow,
WorkflowResponse, WorkflowResponse,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
const step1 = createStep( const step1 = createStep(
"step-1", "step-1",
@@ -26,8 +26,8 @@ For example, you saw this code snippet in the [Medusa container chapter](../medu
```ts highlights={[["10"]]} ```ts highlights={[["10"]]}
import type { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import type { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IProductModuleService } from "@medusajs/types" import { IProductModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export const GET = async ( export const GET = async (
req: MedusaRequest, req: MedusaRequest,
@@ -50,6 +50,6 @@ When you resolve the `Modules.PRODUCT` (or `productModuleService`) registration
<Note title="Tip"> <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> </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? ## 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: 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" ```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", { const MyCustom = model.define("my_custom", {
id: model.id().primaryKey(), id: model.id().primaryKey(),
@@ -85,13 +85,13 @@ For example:
export const highlights = [ export const highlights = [
["7", "container", "Recieve the Medusa Container in the object parameter."], ["7", "container", "Recieve the Medusa Container in the object parameter."],
["10", "resolve", "Resolve the Product Module's main service."], ["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} ```ts title="src/subscribers/product-created.ts" highlights={highlights}
import { SubscriberArgs, type SubscriberConfig } from "@medusajs/medusa" import { SubscriberArgs, type SubscriberConfig } from "@medusajs/medusa"
import { IProductModuleService } from "@medusajs/types" import { IProductModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export default async function productCreateHandler({ export default async function productCreateHandler({
event: { data }, event: { data },
@@ -19,14 +19,14 @@ export const highlights = [
[ [
"10", "10",
"Modules.PRODUCT", "Modules.PRODUCT",
"The resource registration name imported from `@medusajs/utils`.", "The resource registration name imported from `@medusajs/framework/utils`.",
], ],
] ]
```ts highlights={highlights} ```ts highlights={highlights}
import type { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import type { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IProductModuleService } from "@medusajs/types" import { IProductModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export const GET = async ( export const GET = async (
req: MedusaRequest, 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."]]} ```ts title="src/modules/hello/index.ts" highlights={[["7", "", "The main service of the module."]]}
import HelloModuleService from "./service" import HelloModuleService from "./service"
import { Module } from "@medusajs/utils" import { Module } from "@medusajs/framework/utils"
export const HELLO_MODULE = "helloModuleService" 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. 1. The module's name.
2. An object with a required property `service` indicating the module's main service. 2. An object with a required property `service` indicating the module's main service.
@@ -87,15 +87,15 @@ For example:
export const highlights = [ export const highlights = [
["11", "resolve", "Resolve the Product Module's main service."], ["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} ```ts title="src/jobs/hello-world.ts" highlights={highlights}
import { import {
IProductModuleService, IProductModuleService,
MedusaContainer, MedusaContainer,
} from "@medusajs/types" } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export default async function myCustomJob( export default async function myCustomJob(
container: MedusaContainer 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 ### 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: Create the file `src/workflows/hello-world.ts` with the following content:
```ts title="src/workflows/hello-world.ts" ```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 () => { const step1 = createStep("step-1", async () => {
return new StepResponse(`Hello from step one!`) return new StepResponse(`Hello from step one!`)
@@ -59,7 +59,7 @@ import {
// other imports... // other imports...
createWorkflow, createWorkflow,
WorkflowResponse, 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, type SubscriberArgs,
} from "@medusajs/medusa" } from "@medusajs/medusa"
import myWorkflow from "../workflows/hello-world" import myWorkflow from "../workflows/hello-world"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
import { IUserModuleService } from "@medusajs/types" import { IUserModuleService } from "@medusajs/framework/types"
export default async function handleCustomerCreate({ export default async function handleCustomerCreate({
event: { data }, 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"> <CodeTab label="Scheduled Job" value="scheduled-job">
```ts title="src/jobs/message-daily.ts" highlights={[["7"], ["8"], ["9"], ["10"], ["11"], ["12"]]} ```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" import myWorkflow from "../workflows/hello-world"
export default async function myCustomJob( export default async function myCustomJob(
@@ -230,7 +230,7 @@ export const highlights = [
[ [
"12", "12",
"Modules.PRODUCT", "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, StepResponse,
createWorkflow, createWorkflow,
WorkflowResponse, WorkflowResponse,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
import { IProductModuleService } from "@medusajs/types" import { IProductModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
const step1 = createStep("step-1", async (_, context) => { const step1 = createStep("step-1", async (_, context) => {
const productModuleService: IProductModuleService = 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: 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" ```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", { export const Brand = model.define("brand", {
id: model.id().primaryKey(), id: model.id().primaryKey(),
@@ -44,7 +44,7 @@ export const serviceHighlights = [
] ]
```ts title="src/modules/brand/service.ts" highlights={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" import { Brand } from "./models/brand"
class BrandModuleService extends MedusaService({ class BrandModuleService extends MedusaService({
@@ -56,7 +56,7 @@ class BrandModuleService extends MedusaService({
export default BrandModuleService 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`. 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: 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" ```ts title="src/modules/brand/index.ts"
import { Module } from "@medusajs/utils" import { Module } from "@medusajs/framework/utils"
import BrandModuleService from "./service" import BrandModuleService from "./service"
export const BRAND_MODULE = "brandModuleService" export const BRAND_MODULE = "brandModuleService"
@@ -45,7 +45,7 @@ Create the file `src/workflows/create-brand/index.ts` with the following content
import { import {
createWorkflow, createWorkflow,
WorkflowResponse, WorkflowResponse,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
export type CreateBrandInput = { export type CreateBrandInput = {
name: string name: string
@@ -71,7 +71,7 @@ Create the file `src/workflows/create-brand/steps/create-brand.ts` with the foll
import { import {
createStep, createStep,
StepResponse, StepResponse,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
import { CreateBrandInput } from ".." import { CreateBrandInput } from ".."
import { BRAND_MODULE } from "../../../modules/brand" import { BRAND_MODULE } from "../../../modules/brand"
import BrandModuleService from "../../../modules/brand/service" import BrandModuleService from "../../../modules/brand/service"
@@ -34,7 +34,7 @@ export const highlights = [
```tsx title="src/admin/widgets/product-brand.tsx" highlights={highlights} ```tsx title="src/admin/widgets/product-brand.tsx" highlights={highlights}
import { defineWidgetConfig } from "@medusajs/admin-sdk" 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 { useEffect, useState } from "react"
import { Container, Heading } from "@medusajs/ui" import { Container, Heading } from "@medusajs/ui"
@@ -29,11 +29,11 @@ export const stepHighlights = [
import { import {
createStep, createStep,
StepResponse, StepResponse,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
import { import {
Modules, Modules,
ContainerRegistrationKeys, ContainerRegistrationKeys,
} from "@medusajs/utils" } from "@medusajs/framework/utils"
import { BRAND_MODULE } from "../../modules/brand" import { BRAND_MODULE } from "../../modules/brand"
type LinkProductToBrandStepInput = { type LinkProductToBrandStepInput = {
@@ -71,7 +71,7 @@ The `create` method accepts as a parameter an object whose properties are the na
<Note title="Tip"> <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> </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: 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} ```ts title="src/links/product-brand.ts" highlights={highlights}
import BrandModule from "../modules/brand" import BrandModule from "../modules/brand"
import ProductModule from "@medusajs/product" import ProductModule from "@medusajs/medusa/product"
import { defineLink } from "@medusajs/utils" import { defineLink } from "@medusajs/framework/utils"
export default defineLink( export default defineLink(
{ {
@@ -86,9 +86,9 @@ export const hookHighlights = [
] ]
```ts title="src/workflows/hooks/created-product.ts" highlights={hookHighlights} ```ts title="src/workflows/hooks/created-product.ts" highlights={hookHighlights}
import { createProductsWorkflow } from "@medusajs/core-flows" import { createProductsWorkflow } from "@medusajs/medusa/core-flows"
import { StepResponse } from "@medusajs/workflows-sdk" import { StepResponse } from "@medusajs/framework/workflows-sdk"
import { Modules, ContainerRegistrationKeys } from "@medusajs/utils" import { Modules, ContainerRegistrationKeys } from "@medusajs/framework/utils"
import { BRAND_MODULE } from "../../modules/brand" import { BRAND_MODULE } from "../../modules/brand"
import BrandModuleService from "../../modules/brand/service" import BrandModuleService from "../../modules/brand/service"
@@ -52,7 +52,7 @@ import {
} from "@medusajs/medusa" } from "@medusajs/medusa"
import { import {
ContainerRegistrationKeys, ContainerRegistrationKeys,
} from "@medusajs/utils" } from "@medusajs/framework/utils"
export const GET = async ( export const GET = async (
req: MedusaRequest, 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. 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 = [ export const eventHighlights = [
["13", "emitEventStep", "Emit an event."], ["13", "emitEventStep", "Emit an event."],
@@ -37,7 +37,7 @@ export const eventHighlights = [
// other imports... // other imports...
import { import {
emitEventStep, 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 { import {
createWorkflow, createWorkflow,
WorkflowResponse, WorkflowResponse,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
export type SyncBrandToSystemInput = { export type SyncBrandToSystemInput = {
id: string id: string
@@ -104,7 +104,7 @@ export const stepHighlights = [
import { import {
createStep, createStep,
StepResponse, StepResponse,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
import { SyncBrandToSystemInput } from ".." import { SyncBrandToSystemInput } from ".."
import BrandModuleService from "../../../modules/brand/service" import BrandModuleService from "../../../modules/brand/service"
import { BRAND_MODULE } from "../../../modules/brand" 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 { import {
createStep, createStep,
StepResponse, StepResponse,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
import BrandModuleService from "../../../modules/brand/service" import BrandModuleService from "../../../modules/brand/service"
import { BRAND_MODULE } from "../../../modules/brand" import { BRAND_MODULE } from "../../../modules/brand"
@@ -74,8 +74,8 @@ export const createBrandsHighlights = [
import { import {
createStep, createStep,
StepResponse, StepResponse,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
import { InferTypeOf } from "@medusajs/types" import { InferTypeOf } from "@medusajs/framework/types"
import BrandModuleService from "../../../modules/brand/service" import BrandModuleService from "../../../modules/brand/service"
import { BRAND_MODULE } from "../../../modules/brand" import { BRAND_MODULE } from "../../../modules/brand"
import { Brand } from "../../../modules/brand/models/brand" import { Brand } from "../../../modules/brand/models/brand"
@@ -109,7 +109,7 @@ This step receives the brands to create as input.
<Note title="Tip"> <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> </Note>
@@ -131,8 +131,8 @@ export const updateBrandsHighlights = [
import { import {
createStep, createStep,
StepResponse, StepResponse,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
import { InferTypeOf } from "@medusajs/types" import { InferTypeOf } from "@medusajs/framework/types"
import BrandModuleService from "../../../modules/brand/service" import BrandModuleService from "../../../modules/brand/service"
import { BRAND_MODULE } from "../../../modules/brand" import { BRAND_MODULE } from "../../../modules/brand"
import { Brand } from "../../../modules/brand/models/brand" import { Brand } from "../../../modules/brand/models/brand"
@@ -181,8 +181,8 @@ import {
createWorkflow, createWorkflow,
WorkflowResponse, WorkflowResponse,
transform, transform,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
import { InferTypeOf } from "@medusajs/types" import { InferTypeOf } from "@medusajs/framework/types"
import { retrieveBrandsFromSystemStep } from "./steps/retrieve-brands-from-system" import { retrieveBrandsFromSystemStep } from "./steps/retrieve-brands-from-system"
import { createBrandsStep } from "./steps/create-brands" import { createBrandsStep } from "./steps/create-brands"
import { updateBrandsStep } from "./steps/update-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. 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: 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`: 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" ```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" import { syncBrandsFromSystemWorkflow } from "../workflows/sync-brands-from-system"
export default async function (container: MedusaContainer) { export default async function (container: MedusaContainer) {
@@ -32,7 +32,7 @@ export const serviceHighlights = [
] ]
```ts title="src/modules/brand/services/client.ts" highlights={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 ".." import { BRAND_MODULE } from ".."
export type BrandClientOptions = { export type BrandClientOptions = {
@@ -88,7 +88,7 @@ export const methodsHighlights = [
```ts title="src/modules/brand/services/client.ts" highlights={methodsHighlights} ```ts title="src/modules/brand/services/client.ts" highlights={methodsHighlights}
// other imports... // other imports...
import { InferTypeOf } from "@medusajs/types" import { InferTypeOf } from "@medusajs/framework/types"
import { Brand } from "../models/brand" import { Brand } from "../models/brand"
export class BrandClient { 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: 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. - `deleteBrand` that deletes the brand in the third-party system.
- `retrieveBrands` to retrieve a brand from 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} ```ts title="src/jobs/log-message.ts" highlights={highlights}
import { Logger } from "@medusajs/medusa" import { Logger } from "@medusajs/medusa"
import { MedusaContainer } from "@medusajs/types" import { MedusaContainer } from "@medusajs/framework/types"
export default async function myCustomJob( export default async function myCustomJob(
container: MedusaContainer 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: 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" ```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", { const MyCustom = model.define("my_custom", {
id: model.id().primaryKey(), id: model.id().primaryKey(),
@@ -27,7 +27,7 @@ import {
createStep, createStep,
StepResponse, StepResponse,
WorkflowResponse, WorkflowResponse,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
const step1 = createStep("step-1", () => { const step1 = createStep("step-1", () => {
return new StepResponse("Hello, World!") 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: Consider a `hello` module with a `HelloModuleService` that has a `getMessage` method:
```ts title="src/modules/hello/service.ts" ```ts title="src/modules/hello/service.ts"
import { MedusaService } from "@medusajs/utils" import { MedusaService } from "@medusajs/framework/utils"
import MyCustom from "./models/my-custom" import MyCustom from "./models/my-custom"
class HelloModuleService extends MedusaService({ class HelloModuleService extends MedusaService({
@@ -105,7 +105,7 @@ For example:
```ts ```ts
import { moduleIntegrationTestRunner } from "medusa-test-utils" import { moduleIntegrationTestRunner } from "medusa-test-utils"
import HelloModuleService from "../service" import HelloModuleService from "../service"
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const DummyModel = model.define("dummy_model", { const DummyModel = model.define("dummy_model", {
id: model.id().primaryKey(), 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`: To use the `medusa-test-utils` package, install it as a `devDependency`:
```bash npm2yarn ```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: Then, create the file `jest.config.js` with the following content:
```js title="jest.config.js" ```js title="jest.config.js"
const { loadEnv } = require("@medusajs/utils") const { loadEnv } = require("@medusajs/framework/utils")
loadEnv("test", process.cwd()) loadEnv("test", process.cwd())
module.exports = { 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: Create your first Medusa store by running the following command:
```bash ```bash
npx create-medusa-app@preview npx create-medusa-app@rc
``` ```
--- ---
+55 -55
View File
@@ -1,110 +1,110 @@
export const generatedEditDates = { export const generatedEditDates = {
"app/basics/scheduled-jobs/page.mdx": "2024-08-05T07:24:27+00:00", "app/basics/scheduled-jobs/page.mdx": "2024-09-30T08:43:53.132Z",
"app/basics/workflows/page.mdx": "2024-09-18T08:01:24.328Z", "app/basics/workflows/page.mdx": "2024-09-30T08:43:53.132Z",
"app/deployment/page.mdx": "2024-08-05T07:24:05+00:00", "app/deployment/page.mdx": "2024-08-05T07:24:05+00:00",
"app/page.mdx": "2024-09-03T07:09:09.034Z", "app/page.mdx": "2024-09-03T07:09:09.034Z",
"app/basics/modules-and-services/page.mdx": "2024-09-11T10:48:35.195Z", "app/basics/modules-and-services/page.mdx": "2024-09-30T08:43:53.132Z",
"app/basics/commerce-modules/page.mdx": "2024-09-03T07:48:48.148Z", "app/basics/commerce-modules/page.mdx": "2024-09-30T08:43:53.131Z",
"app/advanced-development/workflows/retry-failed-steps/page.mdx": "2024-07-31T17:01:33+03:00", "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-18T12:27:15.321Z", "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/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/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/page.mdx": "2024-09-11T10:58:59.290Z",
"app/storefront-development/nextjs-starter/page.mdx": "2024-07-04T17:26:03+03:00", "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/page.mdx": "2024-09-03T07:11:06.879Z",
"app/basics/admin-customizations/page.mdx": "2024-09-03T08:07:35.584Z", "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/workflow-timeout/page.mdx": "2024-09-30T08:43:53.131Z",
"app/advanced-development/workflows/parallel-steps/page.mdx": "2024-09-18T12:56:50.436Z", "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/advanced-development/page.mdx": "2024-07-04T17:26:03+03:00",
"app/first-customizations/page.mdx": "2024-09-11T10:48:42.374Z", "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/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/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/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/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/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/basics/events-and-subscribers/page.mdx": "2024-09-30T08:43:53.131Z",
"app/advanced-development/modules/container/page.mdx": "2024-08-05T07:23:49+00:00", "app/advanced-development/modules/container/page.mdx": "2024-09-30T08:43:53.125Z",
"app/basics/data-models/page.mdx": "2024-09-19T07:24:38.584Z", "app/basics/data-models/page.mdx": "2024-09-30T08:43:53.131Z",
"app/advanced-development/workflows/execute-another-workflow/page.mdx": "2024-09-18T13:29:11.644Z", "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/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/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/modules/remote-link/page.mdx": "2024-09-30T08:43:53.127Z",
"app/advanced-development/api-routes/protected-routes/page.mdx": "2024-09-11T10:45:44.293Z", "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-18T12:52:24.511Z", "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/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/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/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/events-and-subscribers/emit-event/page.mdx": "2024-09-30T08:43:53.125Z",
"app/advanced-development/workflows/conditions/page.mdx": "2024-09-18T08:52:40.755Z", "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/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/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/long-running-workflow/page.mdx": "2024-09-30T08:43:53.129Z",
"app/advanced-development/workflows/constructor-constraints/page.mdx": "2024-09-18T08:58:08.705Z", "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/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/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/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/modules/options/page.mdx": "2024-09-30T08:43:53.126Z",
"app/advanced-development/data-models/relationships/page.mdx": "2024-09-11T11:28:55.494Z", "app/advanced-development/data-models/relationships/page.mdx": "2024-09-30T08:43:53.125Z",
"app/advanced-development/workflows/compensation-function/page.mdx": "2024-09-18T09:13:11.941Z", "app/advanced-development/workflows/compensation-function/page.mdx": "2024-09-30T08:43:53.128Z",
"app/advanced-development/modules/service-factory/page.mdx": "2024-07-26T14:40:56+00:00", "app/advanced-development/modules/service-factory/page.mdx": "2024-09-30T08:43:53.127Z",
"app/advanced-development/data-models/primary-key/page.mdx": "2024-07-02T12:34:44+03:00", "app/advanced-development/data-models/primary-key/page.mdx": "2024-09-30T08:43:53.123Z",
"app/advanced-development/modules/module-links/page.mdx": "2024-07-24T09:16:01+02:00", "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-19T08:48:53.599Z", "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/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/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/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/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/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/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/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/configure-properties/page.mdx": "2024-09-30T08:43:53.122Z",
"app/advanced-development/data-models/index/page.mdx": "2024-09-19T08:47:12.961Z", "app/advanced-development/data-models/index/page.mdx": "2024-09-30T08:43:53.122Z",
"app/advanced-development/custom-cli-scripts/page.mdx": "2024-07-04T17:26:03+03:00", "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-19T07:31:20.696Z", "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-11T10:48:09.593Z", "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/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/integration-tests/workflows/page.mdx": "2024-09-30T08:43:53.139Z",
"app/debugging-and-testing/testing-tools/page.mdx": "2024-09-10T11:39:51.172Z", "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/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/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/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/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/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/admin/constraints/page.mdx": "2024-09-10T11:39:51.165Z",
"app/advanced-development/modules/query/page.mdx": "2024-09-11T10:46:49.512Z", "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-10T11:39:51.171Z", "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-10T11:39:51.171Z", "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/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/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/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/module/page.mdx": "2024-09-30T08:43:53.133Z",
"app/customization/custom-features/workflow/page.mdx": "2024-09-12T12:40:39.582Z", "app/customization/custom-features/workflow/page.mdx": "2024-09-30T08:43:53.133Z",
"app/customization/extend-models/create-links/page.mdx": "2024-09-26T08:31:08.177Z", "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-12T12:43:57.702Z", "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/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/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/route/page.mdx": "2024-09-12T12:45:39.258Z",
"app/customization/customize-admin/widget/page.mdx": "2024-09-12T12:26:36.013Z", "app/customization/customize-admin/widget/page.mdx": "2024-09-30T08:43:53.133Z",
"app/customization/extend-models/define-link/page.mdx": "2024-09-12T12:38:53.230Z", "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/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/extend-models/query-linked-records/page.mdx": "2024-09-30T08:43:53.134Z",
"app/customization/integrate-systems/handle-event/page.mdx": "2024-09-26T08:34:57.278Z", "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/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/schedule-task/page.mdx": "2024-09-30T08:43:53.135Z",
"app/customization/integrate-systems/service/page.mdx": "2024-09-26T08:34:30.313Z", "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/next-steps/page.mdx": "2024-09-12T10:50:04.873Z",
"app/customization/page.mdx": "2024-09-12T11:16:18.504Z", "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/cheatsheet/page.mdx": "2024-07-11T16:11:26.480Z",
"app/more-resources/examples/page.mdx": "2024-09-19T10:30:30.398Z", "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/architectural-modules/page.mdx": "2024-09-23T12:51:04.520Z",
"app/architecture/overview/page.mdx": "2024-09-23T12:55:01.339Z", "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"
} }
@@ -114,7 +114,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<AdminOrder>` imported from `@medusajs/types` Type `DetailWidgetProps<AdminOrder>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -137,7 +137,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<AdminOrder>` imported from `@medusajs/types` Type `DetailWidgetProps<AdminOrder>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -160,7 +160,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<AdminOrder>` imported from `@medusajs/types` Type `DetailWidgetProps<AdminOrder>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -183,7 +183,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<AdminOrder>` imported from `@medusajs/types` Type `DetailWidgetProps<AdminOrder>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -254,7 +254,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<AdminCustomer>` imported from `@medusajs/types` Type `DetailWidgetProps<AdminCustomer>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -277,7 +277,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<AdminCustomer>` imported from `@medusajs/types` Type `DetailWidgetProps<AdminCustomer>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -334,7 +334,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<AdminCustomerGroup>` imported from `@medusajs/types` Type `DetailWidgetProps<AdminCustomerGroup>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -357,7 +357,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<AdminCustomerGroup>` imported from `@medusajs/types` Type `DetailWidgetProps<AdminCustomerGroup>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -428,7 +428,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<AdminProduct>` imported from `@medusajs/types` Type `DetailWidgetProps<AdminProduct>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -451,7 +451,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<AdminProduct>` imported from `@medusajs/types` Type `DetailWidgetProps<AdminProduct>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -474,7 +474,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<AdminProduct>` imported from `@medusajs/types` Type `DetailWidgetProps<AdminProduct>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -497,7 +497,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<AdminProduct>` imported from `@medusajs/types` Type `DetailWidgetProps<AdminProduct>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -554,7 +554,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<AdminProductCollection>` imported from `@medusajs/types` Type `DetailWidgetProps<AdminProductCollection>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -577,7 +577,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<AdminProductCollection>` imported from `@medusajs/types` Type `DetailWidgetProps<AdminProductCollection>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -634,7 +634,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<AdminProductCategory>` imported from `@medusajs/types` Type `DetailWidgetProps<AdminProductCategory>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -657,7 +657,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<AdminProductCategory>` imported from `@medusajs/types` Type `DetailWidgetProps<AdminProductCategory>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -680,7 +680,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<AdminProductCategory>` imported from `@medusajs/types` Type `DetailWidgetProps<AdminProductCategory>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -703,7 +703,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<AdminProductCategory>` imported from `@medusajs/types` Type `DetailWidgetProps<AdminProductCategory>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -774,7 +774,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<PriceListDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<PriceListDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -797,7 +797,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<PriceListDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<PriceListDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -820,7 +820,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<PriceListDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<PriceListDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -843,7 +843,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<PriceListDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<PriceListDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -914,7 +914,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<PromotionDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<PromotionDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -937,7 +937,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<PromotionDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<PromotionDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -960,7 +960,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<PromotionDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<PromotionDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -983,7 +983,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<PromotionDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<PromotionDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1040,7 +1040,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<CampaignDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<CampaignDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1063,7 +1063,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<CampaignDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<CampaignDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1086,7 +1086,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<CampaignDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<CampaignDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1109,7 +1109,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<CampaignDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<CampaignDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1182,7 +1182,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<UserDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<UserDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1205,7 +1205,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<UserDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<UserDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1242,7 +1242,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<ExtendedStoreDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<ExtendedStoreDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1265,7 +1265,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<ExtendedStoreDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<ExtendedStoreDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1302,7 +1302,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<UserDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<UserDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1325,7 +1325,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<UserDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<UserDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1396,7 +1396,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<AdminRegion>` imported from `@medusajs/types` Type `DetailWidgetProps<AdminRegion>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1419,7 +1419,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<AdminRegion>` imported from `@medusajs/types` Type `DetailWidgetProps<AdminRegion>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1490,7 +1490,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<ShippingProfileDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<ShippingProfileDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1513,7 +1513,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<ShippingProfileDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<ShippingProfileDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1584,7 +1584,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<ExtendedStockLocationDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<ExtendedStockLocationDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1607,7 +1607,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<ExtendedStockLocationDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<ExtendedStockLocationDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1630,7 +1630,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<ExtendedStockLocationDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<ExtendedStockLocationDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1653,7 +1653,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<ExtendedStockLocationDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<ExtendedStockLocationDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1724,7 +1724,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<SalesChannelResponse>` imported from `@medusajs/types` Type `DetailWidgetProps<SalesChannelResponse>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1747,7 +1747,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<SalesChannelResponse>` imported from `@medusajs/types` Type `DetailWidgetProps<SalesChannelResponse>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1818,7 +1818,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<ReservationItemDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<ReservationItemDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1841,7 +1841,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<ReservationItemDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<ReservationItemDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1864,7 +1864,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<ReservationItemDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<ReservationItemDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1887,7 +1887,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<ReservationItemDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<ReservationItemDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1958,7 +1958,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<ApiKeyResponse>` imported from `@medusajs/types` Type `DetailWidgetProps<ApiKeyResponse>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -1981,7 +1981,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<ApiKeyResponse>` imported from `@medusajs/types` Type `DetailWidgetProps<ApiKeyResponse>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -2052,7 +2052,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<WorkflowExecutionDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<WorkflowExecutionDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -2075,7 +2075,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<WorkflowExecutionDTO>` imported from `@medusajs/types` Type `DetailWidgetProps<WorkflowExecutionDTO>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -2146,7 +2146,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<TaxRegionResponse>` imported from `@medusajs/types` Type `DetailWidgetProps<TaxRegionResponse>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -2169,7 +2169,7 @@ This documentation page includes the list of injection zones you can add Admin W
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Type `DetailWidgetProps<TaxRegionResponse>` imported from `@medusajs/types` Type `DetailWidgetProps<TaxRegionResponse>` imported from `@medusajs/framework/types`
```ts blockStyle="inline" ```ts blockStyle="inline"
{ {
@@ -16,10 +16,10 @@ Start by creating a new directory for your module. For example, `src/modules/my-
Create the file `src/modules/my-cache/service.ts` that holds the implementation of the cache service. Create the file `src/modules/my-cache/service.ts` that holds the implementation of the cache service.
The Cache Module's main service must implement the `ICacheService` interface imported from `@medusajs/types`: The Cache Module's main service must implement the `ICacheService` interface imported from `@medusajs/framework/types`:
```ts title="src/modules/my-cache/service.ts" ```ts title="src/modules/my-cache/service.ts"
import { ICacheService } from "@medusajs/types" import { ICacheService } from "@medusajs/framework/types"
class MyCacheService implements ICacheService { class MyCacheService implements ICacheService {
get<T>(key: string): Promise<T> { get<T>(key: string): Promise<T> {
@@ -135,7 +135,7 @@ Create the file `src/modules/my-cache/index.ts` with the following content:
```ts title="src/modules/my-cache/index.ts" ```ts title="src/modules/my-cache/index.ts"
import MyCacheService from "./service" import MyCacheService from "./service"
import { Module } from "@medusajs/utils" import { Module } from "@medusajs/framework/utils"
export default Module("my-cache", { export default Module("my-cache", {
service: MyCacheService, service: MyCacheService,
@@ -153,7 +153,7 @@ To use your Cache Module, add it to the `modules` object exported as part of the
For example: For example:
```js title="medusa-config.js" ```js title="medusa-config.js"
const { Modules } = require("@medusajs/utils") const { Modules } = require("@medusajs/framework/utils")
// ... // ...
@@ -14,30 +14,18 @@ For production, it’s recommended to use modules like [Redis Cache Module](../r
--- ---
## Install the In-Memory Cache Module ## Register the In-Memory Cache Module
<Note> <Note>
The In-Memory Cache Module is installed by default in your application. The In-Memory Cache Module is registered by default in your application.
</Note> </Note>
To install the In-Memory Cache Module, run the following command in the directory of your Medusa application: Add the module into the `modules` property of the exported object in `medusa-config.js`:
```bash npm2yarn
npm install @medusajs/cache-inmemory@preview
```
<Note>
Make sure that the version added in `package.json` is `preview` to avoid errors with installation and updates in the future.
</Note>
Next, add the module into the `modules` property of the exported object in `medusa-config.js`:
```js title="medusa-config.js" ```js title="medusa-config.js"
const { Modules } = require("@medusajs/utils") const { Modules } = require("@medusajs/framework/utils")
// ... // ...
@@ -45,7 +33,7 @@ module.exports = defineConfig({
// ... // ...
modules: { modules: {
[Modules.CACHE]: { [Modules.CACHE]: {
resolve: "@medusajs/cache-inmemory", resolve: "@medusajs/medusa/cache-inmemory",
options: { options: {
// optional options // optional options
}, },
@@ -10,7 +10,7 @@ The Redis Cache Module uses Redis to cache data in your store. In production, it
--- ---
## Install the Redis Cache Module ## Register the Redis Cache Module
<Prerequisites items={[ <Prerequisites items={[
{ {
@@ -19,26 +19,14 @@ The Redis Cache Module uses Redis to cache data in your store. In production, it
} }
]} /> ]} />
To install Redis Cache Module, run the following command in the directory of your Medusa application: Add the module into the `modules` property of the exported object in `medusa-config.js`:
```bash npm2yarn
npm install @medusajs/cache-redis@preview
```
<Note>
Make sure that the version added in `package.json` is `preview` to avoid errors with installation and updates in the future.
</Note>
Next, add the module into the `modules` property of the exported object in `medusa-config.js`:
export const highlights = [ export const highlights = [
["11", "redisUrl", "The Redis connection URL."] ["11", "redisUrl", "The Redis connection URL."]
] ]
```js title="medusa-config.js" highlights={highlights} ```js title="medusa-config.js" highlights={highlights}
const { Modules } = require("@medusajs/utils") const { Modules } = require("@medusajs/framework/utils")
// ... // ...
@@ -46,7 +34,7 @@ module.exports = defineConfig({
// ... // ...
modules: { modules: {
[Modules.CACHE]: { [Modules.CACHE]: {
resolve: "@medusajs/cache-redis", resolve: "@medusajs/medusa/cache-redis",
options: { options: {
redisUrl: process.env.CACHE_REDIS_URL, redisUrl: process.env.CACHE_REDIS_URL,
}, },
@@ -166,6 +154,8 @@ CACHE_REDIS_URL=<YOUR_REDIS_URL>
</Table.Body> </Table.Body>
</Table> </Table>
---
## Test the Module ## Test the Module
To test the module, start the Medusa application: To test the module, start the Medusa application:
@@ -16,11 +16,11 @@ 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. 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/utils`: The Event Module's main service must extend the `AbstractEventBusModuleService` class imported from `@medusajs/framework/utils`:
```ts title="src/modules/my-event/service.ts" ```ts title="src/modules/my-event/service.ts"
import { EmitData, Message } from "@medusajs/types" import { EmitData, Message } from "@medusajs/framework/types"
import { AbstractEventBusModuleService } from "@medusajs/utils" import { AbstractEventBusModuleService } from "@medusajs/framework/utils"
class MyEventService extends AbstractEventBusModuleService { class MyEventService extends AbstractEventBusModuleService {
emit<T>(eventName: string, data: T, options: Record<string, unknown>): Promise<void>; emit<T>(eventName: string, data: T, options: Record<string, unknown>): Promise<void>;
@@ -90,7 +90,7 @@ Create the file `src/modules/my-event/index.ts` with the following content:
```ts title="src/modules/my-event/index.ts" ```ts title="src/modules/my-event/index.ts"
import MyEventService from "./service" import MyEventService from "./service"
import { Module } from "@medusajs/utils" import { Module } from "@medusajs/framework/utils"
export default Module("my-event", { export default Module("my-event", {
service: MyEventService, service: MyEventService,
@@ -108,7 +108,7 @@ To use your Event Module, add it to the `modules` object exported as part of the
For example: For example:
```js title="medusa-config.js" ```js title="medusa-config.js"
const { Modules } = require("@medusajs/utils") const { Modules } = require("@medusajs/framework/utils")
// ... // ...
@@ -12,30 +12,18 @@ For production, it’s recommended to use modules like [Redis Event Bus Module](
--- ---
## Install the Local Event Bus Module ## Register the Local Event Bus Module
<Note> <Note>
The Local Event Bus Module is installed by default in your application. The Local Event Bus Module is registered by default in your application.
</Note> </Note>
To install Local Event Bus Module, run the following command in the directory of your Medusa application: Add the module into the `modules` property of the exported object in `medusa-config.js`:
```bash npm2yarn
npm install @medusajs/event-bus-local@preview
```
<Note>
Make sure that the version added in `package.json` is `preview` to avoid errors with installation and updates in the future.
</Note>
Next, add the module into the `modules` property of the exported object in `medusa-config.js`:
```js title="medusa-config.js" ```js title="medusa-config.js"
const { Modules } = require("@medusajs/utils") const { Modules } = require("@medusajs/framework/utils")
// ... // ...
@@ -14,7 +14,7 @@ In production, it's recommended to use this module.
--- ---
## Install the Redis Events Bus Module ## Register the Redis Events Bus Module
<Prerequisites items={[ <Prerequisites items={[
{ {
@@ -23,26 +23,14 @@ In production, it's recommended to use this module.
} }
]} /> ]} />
To install Redis Event Bus Module, run the following command in the directory of your Medusa application: Add the module into the `modules` property of the exported object in `medusa-config.js`:
```bash npm2yarn
npm install @medusajs/event-bus-redis@preview
```
<Note>
Make sure that the version added in `package.json` is `preview` to avoid errors with installation and updates in the future.
</Note>
Next, add the module into the `modules` property of the exported object in `medusa-config.js`:
export const highlights = [ export const highlights = [
["11", "redisUrl", "The Redis connection URL."] ["11", "redisUrl", "The Redis connection URL."]
] ]
```js title="medusa-config.js" ```js title="medusa-config.js"
const { Modules } = require("@medusajs/utils") const { Modules } = require("@medusajs/framework/utils")
// ... // ...
@@ -50,7 +38,7 @@ module.exports = defineConfig({
// ... // ...
modules: { modules: {
[Modules.EVENT_BUS]: { [Modules.EVENT_BUS]: {
resolve: "@medusajs/event-bus-redis", resolve: "@medusajs/medusa/event-bus-redis",
options: { options: {
redisUrl: process.env.EVENTS_REDIS_URL, redisUrl: process.env.EVENTS_REDIS_URL,
}, },
@@ -16,27 +16,15 @@ The Local File Module Provider is only for development purposes. Use the [S3 Fil
--- ---
## Install the Local File Module ## Register the Local File Module
<Note> <Note>
The Local File Module is installed by default in your application. The Local File Module Provider is registered by default in your application.
</Note> </Note>
To install the Local File Module Provider, run the following command in the directory of your Medusa application: Add the module into the `providers` array of the File Module:
```bash npm2yarn
npm install @medusajs/file-local-next@preview
```
<Note>
Make sure that the version added in `package.json` is `preview` to avoid errors with installation and updates in the future.
</Note>
Next, add the module into the `providers` array of the File Module:
<Note> <Note>
@@ -45,7 +33,7 @@ The File Module accepts one provider only.
</Note> </Note>
```js title="medusa-config.js" ```js title="medusa-config.js"
const { Modules } = require("@medusajs/utils") const { Modules } = require("@medusajs/framework/utils")
// ... // ...
@@ -53,11 +41,11 @@ module.exports = {
// ... // ...
modules: { modules: {
[Modules.FILE]: { [Modules.FILE]: {
resolve: "@medusajs/file", resolve: "@medusajs/medusa/file",
options: { options: {
providers: [ providers: [
{ {
resolve: "@medusajs/file-local-next", resolve: "@medusajs/medusa/file-local-next",
id: "local", id: "local",
options: { options: {
// provider options... // provider options...
@@ -102,15 +102,9 @@ The S3 File Module Provider integrates Amazon S3 and services following a compat
--- ---
## Install the S3 File Module ## Register the S3 File Module
To install the S3 File Module Provider, run the following command in the directory of your Medusa application: Add the module into the `providers` array of the File Module:
```bash npm2yarn
npm install @medusajs/file-s3@preview
```
Next, add the module into the `providers` array of the File Module:
<Note> <Note>
@@ -119,7 +113,7 @@ The File Module accepts one provider only.
</Note> </Note>
```js title="medusa-config.js" ```js title="medusa-config.js"
const { Modules } = require("@medusajs/utils") const { Modules } = require("@medusajs/framework/utils")
// ... // ...
@@ -128,11 +122,11 @@ module.exports = {
modules: { modules: {
// ... // ...
[Modules.FILE]: { [Modules.FILE]: {
resolve: "@medusajs/file", resolve: "@medusajs/medusa/file",
options: { options: {
providers: [ providers: [
{ {
resolve: "@medusajs/file-s3", resolve: "@medusajs/medusa/file-s3",
id: "s3", id: "s3",
options: { options: {
file_url: process.env.S3_FILE_URL, file_url: process.env.S3_FILE_URL,
@@ -360,11 +354,11 @@ module.exports = defineConfig({
// ... // ...
modules: { modules: {
[Modules.FILE]: { [Modules.FILE]: {
resolve: "@medusajs/file", resolve: "@medusajs/medusa/file",
options: { options: {
providers: [ providers: [
{ {
resolve: "@medusajs/file-s3", resolve: "@medusajs/medusa/file-s3",
id: "s3", id: "s3",
options: { options: {
// ... // ...
@@ -10,27 +10,15 @@ The Local Notification Module Provider simulates sending a notification, but onl
--- ---
## Install the Local Notification Module ## Register the Local Notification Module
<Note> <Note>
The Local Notification Module Provider is installed by default in your application. The Local Notification Module Provider is registered by default in your application. It's configured to run on the `feed` channel.
</Note> </Note>
To install the Local Notification Module Provider, run the following command in the directory of your Medusa application: Add the module into the `providers` array of the Notification Module:
```bash npm2yarn
npm install @medusajs/notification-local@preview
```
<Note>
Make sure that the version added in `package.json` is `preview` to avoid errors with installation and updates in the future.
</Note>
Next, add the module into the `providers` array of the Notification Module:
<Note> <Note>
@@ -39,7 +27,7 @@ Only one provider can be defined for a channel.
</Note> </Note>
```js title="medusa-config.js" ```js title="medusa-config.js"
const { Modules } = require("@medusajs/utils") const { Modules } = require("@medusajs/framework/utils")
// ... // ...
@@ -47,12 +35,12 @@ module.exports = defineConfig({
// ... // ...
modules: { modules: {
[Modules.NOTIFICATION]: { [Modules.NOTIFICATION]: {
resolve: "@medusajs/notification", resolve: "@medusajs/medusa/notification",
options: { options: {
providers: [ providers: [
// ... // ...
{ {
resolve: "@medusajs/notification-local", resolve: "@medusajs/medusa/notification-local",
id: "local", id: "local",
options: { options: {
channels: ["email"], channels: ["email"],
@@ -31,7 +31,7 @@ When you send a notification, you specify the channel to send it through, such a
For example: For example:
```js title="medusa-config.js" highlights={[["19"]]} ```js title="medusa-config.js" highlights={[["19"]]}
const { Modules } = require("@medusajs/utils") const { Modules } = require("@medusajs/framework/utils")
// ... // ...
@@ -40,12 +40,12 @@ module.exports = {
modules: { modules: {
// ... // ...
[Modules.NOTIFICATION]: { [Modules.NOTIFICATION]: {
resolve: "@medusajs/notification", resolve: "@medusajs/medusa/notification",
options: { options: {
providers: [ providers: [
// ... // ...
{ {
resolve: "@medusajs/notification-local", resolve: "@medusajs/medusa/notification-local",
id: "notification", id: "notification",
options: { options: {
channels: ["email"], channels: ["email"],
@@ -37,8 +37,8 @@ import type {
SubscriberArgs, SubscriberArgs,
SubscriberConfig, SubscriberConfig,
} from "@medusajs/medusa" } from "@medusajs/medusa"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
import { INotificationModuleService } from "@medusajs/types" import { INotificationModuleService } from "@medusajs/framework/types"
export default async function productCreateHandler({ export default async function productCreateHandler({
event: { data }, event: { data },
@@ -10,7 +10,7 @@ The SendGrid Notification Module Provider integrates [SendGrid](https://sendgrid
--- ---
## Install the SendGrid Notification Module ## Register the SendGrid Notification Module
<Prerequisites <Prerequisites
items={[ items={[
@@ -29,19 +29,7 @@ The SendGrid Notification Module Provider integrates [SendGrid](https://sendgrid
]} ]}
/> />
To install the SendGrid Notification Module Provider, run the following command in the directory of your Medusa application: Add the module into the `providers` array of the Notification Module:
```bash npm2yarn
npm install @medusajs/notification-sendgrid@preview
```
<Note>
Make sure that the version added in `package.json` is `preview` to avoid errors with installation and updates in the future.
</Note>
Next, add the module into the `providers` array of the Notification Module:
<Note> <Note>
@@ -50,7 +38,7 @@ Only one provider can be defined for a channel.
</Note> </Note>
```js title="medusa-config.js" ```js title="medusa-config.js"
const { Modules } = require("@medusajs/utils") const { Modules } = require("@medusajs/framework/utils")
// ... // ...
@@ -58,12 +46,12 @@ module.exports = defineConfig({
// ... // ...
modules: { modules: {
[Modules.NOTIFICATION]: { [Modules.NOTIFICATION]: {
resolve: "@medusajs/notification", resolve: "@medusajs/medusa/notification",
options: { options: {
providers: [ providers: [
// ... // ...
{ {
resolve: "@medusajs/notification-sendgrid", resolve: "@medusajs/medusa/notification-sendgrid",
id: "sendgrid", id: "sendgrid",
options: { options: {
channels: ["email"], channels: ["email"],
@@ -144,8 +132,8 @@ import type {
SubscriberArgs, SubscriberArgs,
SubscriberConfig, SubscriberConfig,
} from "@medusajs/medusa" } from "@medusajs/medusa"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
import { INotificationModuleService } from "@medusajs/types" import { INotificationModuleService } from "@medusajs/framework/types"
export default async function productCreateHandler({ export default async function productCreateHandler({
event: { data }, event: { data },
@@ -14,30 +14,18 @@ For production, it’s recommended to use modules like [Redis Workflow Engine Mo
--- ---
## Install the In-Memory Workflow Engine Module ## Register the In-Memory Workflow Engine Module
<Note> <Note>
The In-Memory Workflow Engine Module is installed by default in your application. The In-Memory Workflow Engine Module is registered by default in your application.
</Note> </Note>
To install the In-Memory Workflow Engine Module, run the following command in the directory of your Medusa application: Add the module into the `modules` property of the exported object in `medusa-config.js`:
```bash npm2yarn
npm install @medusajs/workflow-engine-inmemory@preview
```
<Note>
Make sure that the version added in `package.json` is `preview` to avoid errors with installation and updates in the future.
</Note>
Next, add the module into the `modules` property of the exported object in `medusa-config.js`:
```js title="medusa-config.js" ```js title="medusa-config.js"
const { Modules } = require("@medusajs/utils") const { Modules } = require("@medusajs/framework/utils")
// ... // ...
@@ -10,7 +10,7 @@ The Redis Workflow Engine Module uses Redis to track workflow executions and han
--- ---
## Install the Redis Workflow Engine Module ## Register the Redis Workflow Engine Module
<Prerequisites items={[ <Prerequisites items={[
{ {
@@ -19,26 +19,14 @@ The Redis Workflow Engine Module uses Redis to track workflow executions and han
} }
]} /> ]} />
To install Redis Workflow Engine Module, run the following command in the directory of your Medusa application: Add the module into the `modules` property of the exported object in `medusa-config.js`:
```bash npm2yarn
npm install @medusajs/workflow-engine-redis@preview
```
<Note>
Make sure that the version added in `package.json` is `preview` to avoid errors with installation and updates in the future.
</Note>
Next, add the module into the `modules` property of the exported object in `medusa-config.js`:
export const highlights = [ export const highlights = [
["12", "url", "The Redis connection URL."] ["12", "url", "The Redis connection URL."]
] ]
```js title="medusa-config.js" highlights={highlights} ```js title="medusa-config.js" highlights={highlights}
const { Modules } = require("@medusajs/utils") const { Modules } = require("@medusajs/framework/utils")
// ... // ...
@@ -15,8 +15,8 @@ In this guide, you’ll find common examples of how you can use the API Key Modu
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IApiKeyModuleService } from "@medusajs/types" import { IApiKeyModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST(request: MedusaRequest, res: MedusaResponse) { export async function POST(request: MedusaRequest, res: MedusaResponse) {
const apiKeyModuleService: IApiKeyModuleService = request.scope.resolve( const apiKeyModuleService: IApiKeyModuleService = request.scope.resolve(
@@ -41,7 +41,7 @@ export async function POST(request: MedusaRequest, res: MedusaResponse) {
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeApiKeyModule } from "@medusajs/api-key" import { initialize as initializeApiKeyModule } from "@medusajs/medusa/api-key"
export async function POST(request: Request) { export async function POST(request: Request) {
const apiKeyModuleService = await initializeApiKeyModule() const apiKeyModuleService = await initializeApiKeyModule()
@@ -70,8 +70,8 @@ export async function POST(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IApiKeyModuleService } from "@medusajs/types" import { IApiKeyModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function GET(request: MedusaRequest, res: MedusaResponse) { export async function GET(request: MedusaRequest, res: MedusaResponse) {
const apiKeyModuleService: IApiKeyModuleService = request.scope.resolve( const apiKeyModuleService: IApiKeyModuleService = request.scope.resolve(
@@ -90,7 +90,7 @@ export async function GET(request: MedusaRequest, res: MedusaResponse) {
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeApiKeyModule } from "@medusajs/api-key" import { initialize as initializeApiKeyModule } from "@medusajs/medusa/api-key"
export async function GET(request: Request) { export async function GET(request: Request) {
const apiKeyModuleService = await initializeApiKeyModule() const apiKeyModuleService = await initializeApiKeyModule()
@@ -113,8 +113,8 @@ export async function GET(request: Request) {
```ts collapsibleLines="1-9" expandButtonLabel="Show Imports" ```ts collapsibleLines="1-9" expandButtonLabel="Show Imports"
import { AuthenticatedMedusaRequest, MedusaResponse } from "@medusajs/medusa" import { AuthenticatedMedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IApiKeyModuleService } from "@medusajs/types" import { IApiKeyModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST( export async function POST(
request: AuthenticatedMedusaRequest, request: AuthenticatedMedusaRequest,
@@ -140,7 +140,7 @@ export async function POST(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeApiKeyModule } from "@medusajs/api-key" import { initialize as initializeApiKeyModule } from "@medusajs/medusa/api-key"
type ContextType = { type ContextType = {
params: { params: {
@@ -174,8 +174,8 @@ export async function POST(request: Request, { params }: ContextType) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IApiKeyModuleService } from "@medusajs/types" import { IApiKeyModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST(request: MedusaRequest, res: MedusaResponse) { export async function POST(request: MedusaRequest, res: MedusaResponse) {
const apiKeyModuleService: IApiKeyModuleService = request.scope.resolve( const apiKeyModuleService: IApiKeyModuleService = request.scope.resolve(
@@ -198,7 +198,7 @@ export async function POST(request: MedusaRequest, res: MedusaResponse) {
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeApiKeyModule } from "@medusajs/api-key" import { initialize as initializeApiKeyModule } from "@medusajs/medusa/api-key"
type ContextType = { type ContextType = {
params: { params: {
@@ -234,8 +234,8 @@ export async function POST(request: Request, { params }: ContextType) {
AuthenticatedMedusaRequest, AuthenticatedMedusaRequest,
MedusaResponse, MedusaResponse,
} from "@medusajs/medusa" } from "@medusajs/medusa"
import { IApiKeyModuleService } from "@medusajs/types" import { IApiKeyModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST( export async function POST(
request: AuthenticatedMedusaRequest, request: AuthenticatedMedusaRequest,
@@ -267,7 +267,7 @@ export async function POST(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeApiKeyModule } from "@medusajs/api-key" import { initialize as initializeApiKeyModule } from "@medusajs/medusa/api-key"
type ContextType = { type ContextType = {
params: { params: {
@@ -6,11 +6,11 @@ export const metadata = {
# {metadata.title} # {metadata.title}
The API Key Module is the `@medusajs/api-key` NPM package that provides API-key-related features in your Medusa and Node.js applications. The API Key Module is the `@medusajs/medusa/api-key` NPM package that provides API-key-related features in your Medusa and Node.js applications.
## How to Use API Key Module's Service ## How to Use API Key Module's Service
You can use the API Key Module's main service by resolving from the Medusa container the resource `Modules.API_KEY` imported from `@medusajs/utils`. You can use the API Key Module's main service by resolving from the Medusa container the resource `Modules.API_KEY` imported from `@medusajs/framework/utils`.
For example: For example:
@@ -19,8 +19,8 @@ For example:
```ts title="src/api/store/custom/route.ts" ```ts title="src/api/store/custom/route.ts"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IApiKeyModuleService } from "@medusajs/types" import { IApiKeyModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function GET( export async function GET(
request: MedusaRequest, request: MedusaRequest,
@@ -41,8 +41,8 @@ export async function GET(
```ts title="src/subscribers/custom-handler.ts" ```ts title="src/subscribers/custom-handler.ts"
import { SubscriberArgs } from "@medusajs/medusa" import { SubscriberArgs } from "@medusajs/medusa"
import { IApiKeyModuleService } from "@medusajs/types" import { IApiKeyModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export default async function subscriberHandler({ container }: SubscriberArgs) { export default async function subscriberHandler({ container }: SubscriberArgs) {
const apiKeyModuleService: IApiKeyModuleService = container.resolve( const apiKeyModuleService: IApiKeyModuleService = container.resolve(
@@ -57,9 +57,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) {
<CodeTab label="Workflow Step" value="workflow-step"> <CodeTab label="Workflow Step" value="workflow-step">
```ts title="src/workflows/hello-world/step1.ts" ```ts title="src/workflows/hello-world/step1.ts"
import { createStep } from "@medusajs/workflows-sdk" import { createStep } from "@medusajs/framework/workflows-sdk"
import { IApiKeyModuleService } from "@medusajs/types" import { IApiKeyModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
const step1 = createStep("step-1", async (_, { container }) => { const step1 = createStep("step-1", async (_, { container }) => {
const apiKeyModuleService: IApiKeyModuleService = container.resolve( const apiKeyModuleService: IApiKeyModuleService = container.resolve(
@@ -12,26 +12,26 @@ Using the Emailpass auth module provider, you allow users to register and login
--- ---
## Install the Emailpass Auth Module Provider ## Register the Emailpass Auth Module Provider
The Emailpass auth provider is registered by default with the Auth Module. The Emailpass auth provider is registered by default with the Auth Module.
If you want to pass options to the provider, add the provider to the `providers` option of the Auth Module: If you want to pass options to the provider, add the provider to the `providers` option of the Auth Module:
```js title="medusa-config.js" ```js title="medusa-config.js"
const { Modules } = require("@medusajs/utils") const { Modules } = require("@medusajs/framework/utils")
// ... // ...
const modules = { const modules = {
// ... // ...
[Modules.AUTH]: { [Modules.AUTH]: {
resolve: "@medusajs/auth", resolve: "@medusajs/medusa/auth",
options: { options: {
providers: [ providers: [
// other providers... // other providers...
{ {
resolve: "@medusajs/auth-emailpass", resolve: "@medusajs/medusa/auth-emailpass",
id: "emailpass", id: "emailpass",
options: { options: {
// options... // options...
@@ -18,7 +18,7 @@ Learn about the authentication flow in [this guide](../../authentication-route/p
--- ---
## Install the Github Auth Module Provider ## Register the Github Auth Module Provider
<Prerequisites <Prerequisites
items={[ items={[
@@ -33,28 +33,22 @@ Learn about the authentication flow in [this guide](../../authentication-route/p
]} ]}
/> />
To install the GitHub auth module provider, run the following command in the directory of your Medusa application: Add the module to the array of providers passed to the Auth Module:
```bash npm2yarn
npm install @medusajs/auth-github@preview
```
Next, add the module to the array of providers passed to the Auth Module:
```js title="medusa-config.js" ```js title="medusa-config.js"
const { Modules } = require("@medusajs/utils") const { Modules } = require("@medusajs/framework/utils")
// ... // ...
const modules = { const modules = {
// ... // ...
[Modules.AUTH]: { [Modules.AUTH]: {
resolve: "@medusajs/auth", resolve: "@medusajs/medusa/auth",
options: { options: {
providers: [ providers: [
// other providers... // other providers...
{ {
resolve: "@medusajs/auth-github", resolve: "@medusajs/medusa/auth-github",
id: "github", id: "github",
options: { options: {
clientId: process.env.GITHUB_CLIENT_ID, clientId: process.env.GITHUB_CLIENT_ID,
@@ -18,7 +18,7 @@ Learn about the authentication flow in [this guide](../../authentication-route/p
--- ---
## Install the Google Auth Module Provider ## Register the Google Auth Module Provider
<Prerequisites <Prerequisites
items={[ items={[
@@ -33,28 +33,22 @@ Learn about the authentication flow in [this guide](../../authentication-route/p
]} ]}
/> />
To install the Google auth module provider, run the following command in the directory of your Medusa application: Add the module to the array of providers passed to the Auth Module:
```bash npm2yarn
npm install @medusajs/auth-google@preview
```
Next, add the module to the array of providers passed to the Auth Module:
```js title="medusa-config.js" ```js title="medusa-config.js"
const { Modules } = require("@medusajs/utils") const { Modules } = require("@medusajs/framework/utils")
// ... // ...
const modules = { const modules = {
// ... // ...
[Modules.AUTH]: { [Modules.AUTH]: {
resolve: "@medusajs/auth", resolve: "@medusajs/medusa/auth",
options: { options: {
providers: [ providers: [
// other providers... // other providers...
{ {
resolve: "@medusajs/auth-google", resolve: "@medusajs/medusa/auth-google",
id: "google", id: "google",
options: { options: {
clientId: process.env.GOOGLE_CLIENT_ID, clientId: process.env.GOOGLE_CLIENT_ID,
@@ -13,7 +13,7 @@ Before creating an actor type, you must define a data model the actor type belon
The rest of this guide uses this `Manager` data model as an example: The rest of this guide uses this `Manager` data model as an example:
```ts title="src/modules/manager/models/manager.ts" ```ts title="src/modules/manager/models/manager.ts"
import { model } from "@medusajs/utils" import { model } from "@medusajs/framework/utils"
const Manager = model.define("manager", { const Manager = model.define("manager", {
id: model.id().primaryKey(), id: model.id().primaryKey(),
@@ -49,10 +49,10 @@ import {
createStep, createStep,
StepResponse, StepResponse,
WorkflowResponse, WorkflowResponse,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
import { import {
setAuthAppMetadataStep, setAuthAppMetadataStep,
} from "@medusajs/core-flows" } from "@medusajs/medusa/core-flows"
import ManagerModuleService from "../modules/manager/service" import ManagerModuleService from "../modules/manager/service"
type CreateManagerWorkflowInput = { type CreateManagerWorkflowInput = {
@@ -106,7 +106,7 @@ This workflow accepts the manager’s data and the associated auth identity’s
The workflow has two steps: The workflow has two steps:
1. Create the manager using the `createManagerStep`. 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/core-flows`. You specify the actor type `manager` in the `actorType` property of the step’s input. 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 step’s input.
--- ---
@@ -127,7 +127,7 @@ import type {
AuthenticatedMedusaRequest, AuthenticatedMedusaRequest,
MedusaResponse, MedusaResponse,
} from "@medusajs/medusa" } from "@medusajs/medusa"
import { MedusaError } from "@medusajs/utils" import { MedusaError } from "@medusajs/framework/utils"
import createManagerWorkflow from "../../workflows/create-manager" import createManagerWorkflow from "../../workflows/create-manager"
type RequestBody = { type RequestBody = {
@@ -308,7 +308,7 @@ For example, create the following workflow that deletes a manager and updates it
import { import {
createStep, createStep,
StepResponse, StepResponse,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
import ManagerModuleService from "../modules/manager/service" import ManagerModuleService from "../modules/manager/service"
export type DeleteManagerWorkflow = { export type DeleteManagerWorkflow = {
@@ -348,17 +348,17 @@ export const deleteHighlights = [
```ts title="src/workflows/delete-manager.ts" collapsibleLines="1-15" expandButtonLabel="Show Imports" highlights={deleteHighlights} ```ts title="src/workflows/delete-manager.ts" collapsibleLines="1-15" expandButtonLabel="Show Imports" highlights={deleteHighlights}
// other imports // other imports
import { MedusaError } from "@medusajs/utils" import { MedusaError } from "@medusajs/framework/utils"
import { import {
WorkflowData, WorkflowData,
WorkflowResponse, WorkflowResponse,
createWorkflow, createWorkflow,
transform, transform,
} from "@medusajs/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
import { import {
setAuthAppMetadataStep, setAuthAppMetadataStep,
useRemoteQueryStep, useRemoteQueryStep,
} from "@medusajs/core-flows" } from "@medusajs/medusa/core-flows"
// ... // ...
@@ -24,9 +24,9 @@ This example uses the [jsonwebtoken NPM package](https://www.npmjs.com/package/j
import { import {
IAuthModuleService, IAuthModuleService,
AuthenticationInput, AuthenticationInput,
} from "@medusajs/types" } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
import { MedusaError } from "@medusajs/utils" import { MedusaError } from "@medusajs/framework/utils"
import jwt from "jsonwebtoken" import jwt from "jsonwebtoken"
export async function POST( export async function POST(
@@ -69,7 +69,7 @@ export async function POST(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeAuthModule } from "@medusajs/auth" import { initialize as initializeAuthModule } from "@medusajs/medusa/auth"
export async function POST(request: Request) { export async function POST(request: Request) {
const authModuleService = await initializeAuthModule() const authModuleService = await initializeAuthModule()
@@ -127,9 +127,9 @@ This example uses the [jsonwebtoken NPM package](https://www.npmjs.com/package/j
import { import {
IAuthModuleService, IAuthModuleService,
AuthenticationInput, AuthenticationInput,
} from "@medusajs/types" } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
import { MedusaError } from "@medusajs/utils" import { MedusaError } from "@medusajs/framework/utils"
import jwt from "jsonwebtoken" import jwt from "jsonwebtoken"
export async function POST( export async function POST(
@@ -174,7 +174,7 @@ export async function POST(
```ts collapsibleLines="1-7" expandButtonLabel="Show Imports" ```ts collapsibleLines="1-7" expandButtonLabel="Show Imports"
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeAuthModule } from "@medusajs/auth" import { initialize as initializeAuthModule } from "@medusajs/medusa/auth"
export async function POST(request: Request) { export async function POST(request: Request) {
const authModuleService = await initializeAuthModule() const authModuleService = await initializeAuthModule()
@@ -226,8 +226,8 @@ export async function POST(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IAuthModuleService } from "@medusajs/types" import { IAuthModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST( export async function POST(
req: MedusaRequest, req: MedusaRequest,
@@ -253,7 +253,7 @@ export async function POST(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeAuthModule } from "@medusajs/auth" import { initialize as initializeAuthModule } from "@medusajs/medusa/auth"
export async function POST(request: Request) { export async function POST(request: Request) {
const authModuleService = await initializeAuthModule() const authModuleService = await initializeAuthModule()
@@ -282,8 +282,8 @@ export async function POST(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IAuthModuleService } from "@medusajs/types" import { IAuthModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function GET( export async function GET(
req: MedusaRequest, req: MedusaRequest,
@@ -305,7 +305,7 @@ export async function GET(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeAuthModule } from "@medusajs/auth" import { initialize as initializeAuthModule } from "@medusajs/medusa/auth"
export async function GET(request: Request) { export async function GET(request: Request) {
const authModuleService = await initializeAuthModule() const authModuleService = await initializeAuthModule()
@@ -328,8 +328,8 @@ export async function GET(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IAuthModuleService } from "@medusajs/types" import { IAuthModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST( export async function POST(
req: MedusaRequest, req: MedusaRequest,
@@ -358,7 +358,7 @@ export async function POST(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeAuthModule } from "@medusajs/auth" import { initialize as initializeAuthModule } from "@medusajs/medusa/auth"
type ContextType = { type ContextType = {
params: { params: {
@@ -394,8 +394,8 @@ export async function POST(request: Request, { params }: ContextType) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IAuthModuleService } from "@medusajs/types" import { IAuthModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function DELETE( export async function DELETE(
req: MedusaRequest, req: MedusaRequest,
@@ -417,7 +417,7 @@ export async function DELETE(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeAuthModule } from "@medusajs/auth" import { initialize as initializeAuthModule } from "@medusajs/medusa/auth"
type ContextType = { type ContextType = {
params: { params: {
@@ -21,18 +21,18 @@ When the Medusa application starts, these providers are registered and can be us
For example: For example:
```js title="medusa-config.js" ```js title="medusa-config.js"
const { Modules } = require("@medusajs/utils") const { Modules } = require("@medusajs/framework/utils")
// ... // ...
module.exports = defineConfig({ module.exports = defineConfig({
// ... // ...
modules: { modules: {
resolve: "@medusajs/auth", resolve: "@medusajs/medusa/auth",
options: { options: {
providers: [ providers: [
{ {
resolve: "@medusajs/auth-emailpass", resolve: "@medusajs/medusa/auth-emailpass",
id: "emailpass", id: "emailpass",
options: { options: {
// provider options... // provider options...
@@ -6,11 +6,11 @@ export const metadata = {
# {metadata.title} # {metadata.title}
The Auth Module is the `@medusajs/auth` NPM package that provides authentication-related features in your Medusa and Node.js applications. The Auth Module is the `@medusajs/medusa/auth` NPM package that provides authentication-related features in your Medusa and Node.js applications.
## How to Use Auth Module's Service ## How to Use Auth Module's Service
You can use the Auth Module's main service by resolving from the Medusa container the resource `Modules.AUTH` imported from `@medusajs/utils`. You can use the Auth Module's main service by resolving from the Medusa container the resource `Modules.AUTH` imported from `@medusajs/framework/utils`.
For example: For example:
@@ -19,8 +19,8 @@ For example:
```ts title="src/api/store/custom/route.ts" ```ts title="src/api/store/custom/route.ts"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IAuthModuleService } from "@medusajs/types" import { IAuthModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function GET( export async function GET(
req: MedusaRequest, req: MedusaRequest,
@@ -41,8 +41,8 @@ export async function GET(
```ts title="src/subscribers/custom-handler.ts" ```ts title="src/subscribers/custom-handler.ts"
import { SubscriberArgs } from "@medusajs/medusa" import { SubscriberArgs } from "@medusajs/medusa"
import { IAuthModuleService } from "@medusajs/types" import { IAuthModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export default async function subscriberHandler({ container }: SubscriberArgs) { export default async function subscriberHandler({ container }: SubscriberArgs) {
const authModuleService: IAuthModuleService = container.resolve( const authModuleService: IAuthModuleService = container.resolve(
@@ -57,9 +57,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) {
<CodeTab label="Workflow Step" value="workflow-step"> <CodeTab label="Workflow Step" value="workflow-step">
```ts title="src/workflows/hello-world/step1.ts" ```ts title="src/workflows/hello-world/step1.ts"
import { createStep } from "@medusajs/workflows-sdk" import { createStep } from "@medusajs/framework/workflows-sdk"
import { IAuthModuleService } from "@medusajs/types" import { IAuthModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
const step1 = createStep("step-1", async (_, { container }) => { const step1 = createStep("step-1", async (_, { container }) => {
const authModuleService: IAuthModuleService = container.resolve( const authModuleService: IAuthModuleService = container.resolve(
@@ -15,8 +15,8 @@ In this guide, you’ll find common examples of how you can use the Cart Module
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { ICartModuleService } from "@medusajs/types" import { ICartModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST( export async function POST(
req: MedusaRequest, req: MedusaRequest,
@@ -51,7 +51,7 @@ export async function POST(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeCartModule } from "@medusajs/cart" import { initialize as initializeCartModule } from "@medusajs/medusa/cart"
export async function POST(request: Request) { export async function POST(request: Request) {
const cartModuleService = await initializeCartModule() const cartModuleService = await initializeCartModule()
@@ -89,8 +89,8 @@ export async function POST(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { ICartModuleService } from "@medusajs/types" import { ICartModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function GET( export async function GET(
req: MedusaRequest, req: MedusaRequest,
@@ -112,7 +112,7 @@ export async function GET(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeCartModule } from "@medusajs/cart" import { initialize as initializeCartModule } from "@medusajs/medusa/cart"
export async function GET(request: Request) { export async function GET(request: Request) {
const cartModuleService = await initializeCartModule() const cartModuleService = await initializeCartModule()
@@ -137,8 +137,8 @@ export async function GET(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { ICartModuleService } from "@medusajs/types" import { ICartModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST( export async function POST(
req: MedusaRequest, req: MedusaRequest,
@@ -167,7 +167,7 @@ export async function POST(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeCartModule } from "@medusajs/cart" import { initialize as initializeCartModule } from "@medusajs/medusa/cart"
export async function POST(request: Request) { export async function POST(request: Request) {
const cartModuleService = await initializeCartModule() const cartModuleService = await initializeCartModule()
@@ -197,8 +197,8 @@ export async function POST(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { ICartModuleService } from "@medusajs/types" import { ICartModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST( export async function POST(
req: MedusaRequest, req: MedusaRequest,
@@ -226,7 +226,7 @@ export async function POST(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeCartModule } from "@medusajs/cart" import { initialize as initializeCartModule } from "@medusajs/medusa/cart"
export async function POST(request: Request) { export async function POST(request: Request) {
const cartModuleService = await initializeCartModule() const cartModuleService = await initializeCartModule()
@@ -255,8 +255,8 @@ export async function POST(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { ICartModuleService } from "@medusajs/types" import { ICartModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST( export async function POST(
req: MedusaRequest, req: MedusaRequest,
@@ -284,7 +284,7 @@ export async function POST(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeCartModule } from "@medusajs/cart" import { initialize as initializeCartModule } from "@medusajs/medusa/cart"
export async function POST(request: Request) { export async function POST(request: Request) {
const cartModuleService = await initializeCartModule() const cartModuleService = await initializeCartModule()
@@ -313,8 +313,8 @@ export async function POST(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { ICartModuleService } from "@medusajs/types" import { ICartModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST( export async function POST(
req: MedusaRequest, req: MedusaRequest,
@@ -343,7 +343,7 @@ export async function POST(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeCartModule } from "@medusajs/cart" import { initialize as initializeCartModule } from "@medusajs/medusa/cart"
export async function POST(request: Request) { export async function POST(request: Request) {
const cartModuleService = await initializeCartModule() const cartModuleService = await initializeCartModule()
@@ -373,8 +373,8 @@ export async function POST(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { ICartModuleService } from "@medusajs/types" import { ICartModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function DELETE( export async function DELETE(
req: MedusaRequest, req: MedusaRequest,
@@ -396,7 +396,7 @@ export async function DELETE(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeCartModule } from "@medusajs/cart" import { initialize as initializeCartModule } from "@medusajs/medusa/cart"
export async function DELETE(request: Request) { export async function DELETE(request: Request) {
const cartModuleService = await initializeCartModule() const cartModuleService = await initializeCartModule()
@@ -417,8 +417,8 @@ export async function DELETE(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { ICartModuleService } from "@medusajs/types" import { ICartModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function DELETE( export async function DELETE(
req: MedusaRequest, req: MedusaRequest,
@@ -439,8 +439,8 @@ export async function DELETE(
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { ICartModuleService } from "@medusajs/types" import { ICartModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function DELETE( export async function DELETE(
req: MedusaRequest, req: MedusaRequest,
@@ -6,11 +6,11 @@ export const metadata = {
# {metadata.title} # {metadata.title}
The Cart Module is the `@medusajs/cart` NPM package that provides cart-related features in your Medusa and Node.js applications. The Cart Module is the `@medusajs/medusa/cart` NPM package that provides cart-related features in your Medusa and Node.js applications.
## How to Use Cart Module's Service ## 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/utils`. You can use the Cart Module's main service by resolving from the Medusa container the resource `Modules.CART` imported from `@medusajs/framework/utils`.
For example: For example:
@@ -19,8 +19,8 @@ For example:
```ts title="src/api/store/custom/route.ts" ```ts title="src/api/store/custom/route.ts"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { ICartModuleService } from "@medusajs/types" import { ICartModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function GET( export async function GET(
req: MedusaRequest, req: MedusaRequest,
@@ -41,8 +41,8 @@ export async function GET(
```ts title="src/subscribers/custom-handler.ts" ```ts title="src/subscribers/custom-handler.ts"
import { SubscriberArgs } from "@medusajs/medusa" import { SubscriberArgs } from "@medusajs/medusa"
import { ICartModuleService } from "@medusajs/types" import { ICartModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export default async function subscriberHandler({ container }: SubscriberArgs) { export default async function subscriberHandler({ container }: SubscriberArgs) {
const cartModuleService: ICartModuleService = container.resolve( const cartModuleService: ICartModuleService = container.resolve(
@@ -57,9 +57,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) {
<CodeTab label="Workflow Step" value="workflow-step"> <CodeTab label="Workflow Step" value="workflow-step">
```ts title="src/workflows/hello-world/step1.ts" ```ts title="src/workflows/hello-world/step1.ts"
import { createStep } from "@medusajs/workflows-sdk" import { createStep } from "@medusajs/framework/workflows-sdk"
import { ICartModuleService } from "@medusajs/types" import { ICartModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
const step1 = createStep("step-1", async (_, { container }) => { const step1 = createStep("step-1", async (_, { container }) => {
const cartModuleService: ICartModuleService = container.resolve( const cartModuleService: ICartModuleService = container.resolve(
@@ -47,7 +47,7 @@ import {
ComputeActionItemLine, ComputeActionItemLine,
ComputeActionShippingLine, ComputeActionShippingLine,
// ... // ...
} from "@medusajs/types" } from "@medusajs/framework/types"
// retrieve the cart // retrieve the cart
const cart = await cartModuleService.retrieveCart("cart_123", { const cart = await cartModuleService.retrieveCart("cart_123", {
@@ -106,7 +106,7 @@ import {
AddItemAdjustmentAction, AddItemAdjustmentAction,
AddShippingMethodAdjustment, AddShippingMethodAdjustment,
// ... // ...
} from "@medusajs/types" } from "@medusajs/framework/types"
// ... // ...
@@ -15,8 +15,8 @@ In this guide, you’ll find common examples of how you can use the Currency Mod
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { ICurrencyModuleService } from "@medusajs/types" import { ICurrencyModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function GET( export async function GET(
req: MedusaRequest, req: MedusaRequest,
@@ -38,7 +38,7 @@ export async function GET(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeCurrencyModule } from "@medusajs/currency" import { initialize as initializeCurrencyModule } from "@medusajs/medusa/currency"
export async function GET(request: Request) { export async function GET(request: Request) {
const currencyModuleService = await initializeCurrencyModule() const currencyModuleService = await initializeCurrencyModule()
@@ -61,8 +61,8 @@ export async function GET(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { ICurrencyModuleService } from "@medusajs/types" import { ICurrencyModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function GET( export async function GET(
req: MedusaRequest, req: MedusaRequest,
@@ -86,7 +86,7 @@ export async function GET(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeCurrencyModule } from "@medusajs/currency" import { initialize as initializeCurrencyModule } from "@medusajs/medusa/currency"
export async function GET(request: Request) { export async function GET(request: Request) {
const currencyModuleService = await initializeCurrencyModule() const currencyModuleService = await initializeCurrencyModule()
@@ -6,11 +6,11 @@ export const metadata = {
# {metadata.title} # {metadata.title}
The Currency Module is the `@medusajs/currency` NPM package that provides currency-related features in your Medusa and Node.js applications. The Currency Module is the `@medusajs/medusa/currency` NPM package that provides currency-related features in your Medusa and Node.js applications.
## How to Use Currency Module's Service ## 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/utils`. You can use the Currency Module's main service by resolving from the Medusa container the resource `Modules.CURRENCY` imported from `@medusajs/framework/utils`.
For example: For example:
@@ -19,8 +19,8 @@ For example:
```ts title="src/api/store/custom/route.ts" ```ts title="src/api/store/custom/route.ts"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { ICurrencyModuleService } from "@medusajs/types" import { ICurrencyModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function GET( export async function GET(
req: MedusaRequest, req: MedusaRequest,
@@ -41,8 +41,8 @@ export async function GET(
```ts title="src/subscribers/custom-handler.ts" ```ts title="src/subscribers/custom-handler.ts"
import { SubscriberArgs } from "@medusajs/medusa" import { SubscriberArgs } from "@medusajs/medusa"
import { ICurrencyModuleService } from "@medusajs/types" import { ICurrencyModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export default async function subscriberHandler({ container }: SubscriberArgs) { export default async function subscriberHandler({ container }: SubscriberArgs) {
const currencyModuleService: ICurrencyModuleService = container.resolve( const currencyModuleService: ICurrencyModuleService = container.resolve(
@@ -57,9 +57,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) {
<CodeTab label="Workflow Step" value="workflow-step"> <CodeTab label="Workflow Step" value="workflow-step">
```ts title="src/workflows/hello-world/step1.ts" ```ts title="src/workflows/hello-world/step1.ts"
import { createStep } from "@medusajs/workflows-sdk" import { createStep } from "@medusajs/framework/workflows-sdk"
import { ICurrencyModuleService } from "@medusajs/types" import { ICurrencyModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
const step1 = createStep("step-1", async (_, { container }) => { const step1 = createStep("step-1", async (_, { container }) => {
const currencyModuleService: ICurrencyModuleService = container.resolve( const currencyModuleService: ICurrencyModuleService = container.resolve(
@@ -15,8 +15,8 @@ In this guide, you’ll find common examples of how you can use the Customer Mod
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { ICustomerModuleService } from "@medusajs/types" import { ICustomerModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST(request: MedusaRequest, res: MedusaResponse) { export async function POST(request: MedusaRequest, res: MedusaResponse) {
const customerModuleService: ICustomerModuleService = request.scope.resolve( const customerModuleService: ICustomerModuleService = request.scope.resolve(
@@ -41,7 +41,7 @@ export async function POST(request: MedusaRequest, res: MedusaResponse) {
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeCustomerModule } from "@medusajs/customer" import { initialize as initializeCustomerModule } from "@medusajs/medusa/customer"
export async function POST(request: Request) { export async function POST(request: Request) {
const customerModuleService = await initializeCustomerModule() const customerModuleService = await initializeCustomerModule()
@@ -70,8 +70,8 @@ export async function POST(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { ICustomerModuleService } from "@medusajs/types" import { ICustomerModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST(request: MedusaRequest, res: MedusaResponse) { export async function POST(request: MedusaRequest, res: MedusaResponse) {
const customerModuleService: ICustomerModuleService = request.scope.resolve( const customerModuleService: ICustomerModuleService = request.scope.resolve(
@@ -94,7 +94,7 @@ export async function POST(request: MedusaRequest, res: MedusaResponse) {
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeCustomerModule } from "@medusajs/customer" import { initialize as initializeCustomerModule } from "@medusajs/medusa/customer"
export async function POST(request: Request) { export async function POST(request: Request) {
const customerModuleService = await initializeCustomerModule() const customerModuleService = await initializeCustomerModule()
@@ -121,8 +121,8 @@ export async function POST(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { ICustomerModuleService } from "@medusajs/types" import { ICustomerModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST(request: MedusaRequest, res: MedusaResponse) { export async function POST(request: MedusaRequest, res: MedusaResponse) {
const customerModuleService: ICustomerModuleService = request.scope.resolve( const customerModuleService: ICustomerModuleService = request.scope.resolve(
@@ -144,7 +144,7 @@ export async function POST(request: MedusaRequest, res: MedusaResponse) {
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeCustomerModule } from "@medusajs/customer" import { initialize as initializeCustomerModule } from "@medusajs/medusa/customer"
export async function POST(request: Request) { export async function POST(request: Request) {
const customerModuleService = await initializeCustomerModule() const customerModuleService = await initializeCustomerModule()
@@ -170,8 +170,8 @@ export async function POST(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { ICustomerModuleService } from "@medusajs/types" import { ICustomerModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST(request: MedusaRequest, res: MedusaResponse) { export async function POST(request: MedusaRequest, res: MedusaResponse) {
const customerModuleService: ICustomerModuleService = request.scope.resolve( const customerModuleService: ICustomerModuleService = request.scope.resolve(
@@ -194,7 +194,7 @@ export async function POST(request: MedusaRequest, res: MedusaResponse) {
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
// eslint-disable-next-line prettier/prettier // eslint-disable-next-line prettier/prettier
import { initialize as initializeCustomerModule } from "@medusajs/customer" import { initialize as initializeCustomerModule } from "@medusajs/medusa/customer"
export async function POST(request: Request) { export async function POST(request: Request) {
const customerModuleService = await initializeCustomerModule() const customerModuleService = await initializeCustomerModule()
@@ -6,11 +6,11 @@ export const metadata = {
# {metadata.title} # {metadata.title}
The Customer Module is the `@medusajs/customer` NPM package that provides customer-related features in your Medusa and Node.js applications. The Customer Module is the `@medusajs/medusa/customer` NPM package that provides customer-related features in your Medusa and Node.js applications.
## How to Use Customer Module's Service ## 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/utils`. You can use the Customer Module's main service by resolving from the Medusa container the resource `Modules.CUSTOMER` imported from `@medusajs/framework/utils`.
For example: For example:
@@ -19,8 +19,8 @@ For example:
```ts title="src/api/store/custom/route.ts" ```ts title="src/api/store/custom/route.ts"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { ICustomerModuleService } from "@medusajs/types" import { ICustomerModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function GET(request: MedusaRequest, res: MedusaResponse) { export async function GET(request: MedusaRequest, res: MedusaResponse) {
const customerModuleService: ICustomerModuleService = request.scope.resolve( const customerModuleService: ICustomerModuleService = request.scope.resolve(
@@ -38,8 +38,8 @@ export async function GET(request: MedusaRequest, res: MedusaResponse) {
```ts title="src/subscribers/custom-handler.ts" ```ts title="src/subscribers/custom-handler.ts"
import { SubscriberArgs } from "@medusajs/medusa" import { SubscriberArgs } from "@medusajs/medusa"
import { ICustomerModuleService } from "@medusajs/types" import { ICustomerModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export default async function subscriberHandler({ container }: SubscriberArgs) { export default async function subscriberHandler({ container }: SubscriberArgs) {
const customerModuleService: ICustomerModuleService = container.resolve( const customerModuleService: ICustomerModuleService = container.resolve(
@@ -54,9 +54,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) {
<CodeTab label="Workflow Step" value="workflow-step"> <CodeTab label="Workflow Step" value="workflow-step">
```ts title="src/workflows/hello-world/step1.ts" ```ts title="src/workflows/hello-world/step1.ts"
import { createStep } from "@medusajs/workflows-sdk" import { createStep } from "@medusajs/framework/workflows-sdk"
import { ICustomerModuleService } from "@medusajs/types" import { ICustomerModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
const step1 = createStep("step-1", async (_, { container }) => { const step1 = createStep("step-1", async (_, { container }) => {
const customerModuleService: ICustomerModuleService = container.resolve( const customerModuleService: ICustomerModuleService = container.resolve(
@@ -21,7 +21,7 @@ When the Medusa application starts, these providers are registered and can be us
For example: For example:
```js title="medusa-config.js" ```js title="medusa-config.js"
const { Modules } = require("@medusajs/utils") const { Modules } = require("@medusajs/framework/utils")
// ... // ...
@@ -29,11 +29,11 @@ module.exports = defineConfig({
// ... // ...
modules: { modules: {
[Modules.FULFILLMENT]: { [Modules.FULFILLMENT]: {
resolve: "@medusajs/fulfillment", resolve: "@medusajs/medusa/fulfillment",
options: { options: {
providers: [ providers: [
{ {
resolve: `@medusajs/fulfillment-manual`, resolve: `@medusajs/medusa/fulfillment-manual`,
id: "manual", id: "manual",
options: { options: {
// provider options... // provider options...
@@ -6,11 +6,11 @@ export const metadata = {
# {metadata.title} # {metadata.title}
The Fulfillment Module is the `@medusajs/fulfillment` NPM package that provides fulfillment-related features in your Medusa and Node.js applications. The Fulfillment Module is the `@medusajs/medusa/fulfillment` NPM package that provides fulfillment-related features in your Medusa and Node.js applications.
## How to Use Fulfillment Module's Service ## 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.API_KEY` imported from `@medusajs/utils`. You can use the Fulfillment Module's main service by resolving from the Medusa container the resource `Modules.API_KEY` imported from `@medusajs/framework/utils`.
For example: For example:
@@ -19,8 +19,8 @@ For example:
```ts title="src/api/store/custom/route.ts" ```ts title="src/api/store/custom/route.ts"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IFulfillmentModuleService } from "@medusajs/types" import { IFulfillmentModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function GET( export async function GET(
req: MedusaRequest, req: MedusaRequest,
@@ -41,8 +41,8 @@ export async function GET(
```ts title="src/subscribers/custom-handler.ts" ```ts title="src/subscribers/custom-handler.ts"
import { SubscriberArgs } from "@medusajs/medusa" import { SubscriberArgs } from "@medusajs/medusa"
import { IFulfillmentModuleService } from "@medusajs/types" import { IFulfillmentModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export default async function subscriberHandler({ container }: SubscriberArgs) { export default async function subscriberHandler({ container }: SubscriberArgs) {
const fulfillmentModuleService: IFulfillmentModuleService = container.resolve( const fulfillmentModuleService: IFulfillmentModuleService = container.resolve(
@@ -57,9 +57,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) {
<CodeTab label="Workflow Step" value="workflow-step"> <CodeTab label="Workflow Step" value="workflow-step">
```ts title="src/workflows/hello-world/step1.ts" ```ts title="src/workflows/hello-world/step1.ts"
import { createStep } from "@medusajs/workflows-sdk" import { createStep } from "@medusajs/framework/workflows-sdk"
import { IFulfillmentModuleService } from "@medusajs/types" import { IFulfillmentModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
const step1 = createStep("step-1", async (_, { container }) => { const step1 = createStep("step-1", async (_, { container }) => {
const fulfillmentModuleService: IFulfillmentModuleService = container.resolve( const fulfillmentModuleService: IFulfillmentModuleService = container.resolve(
@@ -15,8 +15,8 @@ In this document, you’ll find common examples of how you can use the Inventory
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IInventoryService } from "@medusajs/types" import { IInventoryService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST( export async function POST(
request: MedusaRequest, request: MedusaRequest,
@@ -42,7 +42,7 @@ export async function POST(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeInventoryModule } from "@medusajs/inventory-next" import { initialize as initializeInventoryModule } from "@medusajs/medusa/inventory-next"
export async function POST(request: Request) { export async function POST(request: Request) {
const inventoryModuleService = await initializeInventoryModule({}) const inventoryModuleService = await initializeInventoryModule({})
@@ -70,8 +70,8 @@ export async function POST(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IInventoryService } from "@medusajs/types" import { IInventoryService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function GET( export async function GET(
request: MedusaRequest, request: MedusaRequest,
@@ -93,7 +93,7 @@ export async function GET(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeInventoryModule } from "@medusajs/inventory-next" import { initialize as initializeInventoryModule } from "@medusajs/medusa/inventory-next"
export async function GET(request: Request) { export async function GET(request: Request) {
const inventoryModuleService = await initializeInventoryModule({}) const inventoryModuleService = await initializeInventoryModule({})
@@ -116,8 +116,8 @@ export async function GET(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IInventoryService } from "@medusajs/types" import { IInventoryService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function GET( export async function GET(
request: MedusaRequest, request: MedusaRequest,
@@ -141,7 +141,7 @@ export async function GET(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeInventoryModule } from "@medusajs/inventory-next" import { initialize as initializeInventoryModule } from "@medusajs/medusa/inventory-next"
type ContextType = { type ContextType = {
params: { params: {
@@ -172,8 +172,8 @@ export async function GET(request: Request, { params }: ContextType) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IInventoryService } from "@medusajs/types" import { IInventoryService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST( export async function POST(
request: MedusaRequest, request: MedusaRequest,
@@ -199,7 +199,7 @@ export async function POST(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeInventoryModule } from "@medusajs/inventory-next" import { initialize as initializeInventoryModule } from "@medusajs/medusa/inventory-next"
export async function POST(request: Request) { export async function POST(request: Request) {
const inventoryModuleService = await initializeInventoryModule({}) const inventoryModuleService = await initializeInventoryModule({})
@@ -227,8 +227,8 @@ export async function POST(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IInventoryService } from "@medusajs/types" import { IInventoryService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST( export async function POST(
request: MedusaRequest, request: MedusaRequest,
@@ -254,7 +254,7 @@ export async function POST(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeInventoryModule } from "@medusajs/inventory-next" import { initialize as initializeInventoryModule } from "@medusajs/medusa/inventory-next"
export async function POST(request: Request) { export async function POST(request: Request) {
const inventoryModuleService = await initializeInventoryModule({}) const inventoryModuleService = await initializeInventoryModule({})
@@ -282,8 +282,8 @@ export async function POST(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IInventoryService } from "@medusajs/types" import { IInventoryService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST( export async function POST(
request: MedusaRequest, request: MedusaRequest,
@@ -309,7 +309,7 @@ export async function POST(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeInventoryModule } from "@medusajs/inventory-next" import { initialize as initializeInventoryModule } from "@medusajs/medusa/inventory-next"
export async function POST(request: Request) { export async function POST(request: Request) {
const inventoryModuleService = await initializeInventoryModule({}) const inventoryModuleService = await initializeInventoryModule({})
@@ -337,8 +337,8 @@ export async function POST(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IInventoryService } from "@medusajs/types" import { IInventoryService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST( export async function POST(
request: MedusaRequest, request: MedusaRequest,
@@ -364,7 +364,7 @@ export async function POST(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeInventoryModule } from "@medusajs/inventory-next" import { initialize as initializeInventoryModule } from "@medusajs/medusa/inventory-next"
export async function POST(request: Request) { export async function POST(request: Request) {
const inventoryModuleService = await initializeInventoryModule({}) const inventoryModuleService = await initializeInventoryModule({})
@@ -394,8 +394,8 @@ export async function POST(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IInventoryService } from "@medusajs/types" import { IInventoryService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function GET( export async function GET(
request: MedusaRequest, request: MedusaRequest,
@@ -434,7 +434,7 @@ export async function GET(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializeInventoryModule } from "@medusajs/inventory-next" import { initialize as initializeInventoryModule } from "@medusajs/medusa/inventory-next"
type ContextType = { type ContextType = {
params: { params: {
@@ -481,8 +481,8 @@ export async function POST(request: Request, { params }: ContextType) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IInventoryService } from "@medusajs/types" import { IInventoryService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function DELETE( export async function DELETE(
request: MedusaRequest, request: MedusaRequest,
@@ -504,7 +504,7 @@ export async function DELETE(
<CodeTab label="Next.js App Router" value="nextjs"> <CodeTab label="Next.js App Router" value="nextjs">
```ts ```ts
import { initialize as initializeInventoryModule } from "@medusajs/inventory-next" import { initialize as initializeInventoryModule } from "@medusajs/medusa/inventory-next"
type ContextType = { type ContextType = {
params: { params: {
@@ -6,11 +6,11 @@ export const metadata = {
# {metadata.title} # {metadata.title}
The Inventory Module is the `@medusajs/inventory-next` NPM package that provides inventory-related features in your Medusa and Node.js applications. The Inventory Module is the `@medusajs/medusa/inventory-next` NPM package that provides inventory-related features in your Medusa and Node.js applications.
## How to Use Inventory Module's Service ## 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/utils`. You can use the Inventory Module's main service by resolving from the Medusa container the resource `Modules.INVENTORY` imported from `@medusajs/framework/utils`.
For example: For example:
@@ -19,8 +19,8 @@ For example:
```ts title="src/api/store/custom/route.ts" ```ts title="src/api/store/custom/route.ts"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IInventoryService } from "@medusajs/types" import { IInventoryService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function GET( export async function GET(
request: MedusaRequest, request: MedusaRequest,
@@ -41,8 +41,8 @@ export async function GET(
```ts title="src/subscribers/custom-handler.ts" ```ts title="src/subscribers/custom-handler.ts"
import { SubscriberArgs } from "@medusajs/medusa" import { SubscriberArgs } from "@medusajs/medusa"
import { IInventoryService } from "@medusajs/types" import { IInventoryService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export default async function subscriberHandler({ container }: SubscriberArgs) { export default async function subscriberHandler({ container }: SubscriberArgs) {
const inventoryModuleService: IInventoryService = container.resolve( const inventoryModuleService: IInventoryService = container.resolve(
@@ -57,9 +57,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) {
<CodeTab label="Workflow Step" value="workflow-step"> <CodeTab label="Workflow Step" value="workflow-step">
```ts title="src/workflows/hello-world/step1.ts" ```ts title="src/workflows/hello-world/step1.ts"
import { createStep } from "@medusajs/workflows-sdk" import { createStep } from "@medusajs/framework/workflows-sdk"
import { IInventoryService } from "@medusajs/types" import { IInventoryService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
const step1 = createStep("step-1", async (_, { container }) => { const step1 = createStep("step-1", async (_, { container }) => {
const inventoryModuleService: IInventoryService = container.resolve( const inventoryModuleService: IInventoryService = container.resolve(
@@ -6,11 +6,11 @@ export const metadata = {
# {metadata.title} # {metadata.title}
The Order Module is the `@medusajs/order` NPM package that provides order-related features in your Medusa and Node.js applications. The Order Module is the `@medusajs/medusa/order` NPM package that provides order-related features in your Medusa and Node.js applications.
## How to Use Order Module's Service ## 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/utils`. You can use the Order Module's main service by resolving from the Medusa container the resource `Modules.ORDER` imported from `@medusajs/framework/utils`.
For example: For example:
@@ -19,8 +19,8 @@ For example:
```ts title="src/api/store/custom/route.ts" ```ts title="src/api/store/custom/route.ts"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IOrderModuleService } from "@medusajs/types" import { IOrderModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function GET( export async function GET(
req: MedusaRequest, req: MedusaRequest,
@@ -41,8 +41,8 @@ export async function GET(
```ts title="src/subscribers/custom-handler.ts" ```ts title="src/subscribers/custom-handler.ts"
import { SubscriberArgs } from "@medusajs/medusa" import { SubscriberArgs } from "@medusajs/medusa"
import { IOrderModuleService } from "@medusajs/types" import { IOrderModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export default async function subscriberHandler({ container }: SubscriberArgs) { export default async function subscriberHandler({ container }: SubscriberArgs) {
const orderModuleService: IOrderModuleService = container.resolve( const orderModuleService: IOrderModuleService = container.resolve(
@@ -57,9 +57,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) {
<CodeTab label="Workflow Step" value="workflow-step"> <CodeTab label="Workflow Step" value="workflow-step">
```ts title="src/workflows/hello-world/step1.ts" ```ts title="src/workflows/hello-world/step1.ts"
import { createStep } from "@medusajs/workflows-sdk" import { createStep } from "@medusajs/framework/workflows-sdk"
import { IOrderModuleService } from "@medusajs/types" import { IOrderModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
const step1 = createStep("step-1", async (_, { container }) => { const step1 = createStep("step-1", async (_, { container }) => {
const orderModuleService: IOrderModuleService = container.resolve( const orderModuleService: IOrderModuleService = container.resolve(
@@ -53,7 +53,7 @@ import {
ComputeActionItemLine, ComputeActionItemLine,
ComputeActionShippingLine, ComputeActionShippingLine,
// ... // ...
} from "@medusajs/types" } from "@medusajs/framework/types"
// ... // ...
@@ -116,7 +116,7 @@ import {
AddItemAdjustmentAction, AddItemAdjustmentAction,
AddShippingMethodAdjustment, AddShippingMethodAdjustment,
// ... // ...
} from "@medusajs/types" } from "@medusajs/framework/types"
// ... // ...
@@ -15,8 +15,8 @@ In this guide, you’ll find common examples of how you can use the Payment Modu
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IPaymentModuleService } from "@medusajs/types" import { IPaymentModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST( export async function POST(
req: MedusaRequest, req: MedusaRequest,
@@ -46,7 +46,7 @@ export async function POST(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializePaymentModule } from "@medusajs/payment" import { initialize as initializePaymentModule } from "@medusajs/medusa/payment"
export async function POST(request: Request) { export async function POST(request: Request) {
const paymentModuleService = await initializePaymentModule() const paymentModuleService = await initializePaymentModule()
@@ -77,8 +77,8 @@ export async function POST(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IPaymentModuleService } from "@medusajs/types" import { IPaymentModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST( export async function POST(
req: MedusaRequest, req: MedusaRequest,
@@ -110,7 +110,7 @@ export async function POST(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializePaymentModule } from "@medusajs/payment" import { initialize as initializePaymentModule } from "@medusajs/medusa/payment"
export async function POST(request: Request) { export async function POST(request: Request) {
const paymentModuleService = await initializePaymentModule() const paymentModuleService = await initializePaymentModule()
@@ -143,8 +143,8 @@ export async function POST(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IPaymentModuleService } from "@medusajs/types" import { IPaymentModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function GET( export async function GET(
req: MedusaRequest, req: MedusaRequest,
@@ -170,7 +170,7 @@ export async function GET(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializePaymentModule } from "@medusajs/payment" import { initialize as initializePaymentModule } from "@medusajs/medusa/payment"
export async function POST(request: Request) { export async function POST(request: Request) {
const paymentModuleService = await initializePaymentModule() const paymentModuleService = await initializePaymentModule()
@@ -197,8 +197,8 @@ export async function POST(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IPaymentModuleService } from "@medusajs/types" import { IPaymentModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST( export async function POST(
req: MedusaRequest, req: MedusaRequest,
@@ -225,7 +225,7 @@ export async function POST(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializePaymentModule } from "@medusajs/payment" import { initialize as initializePaymentModule } from "@medusajs/medusa/payment"
export async function POST(request: Request) { export async function POST(request: Request) {
const paymentModuleService = await initializePaymentModule() const paymentModuleService = await initializePaymentModule()
@@ -253,8 +253,8 @@ export async function POST(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IPaymentModuleService } from "@medusajs/types" import { IPaymentModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function GET( export async function GET(
req: MedusaRequest, req: MedusaRequest,
@@ -280,7 +280,7 @@ export async function GET(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializePaymentModule } from "@medusajs/payment" import { initialize as initializePaymentModule } from "@medusajs/medusa/payment"
export async function GET(request: Request) { export async function GET(request: Request) {
const paymentModuleService = await initializePaymentModule() const paymentModuleService = await initializePaymentModule()
@@ -307,8 +307,8 @@ export async function GET(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IPaymentModuleService } from "@medusajs/types" import { IPaymentModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST( export async function POST(
req: MedusaRequest, req: MedusaRequest,
@@ -334,7 +334,7 @@ export async function POST(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializePaymentModule } from "@medusajs/payment" import { initialize as initializePaymentModule } from "@medusajs/medusa/payment"
export async function POST(request: Request) { export async function POST(request: Request) {
const paymentModuleService = await initializePaymentModule() const paymentModuleService = await initializePaymentModule()
@@ -102,7 +102,7 @@ When the Medusa application starts, these providers are registered and can be us
For example: For example:
```js title="medusa-config.js" ```js title="medusa-config.js"
const { Modules } = require("@medusajs/utils") const { Modules } = require("@medusajs/framework/utils")
// ... // ...
@@ -110,11 +110,11 @@ module.exports = defineConfig({
// ... // ...
modules: { modules: {
[Modules.PAYMENT]: { [Modules.PAYMENT]: {
resolve: "@medusajs/payment", resolve: "@medusajs/medusa/payment",
options: { options: {
providers: [ providers: [
{ {
resolve: "@medusajs/payment-stripe", resolve: "@medusajs/medusa/payment-stripe",
id: "stripe", id: "stripe",
options: { options: {
// ... // ...
@@ -7,11 +7,11 @@ export const metadata = {
# {metadata.title} # {metadata.title}
The Payment Module is the `@medusajs/payment` NPM package that provides payment-related features in your Medusa and Node.js applications. The Payment Module is the `@medusajs/medusa/payment` NPM package that provides payment-related features in your Medusa and Node.js applications.
## How to Use Payment Module's Service ## 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/utils`. You can use the Payment Module's main service by resolving from the Medusa container the resource `Modules.PAYMENT` imported from `@medusajs/framework/utils`.
For example: For example:
@@ -20,8 +20,8 @@ For example:
```ts title="src/api/store/custom/route.ts" ```ts title="src/api/store/custom/route.ts"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IPaymentModuleService } from "@medusajs/types" import { IPaymentModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function GET( export async function GET(
req: MedusaRequest, req: MedusaRequest,
@@ -42,8 +42,8 @@ export async function GET(
```ts title="src/subscribers/custom-handler.ts" ```ts title="src/subscribers/custom-handler.ts"
import { SubscriberArgs } from "@medusajs/medusa" import { SubscriberArgs } from "@medusajs/medusa"
import { IPaymentModuleService } from "@medusajs/types" import { IPaymentModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export default async function subscriberHandler({ container }: SubscriberArgs) { export default async function subscriberHandler({ container }: SubscriberArgs) {
const paymentModuleService: IPaymentModuleService = container.resolve( const paymentModuleService: IPaymentModuleService = container.resolve(
@@ -59,9 +59,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) {
<CodeTab label="Workflow Step" value="workflow-step"> <CodeTab label="Workflow Step" value="workflow-step">
```ts title="src/workflows/hello-world/step1.ts" ```ts title="src/workflows/hello-world/step1.ts"
import { createStep } from "@medusajs/workflows-sdk" import { createStep } from "@medusajs/framework/workflows-sdk"
import { IPaymentModuleService } from "@medusajs/types" import { IPaymentModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
const step1 = createStep("step-1", async (_, { container }) => { const step1 = createStep("step-1", async (_, { container }) => {
const paymentModuleService: IPaymentModuleService = container.resolve( const paymentModuleService: IPaymentModuleService = container.resolve(
@@ -30,7 +30,7 @@ The Payment Module provides a `system` payment provider that acts as a placehold
## How are Payment Providers Created? ## How are Payment Providers Created?
A payment provider is a TypeScript or JavaScript class that extends the `AbstractPaymentProvider` imported from `@medusajs/utils`. It can then be exported as the main service of a module. A payment provider is a TypeScript or JavaScript class that extends the `AbstractPaymentProvider` imported from `@medusajs/framework/utils`. It can then be exported as the main service of a module.
<Note title="Tip"> <Note title="Tip">
@@ -20,7 +20,7 @@ These features are also available in a safe test environment, allowing for a con
--- ---
## Install the Stripe Module Provider ## Register the Stripe Module Provider
<Prerequisites items={[ <Prerequisites items={[
{ {
@@ -37,22 +37,10 @@ These features are also available in a safe test environment, allowing for a con
} }
]} /> ]} />
To install the Stripe Module Provider, run the following command in the directory of your Medusa application: Add the module to the array of providers passed to the Payment Module:
```bash npm2yarn
npm install @medusajs/payment-stripe@preview
```
<Note>
Make sure that the version added in `package.json` is `preview` to avoid errors with installation and updates in the future.
</Note>
Next, add the module to the array of providers passed to the Payment Module:
```js title="medusa-config.js" ```js title="medusa-config.js"
const { Modules } = require("@medusajs/utils") const { Modules } = require("@medusajs/framework/utils")
// ... // ...
@@ -60,11 +48,11 @@ module.exports = defineConfig({
// ... // ...
modules: { modules: {
[Modules.PAYMENT]: { [Modules.PAYMENT]: {
resolve: "@medusajs/payment", resolve: "@medusajs/medusa/payment",
options: { options: {
providers: [ providers: [
{ {
resolve: "@medusajs/payment-stripe", resolve: "@medusajs/medusa/payment-stripe",
id: "stripe", id: "stripe",
options: { options: {
apiKey: process.env.STRIPE_API_KEY, apiKey: process.env.STRIPE_API_KEY,
@@ -15,8 +15,8 @@ In this document, you’ll find common examples of how you can use the Pricing M
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IPricingModuleService } from "@medusajs/types" import { IPricingModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST( export async function POST(
request: MedusaRequest, request: MedusaRequest,
@@ -50,7 +50,7 @@ export async function POST(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializePricingModule } from "@medusajs/pricing" import { initialize as initializePricingModule } from "@medusajs/medusa/pricing"
export async function POST(request: Request) { export async function POST(request: Request) {
const pricingModuleService = await initializePricingModule() const pricingModuleService = await initializePricingModule()
@@ -86,8 +86,8 @@ export async function POST(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IPricingModuleService } from "@medusajs/types" import { IPricingModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function GET( export async function GET(
request: MedusaRequest, request: MedusaRequest,
@@ -109,7 +109,7 @@ export async function GET(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializePricingModule } from "@medusajs/pricing" import { initialize as initializePricingModule } from "@medusajs/medusa/pricing"
export async function GET(request: Request) { export async function GET(request: Request) {
const pricingModuleService = await initializePricingModule() const pricingModuleService = await initializePricingModule()
@@ -132,8 +132,8 @@ export async function GET(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IPricingModuleService } from "@medusajs/types" import { IPricingModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function GET( export async function GET(
request: MedusaRequest, request: MedusaRequest,
@@ -155,7 +155,7 @@ export async function GET(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializePricingModule } from "@medusajs/pricing" import { initialize as initializePricingModule } from "@medusajs/medusa/pricing"
export async function GET(request: Request) { export async function GET(request: Request) {
const pricingModuleService = await initializePricingModule() const pricingModuleService = await initializePricingModule()
@@ -178,8 +178,8 @@ export async function GET(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IPricingModuleService } from "@medusajs/types" import { IPricingModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST( export async function POST(
request: MedusaRequest, request: MedusaRequest,
@@ -212,7 +212,7 @@ export async function POST(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializePricingModule } from "@medusajs/pricing" import { initialize as initializePricingModule } from "@medusajs/medusa/pricing"
export async function POST(request: Request) { export async function POST(request: Request) {
const pricingModuleService = await initializePricingModule() const pricingModuleService = await initializePricingModule()
@@ -247,9 +247,9 @@ export async function POST(request: Request) {
```ts collapsibleLines="1-8" expandButtonLabel="Show Imports" ```ts collapsibleLines="1-8" expandButtonLabel="Show Imports"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IPricingModuleService } from "@medusajs/types" import { IPricingModuleService } from "@medusajs/framework/types"
import { PriceListType } from "@medusajs/utils" import { PriceListType } from "@medusajs/framework/utils"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST( export async function POST(
request: MedusaRequest, request: MedusaRequest,
@@ -290,8 +290,8 @@ export async function POST(
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { PriceListType } from "@medusajs/medusa" import { PriceListType } from "@medusajs/medusa"
import { initialize as initializePricingModule } from "@medusajs/pricing" import { initialize as initializePricingModule } from "@medusajs/medusa/pricing"
import { PriceListType } from "@medusajs/utils" import { PriceListType } from "@medusajs/framework/utils"
export async function POST(request: Request) { export async function POST(request: Request) {
const pricingModuleService = await initializePricingModule() const pricingModuleService = await initializePricingModule()
@@ -332,8 +332,8 @@ export async function POST(request: Request) {
```ts ```ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IPricingModuleService } from "@medusajs/types" import { IPricingModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/utils" import { Modules } from "@medusajs/framework/utils"
export async function POST( export async function POST(
request: MedusaRequest, request: MedusaRequest,
@@ -364,7 +364,7 @@ export async function POST(
```ts ```ts
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { initialize as initializePricingModule } from "@medusajs/pricing" import { initialize as initializePricingModule } from "@medusajs/medusa/pricing"
export async function GET(request: Request) { export async function GET(request: Request) {
const pricingModuleService = await initializePricingModule() const pricingModuleService = await initializePricingModule()
Loaded 100 of 196 files, more files were not shown because too many files have changed in this diff. Show more