@@ -48,6 +48,6 @@ When you resolve the `ModuleRegistrationName.PRODUCT` (or `productModuleService`
|
||||
|
||||
<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>
|
||||
|
||||
@@ -83,7 +83,7 @@ For example:
|
||||
export const highlights = [
|
||||
["7", "container", "Recieve the Medusa Container in the object parameter."],
|
||||
["10", "resolve", "Resolve the Product Module's main service."],
|
||||
["10", "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}
|
||||
|
||||
@@ -19,7 +19,7 @@ export const highlights = [
|
||||
[
|
||||
"10",
|
||||
"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 = [
|
||||
["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}
|
||||
|
||||
@@ -230,7 +230,7 @@ export const highlights = [
|
||||
[
|
||||
"12",
|
||||
"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
|
||||
|
||||
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:
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ Refer to [this documentation](./module-options/page.mdx) for details on the modu
|
||||
|
||||
## 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:
|
||||
|
||||
@@ -110,7 +110,7 @@ export async function GET(
|
||||
```ts title="src/subscribers/custom-handler.ts"
|
||||
import { SubscriberArgs } from "@medusajs/medusa"
|
||||
import { IAuthModuleService } from "@medusajs/types"
|
||||
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
|
||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||
|
||||
export default async function subscriberHandler({ container }: SubscriberArgs) {
|
||||
const authModuleService: IAuthModuleService = container.resolve(
|
||||
@@ -127,7 +127,7 @@ export default async function subscriberHandler({ container }: SubscriberArgs) {
|
||||
```ts title="src/workflows/hello-world/step1.ts"
|
||||
import { createStep } from "@medusajs/workflows-sdk"
|
||||
import { IAuthModuleService } from "@medusajs/types"
|
||||
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
|
||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||
|
||||
const step1 = createStep("step-1", async (_, { container }) => {
|
||||
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
|
||||
|
||||
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:
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ const currency = await currencyModuleService.retrieveCurrency(
|
||||
|
||||
## 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:
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ await customerModuleService.addCustomerToGroup({
|
||||
|
||||
## 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:
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ Refer to [this documentation](./module-options/page.mdx) for details on the modu
|
||||
|
||||
## 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:
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ const isAvailable = await inventoryModuleService.confirmInventory(
|
||||
|
||||
## 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:
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ const orderReturn = await orderModuleService.createReturn({
|
||||
|
||||
## 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:
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ Refer to [this documentation](./module-options/page.mdx) for details on the modu
|
||||
|
||||
## 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:
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ const price = await pricingModuleService.calculatePrices(
|
||||
|
||||
## 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:
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ const products = await productService.updateProducts([
|
||||
|
||||
## 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:
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ const campaign = await promotionModuleService.createCampaigns({
|
||||
|
||||
## 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:
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ const regions = await regionModuleService.createRegions([
|
||||
|
||||
## 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:
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
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:
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ const stockLocation = await stockLocationModuleService.updateStockLocations({
|
||||
|
||||
## 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:
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ const stores = await storeModuleService.createStores([
|
||||
|
||||
## 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:
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ Refer to [this documentation](./module-options/page.mdx) for details on the modu
|
||||
|
||||
## 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:
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ Refer to [this documentation](./module-options/page.mdx) for details on the modu
|
||||
|
||||
## 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:
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ This documentation page includes the list of resources registered in the Medusa
|
||||
<Table.Cell>
|
||||
|
||||
- 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.Row>
|
||||
|
||||
@@ -475,7 +475,7 @@ export const syncProductsWorkflowHighlight = [
|
||||
```ts title="src/workflows/sync-products.ts" highlights={syncProductsWorkflowHighlight} collapsibleLines="1-16" expandButtonLabel="Show Imports"
|
||||
import {
|
||||
ModuleRegistrationName
|
||||
} from "@medusajs/modules-sdk"
|
||||
} from "@medusajs/utils"
|
||||
import {
|
||||
IProductModuleService,
|
||||
IStoreModuleService,
|
||||
@@ -786,7 +786,7 @@ The `order.placed` event is currently not emitted.
|
||||
} from "@medusajs/medusa"
|
||||
import {
|
||||
ModuleRegistrationName,
|
||||
} from "@medusajs/modules-sdk"
|
||||
} from "@medusajs/utils"
|
||||
import {
|
||||
ICustomerModuleService,
|
||||
IOrderModuleService,
|
||||
@@ -902,7 +902,7 @@ export const newsletterHighlights = [
|
||||
} from "@medusajs/medusa"
|
||||
import {
|
||||
ModuleRegistrationName,
|
||||
} from "@medusajs/modules-sdk"
|
||||
} from "@medusajs/utils"
|
||||
import {
|
||||
ICustomerModuleService,
|
||||
IProductModuleService,
|
||||
|
||||
@@ -319,7 +319,7 @@ For example, suppose an administrator changes the product data in the ERP system
|
||||
} from "@medusajs/types"
|
||||
import {
|
||||
ModuleRegistrationName
|
||||
} from "@medusajs/modules-sdk"
|
||||
} from "@medusajs/utils"
|
||||
|
||||
type WebhookReq = {
|
||||
id: string
|
||||
|
||||
Reference in New Issue
Block a user