docs: added how-to guides for architectural modules (#11883)

* added initial how-tos

* finished changes

* generated sidebars
This commit is contained in:
Shahed Nasser
2025-03-18 09:49:19 +02:00
committed by GitHub
parent 0099c1e2e9
commit cb68a9e67b
37 changed files with 5265 additions and 68 deletions
@@ -0,0 +1,392 @@
---
sidebar_label: "Use Workflow Engine Module"
tags:
- workflow engine
- server
- how to
---
import { TypeList } from "docs-ui"
export const metadata = {
title: `How to Use the Workflow Engine Module`,
}
# {metadata.title}
In this document, youll learn about the different methods in the Workflow Engine Module's service and how to use them.
---
## Resolve Workflow Engine Module's Service
In your workflow's step, you can resolve the Workflow Engine Module's service from the Medusa container:
```ts
import { Modules } from "@medusajs/framework/utils"
import { createStep } from "@medusajs/framework/workflows-sdk"
const step1 = createStep(
"step-1",
async ({}, { container }) => {
const workflowEngineModuleService = container.resolve(
Modules.WORKFLOW_ENGINE
)
// TODO use workflowEngineModuleService
}
)
```
This will resolve the service of the configured Workflow Engine Module, which is the [In-Memory Workflow Engine Module](../in-memory/page.mdx) by default.
You can then use the Workflow Engine Module's service's methods in the step. The rest of this guide details these methods.
---
## setStepSuccess
This method sets an async step in a currently-executing [long-running workflow](!docs!/learn/fundamentals/workflows/long-running-workflow) as successful. The workflow will then continue to the next step.
### Example
```ts
// other imports...
import {
TransactionHandlerType,
} from "@medusajs/framework/utils"
await workflowEngineModuleService.setStepSuccess({
idempotencyKey: {
action: TransactionHandlerType.INVOKE,
transactionId,
stepId: "step-2",
workflowId: "hello-world",
},
stepResponse: new StepResponse("Done!"),
options: {
container,
},
})
```
### Parameters
<TypeList types={[
{
"name": "idempotencyKey",
"type": "`object`",
"description": "The details of the step to set as successful.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "action",
"type": "`invoke` | `compensate`",
"description": "If the step's compensation function is running, use `compensate`. Otherwise, use `invoke`.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionId",
"type": "`string`",
"description": "The ID of the workflow execution's transaction.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "stepId",
"type": "`string`",
"description": "The ID of the step to change its status. This is the first parameter passed to `createStep` when creating the step.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "workflowId",
"type": "`string`",
"description": "The ID of the workflow. This is the first parameter passed to `createWorkflow` when creating the workflow.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "stepResponse",
"type": "`StepResponse`",
"description": "Set the response of the step. This is similar to the response you return in a step's definition, but since the async step doesn't have a response, you set its response when changing its status.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "options",
"type": "`object`",
"description": "Options to pass to the step.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "container",
"type": "`Container`",
"description": "An instance of the Medusa container.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="setStepSuccess"/>
---
## setStepFailure
This method sets an async step in a currently-executing [long-running workflow](!docs!/learn/fundamentals/workflows/long-running-workflow) as failed. The workflow will then stop executing and the compensation functions of the workflow's steps will be executed.
### Example
```ts
// other imports...
import {
TransactionHandlerType,
} from "@medusajs/framework/utils"
await workflowEngineModuleService.setStepFailure({
idempotencyKey: {
action: TransactionHandlerType.INVOKE,
transactionId,
stepId: "step-2",
workflowId: "hello-world",
},
stepResponse: new StepResponse("Failed!"),
options: {
container,
},
})
```
### Parameters
<TypeList types={[
{
"name": "idempotencyKey",
"type": "`object`",
"description": "The details of the step to set as failed.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "action",
"type": "`invoke` | `compensate`",
"description": "If the step's compensation function is running, use `compensate`. Otherwise, use `invoke`.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionId",
"type": "`string`",
"description": "The ID of the workflow execution's transaction.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "stepId",
"type": "`string`",
"description": "The ID of the step to change its status. This is the first parameter passed to `createStep` when creating the step.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "workflowId",
"type": "`string`",
"description": "The ID of the workflow. This is the first parameter passed to `createWorkflow` when creating the workflow.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "stepResponse",
"type": "`StepResponse`",
"description": "Set the response of the step. This is similar to the response you return in a step's definition, but since the async step doesn't have a response, you set its response when changing its status.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "options",
"type": "`object`",
"description": "Options to pass to the step.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "container",
"type": "`Container`",
"description": "An instance of the Medusa container.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="setStepFailure"/>
---
## subscribe
This method subscribes to a workflow's events. You can use this method to listen to a [long-running workflow](!docs!/learn/fundamentals/workflows/long-running-workflow)'s events and retrieve its result once it's done executing.
Refer to the [Long-Running Workflows](!docs!/learn/fundamentals/workflows/long-running-workflow#access-long-running-workflow-status-and-result) documentation to learn more.
### Example
```ts
const { transaction } = await helloWorldWorkflow(container).run()
const subscriptionOptions = {
workflowId: "hello-world",
transactionId: transaction.transactionId,
subscriberId: "hello-world-subscriber",
}
await workflowEngineModuleService.subscribe({
...subscriptionOptions,
subscriber: async (data) => {
if (data.eventType === "onFinish") {
console.log("Finished execution", data.result)
// unsubscribe
await workflowEngineModuleService.unsubscribe({
...subscriptionOptions,
subscriberOrId: subscriptionOptions.subscriberId,
})
} else if (data.eventType === "onStepFailure") {
console.log("Workflow failed", data.step)
}
},
})
```
### Parameters
<TypeList types={[
{
"name": "subscriptionOptions",
"type": "`object`",
"description": "The options for the subscription.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "workflowId",
"type": "`string`",
"description": "The ID of the workflow to subscribe to. This is the first parameter passed to `createWorkflow` when creating the workflow.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionId",
"type": "`string`",
"description": "The ID of the workflow execution's transaction. This is returned when you execute a workflow.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "subscriberId",
"type": "`string`",
"description": "A unique ID for the subscriber. It's used to unsubscribe from the workflow's events.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "subscriber",
"type": "`(data: WorkflowEvent) => void`",
"description": "The subscriber function that will be called when the workflow emits an event.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="subscribe"/>
---
## unsubscribe
This method unsubscribes from a workflow's events. You can use this method to stop listening to a [long-running workflow](!docs!/learn/fundamentals/workflows/long-running-workflow)'s events after you've received the result.
### Example
```ts
await workflowEngineModuleService.unsubscribe({
workflowId: "hello-world",
transactionId: "transaction-id",
subscriberOrId: "hello-world-subscriber",
})
```
### Parameters
<TypeList types={[
{
"name": "workflowId",
"type": "`string`",
"description": "The ID of the workflow to unsubscribe from. This is the first parameter passed to `createWorkflow` when creating the workflow.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionId",
"type": "`string`",
"description": "The ID of the workflow execution's transaction. This is returned when you execute a workflow.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "subscriberOrId",
"type": "`string`",
"description": "The subscriber ID or the subscriber function to unsubscribe from the workflow's events.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="unsubscribe"/>
+9 -1
View File
@@ -6049,5 +6049,13 @@ export const generatedEditDates = {
"app/architectural-modules/locking/redis/page.mdx": "2025-03-12T10:07:43.867Z",
"references/locking/interfaces/locking.ILockingModule/page.mdx": "2025-03-12T12:28:30.425Z",
"references/locking/interfaces/locking.ILockingProvider/page.mdx": "2025-03-12T12:28:30.422Z",
"references/modules/locking/page.mdx": "2025-03-12T12:28:30.419Z"
"references/modules/locking/page.mdx": "2025-03-12T12:28:30.419Z",
"references/cache/interfaces/cache.ICacheService/page.mdx": "2025-03-17T15:24:02.574Z",
"references/event/interfaces/event.IEventBusModuleService/page.mdx": "2025-03-17T15:24:03.025Z",
"references/file_service/interfaces/file_service.IFileModuleService/page.mdx": "2025-03-17T15:24:03.031Z",
"references/modules/cache/page.mdx": "2025-03-17T15:24:02.572Z",
"references/modules/event/page.mdx": "2025-03-17T15:24:03.021Z",
"references/modules/file_service/page.mdx": "2025-03-17T15:24:03.025Z",
"references/modules/notification_service/page.mdx": "2025-03-17T15:24:05.164Z",
"references/notification_service/interfaces/notification_service.INotificationModuleService/page.mdx": "2025-03-17T15:24:05.173Z"
}
@@ -123,6 +123,10 @@ export const filesMap = [
"filePath": "/www/apps/resources/app/architectural-modules/page.mdx",
"pathname": "/architectural-modules"
},
{
"filePath": "/www/apps/resources/app/architectural-modules/workflow-engine/how-to-use/page.mdx",
"pathname": "/architectural-modules/workflow-engine/how-to-use"
},
{
"filePath": "/www/apps/resources/app/architectural-modules/workflow-engine/in-memory/page.mdx",
"pathname": "/architectural-modules/workflow-engine/in-memory"
@@ -1691,6 +1695,10 @@ export const filesMap = [
"filePath": "/www/apps/resources/references/auth_provider/classes/auth_provider.AbstractAuthModuleProvider/page.mdx",
"pathname": "/references/auth_provider/classes/auth_provider.AbstractAuthModuleProvider"
},
{
"filePath": "/www/apps/resources/references/cache/interfaces/cache.ICacheService/page.mdx",
"pathname": "/references/cache/interfaces/cache.ICacheService"
},
{
"filePath": "/www/apps/resources/references/cart/IBigNumber/methods/cart.IBigNumber.toJSON/page.mdx",
"pathname": "/references/cart/IBigNumber/methods/cart.IBigNumber.toJSON"
@@ -9571,10 +9579,18 @@ export const filesMap = [
"filePath": "/www/apps/resources/references/dml/properties_base/classes/dml.properties_base.BaseProperty/page.mdx",
"pathname": "/references/dml/properties_base/classes/dml.properties_base.BaseProperty"
},
{
"filePath": "/www/apps/resources/references/event/interfaces/event.IEventBusModuleService/page.mdx",
"pathname": "/references/event/interfaces/event.IEventBusModuleService"
},
{
"filePath": "/www/apps/resources/references/file/classes/file.AbstractFileProviderService/page.mdx",
"pathname": "/references/file/classes/file.AbstractFileProviderService"
},
{
"filePath": "/www/apps/resources/references/file_service/interfaces/file_service.IFileModuleService/page.mdx",
"pathname": "/references/file_service/interfaces/file_service.IFileModuleService"
},
{
"filePath": "/www/apps/resources/references/fulfillment/IBigNumber/methods/fulfillment.IBigNumber.toJSON/page.mdx",
"pathname": "/references/fulfillment/IBigNumber/methods/fulfillment.IBigNumber.toJSON"
@@ -12967,6 +12983,10 @@ export const filesMap = [
"filePath": "/www/apps/resources/references/modules/auth_provider/page.mdx",
"pathname": "/references/modules/auth_provider"
},
{
"filePath": "/www/apps/resources/references/modules/cache/page.mdx",
"pathname": "/references/modules/cache"
},
{
"filePath": "/www/apps/resources/references/modules/cart/page.mdx",
"pathname": "/references/modules/cart"
@@ -12999,10 +13019,18 @@ export const filesMap = [
"filePath": "/www/apps/resources/references/modules/dml/page.mdx",
"pathname": "/references/modules/dml"
},
{
"filePath": "/www/apps/resources/references/modules/event/page.mdx",
"pathname": "/references/modules/event"
},
{
"filePath": "/www/apps/resources/references/modules/file/page.mdx",
"pathname": "/references/modules/file"
},
{
"filePath": "/www/apps/resources/references/modules/file_service/page.mdx",
"pathname": "/references/modules/file_service"
},
{
"filePath": "/www/apps/resources/references/modules/fulfillment/page.mdx",
"pathname": "/references/modules/fulfillment"
@@ -13051,6 +13079,10 @@ export const filesMap = [
"filePath": "/www/apps/resources/references/modules/notification/page.mdx",
"pathname": "/references/modules/notification"
},
{
"filePath": "/www/apps/resources/references/modules/notification_service/page.mdx",
"pathname": "/references/modules/notification_service"
},
{
"filePath": "/www/apps/resources/references/modules/order/page.mdx",
"pathname": "/references/modules/order"
@@ -13239,6 +13271,10 @@ export const filesMap = [
"filePath": "/www/apps/resources/references/notification/classes/notification.AbstractNotificationProviderService/page.mdx",
"pathname": "/references/notification/classes/notification.AbstractNotificationProviderService"
},
{
"filePath": "/www/apps/resources/references/notification_service/interfaces/notification_service.INotificationModuleService/page.mdx",
"pathname": "/references/notification_service/interfaces/notification_service.INotificationModuleService"
},
{
"filePath": "/www/apps/resources/references/order/IBigNumber/methods/order.IBigNumber.toJSON/page.mdx",
"pathname": "/references/order/IBigNumber/methods/order.IBigNumber.toJSON"
@@ -65,6 +65,14 @@ const generatedgeneratedArchitecturalModulesSidebarSidebar = {
"path": "/architectural-modules/cache/create",
"title": "Create Cache Module",
"children": []
},
{
"loaded": true,
"isPathHref": true,
"type": "link",
"path": "/references/cache-service",
"title": "Use Cache Module",
"children": []
}
]
}
@@ -122,6 +130,14 @@ const generatedgeneratedArchitecturalModulesSidebarSidebar = {
"path": "/architectural-modules/event/create",
"title": "Create Event Module",
"children": []
},
{
"loaded": true,
"isPathHref": true,
"type": "link",
"path": "/references/event-service",
"title": "Use Event Module",
"children": []
}
]
}
@@ -179,6 +195,14 @@ const generatedgeneratedArchitecturalModulesSidebarSidebar = {
"path": "/references/file-provider-module",
"title": "Create File Provider",
"children": []
},
{
"loaded": true,
"isPathHref": true,
"type": "link",
"path": "/references/file-service",
"title": "Use File Module",
"children": []
}
]
}
@@ -317,6 +341,14 @@ const generatedgeneratedArchitecturalModulesSidebarSidebar = {
"path": "/architectural-modules/notification/send-notification",
"title": "Send Notification",
"children": []
},
{
"loaded": true,
"isPathHref": true,
"type": "link",
"path": "/references/notification-service",
"title": "Use Notification Module",
"children": []
}
]
}
@@ -360,6 +392,22 @@ const generatedgeneratedArchitecturalModulesSidebarSidebar = {
"children": []
}
]
},
{
"loaded": true,
"isPathHref": true,
"type": "sub-category",
"title": "Guides",
"children": [
{
"loaded": true,
"isPathHref": true,
"type": "link",
"path": "/architectural-modules/workflow-engine/how-to-use",
"title": "Use Workflow Engine Module",
"children": []
}
]
}
]
}
@@ -142,6 +142,30 @@ const generatedgeneratedHowToTutorialsSidebarSidebar = {
"path": "https://docs.medusajs.com/resources/architectural-modules/notification/send-notification",
"children": []
},
{
"loaded": true,
"isPathHref": true,
"type": "ref",
"title": "Use Cache Module",
"path": "https://docs.medusajs.com/resources/references/cache-service",
"children": []
},
{
"loaded": true,
"isPathHref": true,
"type": "ref",
"title": "Use Event Module",
"path": "https://docs.medusajs.com/resources/references/event-service",
"children": []
},
{
"loaded": true,
"isPathHref": true,
"type": "ref",
"title": "Use File Module",
"path": "https://docs.medusajs.com/resources/references/file-service",
"children": []
},
{
"loaded": true,
"isPathHref": true,
@@ -149,6 +173,22 @@ const generatedgeneratedHowToTutorialsSidebarSidebar = {
"title": "Use Locking Module",
"path": "https://docs.medusajs.com/resources/references/locking-service",
"children": []
},
{
"loaded": true,
"isPathHref": true,
"type": "ref",
"title": "Use Notification Module",
"path": "https://docs.medusajs.com/resources/references/notification-service",
"children": []
},
{
"loaded": true,
"isPathHref": true,
"type": "ref",
"title": "Use Workflow Engine Module",
"path": "https://docs.medusajs.com/resources/architectural-modules/workflow-engine/how-to-use",
"children": []
}
]
},
@@ -149,6 +149,11 @@ export const slugChanges = [
"newSlug": "/references/auth/provider",
"filePath": "/www/apps/resources/references/auth_provider/classes/auth_provider.AbstractAuthModuleProvider/page.mdx"
},
{
"origSlug": "/references/cache/interfaces/cache.ICacheService",
"newSlug": "/references/cache-service",
"filePath": "/www/apps/resources/references/cache/interfaces/cache.ICacheService/page.mdx"
},
{
"origSlug": "/references/cart/ICartModuleService/methods/cart.ICartModuleService.addLineItemAdjustments",
"newSlug": "/references/cart/addLineItemAdjustments",
@@ -3734,11 +3739,21 @@ export const slugChanges = [
"newSlug": "/references/data-model/define",
"filePath": "/www/apps/resources/references/dml/entity_builder/EntityBuilder/methods/dml.entity_builder.EntityBuilder.define/page.mdx"
},
{
"origSlug": "/references/event/interfaces/event.IEventBusModuleService",
"newSlug": "/references/event-service",
"filePath": "/www/apps/resources/references/event/interfaces/event.IEventBusModuleService/page.mdx"
},
{
"origSlug": "/references/file/classes/file.AbstractFileProviderService",
"newSlug": "/references/file-provider-module",
"filePath": "/www/apps/resources/references/file/classes/file.AbstractFileProviderService/page.mdx"
},
{
"origSlug": "/references/file_service/interfaces/file_service.IFileModuleService",
"newSlug": "/references/file-service",
"filePath": "/www/apps/resources/references/file_service/interfaces/file_service.IFileModuleService/page.mdx"
},
{
"origSlug": "/references/fulfillment/IFulfillmentModuleService/methods/fulfillment.IFulfillmentModuleService.calculateShippingOptionsPrices",
"newSlug": "/references/fulfillment/calculateShippingOptionsPrices",
@@ -4829,6 +4844,11 @@ export const slugChanges = [
"newSlug": "/references/notification-provider-module",
"filePath": "/www/apps/resources/references/notification/classes/notification.AbstractNotificationProviderService/page.mdx"
},
{
"origSlug": "/references/notification_service/interfaces/notification_service.INotificationModuleService",
"newSlug": "/references/notification-service",
"filePath": "/www/apps/resources/references/notification_service/interfaces/notification_service.INotificationModuleService/page.mdx"
},
{
"origSlug": "/references/order/IOrderModuleService/methods/order.IOrderModuleService.addOrderAction",
"newSlug": "/references/order/addOrderAction",
+4
View File
@@ -9,6 +9,7 @@ import { TypeList } from "docs-ui"
- [auth](modules/auth/page.mdx)
- [auth-models](modules/auth_models/page.mdx)
- [auth-provider](modules/auth_provider/page.mdx)
- [cache](modules/cache/page.mdx)
- [cart](modules/cart/page.mdx)
- [cart-models](modules/cart_models/page.mdx)
- [core-flows](modules/core_flows/page.mdx)
@@ -17,7 +18,9 @@ import { TypeList } from "docs-ui"
- [customer](modules/customer/page.mdx)
- [customer-models](modules/customer_models/page.mdx)
- [dml](modules/dml/page.mdx)
- [event](modules/event/page.mdx)
- [file](modules/file/page.mdx)
- [file-service](modules/file_service/page.mdx)
- [fulfillment](modules/fulfillment/page.mdx)
- [fulfillment-models](modules/fulfillment_models/page.mdx)
- [fulfillment-provider](modules/fulfillment_provider/page.mdx)
@@ -30,6 +33,7 @@ import { TypeList } from "docs-ui"
- [medusa-config](modules/medusa_config/page.mdx)
- [modules-sdk](modules/modules_sdk/page.mdx)
- [notification](modules/notification/page.mdx)
- [notification-service](modules/notification_service/page.mdx)
- [order](modules/order/page.mdx)
- [order-models](modules/order_models/page.mdx)
- [payment](modules/payment/page.mdx)
@@ -0,0 +1,104 @@
---
slug: /references/cache-service
tags:
- cache
- server
- how to
sidebar_label: Use Cache Module
---
import { TypeList } from "docs-ui"
# How to Use Cache Module
In this document, youll learn about the different methods in the Cache Module's service and how to use them.
---
## Resolve Cache Module's Service
In your workflow's step, you can resolve the Cache Module's service from the Medusa container:
```ts
import { Modules } from "@medusajs/framework/utils"
import { createStep } from "@medusajs/framework/workflows-sdk"
const step1 = createStep(
"step-1",
async ({}, { container }) => {
const cacheModuleService = container.resolve(
Modules.CACHE
)
// TODO use cacheModuleService
}
)
```
This will resolve the service of the configured Cache Module, which is the [In-Memory Cache Module](https://docs.medusajs.com/resources/architectural-modules/cache/in-memory) by default.
You can then use the Cache Module's service's methods in the step. The rest of this guide details these methods.
---
## get
This method retrieves data from the cache.
### Example
```ts
const data = await cacheModuleService.get("my-key")
```
### Type Parameters
<TypeList types={[{"name":"T","type":"`object`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="get"/>
### Parameters
<TypeList types={[{"name":"key","type":"`string`","description":"The key of the item to retrieve.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="get"/>
### Returns
<TypeList types={[{"name":"Promise","type":"Promise&#60;null \\| T&#62;","optional":false,"defaultValue":"","description":"The item that was stored in the cache. If the item was not found, null is returned.","expandable":false,"children":[{"name":"null \\| T","type":"`null` \\| T","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="get"/>
___
## set
This method stores data in the cache.
### Example
```ts
await cacheModuleService.set("my-key", { product_id: "prod_123" }, 60)
```
### Parameters
<TypeList types={[{"name":"key","type":"`string`","description":"The key of the item to store.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"data","type":"`unknown`","description":"The data to store in the cache.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"ttl","type":"`number`","description":"The time-to-live (TTL) value in seconds. If not provided, the default TTL value is used. The default value is based on the used Cache Module.","optional":true,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="set"/>
### Returns
<TypeList types={[{"name":"Promise","type":"Promise&#60;void&#62;","optional":false,"defaultValue":"","description":"This method stores data in the cache.","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="set"/>
___
## invalidate
This method removes an item from the cache.
### Example
```ts
await cacheModuleService.invalidate("my-key")
```
### Parameters
<TypeList types={[{"name":"key","type":"`string`","description":"The key of the item to remove.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="invalidate"/>
### Returns
<TypeList types={[{"name":"Promise","type":"Promise&#60;void&#62;","optional":false,"defaultValue":"","description":"This method removes an item from the cache.","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="invalidate"/>
@@ -0,0 +1,155 @@
---
slug: /references/event-service
tags:
- event
- server
- how to
sidebar_label: Use Event Module
---
import { TypeList } from "docs-ui"
# How to Use Event Module
In this document, youll learn about the different methods in the Event Module's service and how to use them.
---
## Resolve Event Module's Service
In your workflow's step, you can resolve the Event Module's service from the Medusa container:
```ts
import { Modules } from "@medusajs/framework/utils"
import { createStep } from "@medusajs/framework/workflows-sdk"
const step1 = createStep(
"step-1",
async ({}, { container }) => {
const eventModuleService = container.resolve(
Modules.EVENT
)
// TODO use eventModuleService
}
)
```
This will resolve the service of the configured Event Module, which is the [Local Event Module](https://docs.medusajs.com/resources/architectural-modules/event/local) by default.
You can then use the Event Module's service's methods in the step. The rest of this guide details these methods.
---
## emit
This method emits one or more events. Subscribers listening to the event(s) are executed asynchronously.
### Example
```ts
await eventModuleService.emit({
name: "user.created",
data: {
user_id: "user_123"
}
})
```
### Type Parameters
<TypeList types={[{"name":"T","type":"`object`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="emit"/>
### Parameters
<TypeList types={[{"name":"data","type":"[Message](../../../types/EventBusTypes/types/types.EventBusTypes.Message/page.mdx)&#60;T&#62; \\| [Message](../../../types/EventBusTypes/types/types.EventBusTypes.Message/page.mdx)&#60;T&#62;[]","description":"The details of the events to emit.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"name","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"data","type":"TData","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"metadata","type":"[EventMetadata](../../../types/EventBusTypes/types/types.EventBusTypes.EventMetadata/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"eventGroupId","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"options","type":"`Record<string, unknown>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"options","type":"`Record<string, unknown>`","description":"Additional options for the event.","optional":true,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="emit"/>
### Returns
<TypeList types={[{"name":"Promise","type":"Promise&#60;void&#62;","optional":false,"defaultValue":"","description":"This method emits one or more events. Subscribers listening to the event(s) are executed asynchronously.","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="emit"/>
___
## subscribe
This method adds a subscriber to an event. It's mainly used internally to register subscribers.
### Example
```ts
eventModuleService.subscribe("user.created", async (data) => {
console.log("User created", data)
})
```
### Parameters
<TypeList types={[{"name":"eventName","type":"`string` \\| `symbol`","description":"The name of the event to subscribe to.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"subscriber","type":"[Subscriber](../../../types/EventBusTypes/types/types.EventBusTypes.Subscriber/page.mdx)","description":"The subscriber function to execute when the event is emitted.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"context","type":"[SubscriberContext](../../../types/EventBusTypes/types/types.EventBusTypes.SubscriberContext/page.mdx)","description":"The context of the subscriber.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"subscriberId","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="subscribe"/>
### Returns
<TypeList types={[{"name":"this","type":"`this`","optional":false,"defaultValue":"","description":"The instance of the Event Module","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="subscribe"/>
___
## unsubscribe
This method removes a subscriber from an event. It's mainly used internally to unregister subscribers.
### Example
```ts
eventModuleService.unsubscribe("user.created", async (data) => {
console.log("User created", data)
})
```
### Parameters
<TypeList types={[{"name":"eventName","type":"`string` \\| `symbol`","description":"The name of the event to unsubscribe from.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"subscriber","type":"[Subscriber](../../../types/EventBusTypes/types/types.EventBusTypes.Subscriber/page.mdx)","description":"The subscriber function to remove.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"context","type":"[SubscriberContext](../../../types/EventBusTypes/types/types.EventBusTypes.SubscriberContext/page.mdx)","description":"The context of the subscriber.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"subscriberId","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="unsubscribe"/>
### Returns
<TypeList types={[{"name":"this","type":"`this`","optional":false,"defaultValue":"","description":"The instance of the Event Module","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="unsubscribe"/>
___
## releaseGroupedEvents
This method emits all events in the specified group. Grouped events are useful when you have distributed transactions
where you need to explicitly group, release and clear events upon lifecycle events of a transaction.
### Example
```ts
await eventModuleService.releaseGroupedEvents("group_123")
```
### Parameters
<TypeList types={[{"name":"eventGroupId","type":"`string`","description":"The ID of the event group.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="releaseGroupedEvents"/>
### Returns
<TypeList types={[{"name":"Promise","type":"Promise&#60;void&#62;","optional":false,"defaultValue":"","description":"This method emits all events in the specified group. Grouped events are useful when you have distributed transactions\nwhere you need to explicitly group, release and clear events upon lifecycle events of a transaction.","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="releaseGroupedEvents"/>
___
## clearGroupedEvents
This method removes all events in the specified group. Grouped events are useful when you have distributed transactions
where you need to explicitly group, release and clear events upon lifecycle events of a transaction.
### Example
```ts
await eventModuleService.clearGroupedEvents("group_123")
```
### Parameters
<TypeList types={[{"name":"eventGroupId","type":"`string`","description":"The ID of the event group.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="clearGroupedEvents"/>
### Returns
<TypeList types={[{"name":"Promise","type":"Promise&#60;void&#62;","optional":false,"defaultValue":"","description":"This method removes all events in the specified group. Grouped events are useful when you have distributed transactions\nwhere you need to explicitly group, release and clear events upon lifecycle events of a transaction.","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="clearGroupedEvents"/>
File diff suppressed because one or more lines are too long
+7
View File
@@ -0,0 +1,7 @@
import { TypeList } from "docs-ui"
# cache
## Interfaces
- [ICacheService](../../cache/interfaces/cache.ICacheService/page.mdx)
@@ -0,0 +1,7 @@
import { TypeList } from "docs-ui"
# event
## Interfaces
- [IEventBusModuleService](../../event/interfaces/event.IEventBusModuleService/page.mdx)
@@ -0,0 +1,7 @@
import { TypeList } from "docs-ui"
# file-service
## Interfaces
- [IFileModuleService](../../file_service/interfaces/file_service.IFileModuleService/page.mdx)
@@ -0,0 +1,7 @@
import { TypeList } from "docs-ui"
# notification-service
## Interfaces
- [INotificationModuleService](../../notification_service/interfaces/notification_service.INotificationModuleService/page.mdx)
@@ -43,6 +43,11 @@ export const architecturalModulesSidebar = [
path: "/architectural-modules/cache/create",
title: "Create Cache Module",
},
{
type: "link",
path: "/references/cache-service",
title: "Use Cache Module",
},
],
},
],
@@ -82,6 +87,11 @@ export const architecturalModulesSidebar = [
path: "/architectural-modules/event/create",
title: "Create Event Module",
},
{
type: "link",
path: "/references/event-service",
title: "Use Event Module",
},
],
},
],
@@ -121,6 +131,11 @@ export const architecturalModulesSidebar = [
path: "/references/file-provider-module",
title: "Create File Provider",
},
{
type: "link",
path: "/references/file-service",
title: "Use File Module",
},
],
},
],
@@ -214,6 +229,11 @@ export const architecturalModulesSidebar = [
path: "/architectural-modules/notification/send-notification",
title: "Send Notification",
},
{
type: "link",
path: "/references/notification-service",
title: "Use Notification Module",
},
],
},
],
@@ -244,6 +264,17 @@ export const architecturalModulesSidebar = [
},
],
},
{
type: "sub-category",
title: "Guides",
children: [
{
type: "link",
path: "/architectural-modules/workflow-engine/how-to-use",
title: "Use Workflow Engine Module",
},
],
},
],
},
]
@@ -71,6 +71,10 @@ const sidebarMappings: {
"/references/file-provider-module",
"/references/locking",
"/references/notification-provider-module",
"/references/notification-service",
"/references/event-service",
"/references/cache-service",
"/references/file-service",
],
},
{
+4
View File
@@ -2,5 +2,9 @@ export const cache = [
{
"title": "Create Cache Module",
"path": "https://docs.medusajs.com/resources/architectural-modules/cache/create"
},
{
"title": "Use Cache Module",
"path": "https://docs.medusajs.com/resources/references/cache-service"
}
]
+4
View File
@@ -2,5 +2,9 @@ export const event = [
{
"title": "Create Event Module",
"path": "https://docs.medusajs.com/resources/architectural-modules/event/create"
},
{
"title": "Use Event Module",
"path": "https://docs.medusajs.com/resources/references/event-service"
}
]
+4
View File
@@ -23,6 +23,10 @@ export const file = [
"title": "exportProductsWorkflow",
"path": "https://docs.medusajs.com/resources/references/medusa-workflows/exportProductsWorkflow"
},
{
"title": "Use File Module",
"path": "https://docs.medusajs.com/resources/references/file-service"
},
{
"title": "upload",
"path": "https://docs.medusajs.com/resources/references/js-sdk/admin/upload"
+20
View File
@@ -11,6 +11,10 @@ export const howTo = [
"title": "Send Notification",
"path": "https://docs.medusajs.com/resources/architectural-modules/notification/send-notification"
},
{
"title": "Use Workflow Engine Module",
"path": "https://docs.medusajs.com/resources/architectural-modules/workflow-engine/how-to-use"
},
{
"title": "Create Actor Type",
"path": "https://docs.medusajs.com/resources/commerce-modules/auth/create-actor-type"
@@ -31,6 +35,18 @@ export const howTo = [
"title": "Create Auth Provider",
"path": "https://docs.medusajs.com/resources/references/auth/provider"
},
{
"title": "Use Cache Module",
"path": "https://docs.medusajs.com/resources/references/cache-service"
},
{
"title": "Use Event Module",
"path": "https://docs.medusajs.com/resources/references/event-service"
},
{
"title": "Use File Module",
"path": "https://docs.medusajs.com/resources/references/file-service"
},
{
"title": "Create Fulfillment Provider",
"path": "https://docs.medusajs.com/resources/references/fulfillment/provider"
@@ -47,6 +63,10 @@ export const howTo = [
"title": "Create Notification Provider",
"path": "https://docs.medusajs.com/resources/references/notification-provider-module"
},
{
"title": "Use Notification Module",
"path": "https://docs.medusajs.com/resources/references/notification-service"
},
{
"title": "Create Payment Provider",
"path": "https://docs.medusajs.com/resources/references/payment/provider"
+40 -39
View File
@@ -1,45 +1,46 @@
export * from "./user-guide.js"
export * from "./admin.js"
export * from "./api-key.js"
export * from "./auth.js"
export * from "./cache.js"
export * from "./cart.js"
export * from "./checkout.js"
export * from "./concept.js"
export * from "./currency.js"
export * from "./customer.js"
export * from "./event-bus.js"
export * from "./event.js"
export * from "./example.js"
export * from "./extend-module.js"
export * from "./file.js"
export * from "./fulfillment.js"
export * from "./how-to.js"
export * from "./inventory.js"
export * from "./js-sdk.js"
export * from "./link.js"
export * from "./locking.js"
export * from "./logger.js"
export * from "./notification.js"
export * from "./order.js"
export * from "./payment.js"
export * from "./cache.js"
export * from "./how-to.js"
export * from "./server.js"
export * from "./product.js"
export * from "./pricing.js"
export * from "./event.js"
export * from "./promotion.js"
export * from "./notification.js"
export * from "./auth.js"
export * from "./api-key.js"
export * from "./workflow.js"
export * from "./stock-location.js"
export * from "./inventory.js"
export * from "./sales-channel.js"
export * from "./user.js"
export * from "./region.js"
export * from "./store.js"
export * from "./cart.js"
export * from "./currency.js"
export * from "./extend-module.js"
export * from "./tutorial.js"
export * from "./fulfillment.js"
export * from "./tax.js"
export * from "./concept.js"
export * from "./stripe.js"
export * from "./storefront.js"
export * from "./product-category.js"
export * from "./query.js"
export * from "./checkout.js"
export * from "./publishable-api-key.js"
export * from "./product-collection.js"
export * from "./step.js"
export * from "./example.js"
export * from "./customer.js"
export * from "./locking.js"
export * from "./product.js"
export * from "./promotion.js"
export * from "./publishable-api-key.js"
export * from "./query.js"
export * from "./region.js"
export * from "./remote-query.js"
export * from "./link.js"
export * from "./event-bus.js"
export * from "./logger.js"
export * from "./file.js"
export * from "./js-sdk.js"
export * from "./admin.js"
export * from "./sales-channel.js"
export * from "./server.js"
export * from "./step.js"
export * from "./stock-location.js"
export * from "./store.js"
export * from "./storefront.js"
export * from "./stripe.js"
export * from "./tax.js"
export * from "./tutorial.js"
export * from "./user-guide.js"
export * from "./user.js"
export * from "./workflow-engine.js"
export * from "./workflow.js"
@@ -30,5 +30,9 @@ export const notification = [
{
"title": "Create Notification Provider",
"path": "https://docs.medusajs.com/resources/references/notification-provider-module"
},
{
"title": "Use Notification Module",
"path": "https://docs.medusajs.com/resources/references/notification-service"
}
]
+20
View File
@@ -11,6 +11,10 @@ export const server = [
"title": "Send Notification",
"path": "https://docs.medusajs.com/resources/architectural-modules/notification/send-notification"
},
{
"title": "Use Workflow Engine Module",
"path": "https://docs.medusajs.com/resources/architectural-modules/workflow-engine/how-to-use"
},
{
"title": "Create Actor Type",
"path": "https://docs.medusajs.com/resources/commerce-modules/auth/create-actor-type"
@@ -59,6 +63,18 @@ export const server = [
"title": "Create Auth Provider",
"path": "https://docs.medusajs.com/resources/references/auth/provider"
},
{
"title": "Use Cache Module",
"path": "https://docs.medusajs.com/resources/references/cache-service"
},
{
"title": "Use Event Module",
"path": "https://docs.medusajs.com/resources/references/event-service"
},
{
"title": "Use File Module",
"path": "https://docs.medusajs.com/resources/references/file-service"
},
{
"title": "Create Fulfillment Provider",
"path": "https://docs.medusajs.com/resources/references/fulfillment/provider"
@@ -75,6 +91,10 @@ export const server = [
"title": "Create Notification Provider",
"path": "https://docs.medusajs.com/resources/references/notification-provider-module"
},
{
"title": "Use Notification Module",
"path": "https://docs.medusajs.com/resources/references/notification-service"
},
{
"title": "Create Payment Provider",
"path": "https://docs.medusajs.com/resources/references/payment/provider"
@@ -0,0 +1,6 @@
export const workflowEngine = [
{
"title": "Use Workflow Engine Module",
"path": "https://docs.medusajs.com/resources/architectural-modules/workflow-engine/how-to-use"
}
]
+1 -1
View File
@@ -158,6 +158,6 @@ export async function generateTags(basePath?: string) {
)
// write index.ts
const indexContent = files.map((file) => `export * from "./${file}"\n`)
const indexContent = files.sort().map((file) => `export * from "./${file}"\n`)
await writeFile(path.join(tagsDir, "index.ts"), indexContent)
}
@@ -0,0 +1,442 @@
{
"id": 0,
"name": "cache",
"variant": "project",
"kind": 1,
"flags": {},
"children": [
{
"id": 1,
"name": "ICacheService",
"variant": "declaration",
"kind": 256,
"flags": {},
"children": [
{
"id": 2,
"name": "get",
"variant": "declaration",
"kind": 2048,
"flags": {},
"sources": [
{
"fileName": "service.ts",
"line": 11,
"character": 2,
"url": "https://github.com/medusajs/medusa/blob/cb6249320e7322e8eabfec8434f1278f8d63e96c/packages/core/types/src/cache/service.ts#L11"
}
],
"signatures": [
{
"id": 3,
"name": "get",
"variant": "signature",
"kind": 4096,
"flags": {},
"comment": {
"summary": [
{
"kind": "text",
"text": "This method retrieves data from the cache."
}
],
"blockTags": [
{
"tag": "@returns",
"content": [
{
"kind": "text",
"text": "The item that was stored in the cache. If the item was not found, null is returned."
}
]
},
{
"tag": "@example",
"content": [
{
"kind": "code",
"text": "```ts\nconst data = await cache.get(\"my-key\")\n```"
}
]
}
]
},
"sources": [
{
"fileName": "service.ts",
"line": 11,
"character": 2,
"url": "https://github.com/medusajs/medusa/blob/cb6249320e7322e8eabfec8434f1278f8d63e96c/packages/core/types/src/cache/service.ts#L11"
}
],
"typeParameters": [
{
"id": 4,
"name": "T",
"variant": "typeParam",
"kind": 131072,
"flags": {}
}
],
"parameters": [
{
"id": 5,
"name": "key",
"variant": "param",
"kind": 32768,
"flags": {},
"comment": {
"summary": [
{
"kind": "text",
"text": "The key of the item to retrieve."
}
]
},
"type": {
"type": "intrinsic",
"name": "string"
}
}
],
"type": {
"type": "reference",
"target": {
"sourceFileName": "../../node_modules/typescript/lib/lib.es5.d.ts",
"qualifiedName": "Promise"
},
"typeArguments": [
{
"type": "union",
"types": [
{
"type": "literal",
"value": null
},
{
"type": "reference",
"target": 4,
"name": "T",
"package": "@medusajs/types",
"refersToTypeParameter": true
}
]
}
],
"name": "Promise",
"package": "typescript"
}
}
]
},
{
"id": 6,
"name": "set",
"variant": "declaration",
"kind": 2048,
"flags": {},
"sources": [
{
"fileName": "service.ts",
"line": 22,
"character": 2,
"url": "https://github.com/medusajs/medusa/blob/cb6249320e7322e8eabfec8434f1278f8d63e96c/packages/core/types/src/cache/service.ts#L22"
}
],
"signatures": [
{
"id": 7,
"name": "set",
"variant": "signature",
"kind": 4096,
"flags": {},
"comment": {
"summary": [
{
"kind": "text",
"text": "This method stores data in the cache."
}
],
"blockTags": [
{
"tag": "@example",
"content": [
{
"kind": "code",
"text": "```ts\nawait cache.set(\"my-key\", { product_id: \"prod_123\" }, 60)\n```"
}
]
}
]
},
"sources": [
{
"fileName": "service.ts",
"line": 22,
"character": 2,
"url": "https://github.com/medusajs/medusa/blob/cb6249320e7322e8eabfec8434f1278f8d63e96c/packages/core/types/src/cache/service.ts#L22"
}
],
"parameters": [
{
"id": 8,
"name": "key",
"variant": "param",
"kind": 32768,
"flags": {},
"comment": {
"summary": [
{
"kind": "text",
"text": "The key of the item to store."
}
]
},
"type": {
"type": "intrinsic",
"name": "string"
}
},
{
"id": 9,
"name": "data",
"variant": "param",
"kind": 32768,
"flags": {},
"comment": {
"summary": [
{
"kind": "text",
"text": "The data to store in the cache."
}
]
},
"type": {
"type": "intrinsic",
"name": "unknown"
}
},
{
"id": 10,
"name": "ttl",
"variant": "param",
"kind": 32768,
"flags": {
"isOptional": true
},
"comment": {
"summary": [
{
"kind": "text",
"text": "The time-to-live (TTL) value in seconds. If not provided, the default TTL value is used. The default value is based on the used Cache Module."
}
]
},
"type": {
"type": "intrinsic",
"name": "number"
}
}
],
"type": {
"type": "reference",
"target": {
"sourceFileName": "../../node_modules/typescript/lib/lib.es5.d.ts",
"qualifiedName": "Promise"
},
"typeArguments": [
{
"type": "intrinsic",
"name": "void"
}
],
"name": "Promise",
"package": "typescript"
}
}
]
},
{
"id": 11,
"name": "invalidate",
"variant": "declaration",
"kind": 2048,
"flags": {},
"sources": [
{
"fileName": "service.ts",
"line": 31,
"character": 2,
"url": "https://github.com/medusajs/medusa/blob/cb6249320e7322e8eabfec8434f1278f8d63e96c/packages/core/types/src/cache/service.ts#L31"
}
],
"signatures": [
{
"id": 12,
"name": "invalidate",
"variant": "signature",
"kind": 4096,
"flags": {},
"comment": {
"summary": [
{
"kind": "text",
"text": "This method removes an item from the cache."
}
],
"blockTags": [
{
"tag": "@example",
"content": [
{
"kind": "code",
"text": "```ts\nawait cache.invalidate(\"my-key\")\n```"
}
]
}
]
},
"sources": [
{
"fileName": "service.ts",
"line": 31,
"character": 2,
"url": "https://github.com/medusajs/medusa/blob/cb6249320e7322e8eabfec8434f1278f8d63e96c/packages/core/types/src/cache/service.ts#L31"
}
],
"parameters": [
{
"id": 13,
"name": "key",
"variant": "param",
"kind": 32768,
"flags": {},
"comment": {
"summary": [
{
"kind": "text",
"text": "The key of the item to remove."
}
]
},
"type": {
"type": "intrinsic",
"name": "string"
}
}
],
"type": {
"type": "reference",
"target": {
"sourceFileName": "../../node_modules/typescript/lib/lib.es5.d.ts",
"qualifiedName": "Promise"
},
"typeArguments": [
{
"type": "intrinsic",
"name": "void"
}
],
"name": "Promise",
"package": "typescript"
}
}
]
}
],
"groups": [
{
"title": "Methods",
"children": [
2,
6,
11
]
}
],
"sources": [
{
"fileName": "service.ts",
"line": 1,
"character": 17,
"url": "https://github.com/medusajs/medusa/blob/cb6249320e7322e8eabfec8434f1278f8d63e96c/packages/core/types/src/cache/service.ts#L1"
}
]
}
],
"groups": [
{
"title": "Interfaces",
"children": [
1
]
}
],
"packageName": "@medusajs/types",
"symbolIdMap": {
"0": {
"sourceFileName": "../../../../packages/core/types/src/cache/service.ts",
"qualifiedName": ""
},
"1": {
"sourceFileName": "../../../../packages/core/types/src/cache/service.ts",
"qualifiedName": "ICacheService"
},
"2": {
"sourceFileName": "../../../../packages/core/types/src/cache/service.ts",
"qualifiedName": "ICacheService.get"
},
"3": {
"sourceFileName": "../../../../packages/core/types/src/cache/service.ts",
"qualifiedName": "ICacheService.get"
},
"4": {
"sourceFileName": "../../../../packages/core/types/src/cache/service.ts",
"qualifiedName": "T"
},
"5": {
"sourceFileName": "../../../../packages/core/types/src/cache/service.ts",
"qualifiedName": "key"
},
"6": {
"sourceFileName": "../../../../packages/core/types/src/cache/service.ts",
"qualifiedName": "ICacheService.set"
},
"7": {
"sourceFileName": "../../../../packages/core/types/src/cache/service.ts",
"qualifiedName": "ICacheService.set"
},
"8": {
"sourceFileName": "../../../../packages/core/types/src/cache/service.ts",
"qualifiedName": "key"
},
"9": {
"sourceFileName": "../../../../packages/core/types/src/cache/service.ts",
"qualifiedName": "data"
},
"10": {
"sourceFileName": "../../../../packages/core/types/src/cache/service.ts",
"qualifiedName": "ttl"
},
"11": {
"sourceFileName": "../../../../packages/core/types/src/cache/service.ts",
"qualifiedName": "ICacheService.invalidate"
},
"12": {
"sourceFileName": "../../../../packages/core/types/src/cache/service.ts",
"qualifiedName": "ICacheService.invalidate"
},
"13": {
"sourceFileName": "../../../../packages/core/types/src/cache/service.ts",
"qualifiedName": "key"
}
},
"files": {
"entries": {
"1": "../../../../packages/core/types/src/cache/service.ts"
},
"reflections": {
"1": 0
}
}
}
@@ -0,0 +1,783 @@
{
"id": 58,
"name": "event",
"variant": "project",
"kind": 1,
"flags": {},
"children": [
{
"id": 59,
"name": "IEventBusModuleService",
"variant": "declaration",
"kind": 256,
"flags": {},
"children": [
{
"id": 60,
"name": "emit",
"variant": "declaration",
"kind": 2048,
"flags": {},
"sources": [
{
"fileName": "event-bus-module.ts",
"line": 18,
"character": 2,
"url": "https://github.com/medusajs/medusa/blob/cb6249320e7322e8eabfec8434f1278f8d63e96c/packages/core/types/src/event-bus/event-bus-module.ts#L18"
}
],
"signatures": [
{
"id": 61,
"name": "emit",
"variant": "signature",
"kind": 4096,
"flags": {},
"comment": {
"summary": [
{
"kind": "text",
"text": "This method emits one or more events. Subscribers listening to the event(s) are executed asynchronously."
}
],
"blockTags": [
{
"tag": "@example",
"content": [
{
"kind": "code",
"text": "```ts\nawait eventBus.emit({ \n name: \"user.created\", \n data: { \n user_id: \"user_123\"\n }\n})\n```"
}
]
}
]
},
"sources": [
{
"fileName": "event-bus-module.ts",
"line": 18,
"character": 2,
"url": "https://github.com/medusajs/medusa/blob/cb6249320e7322e8eabfec8434f1278f8d63e96c/packages/core/types/src/event-bus/event-bus-module.ts#L18"
}
],
"typeParameters": [
{
"id": 62,
"name": "T",
"variant": "typeParam",
"kind": 131072,
"flags": {}
}
],
"parameters": [
{
"id": 63,
"name": "data",
"variant": "param",
"kind": 32768,
"flags": {},
"comment": {
"summary": [
{
"kind": "text",
"text": "The details of the events to emit."
}
]
},
"type": {
"type": "union",
"types": [
{
"type": "reference",
"target": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/common.ts",
"qualifiedName": "Message"
},
"typeArguments": [
{
"type": "reference",
"target": 62,
"name": "T",
"package": "@medusajs/types",
"refersToTypeParameter": true
}
],
"name": "Message",
"package": "@medusajs/types"
},
{
"type": "array",
"elementType": {
"type": "reference",
"target": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/common.ts",
"qualifiedName": "Message"
},
"typeArguments": [
{
"type": "reference",
"target": 62,
"name": "T",
"package": "@medusajs/types",
"refersToTypeParameter": true
}
],
"name": "Message",
"package": "@medusajs/types"
}
}
]
}
},
{
"id": 64,
"name": "options",
"variant": "param",
"kind": 32768,
"flags": {
"isOptional": true
},
"comment": {
"summary": [
{
"kind": "text",
"text": "Additional options for the event."
}
]
},
"type": {
"type": "reference",
"target": {
"sourceFileName": "../../node_modules/typescript/lib/lib.es5.d.ts",
"qualifiedName": "Record"
},
"typeArguments": [
{
"type": "intrinsic",
"name": "string"
},
{
"type": "intrinsic",
"name": "unknown"
}
],
"name": "Record",
"package": "typescript"
}
}
],
"type": {
"type": "reference",
"target": {
"sourceFileName": "../../node_modules/typescript/lib/lib.es5.d.ts",
"qualifiedName": "Promise"
},
"typeArguments": [
{
"type": "intrinsic",
"name": "void"
}
],
"name": "Promise",
"package": "typescript"
}
}
]
},
{
"id": 65,
"name": "subscribe",
"variant": "declaration",
"kind": 2048,
"flags": {},
"sources": [
{
"fileName": "event-bus-module.ts",
"line": 36,
"character": 2,
"url": "https://github.com/medusajs/medusa/blob/cb6249320e7322e8eabfec8434f1278f8d63e96c/packages/core/types/src/event-bus/event-bus-module.ts#L36"
}
],
"signatures": [
{
"id": 66,
"name": "subscribe",
"variant": "signature",
"kind": 4096,
"flags": {},
"comment": {
"summary": [
{
"kind": "text",
"text": "This method adds a subscriber to an event. It's mainly used internally to register subscribers."
}
],
"blockTags": [
{
"tag": "@returns",
"content": [
{
"kind": "text",
"text": "The instance of the Event Module"
}
]
},
{
"tag": "@example",
"content": [
{
"kind": "code",
"text": "```ts\neventBus.subscribe(\"user.created\", async (data) => {\n console.log(\"User created\", data)\n})\n```"
}
]
}
]
},
"sources": [
{
"fileName": "event-bus-module.ts",
"line": 36,
"character": 2,
"url": "https://github.com/medusajs/medusa/blob/cb6249320e7322e8eabfec8434f1278f8d63e96c/packages/core/types/src/event-bus/event-bus-module.ts#L36"
}
],
"parameters": [
{
"id": 67,
"name": "eventName",
"variant": "param",
"kind": 32768,
"flags": {},
"comment": {
"summary": [
{
"kind": "text",
"text": "The name of the event to subscribe to."
}
]
},
"type": {
"type": "union",
"types": [
{
"type": "intrinsic",
"name": "string"
},
{
"type": "intrinsic",
"name": "symbol"
}
]
}
},
{
"id": 68,
"name": "subscriber",
"variant": "param",
"kind": 32768,
"flags": {},
"comment": {
"summary": [
{
"kind": "text",
"text": "The subscriber function to execute when the event is emitted."
}
]
},
"type": {
"type": "reference",
"target": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/common.ts",
"qualifiedName": "Subscriber"
},
"name": "Subscriber",
"package": "@medusajs/types"
}
},
{
"id": 69,
"name": "context",
"variant": "param",
"kind": 32768,
"flags": {
"isOptional": true
},
"comment": {
"summary": [
{
"kind": "text",
"text": "The context of the subscriber."
}
]
},
"type": {
"type": "reference",
"target": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/common.ts",
"qualifiedName": "SubscriberContext"
},
"name": "SubscriberContext",
"package": "@medusajs/types"
}
}
],
"type": {
"type": "intrinsic",
"name": "this"
}
}
]
},
{
"id": 70,
"name": "unsubscribe",
"variant": "declaration",
"kind": 2048,
"flags": {},
"sources": [
{
"fileName": "event-bus-module.ts",
"line": 55,
"character": 2,
"url": "https://github.com/medusajs/medusa/blob/cb6249320e7322e8eabfec8434f1278f8d63e96c/packages/core/types/src/event-bus/event-bus-module.ts#L55"
}
],
"signatures": [
{
"id": 71,
"name": "unsubscribe",
"variant": "signature",
"kind": 4096,
"flags": {},
"comment": {
"summary": [
{
"kind": "text",
"text": "This method removes a subscriber from an event. It's mainly used internally to unregister subscribers."
}
],
"blockTags": [
{
"tag": "@returns",
"content": [
{
"kind": "text",
"text": "The instance of the Event Module"
}
]
},
{
"tag": "@example",
"content": [
{
"kind": "code",
"text": "```ts\neventBus.unsubscribe(\"user.created\", async (data) => {\n console.log(\"User created\", data)\n})\n```"
}
]
}
]
},
"sources": [
{
"fileName": "event-bus-module.ts",
"line": 55,
"character": 2,
"url": "https://github.com/medusajs/medusa/blob/cb6249320e7322e8eabfec8434f1278f8d63e96c/packages/core/types/src/event-bus/event-bus-module.ts#L55"
}
],
"parameters": [
{
"id": 72,
"name": "eventName",
"variant": "param",
"kind": 32768,
"flags": {},
"comment": {
"summary": [
{
"kind": "text",
"text": "The name of the event to unsubscribe from."
}
]
},
"type": {
"type": "union",
"types": [
{
"type": "intrinsic",
"name": "string"
},
{
"type": "intrinsic",
"name": "symbol"
}
]
}
},
{
"id": 73,
"name": "subscriber",
"variant": "param",
"kind": 32768,
"flags": {},
"comment": {
"summary": [
{
"kind": "text",
"text": "The subscriber function to remove."
}
]
},
"type": {
"type": "reference",
"target": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/common.ts",
"qualifiedName": "Subscriber"
},
"name": "Subscriber",
"package": "@medusajs/types"
}
},
{
"id": 74,
"name": "context",
"variant": "param",
"kind": 32768,
"flags": {
"isOptional": true
},
"comment": {
"summary": [
{
"kind": "text",
"text": "The context of the subscriber."
}
]
},
"type": {
"type": "reference",
"target": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/common.ts",
"qualifiedName": "SubscriberContext"
},
"name": "SubscriberContext",
"package": "@medusajs/types"
}
}
],
"type": {
"type": "intrinsic",
"name": "this"
}
}
]
},
{
"id": 75,
"name": "releaseGroupedEvents",
"variant": "declaration",
"kind": 2048,
"flags": {},
"sources": [
{
"fileName": "event-bus-module.ts",
"line": 70,
"character": 2,
"url": "https://github.com/medusajs/medusa/blob/cb6249320e7322e8eabfec8434f1278f8d63e96c/packages/core/types/src/event-bus/event-bus-module.ts#L70"
}
],
"signatures": [
{
"id": 76,
"name": "releaseGroupedEvents",
"variant": "signature",
"kind": 4096,
"flags": {},
"comment": {
"summary": [
{
"kind": "text",
"text": "This method emits all events in the specified group. Grouped events are useful when you have distributed transactions\nwhere you need to explicitly group, release and clear events upon lifecycle events of a transaction."
}
],
"blockTags": [
{
"tag": "@example",
"content": [
{
"kind": "code",
"text": "```ts\nawait eventBus.releaseGroupedEvents(\"group_123\")\n```"
}
]
}
]
},
"sources": [
{
"fileName": "event-bus-module.ts",
"line": 70,
"character": 2,
"url": "https://github.com/medusajs/medusa/blob/cb6249320e7322e8eabfec8434f1278f8d63e96c/packages/core/types/src/event-bus/event-bus-module.ts#L70"
}
],
"parameters": [
{
"id": 77,
"name": "eventGroupId",
"variant": "param",
"kind": 32768,
"flags": {},
"comment": {
"summary": [
{
"kind": "text",
"text": "The ID of the event group."
}
]
},
"type": {
"type": "intrinsic",
"name": "string"
}
}
],
"type": {
"type": "reference",
"target": {
"sourceFileName": "../../node_modules/typescript/lib/lib.es5.d.ts",
"qualifiedName": "Promise"
},
"typeArguments": [
{
"type": "intrinsic",
"name": "void"
}
],
"name": "Promise",
"package": "typescript"
}
}
]
},
{
"id": 78,
"name": "clearGroupedEvents",
"variant": "declaration",
"kind": 2048,
"flags": {},
"sources": [
{
"fileName": "event-bus-module.ts",
"line": 80,
"character": 2,
"url": "https://github.com/medusajs/medusa/blob/cb6249320e7322e8eabfec8434f1278f8d63e96c/packages/core/types/src/event-bus/event-bus-module.ts#L80"
}
],
"signatures": [
{
"id": 79,
"name": "clearGroupedEvents",
"variant": "signature",
"kind": 4096,
"flags": {},
"comment": {
"summary": [
{
"kind": "text",
"text": "This method removes all events in the specified group. Grouped events are useful when you have distributed transactions\nwhere you need to explicitly group, release and clear events upon lifecycle events of a transaction."
}
],
"blockTags": [
{
"tag": "@example",
"content": [
{
"kind": "code",
"text": "```ts\nawait eventBus.clearGroupedEvents(\"group_123\")\n```"
}
]
}
]
},
"sources": [
{
"fileName": "event-bus-module.ts",
"line": 80,
"character": 2,
"url": "https://github.com/medusajs/medusa/blob/cb6249320e7322e8eabfec8434f1278f8d63e96c/packages/core/types/src/event-bus/event-bus-module.ts#L80"
}
],
"parameters": [
{
"id": 80,
"name": "eventGroupId",
"variant": "param",
"kind": 32768,
"flags": {},
"comment": {
"summary": [
{
"kind": "text",
"text": "The ID of the event group."
}
]
},
"type": {
"type": "intrinsic",
"name": "string"
}
}
],
"type": {
"type": "reference",
"target": {
"sourceFileName": "../../node_modules/typescript/lib/lib.es5.d.ts",
"qualifiedName": "Promise"
},
"typeArguments": [
{
"type": "intrinsic",
"name": "void"
}
],
"name": "Promise",
"package": "typescript"
}
}
]
}
],
"groups": [
{
"title": "Methods",
"children": [
60,
65,
70,
75,
78
]
}
],
"sources": [
{
"fileName": "event-bus-module.ts",
"line": 3,
"character": 17,
"url": "https://github.com/medusajs/medusa/blob/cb6249320e7322e8eabfec8434f1278f8d63e96c/packages/core/types/src/event-bus/event-bus-module.ts#L3"
}
]
}
],
"groups": [
{
"title": "Interfaces",
"children": [
59
]
}
],
"packageName": "@medusajs/types",
"symbolIdMap": {
"58": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/event-bus-module.ts",
"qualifiedName": ""
},
"59": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/event-bus-module.ts",
"qualifiedName": "IEventBusModuleService"
},
"60": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/event-bus-module.ts",
"qualifiedName": "IEventBusModuleService.emit"
},
"61": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/event-bus-module.ts",
"qualifiedName": "IEventBusModuleService.emit"
},
"62": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/event-bus-module.ts",
"qualifiedName": "T"
},
"63": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/event-bus-module.ts",
"qualifiedName": "data"
},
"64": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/event-bus-module.ts",
"qualifiedName": "options"
},
"65": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/event-bus-module.ts",
"qualifiedName": "IEventBusModuleService.subscribe"
},
"66": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/event-bus-module.ts",
"qualifiedName": "IEventBusModuleService.subscribe"
},
"67": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/event-bus-module.ts",
"qualifiedName": "eventName"
},
"68": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/event-bus-module.ts",
"qualifiedName": "subscriber"
},
"69": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/event-bus-module.ts",
"qualifiedName": "context"
},
"70": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/event-bus-module.ts",
"qualifiedName": "IEventBusModuleService.unsubscribe"
},
"71": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/event-bus-module.ts",
"qualifiedName": "IEventBusModuleService.unsubscribe"
},
"72": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/event-bus-module.ts",
"qualifiedName": "eventName"
},
"73": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/event-bus-module.ts",
"qualifiedName": "subscriber"
},
"74": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/event-bus-module.ts",
"qualifiedName": "context"
},
"75": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/event-bus-module.ts",
"qualifiedName": "IEventBusModuleService.releaseGroupedEvents"
},
"76": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/event-bus-module.ts",
"qualifiedName": "IEventBusModuleService.releaseGroupedEvents"
},
"77": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/event-bus-module.ts",
"qualifiedName": "eventGroupId"
},
"78": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/event-bus-module.ts",
"qualifiedName": "IEventBusModuleService.clearGroupedEvents"
},
"79": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/event-bus-module.ts",
"qualifiedName": "IEventBusModuleService.clearGroupedEvents"
},
"80": {
"sourceFileName": "../../../../packages/core/types/src/event-bus/event-bus-module.ts",
"qualifiedName": "eventGroupId"
}
},
"files": {
"entries": {
"1": "../../../../packages/core/types/src/event-bus/event-bus-module.ts"
},
"reflections": {
"1": 58
}
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -11,6 +11,17 @@ import { modules } from "./references.js"
import { getCoreFlowNamespaces } from "../utils/get-namespaces.js"
const customOptions: Record<string, Partial<TypeDocOptions>> = {
"auth-provider": getOptions({
entryPointPath: "packages/core/utils/src/auth/abstract-auth-provider.ts",
tsConfigName: "utils.json",
name: "auth-provider",
parentIgnore: true,
}),
cache: getOptions({
entryPointPath: "packages/core/types/src/cache/service.ts",
tsConfigName: "types.json",
name: "cache",
}),
"core-flows": getOptions({
entryPointPath: "packages/core/core-flows/src/index.ts",
tsConfigName: "core-flows.json",
@@ -21,17 +32,6 @@ const customOptions: Record<string, Partial<TypeDocOptions>> = {
// @ts-expect-error there's a typing issue in typedoc
generatePathNamespaces: getCoreFlowNamespaces(),
}),
"auth-provider": getOptions({
entryPointPath: "packages/core/utils/src/auth/abstract-auth-provider.ts",
tsConfigName: "utils.json",
name: "auth-provider",
parentIgnore: true,
}),
locking: getOptions({
entryPointPath: "packages/core/types/src/locking/index.ts",
tsConfigName: "types.json",
name: "locking",
}),
dml: getOptions({
entryPointPath: [
"packages/core/utils/src/dml/entity-builder.ts",
@@ -42,29 +42,28 @@ const customOptions: Record<string, Partial<TypeDocOptions>> = {
name: "dml",
generateCustomNamespaces: true,
}),
event: getOptions({
entryPointPath: "packages/core/types/src/event-bus/event-bus-module.ts",
tsConfigName: "types.json",
name: "event",
}),
file: getOptions({
entryPointPath: "packages/core/utils/src/file/abstract-file-provider.ts",
tsConfigName: "utils.json",
name: "file",
parentIgnore: true,
}),
"file-service": getOptions({
entryPointPath: "packages/core/types/src/file/service.ts",
tsConfigName: "types.json",
name: "file-service",
}),
"fulfillment-provider": getOptions({
entryPointPath: "packages/core/utils/src/fulfillment/provider.ts",
tsConfigName: "utils.json",
name: "fulfillment-provider",
parentIgnore: true,
}),
"js-sdk": getOptions({
entryPointPath: [
"packages/core/js-sdk/src/admin/index.ts",
"packages/core/js-sdk/src/auth/index.ts",
"packages/core/js-sdk/src/store/index.ts",
],
tsConfigName: "js-sdk.json",
name: "js-sdk",
enableInternalResolve: true,
exclude: [...(baseOptions.exclude || []), "**/dist/**"],
}),
"helper-steps": getOptions({
entryPointPath: "packages/core/core-flows/src/common/index.ts",
tsConfigName: "core-flows.json",
@@ -77,6 +76,22 @@ const customOptions: Record<string, Partial<TypeDocOptions>> = {
),
],
}),
"js-sdk": getOptions({
entryPointPath: [
"packages/core/js-sdk/src/admin/index.ts",
"packages/core/js-sdk/src/auth/index.ts",
"packages/core/js-sdk/src/store/index.ts",
],
tsConfigName: "js-sdk.json",
name: "js-sdk",
enableInternalResolve: true,
exclude: [...(baseOptions.exclude || []), "**/dist/**"],
}),
locking: getOptions({
entryPointPath: "packages/core/types/src/locking/index.ts",
tsConfigName: "types.json",
name: "locking",
}),
medusa: getOptions({
entryPointPath: "packages/medusa/src/index.ts",
tsConfigName: "medusa.json",
@@ -104,6 +119,11 @@ const customOptions: Record<string, Partial<TypeDocOptions>> = {
"**/modules-config.ts",
],
}),
"modules-sdk": getOptions({
entryPointPath: "packages/core/modules-sdk/src/index.ts",
tsConfigName: "modules-sdk.json",
name: "modules-sdk",
}),
notification: getOptions({
entryPointPath:
"packages/core/utils/src/notification/abstract-notification-provider.ts",
@@ -111,6 +131,11 @@ const customOptions: Record<string, Partial<TypeDocOptions>> = {
name: "notification",
parentIgnore: true,
}),
"notification-service": getOptions({
entryPointPath: "packages/core/types/src/notification/service.ts",
tsConfigName: "types.json",
name: "notification-service",
}),
"payment-provider": getOptions({
entryPointPath:
"packages/core/utils/src/payment/abstract-payment-provider.ts",
@@ -143,11 +168,6 @@ const customOptions: Record<string, Partial<TypeDocOptions>> = {
),
],
}),
"modules-sdk": getOptions({
entryPointPath: "packages/core/modules-sdk/src/index.ts",
tsConfigName: "modules-sdk.json",
name: "modules-sdk",
}),
utils: getOptions({
entryPointPath: "packages/core/utils/src/index.ts",
tsConfigName: "utils.json",
@@ -0,0 +1,49 @@
import { FormattingOptionsType } from "types"
const cacheOptions: FormattingOptionsType = {
"^cache/.*ICacheService": {
reflectionGroups: {
Constructors: false,
},
reflectionDescription: `In this document, youll learn about the different methods in the Cache Module's service and how to use them.`,
frontmatterData: {
slug: "/references/cache-service",
tags: ["cache", "server", "how to"],
sidebar_label: "Use Cache Module",
},
reflectionTitle: {
fullReplacement: "How to Use Cache Module",
},
expandMembers: true,
startSections: [
`## Resolve Cache Module's Service
In your workflow's step, you can resolve the Cache Module's service from the Medusa container:
\`\`\`ts
import { Modules } from "@medusajs/framework/utils"
import { createStep } from "@medusajs/framework/workflows-sdk"
const step1 = createStep(
"step-1",
async ({}, { container }) => {
const cacheModuleService = container.resolve(
Modules.CACHE
)
// TODO use cacheModuleService
}
)
\`\`\`
This will resolve the service of the configured Cache Module, which is the [In-Memory Cache Module](https://docs.medusajs.com/resources/architectural-modules/cache/in-memory) by default.
You can then use the Cache Module's service's methods in the step. The rest of this guide details these methods.
---
`,
],
},
}
export default cacheOptions
@@ -0,0 +1,49 @@
import { FormattingOptionsType } from "types"
const eventOptions: FormattingOptionsType = {
"^event/.*IEventBusModuleService": {
reflectionGroups: {
Constructors: false,
},
reflectionDescription: `In this document, youll learn about the different methods in the Event Module's service and how to use them.`,
frontmatterData: {
slug: "/references/event-service",
tags: ["event", "server", "how to"],
sidebar_label: "Use Event Module",
},
reflectionTitle: {
fullReplacement: "How to Use Event Module",
},
expandMembers: true,
startSections: [
`## Resolve Event Module's Service
In your workflow's step, you can resolve the Event Module's service from the Medusa container:
\`\`\`ts
import { Modules } from "@medusajs/framework/utils"
import { createStep } from "@medusajs/framework/workflows-sdk"
const step1 = createStep(
"step-1",
async ({}, { container }) => {
const eventModuleService = container.resolve(
Modules.EVENT
)
// TODO use eventModuleService
}
)
\`\`\`
This will resolve the service of the configured Event Module, which is the [Local Event Module](https://docs.medusajs.com/resources/architectural-modules/event/local) by default.
You can then use the Event Module's service's methods in the step. The rest of this guide details these methods.
---
`,
],
},
}
export default eventOptions
@@ -0,0 +1,47 @@
import { FormattingOptionsType } from "types"
const fileServiceOptions: FormattingOptionsType = {
"^file_service/.*IFileModuleService": {
reflectionGroups: {
Constructors: false,
},
reflectionDescription: `In this document, youll learn about the different methods in the File Module's service and how to use them.`,
frontmatterData: {
slug: "/references/file-service",
tags: ["file", "server", "how to"],
sidebar_label: "Use File Module",
},
reflectionTitle: {
fullReplacement: "How to Use File Module",
},
expandMembers: true,
startSections: [
`## Resolve File Module's Service
In your workflow's step, you can resolve the File Module's service from the Medusa container:
\`\`\`ts
import { Modules } from "@medusajs/framework/utils"
import { createStep } from "@medusajs/framework/workflows-sdk"
const step1 = createStep(
"step-1",
async ({}, { container }) => {
const fileModuleService = container.resolve(
Modules.FILE
)
// TODO use fileModuleService
}
)
\`\`\`
You can then use the File Module's service's methods in the step. The rest of this guide details these methods.
---
`,
],
},
}
export default fileServiceOptions
@@ -14,11 +14,18 @@ import dmlOptions from "./dml.js"
import coreFlowsOptions from "./core-flows.js"
import jsSdkOptions from "./js-sdk.js"
import lockingOptions from "./locking.js"
import cacheOptions from "./cache.js"
import eventOptions from "./event.js"
import fileServiceOptions from "./file-service.js"
import notificationServiceOptions from "./notification-service.js"
const mergerCustomOptions: FormattingOptionsType = {
...authProviderOptions,
...cacheOptions,
...coreFlowsOptions,
...dmlOptions,
...eventOptions,
...fileServiceOptions,
...fileOptions,
...fulfillmentProviderOptions,
...helperStepsOptions,
@@ -26,6 +33,7 @@ const mergerCustomOptions: FormattingOptionsType = {
...lockingOptions,
...medusaConfigOptions,
...medusaOptions,
...notificationServiceOptions,
...notificationOptions,
...paymentProviderOptions,
...searchOptions,
@@ -0,0 +1,47 @@
import { FormattingOptionsType } from "types"
const notificationServiceOptions: FormattingOptionsType = {
"^notification_service/.*INotificationModuleService": {
reflectionGroups: {
Constructors: false,
},
reflectionDescription: `In this document, youll learn about the different methods in the Notification Module's service and how to use them.`,
frontmatterData: {
slug: "/references/notification-service",
tags: ["notification", "server", "how to"],
sidebar_label: "Use Notification Module",
},
reflectionTitle: {
fullReplacement: "How to Use Notification Module",
},
expandMembers: true,
startSections: [
`## Resolve Notification Module's Service
In your workflow's step, you can resolve the Notification Module's service from the Medusa container:
\`\`\`ts
import { Modules } from "@medusajs/framework/utils"
import { createStep } from "@medusajs/framework/workflows-sdk"
const step1 = createStep(
"step-1",
async ({}, { container }) => {
const notificationModuleService = container.resolve(
Modules.NOTIFICATION
)
// TODO use notificationModuleService
}
)
\`\`\`
You can then use the Notification Module's service's methods in the step. The rest of this guide details these methods.
---
`,
],
},
}
export default notificationServiceOptions
@@ -39,6 +39,10 @@ const allReferences = [
"utils",
"workflows",
"locking",
"cache",
"event",
"file-service",
"notification-service",
]
export default allReferences