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:
@@ -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.
|
||||
|
||||
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"
|
||||
import { ICacheService } from "@medusajs/types"
|
||||
import { ICacheService } from "@medusajs/framework/types"
|
||||
|
||||
class MyCacheService implements ICacheService {
|
||||
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"
|
||||
import MyCacheService from "./service"
|
||||
import { Module } from "@medusajs/utils"
|
||||
import { Module } from "@medusajs/framework/utils"
|
||||
|
||||
export default Module("my-cache", {
|
||||
service: MyCacheService,
|
||||
@@ -153,7 +153,7 @@ To use your Cache Module, add it to the `modules` object exported as part of the
|
||||
For example:
|
||||
|
||||
```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>
|
||||
|
||||
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>
|
||||
|
||||
To install the In-Memory Cache Module, run the following command in the directory of your Medusa application:
|
||||
|
||||
```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`:
|
||||
Add the module into the `modules` property of the exported object in `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.CACHE]: {
|
||||
resolve: "@medusajs/cache-inmemory",
|
||||
resolve: "@medusajs/medusa/cache-inmemory",
|
||||
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={[
|
||||
{
|
||||
@@ -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:
|
||||
|
||||
```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`:
|
||||
Add the module into the `modules` property of the exported object in `medusa-config.js`:
|
||||
|
||||
export const highlights = [
|
||||
["11", "redisUrl", "The Redis connection URL."]
|
||||
]
|
||||
|
||||
```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.CACHE]: {
|
||||
resolve: "@medusajs/cache-redis",
|
||||
resolve: "@medusajs/medusa/cache-redis",
|
||||
options: {
|
||||
redisUrl: process.env.CACHE_REDIS_URL,
|
||||
},
|
||||
@@ -166,6 +154,8 @@ CACHE_REDIS_URL=<YOUR_REDIS_URL>
|
||||
</Table.Body>
|
||||
</Table>
|
||||
|
||||
---
|
||||
|
||||
## Test the Module
|
||||
|
||||
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.
|
||||
|
||||
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"
|
||||
import { EmitData, Message } from "@medusajs/types"
|
||||
import { AbstractEventBusModuleService } from "@medusajs/utils"
|
||||
import { EmitData, Message } from "@medusajs/framework/types"
|
||||
import { AbstractEventBusModuleService } from "@medusajs/framework/utils"
|
||||
|
||||
class MyEventService extends AbstractEventBusModuleService {
|
||||
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"
|
||||
import MyEventService from "./service"
|
||||
import { Module } from "@medusajs/utils"
|
||||
import { Module } from "@medusajs/framework/utils"
|
||||
|
||||
export default Module("my-event", {
|
||||
service: MyEventService,
|
||||
@@ -108,7 +108,7 @@ To use your Event Module, add it to the `modules` object exported as part of the
|
||||
For example:
|
||||
|
||||
```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>
|
||||
|
||||
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>
|
||||
|
||||
To install Local Event Bus Module, run the following command in the directory of your Medusa application:
|
||||
|
||||
```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`:
|
||||
Add the module into the `modules` property of the exported object in `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={[
|
||||
{
|
||||
@@ -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:
|
||||
|
||||
```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`:
|
||||
Add the module into the `modules` property of the exported object in `medusa-config.js`:
|
||||
|
||||
export const highlights = [
|
||||
["11", "redisUrl", "The Redis connection URL."]
|
||||
]
|
||||
|
||||
```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.EVENT_BUS]: {
|
||||
resolve: "@medusajs/event-bus-redis",
|
||||
resolve: "@medusajs/medusa/event-bus-redis",
|
||||
options: {
|
||||
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>
|
||||
|
||||
The Local File Module is installed by default in your application.
|
||||
The Local File Module Provider is registered by default in your application.
|
||||
|
||||
</Note>
|
||||
|
||||
To install the Local File Module Provider, run the following command in the directory of your Medusa application:
|
||||
|
||||
```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:
|
||||
Add the module into the `providers` array of the File Module:
|
||||
|
||||
<Note>
|
||||
|
||||
@@ -45,7 +33,7 @@ The File Module accepts one provider only.
|
||||
</Note>
|
||||
|
||||
```js title="medusa-config.js"
|
||||
const { Modules } = require("@medusajs/utils")
|
||||
const { Modules } = require("@medusajs/framework/utils")
|
||||
|
||||
// ...
|
||||
|
||||
@@ -53,11 +41,11 @@ module.exports = {
|
||||
// ...
|
||||
modules: {
|
||||
[Modules.FILE]: {
|
||||
resolve: "@medusajs/file",
|
||||
resolve: "@medusajs/medusa/file",
|
||||
options: {
|
||||
providers: [
|
||||
{
|
||||
resolve: "@medusajs/file-local-next",
|
||||
resolve: "@medusajs/medusa/file-local-next",
|
||||
id: "local",
|
||||
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:
|
||||
|
||||
```bash npm2yarn
|
||||
npm install @medusajs/file-s3@preview
|
||||
```
|
||||
|
||||
Next, add the module into the `providers` array of the File Module:
|
||||
Add the module into the `providers` array of the File Module:
|
||||
|
||||
<Note>
|
||||
|
||||
@@ -119,7 +113,7 @@ The File Module accepts one provider only.
|
||||
</Note>
|
||||
|
||||
```js title="medusa-config.js"
|
||||
const { Modules } = require("@medusajs/utils")
|
||||
const { Modules } = require("@medusajs/framework/utils")
|
||||
|
||||
// ...
|
||||
|
||||
@@ -128,11 +122,11 @@ module.exports = {
|
||||
modules: {
|
||||
// ...
|
||||
[Modules.FILE]: {
|
||||
resolve: "@medusajs/file",
|
||||
resolve: "@medusajs/medusa/file",
|
||||
options: {
|
||||
providers: [
|
||||
{
|
||||
resolve: "@medusajs/file-s3",
|
||||
resolve: "@medusajs/medusa/file-s3",
|
||||
id: "s3",
|
||||
options: {
|
||||
file_url: process.env.S3_FILE_URL,
|
||||
@@ -360,11 +354,11 @@ module.exports = defineConfig({
|
||||
// ...
|
||||
modules: {
|
||||
[Modules.FILE]: {
|
||||
resolve: "@medusajs/file",
|
||||
resolve: "@medusajs/medusa/file",
|
||||
options: {
|
||||
providers: [
|
||||
{
|
||||
resolve: "@medusajs/file-s3",
|
||||
resolve: "@medusajs/medusa/file-s3",
|
||||
id: "s3",
|
||||
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>
|
||||
|
||||
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>
|
||||
|
||||
To install the Local Notification Module Provider, run the following command in the directory of your Medusa application:
|
||||
|
||||
```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:
|
||||
Add the module into the `providers` array of the Notification Module:
|
||||
|
||||
<Note>
|
||||
|
||||
@@ -39,7 +27,7 @@ Only one provider can be defined for a channel.
|
||||
</Note>
|
||||
|
||||
```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.NOTIFICATION]: {
|
||||
resolve: "@medusajs/notification",
|
||||
resolve: "@medusajs/medusa/notification",
|
||||
options: {
|
||||
providers: [
|
||||
// ...
|
||||
{
|
||||
resolve: "@medusajs/notification-local",
|
||||
resolve: "@medusajs/medusa/notification-local",
|
||||
id: "local",
|
||||
options: {
|
||||
channels: ["email"],
|
||||
|
||||
@@ -31,7 +31,7 @@ When you send a notification, you specify the channel to send it through, such a
|
||||
For example:
|
||||
|
||||
```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.NOTIFICATION]: {
|
||||
resolve: "@medusajs/notification",
|
||||
resolve: "@medusajs/medusa/notification",
|
||||
options: {
|
||||
providers: [
|
||||
// ...
|
||||
{
|
||||
resolve: "@medusajs/notification-local",
|
||||
resolve: "@medusajs/medusa/notification-local",
|
||||
id: "notification",
|
||||
options: {
|
||||
channels: ["email"],
|
||||
|
||||
+2
-2
@@ -37,8 +37,8 @@ import type {
|
||||
SubscriberArgs,
|
||||
SubscriberConfig,
|
||||
} from "@medusajs/medusa"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { INotificationModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
import { INotificationModuleService } from "@medusajs/framework/types"
|
||||
|
||||
export default async function productCreateHandler({
|
||||
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
|
||||
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:
|
||||
|
||||
```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:
|
||||
Add the module into the `providers` array of the Notification Module:
|
||||
|
||||
<Note>
|
||||
|
||||
@@ -50,7 +38,7 @@ Only one provider can be defined for a channel.
|
||||
</Note>
|
||||
|
||||
```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.NOTIFICATION]: {
|
||||
resolve: "@medusajs/notification",
|
||||
resolve: "@medusajs/medusa/notification",
|
||||
options: {
|
||||
providers: [
|
||||
// ...
|
||||
{
|
||||
resolve: "@medusajs/notification-sendgrid",
|
||||
resolve: "@medusajs/medusa/notification-sendgrid",
|
||||
id: "sendgrid",
|
||||
options: {
|
||||
channels: ["email"],
|
||||
@@ -144,8 +132,8 @@ import type {
|
||||
SubscriberArgs,
|
||||
SubscriberConfig,
|
||||
} from "@medusajs/medusa"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { INotificationModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
import { INotificationModuleService } from "@medusajs/framework/types"
|
||||
|
||||
export default async function productCreateHandler({
|
||||
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>
|
||||
|
||||
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>
|
||||
|
||||
To install the In-Memory Workflow Engine Module, run the following command in the directory of your Medusa application:
|
||||
|
||||
```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`:
|
||||
Add the module into the `modules` property of the exported object in `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={[
|
||||
{
|
||||
@@ -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:
|
||||
|
||||
```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`:
|
||||
Add the module into the `modules` property of the exported object in `medusa-config.js`:
|
||||
|
||||
export const highlights = [
|
||||
["12", "url", "The Redis connection URL."]
|
||||
]
|
||||
|
||||
```js title="medusa-config.js" highlights={highlights}
|
||||
const { Modules } = require("@medusajs/utils")
|
||||
const { Modules } = require("@medusajs/framework/utils")
|
||||
|
||||
// ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user