@@ -48,6 +48,6 @@ When you resolve the `ModuleRegistrationName.PRODUCT` (or `productModuleService`
|
|||||||
|
|
||||||
<Note title="Tip">
|
<Note title="Tip">
|
||||||
|
|
||||||
To resolve the main service of any commerce module, use the registration name defined in the `ModuleRegistrationName` enum imported from `@medusajs/modules-sdk`.
|
To resolve the main service of any commerce module, use the registration name defined in the `ModuleRegistrationName` enum imported from `@medusajs/utils`.
|
||||||
|
|
||||||
</Note>
|
</Note>
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ 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", "ModuleRegistrationName.PRODUCT", "The module's registration name imported from `@medusajs/modules-sdk`."]
|
["10", "ModuleRegistrationName.PRODUCT", "The module's registration name imported from `@medusajs/utils`."]
|
||||||
]
|
]
|
||||||
|
|
||||||
```ts title="src/subscribers/product-created.ts" highlights={highlights}
|
```ts title="src/subscribers/product-created.ts" highlights={highlights}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export const highlights = [
|
|||||||
[
|
[
|
||||||
"10",
|
"10",
|
||||||
"ModuleRegistrationName.PRODUCT",
|
"ModuleRegistrationName.PRODUCT",
|
||||||
"The resource registration name imported from `@medusajs/modules-sdk`.",
|
"The resource registration name imported from `@medusajs/utils`.",
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ 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", "ModuleRegistrationName.PRODUCT", "The module's registration name imported from `@medusajs/modules-sdk`."]
|
["11", "ModuleRegistrationName.PRODUCT", "The module's registration name imported from `@medusajs/utils`."]
|
||||||
]
|
]
|
||||||
|
|
||||||
```ts title="src/jobs/hello-world.ts" highlights={highlights}
|
```ts title="src/jobs/hello-world.ts" highlights={highlights}
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ export const highlights = [
|
|||||||
[
|
[
|
||||||
"12",
|
"12",
|
||||||
"ModuleRegistrationName.PRODUCT",
|
"ModuleRegistrationName.PRODUCT",
|
||||||
"The resource registration name imported from `@medusajs/modules-sdk`.",
|
"The resource registration name imported from `@medusajs/utils`.",
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ const newKey = await apiKeyModuleService.createApiKeys({
|
|||||||
|
|
||||||
## 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 `ModuleRegistrationName.API_KEY` imported from `@medusajs/modules-sdk`.
|
You can use the API Key Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.API_KEY` imported from `@medusajs/utils`.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ Refer to [this documentation](./module-options/page.mdx) for details on the modu
|
|||||||
|
|
||||||
## 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 `ModuleRegistrationName.AUTH` imported from `@medusajs/modules-sdk`.
|
You can use the Auth Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.AUTH` imported from `@medusajs/utils`.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ 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/types"
|
||||||
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
|
import { ModuleRegistrationName } from "@medusajs/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(
|
||||||
@@ -127,7 +127,7 @@ export default async function subscriberHandler({ container }: SubscriberArgs) {
|
|||||||
```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/workflows-sdk"
|
||||||
import { IAuthModuleService } from "@medusajs/types"
|
import { IAuthModuleService } from "@medusajs/types"
|
||||||
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
|
import { ModuleRegistrationName } from "@medusajs/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(
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ When used with their respective modules and other commerce modules, you benefit
|
|||||||
|
|
||||||
## 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 `ModuleRegistrationName.CART` imported from `@medusajs/modules-sdk`.
|
You can use the Cart Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.CART` imported from `@medusajs/utils`.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ const currency = await currencyModuleService.retrieveCurrency(
|
|||||||
|
|
||||||
## 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 `ModuleRegistrationName.CURRENCY` imported from `@medusajs/modules-sdk`.
|
You can use the Currency Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.CURRENCY` imported from `@medusajs/utils`.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ await customerModuleService.addCustomerToGroup({
|
|||||||
|
|
||||||
## 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 `ModuleRegistrationName.CUSTOMER` imported from `@medusajs/modules-sdk`.
|
You can use the Customer Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.CUSTOMER` imported from `@medusajs/utils`.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ Refer to [this documentation](./module-options/page.mdx) for details on the modu
|
|||||||
|
|
||||||
## 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 `ModuleRegistrationName.API_KEY` imported from `@medusajs/modules-sdk`.
|
You can use the Fulfillment Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.API_KEY` imported from `@medusajs/utils`.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ const isAvailable = await inventoryModuleService.confirmInventory(
|
|||||||
|
|
||||||
## 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 `ModuleRegistrationName.INVENTORY` imported from `@medusajs/modules-sdk`.
|
You can use the Inventory Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.INVENTORY` imported from `@medusajs/utils`.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ const orderReturn = await orderModuleService.createReturn({
|
|||||||
|
|
||||||
## 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 `ModuleRegistrationName.ORDER` imported from `@medusajs/modules-sdk`.
|
You can use the Order Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.ORDER` imported from `@medusajs/utils`.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ Refer to [this documentation](./module-options/page.mdx) for details on the modu
|
|||||||
|
|
||||||
## 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 `ModuleRegistrationName.PAYMENT` imported from `@medusajs/modules-sdk`.
|
You can use the Payment Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.PAYMENT` imported from `@medusajs/utils`.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ const price = await pricingModuleService.calculatePrices(
|
|||||||
|
|
||||||
## How to Use Pricing Module's Service
|
## How to Use Pricing Module's Service
|
||||||
|
|
||||||
You can use the Pricing Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.PRICING` imported from `@medusajs/modules-sdk`.
|
You can use the Pricing Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.PRICING` imported from `@medusajs/utils`.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ const products = await productService.updateProducts([
|
|||||||
|
|
||||||
## How to Use Product Module's Service
|
## How to Use Product Module's Service
|
||||||
|
|
||||||
You can use the Product Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.PRODUCT` imported from `@medusajs/modules-sdk`.
|
You can use the Product Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.PRODUCT` imported from `@medusajs/utils`.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ const campaign = await promotionModuleService.createCampaigns({
|
|||||||
|
|
||||||
## How to Use the Promotion Module's Service
|
## How to Use the Promotion Module's Service
|
||||||
|
|
||||||
You can use the Promotion Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.PROMOTION` imported from `@medusajs/modules-sdk`.
|
You can use the Promotion Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.PROMOTION` imported from `@medusajs/utils`.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ const regions = await regionModuleService.createRegions([
|
|||||||
|
|
||||||
## How to Use Region Module's Service
|
## How to Use Region Module's Service
|
||||||
|
|
||||||
You can use the Region Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.REGION` imported from `@medusajs/modules-sdk`.
|
You can use the Region Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.REGION` imported from `@medusajs/utils`.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ Orders are also scoped to a sales channel due to the relation between the Sales
|
|||||||
|
|
||||||
## How to Use Sales Channel Module's Service
|
## How to Use Sales Channel Module's Service
|
||||||
|
|
||||||
You can use the Sales Channel Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.SALES_CHANNEL` imported from `@medusajs/modules-sdk`.
|
You can use the Sales Channel Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.SALES_CHANNEL` imported from `@medusajs/utils`.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ const stockLocation = await stockLocationModuleService.updateStockLocations({
|
|||||||
|
|
||||||
## How to Use Stock Location Module's Service
|
## How to Use Stock Location Module's Service
|
||||||
|
|
||||||
You can use the Stock Location Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.STOCK_LOCATION` imported from `@medusajs/modules-sdk`.
|
You can use the Stock Location Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.STOCK_LOCATION` imported from `@medusajs/utils`.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ const stores = await storeModuleService.createStores([
|
|||||||
|
|
||||||
## How to Use Store Module's Service
|
## How to Use Store Module's Service
|
||||||
|
|
||||||
You can use the Store Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.STORE` imported from `@medusajs/modules-sdk`.
|
You can use the Store Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.STORE` imported from `@medusajs/utils`.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ Refer to [this documentation](./module-options/page.mdx) for details on the modu
|
|||||||
|
|
||||||
## How to Use Tax Module's Service
|
## How to Use Tax Module's Service
|
||||||
|
|
||||||
You can use the Tax Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.TAX` imported from `@medusajs/modules-sdk`.
|
You can use the Tax Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.TAX` imported from `@medusajs/utils`.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ Refer to [this documentation](./module-options/page.mdx) for details on the modu
|
|||||||
|
|
||||||
## How to Use User Module's Service
|
## How to Use User Module's Service
|
||||||
|
|
||||||
You can use the User Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.USER` imported from `@medusajs/modules-sdk`.
|
You can use the User Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.USER` imported from `@medusajs/utils`.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ This documentation page includes the list of resources registered in the Medusa
|
|||||||
<Table.Cell>
|
<Table.Cell>
|
||||||
|
|
||||||
- For custom modules, the registration name is the key of the module in the `modules` configuration.
|
- For custom modules, the registration name is the key of the module in the `modules` configuration.
|
||||||
- For Medusa's commerce modules, you can use the `ModuleRegistrationName` enum imported from `@medusajs/modules-sdk`.
|
- For Medusa's commerce modules, you can use the `ModuleRegistrationName` enum imported from `@medusajs/utils`.
|
||||||
|
|
||||||
</Table.Cell>
|
</Table.Cell>
|
||||||
</Table.Row>
|
</Table.Row>
|
||||||
|
|||||||
@@ -475,7 +475,7 @@ export const syncProductsWorkflowHighlight = [
|
|||||||
```ts title="src/workflows/sync-products.ts" highlights={syncProductsWorkflowHighlight} collapsibleLines="1-16" expandButtonLabel="Show Imports"
|
```ts title="src/workflows/sync-products.ts" highlights={syncProductsWorkflowHighlight} collapsibleLines="1-16" expandButtonLabel="Show Imports"
|
||||||
import {
|
import {
|
||||||
ModuleRegistrationName
|
ModuleRegistrationName
|
||||||
} from "@medusajs/modules-sdk"
|
} from "@medusajs/utils"
|
||||||
import {
|
import {
|
||||||
IProductModuleService,
|
IProductModuleService,
|
||||||
IStoreModuleService,
|
IStoreModuleService,
|
||||||
@@ -786,7 +786,7 @@ The `order.placed` event is currently not emitted.
|
|||||||
} from "@medusajs/medusa"
|
} from "@medusajs/medusa"
|
||||||
import {
|
import {
|
||||||
ModuleRegistrationName,
|
ModuleRegistrationName,
|
||||||
} from "@medusajs/modules-sdk"
|
} from "@medusajs/utils"
|
||||||
import {
|
import {
|
||||||
ICustomerModuleService,
|
ICustomerModuleService,
|
||||||
IOrderModuleService,
|
IOrderModuleService,
|
||||||
@@ -902,7 +902,7 @@ export const newsletterHighlights = [
|
|||||||
} from "@medusajs/medusa"
|
} from "@medusajs/medusa"
|
||||||
import {
|
import {
|
||||||
ModuleRegistrationName,
|
ModuleRegistrationName,
|
||||||
} from "@medusajs/modules-sdk"
|
} from "@medusajs/utils"
|
||||||
import {
|
import {
|
||||||
ICustomerModuleService,
|
ICustomerModuleService,
|
||||||
IProductModuleService,
|
IProductModuleService,
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ For example, suppose an administrator changes the product data in the ERP system
|
|||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import {
|
import {
|
||||||
ModuleRegistrationName
|
ModuleRegistrationName
|
||||||
} from "@medusajs/modules-sdk"
|
} from "@medusajs/utils"
|
||||||
|
|
||||||
type WebhookReq = {
|
type WebhookReq = {
|
||||||
id: string
|
id: string
|
||||||
|
|||||||
Reference in New Issue
Block a user