docs: added how-to guides for architectural modules (#11883)
* added initial how-tos * finished changes * generated sidebars
This commit is contained in:
1 parent
0099c1e2e9
commit
cb68a9e67b
37 files changed
+5265
-68
No files matched your search
@@ -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, you’ll 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"/>
|
||||
@@ -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",
|
||||
|
||||
@@ -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, you’ll 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<null \\| T>","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<void>","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<void>","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, you’ll 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)<T> \\| [Message](../../../types/EventBusTypes/types/types.EventBusTypes.Message/page.mdx)<T>[]","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<void>","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<void>","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<void>","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"/>
|
||||
+186
@@ -0,0 +1,186 @@
|
||||
---
|
||||
slug: /references/file-service
|
||||
tags:
|
||||
- file
|
||||
- server
|
||||
- how to
|
||||
sidebar_label: Use File Module
|
||||
---
|
||||
|
||||
import { TypeList } from "docs-ui"
|
||||
|
||||
# How to Use File Module
|
||||
|
||||
In this document, you’ll learn about the different methods in the File Module's service and how to use them.
|
||||
|
||||
---
|
||||
|
||||
## 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.
|
||||
|
||||
---
|
||||
|
||||
## createFiles
|
||||
|
||||
### createFiles(data, sharedContext?): Promise<[FileDTO](../../../types/FileTypes/interfaces/types.FileTypes.FileDTO/page.mdx)[]>
|
||||
|
||||
This method uploads files to the designated file storage system.
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const [file] = await fileModuleService.createFiles([{
|
||||
filename: "product.png",
|
||||
mimeType: "image/png",
|
||||
content: "somecontent" // base64 encoded
|
||||
}])
|
||||
```
|
||||
|
||||
#### Parameters
|
||||
|
||||
<TypeList types={[{"name":"data","type":"[CreateFileDTO](../../../types/FileTypes/interfaces/types.FileTypes.CreateFileDTO/page.mdx)[]","description":"The files to be created.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"filename","type":"`string`","description":"The filename of the uploaded file","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"mimeType","type":"`string`","description":"The mimetype of the uploaded file","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"content","type":"`string`","description":"The file content as a binary-encoded string","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"access","type":"`\"public\"` \\| `\"private\"`","description":"The access level of the file. Defaults to private if not passed","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"sharedContext","type":"[Context](../../../types/interfaces/types.Context/page.mdx)","description":"A context used to share resources, such as transaction manager, between the application and the module.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"transactionManager","type":"TManager","description":"An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"manager","type":"TManager","description":"An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"isolationLevel","type":"`string`","description":"A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"enableNestedTransactions","type":"`boolean`","description":"A boolean value indicating whether nested transactions are enabled.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"eventGroupId","type":"`string`","description":"A string indicating the ID of the group to aggregate the events to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"transactionId","type":"`string`","description":"A string indicating the ID of the current transaction.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"messageAggregator","type":"[IMessageAggregator](../../../types/interfaces/types.IMessageAggregator/page.mdx)","description":"An instance of a message aggregator, which is used to aggregate messages to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"requestId","type":"`string`","description":"A string indicating the ID of the current request.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"idempotencyKey","type":"`string`","description":"A string indicating the idempotencyKey of the current workflow execution.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"parentStepIdempotencyKey","type":"`string`","description":"A string indicating the idempotencyKey of the parent workflow execution.","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="createFiles"/>
|
||||
|
||||
#### Returns
|
||||
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<[FileDTO](../../../types/FileTypes/interfaces/types.FileTypes.FileDTO/page.mdx)[]>","optional":false,"defaultValue":"","description":"The created files.","expandable":false,"children":[{"name":"FileDTO[]","type":"[FileDTO](../../../types/FileTypes/interfaces/types.FileTypes.FileDTO/page.mdx)[]","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"FileDTO","type":"`object`","description":"The File details.","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="createFiles"/>
|
||||
|
||||
### createFiles(data, sharedContext?): Promise<[FileDTO](../../../types/FileTypes/interfaces/types.FileTypes.FileDTO/page.mdx)>
|
||||
|
||||
This method uploads a file to the designated file storage system.
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const file = await fileModuleService.createFiles({
|
||||
filename: "product.png",
|
||||
mimeType: "image/png",
|
||||
content: "somecontent" // base64 encoded
|
||||
})
|
||||
```
|
||||
|
||||
#### Parameters
|
||||
|
||||
<TypeList types={[{"name":"data","type":"[CreateFileDTO](../../../types/FileTypes/interfaces/types.FileTypes.CreateFileDTO/page.mdx)","description":"The file to be created.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"filename","type":"`string`","description":"The filename of the uploaded file","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"mimeType","type":"`string`","description":"The mimetype of the uploaded file","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"content","type":"`string`","description":"The file content as a binary-encoded string","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"access","type":"`\"public\"` \\| `\"private\"`","description":"The access level of the file. Defaults to private if not passed","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"sharedContext","type":"[Context](../../../types/interfaces/types.Context/page.mdx)","description":"A context used to share resources, such as transaction manager, between the application and the module.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"transactionManager","type":"TManager","description":"An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"manager","type":"TManager","description":"An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"isolationLevel","type":"`string`","description":"A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"enableNestedTransactions","type":"`boolean`","description":"A boolean value indicating whether nested transactions are enabled.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"eventGroupId","type":"`string`","description":"A string indicating the ID of the group to aggregate the events to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"transactionId","type":"`string`","description":"A string indicating the ID of the current transaction.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"messageAggregator","type":"[IMessageAggregator](../../../types/interfaces/types.IMessageAggregator/page.mdx)","description":"An instance of a message aggregator, which is used to aggregate messages to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"requestId","type":"`string`","description":"A string indicating the ID of the current request.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"idempotencyKey","type":"`string`","description":"A string indicating the idempotencyKey of the current workflow execution.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"parentStepIdempotencyKey","type":"`string`","description":"A string indicating the idempotencyKey of the parent workflow execution.","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="createFiles"/>
|
||||
|
||||
#### Returns
|
||||
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<[FileDTO](../../../types/FileTypes/interfaces/types.FileTypes.FileDTO/page.mdx)>","optional":false,"defaultValue":"","description":"The created file.","expandable":false,"children":[{"name":"FileDTO","type":"[FileDTO](../../../types/FileTypes/interfaces/types.FileTypes.FileDTO/page.mdx)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"The ID of the File.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"url","type":"`string`","description":"The URL of the File.","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="createFiles"/>
|
||||
|
||||
___
|
||||
|
||||
## deleteFiles
|
||||
|
||||
### deleteFiles(ids, sharedContext?): Promise<void>
|
||||
|
||||
This method deletes files by their IDs.
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
await fileModuleService.deleteFiles(["file_123"])
|
||||
```
|
||||
|
||||
#### Parameters
|
||||
|
||||
<TypeList types={[{"name":"ids","type":"`string`[]","description":"The IDs of the files.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"sharedContext","type":"[Context](../../../types/interfaces/types.Context/page.mdx)","description":"A context used to share resources, such as transaction manager, between the application and the module.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"transactionManager","type":"TManager","description":"An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"manager","type":"TManager","description":"An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"isolationLevel","type":"`string`","description":"A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"enableNestedTransactions","type":"`boolean`","description":"A boolean value indicating whether nested transactions are enabled.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"eventGroupId","type":"`string`","description":"A string indicating the ID of the group to aggregate the events to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"transactionId","type":"`string`","description":"A string indicating the ID of the current transaction.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"messageAggregator","type":"[IMessageAggregator](../../../types/interfaces/types.IMessageAggregator/page.mdx)","description":"An instance of a message aggregator, which is used to aggregate messages to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"requestId","type":"`string`","description":"A string indicating the ID of the current request.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"idempotencyKey","type":"`string`","description":"A string indicating the idempotencyKey of the current workflow execution.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"parentStepIdempotencyKey","type":"`string`","description":"A string indicating the idempotencyKey of the parent workflow execution.","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="deleteFiles"/>
|
||||
|
||||
#### Returns
|
||||
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<void>","optional":false,"defaultValue":"","description":"Resolves when the files are deleted successfully.","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="deleteFiles"/>
|
||||
|
||||
### deleteFiles(id, sharedContext?): Promise<void>
|
||||
|
||||
This method deletes a file by its ID.
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
await fileModuleService.deleteFiles("file_123")
|
||||
```
|
||||
|
||||
#### Parameters
|
||||
|
||||
<TypeList types={[{"name":"id","type":"`string`","description":"The ID of the file.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"sharedContext","type":"[Context](../../../types/interfaces/types.Context/page.mdx)","description":"A context used to share resources, such as transaction manager, between the application and the module.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"transactionManager","type":"TManager","description":"An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"manager","type":"TManager","description":"An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"isolationLevel","type":"`string`","description":"A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"enableNestedTransactions","type":"`boolean`","description":"A boolean value indicating whether nested transactions are enabled.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"eventGroupId","type":"`string`","description":"A string indicating the ID of the group to aggregate the events to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"transactionId","type":"`string`","description":"A string indicating the ID of the current transaction.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"messageAggregator","type":"[IMessageAggregator](../../../types/interfaces/types.IMessageAggregator/page.mdx)","description":"An instance of a message aggregator, which is used to aggregate messages to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"requestId","type":"`string`","description":"A string indicating the ID of the current request.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"idempotencyKey","type":"`string`","description":"A string indicating the idempotencyKey of the current workflow execution.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"parentStepIdempotencyKey","type":"`string`","description":"A string indicating the idempotencyKey of the parent workflow execution.","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="deleteFiles"/>
|
||||
|
||||
#### Returns
|
||||
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<void>","optional":false,"defaultValue":"","description":"Resolves when the file is deleted successfully.","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="deleteFiles"/>
|
||||
|
||||
___
|
||||
|
||||
## retrieveFile
|
||||
|
||||
This method retrieves a file with a downloadable URL by its ID.
|
||||
|
||||
### Example
|
||||
|
||||
```ts
|
||||
const file = await fileModuleService.retrieveFile("file_123")
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
<TypeList types={[{"name":"id","type":"`string`","description":"The ID of the file.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"config","type":"[FindConfig](../../../medusa/interfaces/medusa.FindConfig/page.mdx)<[FileDTO](../../../types/FileTypes/interfaces/types.FileTypes.FileDTO/page.mdx)>","description":"The configurations determining how the file is retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a file.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"select","type":"(keyof Entity \\| `string` & `object`)[]","description":"An array of strings, each being attribute names of the entity to retrieve in the result.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"skip","type":"`null` \\| `number`","description":"A number indicating the number of records to skip before retrieving the results.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"take","type":"`null` \\| `number`","description":"A number indicating the number of records to return in the result.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"relations","type":"`string`[]","description":"An array of strings, each being relation names of the entity to retrieve in the result.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"order","type":"[FindConfigOrder](../../../medusa/types/medusa.FindConfigOrder/page.mdx)","description":"An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"withDeleted","type":"`boolean`","description":"A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"filters","type":"`Record<string, any>`","description":"Enable ORM specific defined filters","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`Record<string, any>`","description":"Enable ORM specific defined options","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"sharedContext","type":"[Context](../../../types/interfaces/types.Context/page.mdx)","description":"A context used to share resources, such as transaction manager, between the application and the module.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"transactionManager","type":"TManager","description":"An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"manager","type":"TManager","description":"An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"isolationLevel","type":"`string`","description":"A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"enableNestedTransactions","type":"`boolean`","description":"A boolean value indicating whether nested transactions are enabled.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"eventGroupId","type":"`string`","description":"A string indicating the ID of the group to aggregate the events to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"transactionId","type":"`string`","description":"A string indicating the ID of the current transaction.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"messageAggregator","type":"[IMessageAggregator](../../../types/interfaces/types.IMessageAggregator/page.mdx)","description":"An instance of a message aggregator, which is used to aggregate messages to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"requestId","type":"`string`","description":"A string indicating the ID of the current request.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"idempotencyKey","type":"`string`","description":"A string indicating the idempotencyKey of the current workflow execution.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"parentStepIdempotencyKey","type":"`string`","description":"A stLine truncated
|
||||
|
||||
### Returns
|
||||
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<[FileDTO](../../../types/FileTypes/interfaces/types.FileTypes.FileDTO/page.mdx)>","optional":false,"defaultValue":"","description":"The retrieved file.","expandable":false,"children":[{"name":"FileDTO","type":"[FileDTO](../../../types/FileTypes/interfaces/types.FileTypes.FileDTO/page.mdx)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"The ID of the File.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"url","type":"`string`","description":"The URL of the File.","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="retrieveFile"/>
|
||||
|
||||
___
|
||||
|
||||
## listFiles
|
||||
|
||||
This method is used to retrieve a file by ID, similarly to `retrieve`. It doesn't retrieve multiple files, but it's added to support retrieving files with [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query).
|
||||
|
||||
### Example
|
||||
|
||||
```ts
|
||||
const files = await fileModuleService.listFiles({ id: "file_123" })
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
<TypeList types={[{"name":"filters","type":"[FilterableFileProps](../../../types/FileTypes/interfaces/types.FileTypes.FilterableFileProps/page.mdx)","description":"The filters to apply on the retrieved files.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"The file ID to filter by.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"config","type":"[FindConfig](../../../medusa/interfaces/medusa.FindConfig/page.mdx)<[FileDTO](../../../types/FileTypes/interfaces/types.FileTypes.FileDTO/page.mdx)>","description":"The configurations determining how the files are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a file.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"select","type":"(keyof Entity \\| `string` & `object`)[]","description":"An array of strings, each being attribute names of the entity to retrieve in the result.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"skip","type":"`null` \\| `number`","description":"A number indicating the number of records to skip before retrieving the results.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"take","type":"`null` \\| `number`","description":"A number indicating the number of records to return in the result.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"relations","type":"`string`[]","description":"An array of strings, each being relation names of the entity to retrieve in the result.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"order","type":"[FindConfigOrder](../../../medusa/types/medusa.FindConfigOrder/page.mdx)","description":"An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"withDeleted","type":"`boolean`","description":"A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"filters","type":"`Record<string, any>`","description":"Enable ORM specific defined filters","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`Record<string, any>`","description":"Enable ORM specific defined options","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"sharedContext","type":"[Context](../../../types/interfaces/types.Context/page.mdx)","description":"A context used to share resources, such as transaction manager, between the application and the module.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"transactionManager","type":"TManager","description":"An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"manager","type":"TManager","description":"An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"isolationLevel","type":"`string`","description":"A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"enableNestedTransactions","type":"`boolean`","description":"A boolean value indicating whether nested transactions are enabled.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"eventGroupId","type":"`string`","description":"A string indicating the ID of the group to aggregate the events to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"transactionId","type":"`string`","description":"A string indicating the ID of the current transaction.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"messageAggregator","type":"[IMessageAggregator](../../../types/interfaces/types.IMessageAggregator/page.mdx)","description":"An instance of a message aggregator, which is used to aggregate messages to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"requestId","type":"`string`","description":"A string indicating the ID of the current request.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name"Line truncated
|
||||
|
||||
### Returns
|
||||
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<[FileDTO](../../../types/FileTypes/interfaces/types.FileTypes.FileDTO/page.mdx)[]>","optional":false,"defaultValue":"","description":"The list of files. In this case, it will have at most one file.","expandable":false,"children":[{"name":"FileDTO[]","type":"[FileDTO](../../../types/FileTypes/interfaces/types.FileTypes.FileDTO/page.mdx)[]","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"FileDTO","type":"`object`","description":"The File details.","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="listFiles"/>
|
||||
|
||||
___
|
||||
|
||||
## listAndCountFiles
|
||||
|
||||
This method is used to retrieve a file by ID, similarly to `retrieve`. It doesn't retrieve multiple files, but it's added to support retrieving files with [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query).
|
||||
|
||||
### Example
|
||||
|
||||
```ts
|
||||
const [files] = await fileModuleService.listAndCountFiles({ id: "file_123" })
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
<TypeList types={[{"name":"filters","type":"[FilterableFileProps](../../../types/FileTypes/interfaces/types.FileTypes.FilterableFileProps/page.mdx)","description":"The filters to apply on the retrieved files.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"The file ID to filter by.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"config","type":"[FindConfig](../../../medusa/interfaces/medusa.FindConfig/page.mdx)<[FileDTO](../../../types/FileTypes/interfaces/types.FileTypes.FileDTO/page.mdx)>","description":"The configurations determining how the files are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a file.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"select","type":"(keyof Entity \\| `string` & `object`)[]","description":"An array of strings, each being attribute names of the entity to retrieve in the result.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"skip","type":"`null` \\| `number`","description":"A number indicating the number of records to skip before retrieving the results.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"take","type":"`null` \\| `number`","description":"A number indicating the number of records to return in the result.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"relations","type":"`string`[]","description":"An array of strings, each being relation names of the entity to retrieve in the result.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"order","type":"[FindConfigOrder](../../../medusa/types/medusa.FindConfigOrder/page.mdx)","description":"An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"withDeleted","type":"`boolean`","description":"A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"filters","type":"`Record<string, any>`","description":"Enable ORM specific defined filters","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`Record<string, any>`","description":"Enable ORM specific defined options","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"sharedContext","type":"[Context](../../../types/interfaces/types.Context/page.mdx)","description":"A context used to share resources, such as transaction manager, between the application and the module.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"transactionManager","type":"TManager","description":"An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"manager","type":"TManager","description":"An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"isolationLevel","type":"`string`","description":"A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"enableNestedTransactions","type":"`boolean`","description":"A boolean value indicating whether nested transactions are enabled.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"eventGroupId","type":"`string`","description":"A string indicating the ID of the group to aggregate the events to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"transactionId","type":"`string`","description":"A string indicating the ID of the current transaction.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"messageAggregator","type":"[IMessageAggregator](../../../types/interfaces/types.IMessageAggregator/page.mdx)","description":"An instance of a message aggregator, which is used to aggregate messages to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"requestId","type":"`string`","description":"A string indicating the ID of the current request.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name"Line truncated
|
||||
|
||||
### Returns
|
||||
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<[[FileDTO](../../../types/FileTypes/interfaces/types.FileTypes.FileDTO/page.mdx)[], number]>","optional":false,"defaultValue":"","description":"The list of files and their count. In this case, it will have at most one file.","expandable":false,"children":[{"name":"FileDTO[]","type":"[FileDTO](../../../types/FileTypes/interfaces/types.FileTypes.FileDTO/page.mdx)[]","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]},{"name":"number","type":"`number`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="listAndCountFiles"/>
|
||||
@@ -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)
|
||||
+234
@@ -0,0 +1,234 @@
|
||||
---
|
||||
slug: /references/notification-service
|
||||
tags:
|
||||
- notification
|
||||
- server
|
||||
- how to
|
||||
sidebar_label: Use Notification Module
|
||||
---
|
||||
|
||||
import { TypeList } from "docs-ui"
|
||||
|
||||
# How to Use Notification Module
|
||||
|
||||
In this document, you’ll learn about the different methods in the Notification Module's service and how to use them.
|
||||
|
||||
---
|
||||
|
||||
## 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.
|
||||
|
||||
---
|
||||
|
||||
## createNotifications
|
||||
|
||||
### createNotifications(data, sharedContext?): Promise<[NotificationDTO](../../../types/NotificationTypes/interfaces/types.NotificationTypes.NotificationDTO/page.mdx)[]>
|
||||
|
||||
This method is used to send multiple notifications and store them in the database.
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const notifications = await notificationModuleService.createNotifications([
|
||||
{
|
||||
to: "john@doe.me",
|
||||
template: "order-confirmation",
|
||||
channel: "email",
|
||||
},
|
||||
{
|
||||
to: "+38975123456",
|
||||
template: "order-confirmation",
|
||||
channel: "sms",
|
||||
},
|
||||
])
|
||||
```
|
||||
|
||||
#### Parameters
|
||||
|
||||
<TypeList types={[{"name":"data","type":"[CreateNotificationDTO](../../../types/NotificationTypes/interfaces/types.NotificationTypes.CreateNotificationDTO/page.mdx)[]","description":"The notifications to be sent.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"to","type":"`string`","description":"The recipient of the notification. It can be email, phone number, or username, depending on the channel.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"channel","type":"`string`","description":"The channel through which the notification is sent, such as 'email' or 'sms'","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"template","type":"`string`","description":"The template name in the provider's system.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"data","type":"`null` \\| `Record<string, unknown>`","description":"The data that gets passed over to the provider for rendering the notification.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"content","type":"`null` \\| [NotificationContent](../../../types/NotificationTypes/interfaces/types.NotificationTypes.NotificationContent/page.mdx)","description":"The content that gets passed over to the provider.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"subject","type":"`string`","description":"the subject of the notification","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"text","type":"`string`","description":"the text content of the notification","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"html","type":"`string`","description":"the html content of the notification","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"trigger_type","type":"`null` \\| `string`","description":"The event name, the workflow, or anything else that can help to identify what triggered the notification.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"resource_id","type":"`null` \\| `string`","description":"The ID of the resource this notification is for, if applicable. Useful for displaying relevant information in the UI","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"resource_type","type":"`null` \\| `string`","description":"The type of the resource this notification is for, if applicable, eg. \"order\"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"receiver_id","type":"`null` \\| `string`","description":"The ID of the customer this notification is for, if applicable.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"original_notification_id","type":"`null` \\| `string`","description":"The original notification, in case this is a retried notification.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"idempotency_key","type":"`null` \\| `string`","description":"An idempotency key that ensures the same notification is not sent multiple times.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"sharedContext","type":"[Context](../../../types/interfaces/types.Context/page.mdx)","description":"A context used to share resources, such as transaction manager, between the application and the module.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"transactionManager","type":"TManager","description":"An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"manager","type":"TManager","description":"An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"isolationLevel","type":"`string`","description":"A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"enableNestedTransactions","type":"`boolean`","description":"A boolean value indicating whether nested transactions are enabled.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"eventGroupId","type":"`string`","description":"A string indicating the ID of the group to aggregate the events to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"transactionId","type":"`string`","description":"A string indicating the ID of the current transaction.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"messageAggregator","type":"[IMessageAggregator](../../../types/interLine truncated
|
||||
|
||||
#### Returns
|
||||
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<[NotificationDTO](../../../types/NotificationTypes/interfaces/types.NotificationTypes.NotificationDTO/page.mdx)[]>","optional":false,"defaultValue":"","description":"The list of sent notifications.","expandable":false,"children":[{"name":"NotificationDTO[]","type":"[NotificationDTO](../../../types/NotificationTypes/interfaces/types.NotificationTypes.NotificationDTO/page.mdx)[]","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"NotificationDTO","type":"`object`","description":"A notification's data.","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="createNotifications"/>
|
||||
|
||||
### createNotifications(data, sharedContext?): Promise<[NotificationDTO](../../../types/NotificationTypes/interfaces/types.NotificationTypes.NotificationDTO/page.mdx)>
|
||||
|
||||
This method is used to send a notification, and store the request in the database.
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const notification = await notificationModuleService.createNotifications({
|
||||
to: "john@doe.me",
|
||||
template: "order-confirmation",
|
||||
channel: "email",
|
||||
})
|
||||
```
|
||||
|
||||
#### Parameters
|
||||
|
||||
<TypeList types={[{"name":"data","type":"[CreateNotificationDTO](../../../types/NotificationTypes/interfaces/types.NotificationTypes.CreateNotificationDTO/page.mdx)","description":"The notification to be sent.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"to","type":"`string`","description":"The recipient of the notification. It can be email, phone number, or username, depending on the channel.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"channel","type":"`string`","description":"The channel through which the notification is sent, such as 'email' or 'sms'","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"template","type":"`string`","description":"The template name in the provider's system.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"data","type":"`null` \\| `Record<string, unknown>`","description":"The data that gets passed over to the provider for rendering the notification.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"content","type":"`null` \\| [NotificationContent](../../../types/NotificationTypes/interfaces/types.NotificationTypes.NotificationContent/page.mdx)","description":"The content that gets passed over to the provider.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"subject","type":"`string`","description":"the subject of the notification","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"text","type":"`string`","description":"the text content of the notification","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"html","type":"`string`","description":"the html content of the notification","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"trigger_type","type":"`null` \\| `string`","description":"The event name, the workflow, or anything else that can help to identify what triggered the notification.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"resource_id","type":"`null` \\| `string`","description":"The ID of the resource this notification is for, if applicable. Useful for displaying relevant information in the UI","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"resource_type","type":"`null` \\| `string`","description":"The type of the resource this notification is for, if applicable, eg. \"order\"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"receiver_id","type":"`null` \\| `string`","description":"The ID of the customer this notification is for, if applicable.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"original_notification_id","type":"`null` \\| `string`","description":"The original notification, in case this is a retried notification.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"idempotency_key","type":"`null` \\| `string`","description":"An idempotency key that ensures the same notification is not sent multiple times.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"sharedContext","type":"[Context](../../../types/interfaces/types.Context/page.mdx)","description":"A context used to share resources, such as transaction manager, between the application and the module.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"transactionManager","type":"TManager","description":"An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"manager","type":"TManager","description":"An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"isolationLevel","type":"`string`","description":"A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"enableNestedTransactions","type":"`boolean`","description":"A boolean value indicating whether nested transactions are enabled.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"eventGroupId","type":"`string`","description":"A string indicating the ID of the group to aggregate the events to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"transactionId","type":"`string`","description":"A string indicating the ID of the current transaction.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"messageAggregator","type":"[IMessageAggregator](../../../types/interfacLine truncated
|
||||
|
||||
#### Returns
|
||||
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<[NotificationDTO](../../../types/NotificationTypes/interfaces/types.NotificationTypes.NotificationDTO/page.mdx)>","optional":false,"defaultValue":"","description":"The sent notification.","expandable":false,"children":[{"name":"NotificationDTO","type":"[NotificationDTO](../../../types/NotificationTypes/interfaces/types.NotificationTypes.NotificationDTO/page.mdx)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"The ID of the notification.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"to","type":"`string`","description":"The recipient of the notification. It can be email, phone number, or username, depending on the channel.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"channel","type":"`string`","description":"The channel through which the notification is sent, such as 'email' or 'sms'","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"template","type":"`string`","description":"The template name in the provider's system.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"data","type":"`null` \\| `Record<string, unknown>`","description":"The data that gets passed over to the provider for rendering the notification.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"provider_id","type":"`string`","description":"The ID of the notification provider.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"provider","type":"[NotificationProviderDTO](../../../types/NotificationTypes/interfaces/types.NotificationTypes.NotificationProviderDTO/page.mdx)","description":"Information about the notification provider","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"The ID of the notification provider.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"handle","type":"`string`","description":"The handle of the notification provider.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"name","type":"`string`","description":"A user-friendly name of the notification provider.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"channels","type":"`string`[]","description":"The supported channels by the notification provider.","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"created_at","type":"`Date`","description":"The date and time the notification was created.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"status","type":"`\"pending\"` \\| `\"success\"` \\| `\"failure\"`","description":"The status of the notification","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"from","type":"`null` \\| `string`","description":"The sender of the notification. It can be email, phone number, or username, depending on the channel.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"attachments","type":"`null` \\| [Attachment](../../../types/NotificationTypes/interfaces/types.NotificationTypes.Attachment/page.mdx)[]","description":"Optional attachments for the notification.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"content","type":"`string`","description":"The content of the attachment, encoded as a base64 string.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"filename","type":"`string`","description":"The filename of the attachment.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"content_type","type":"`string`","description":"The MIME type of the attachment.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"disposition","type":"`string`","description":"The disposition of the attachment, For example, \"inline\" or \"attachment\".","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"id","type":"`string`","description":"The ID, if the attachment is meant to be referenced within the body of the message.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"trigger_type","type":"`null` \\| `string`","description":"The event name, the workflow, or anything else that can help to identify what triggered the notification.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"resource_id","type":"`null` \\| `string`","description":"The ID of the resource this notification is for, if applicable. Useful for displaying relevant information in the UI","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"resource_type","type":"`null` \\| `string`","description":"The type of the resource this notification is for, if applicable, eg. \"order\"","optional":true,"defaultValue"Line truncated
|
||||
|
||||
___
|
||||
|
||||
## retrieveNotification
|
||||
|
||||
This method is used to retrieve a notification by its ID
|
||||
|
||||
### Example
|
||||
|
||||
A simple example that retrieves a notification by its ID:
|
||||
|
||||
```ts
|
||||
const notification =
|
||||
await notificationModuleService.retrieveNotification("noti_123")
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved:
|
||||
|
||||
```ts
|
||||
const notification = await notificationModuleService.retrieveNotification(
|
||||
"noti_123",
|
||||
{
|
||||
relations: ["provider"],
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
<TypeList types={[{"name":"notificationId","type":"`string`","description":"The ID of the notification to retrieve.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"config","type":"[FindConfig](../../../medusa/interfaces/medusa.FindConfig/page.mdx)<[NotificationDTO](../../../types/NotificationTypes/interfaces/types.NotificationTypes.NotificationDTO/page.mdx)>","description":"The configurations determining how the notification is retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a notification.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"select","type":"(keyof Entity \\| `string` & `object`)[]","description":"An array of strings, each being attribute names of the entity to retrieve in the result.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"skip","type":"`null` \\| `number`","description":"A number indicating the number of records to skip before retrieving the results.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"take","type":"`null` \\| `number`","description":"A number indicating the number of records to return in the result.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"relations","type":"`string`[]","description":"An array of strings, each being relation names of the entity to retrieve in the result.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"order","type":"[FindConfigOrder](../../../medusa/types/medusa.FindConfigOrder/page.mdx)","description":"An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"withDeleted","type":"`boolean`","description":"A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"filters","type":"`Record<string, any>`","description":"Enable ORM specific defined filters","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`Record<string, any>`","description":"Enable ORM specific defined options","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"sharedContext","type":"[Context](../../../types/interfaces/types.Context/page.mdx)","description":"A context used to share resources, such as transaction manager, between the application and the module.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"transactionManager","type":"TManager","description":"An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"manager","type":"TManager","description":"An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"isolationLevel","type":"`string`","description":"A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"enableNestedTransactions","type":"`boolean`","description":"A boolean value indicating whether nested transactions are enabled.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"eventGroupId","type":"`string`","description":"A string indicating the ID of the group to aggregate the events to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"transactionId","type":"`string`","description":"A string indicating the ID of the current transaction.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"messageAggregator","type":"[IMessageAggregator](../../../types/interfaces/types.IMessageAggregator/page.mdx)","description":"An instance of a message aggregator, which is used to aggregate messages to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"requestId","type":"`string`","description":"A string indicating the ID of the current request.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"idempotencyKey","type":"`string`","description":"A string indicating the idempotencyKey of the current workflow execution.","optional":true,"defaultValue":"","expandable":false,"childrLine truncated
|
||||
|
||||
### Returns
|
||||
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<[NotificationDTO](../../../types/NotificationTypes/interfaces/types.NotificationTypes.NotificationDTO/page.mdx)>","optional":false,"defaultValue":"","description":"The retrieved notification.","expandable":false,"children":[{"name":"NotificationDTO","type":"[NotificationDTO](../../../types/NotificationTypes/interfaces/types.NotificationTypes.NotificationDTO/page.mdx)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"The ID of the notification.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"to","type":"`string`","description":"The recipient of the notification. It can be email, phone number, or username, depending on the channel.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"channel","type":"`string`","description":"The channel through which the notification is sent, such as 'email' or 'sms'","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"template","type":"`string`","description":"The template name in the provider's system.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"data","type":"`null` \\| `Record<string, unknown>`","description":"The data that gets passed over to the provider for rendering the notification.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"provider_id","type":"`string`","description":"The ID of the notification provider.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"provider","type":"[NotificationProviderDTO](../../../types/NotificationTypes/interfaces/types.NotificationTypes.NotificationProviderDTO/page.mdx)","description":"Information about the notification provider","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"The ID of the notification provider.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"handle","type":"`string`","description":"The handle of the notification provider.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"name","type":"`string`","description":"A user-friendly name of the notification provider.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"channels","type":"`string`[]","description":"The supported channels by the notification provider.","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"created_at","type":"`Date`","description":"The date and time the notification was created.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"status","type":"`\"pending\"` \\| `\"success\"` \\| `\"failure\"`","description":"The status of the notification","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"from","type":"`null` \\| `string`","description":"The sender of the notification. It can be email, phone number, or username, depending on the channel.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"attachments","type":"`null` \\| [Attachment](../../../types/NotificationTypes/interfaces/types.NotificationTypes.Attachment/page.mdx)[]","description":"Optional attachments for the notification.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"content","type":"`string`","description":"The content of the attachment, encoded as a base64 string.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"filename","type":"`string`","description":"The filename of the attachment.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"content_type","type":"`string`","description":"The MIME type of the attachment.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"disposition","type":"`string`","description":"The disposition of the attachment, For example, \"inline\" or \"attachment\".","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"id","type":"`string`","description":"The ID, if the attachment is meant to be referenced within the body of the message.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"trigger_type","type":"`null` \\| `string`","description":"The event name, the workflow, or anything else that can help to identify what triggered the notification.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"resource_id","type":"`null` \\| `string`","description":"The ID of the resource this notification is for, if applicable. Useful for displaying relevant information in the UI","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"resource_type","type":"`null` \\| `string`","description":"The type of the resource this notification is for, if applicable, eg. \"order\"","optional":true,"defaultVLine truncated
|
||||
|
||||
___
|
||||
|
||||
## listNotifications
|
||||
|
||||
This method is used to retrieve a paginated list of notifications based on optional filters and configuration.
|
||||
|
||||
### Example
|
||||
|
||||
To retrieve a list of notifications using their IDs:
|
||||
|
||||
```ts
|
||||
const notifications = await notificationModuleService.listNotifications({
|
||||
id: ["noti_123", "noti_321"],
|
||||
})
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved within the notifications:
|
||||
|
||||
```ts
|
||||
const notifications = await notificationModuleService.listNotifications(
|
||||
{
|
||||
id: ["noti_123", "noti_321"],
|
||||
},
|
||||
{
|
||||
relations: ["provider"],
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
const notifications = await notificationModuleService.listNotifications(
|
||||
{
|
||||
id: ["noti_123", "noti_321"],
|
||||
},
|
||||
{
|
||||
relations: ["provider"],
|
||||
take: 20,
|
||||
skip: 2,
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
<TypeList types={[{"name":"filters","type":"[FilterableNotificationProps](../../../types/NotificationTypes/interfaces/types.NotificationTypes.FilterableNotificationProps/page.mdx)","description":"The filters to apply on the retrieved notifications.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"$and","type":"([FilterableNotificationProps](../../../types/NotificationTypes/interfaces/types.NotificationTypes.FilterableNotificationProps/page.mdx) \\| [BaseFilterable](../../../types/DAL/interfaces/types.DAL.BaseFilterable/page.mdx)<[FilterableNotificationProps](../../../types/NotificationTypes/interfaces/types.NotificationTypes.FilterableNotificationProps/page.mdx)>)[]","description":"An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"$and","type":"([FilterableNotificationProps](../../../types/NotificationTypes/interfaces/types.NotificationTypes.FilterableNotificationProps/page.mdx) \\| [BaseFilterable](../../../types/DAL/interfaces/types.DAL.BaseFilterable/page.mdx)<[FilterableNotificationProps](../../../types/NotificationTypes/interfaces/types.NotificationTypes.FilterableNotificationProps/page.mdx)>)[]","description":"An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"$or","type":"([FilterableNotificationProps](../../../types/NotificationTypes/interfaces/types.NotificationTypes.FilterableNotificationProps/page.mdx) \\| [BaseFilterable](../../../types/DAL/interfaces/types.DAL.BaseFilterable/page.mdx)<[FilterableNotificationProps](../../../types/NotificationTypes/interfaces/types.NotificationTypes.FilterableNotificationProps/page.mdx)>)[]","description":"An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"q","type":"`string`","description":"Search through the notifications' attributes, such as trigger types and recipients, using this search term.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"to","type":"`string` \\| `string`[] \\| [OperatorMap](../../../types/DAL/types/types.DAL.OperatorMap/page.mdx)<string \\| string[]>","description":"Filter based on the recipient of the notification.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"channel","type":"`string` \\| `string`[] \\| [OperatorMap](../../../types/DAL/types/types.DAL.OperatorMap/page.mdx)<string \\| string[]>","description":"Filter based on the channel through which the notification is sent, such as 'email' or 'sms'","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"template","type":"`string` \\| `string`[] \\| [OperatorMap](../../../types/DAL/types/types.DAL.OperatorMap/page.mdx)<string \\| string[]>","description":"Filter based on the template name.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"trigger_type","type":"`string` \\| `string`[] \\| [OperatorMap](../../../types/DAL/types/types.DAL.OperatorMap/page.mdx)<string \\| string[]>","description":"Filter based on the trigger type.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"resource_id","type":"`string` \\| `string`[] \\| [OperatorMap](../../../types/DAL/types/types.DAL.OperatorMap/page.mdx)<string \\| string[]>","description":"Filter based on the resource that was the trigger for the notification.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"resource_type","type":"`string` \\| `string`[] \\| [OperatorMap](../../../types/DAL/types/types.DAL.OperatorMap/page.mdx)<string \\| string[]>","description":"T* Filter based on the resource type that was the trigger for the notification.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"receiver_id","type":"`string` \\| `string`[] \\| [OperatorMap](../../../types/DAL/types/types.DAL.OperatorMap/page.mdx)<string \\| string[]>","description":"Filter based on the customer ID.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"created_at","type":"[OperatorMap](../../../types/DAL/types/types.DAL.OperatorMap/page.mdx)<string>","description":"Filters a notification based on when it was sent and created in the database","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"$or","type":"([FilterableNotificationProps](../../../types/NotificationTypes/interfaces/types.NotificationTypes.FilterableNotificationProps/page.mdx) \\| [BaseFilterable](../../../types/DAL/interfaces/types.DAL.BaseFilterable/page.mdx)<[FilterableNotificationProps](../../../types/NotificationTypes/interfaces/types.NotifLine truncated
|
||||
|
||||
### Returns
|
||||
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<[NotificationDTO](../../../types/NotificationTypes/interfaces/types.NotificationTypes.NotificationDTO/page.mdx)[]>","optional":false,"defaultValue":"","description":"The list of notifications.","expandable":false,"children":[{"name":"NotificationDTO[]","type":"[NotificationDTO](../../../types/NotificationTypes/interfaces/types.NotificationTypes.NotificationDTO/page.mdx)[]","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"NotificationDTO","type":"`object`","description":"A notification's data.","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="listNotifications"/>
|
||||
|
||||
___
|
||||
|
||||
## listAndCountNotifications
|
||||
|
||||
This method is used to retrieve a paginated list of notifications along with the total count of available notifications satisfying the provided filters.
|
||||
|
||||
### Example
|
||||
|
||||
To retrieve a list of notifications using their IDs:
|
||||
|
||||
```ts
|
||||
const [notifications, count] =
|
||||
await notificationModuleService.listAndCountNotifications({
|
||||
id: ["noti_123", "noti_321"],
|
||||
})
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved within the notifications:
|
||||
|
||||
```ts
|
||||
const [notifications, count] =
|
||||
await notificationModuleService.listAndCountNotifications(
|
||||
{
|
||||
id: ["noti_123", "noti_321"],
|
||||
},
|
||||
{
|
||||
relations: ["provider"],
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
const [notifications, count] =
|
||||
await notificationModuleService.listAndCountNotifications(
|
||||
{
|
||||
id: ["noti_123", "noti_321"],
|
||||
},
|
||||
{
|
||||
relations: ["provider"],
|
||||
take: 20,
|
||||
skip: 2,
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
<TypeList types={[{"name":"filters","type":"[FilterableNotificationProps](../../../types/NotificationTypes/interfaces/types.NotificationTypes.FilterableNotificationProps/page.mdx)","description":"The filters to apply on the retrieved notifications.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"$and","type":"([FilterableNotificationProps](../../../types/NotificationTypes/interfaces/types.NotificationTypes.FilterableNotificationProps/page.mdx) \\| [BaseFilterable](../../../types/DAL/interfaces/types.DAL.BaseFilterable/page.mdx)<[FilterableNotificationProps](../../../types/NotificationTypes/interfaces/types.NotificationTypes.FilterableNotificationProps/page.mdx)>)[]","description":"An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"$and","type":"([FilterableNotificationProps](../../../types/NotificationTypes/interfaces/types.NotificationTypes.FilterableNotificationProps/page.mdx) \\| [BaseFilterable](../../../types/DAL/interfaces/types.DAL.BaseFilterable/page.mdx)<[FilterableNotificationProps](../../../types/NotificationTypes/interfaces/types.NotificationTypes.FilterableNotificationProps/page.mdx)>)[]","description":"An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"$or","type":"([FilterableNotificationProps](../../../types/NotificationTypes/interfaces/types.NotificationTypes.FilterableNotificationProps/page.mdx) \\| [BaseFilterable](../../../types/DAL/interfaces/types.DAL.BaseFilterable/page.mdx)<[FilterableNotificationProps](../../../types/NotificationTypes/interfaces/types.NotificationTypes.FilterableNotificationProps/page.mdx)>)[]","description":"An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"q","type":"`string`","description":"Search through the notifications' attributes, such as trigger types and recipients, using this search term.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"to","type":"`string` \\| `string`[] \\| [OperatorMap](../../../types/DAL/types/types.DAL.OperatorMap/page.mdx)<string \\| string[]>","description":"Filter based on the recipient of the notification.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"channel","type":"`string` \\| `string`[] \\| [OperatorMap](../../../types/DAL/types/types.DAL.OperatorMap/page.mdx)<string \\| string[]>","description":"Filter based on the channel through which the notification is sent, such as 'email' or 'sms'","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"template","type":"`string` \\| `string`[] \\| [OperatorMap](../../../types/DAL/types/types.DAL.OperatorMap/page.mdx)<string \\| string[]>","description":"Filter based on the template name.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"trigger_type","type":"`string` \\| `string`[] \\| [OperatorMap](../../../types/DAL/types/types.DAL.OperatorMap/page.mdx)<string \\| string[]>","description":"Filter based on the trigger type.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"resource_id","type":"`string` \\| `string`[] \\| [OperatorMap](../../../types/DAL/types/types.DAL.OperatorMap/page.mdx)<string \\| string[]>","description":"Filter based on the resource that was the trigger for the notification.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"resource_type","type":"`string` \\| `string`[] \\| [OperatorMap](../../../types/DAL/types/types.DAL.OperatorMap/page.mdx)<string \\| string[]>","description":"T* Filter based on the resource type that was the trigger for the notification.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"receiver_id","type":"`string` \\| `string`[] \\| [OperatorMap](../../../types/DAL/types/types.DAL.OperatorMap/page.mdx)<string \\| string[]>","description":"Filter based on the customer ID.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"created_at","type":"[OperatorMap](../../../types/DAL/types/types.DAL.OperatorMap/page.mdx)<string>","description":"Filters a notification based on when it was sent and created in the database","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"$or","type":"([FilterableNotificationProps](../../../types/NotificationTypes/interfaces/types.NotificationTypes.FilterableNotificationProps/page.mdx) \\| [BaseFilterable](../../../types/DAL/interfaces/types.DAL.BaseFilterable/page.mdx)<[FilterableNotificationProps](../../../types/NotificationTypes/interfaces/types.NotifLine truncated
|
||||
|
||||
### Returns
|
||||
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<[[NotificationDTO](../../../types/NotificationTypes/interfaces/types.NotificationTypes.NotificationDTO/page.mdx)[], number]>","optional":false,"defaultValue":"","description":"The list of notifications along with the total count.","expandable":false,"children":[{"name":"NotificationDTO[]","type":"[NotificationDTO](../../../types/NotificationTypes/interfaces/types.NotificationTypes.NotificationDTO/page.mdx)[]","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]},{"name":"number","type":"`number`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="listAndCountNotifications"/>
|
||||
@@ -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",
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
]
|
||||
@@ -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"
|
||||
}
|
||||
]
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
]
|
||||
@@ -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"
|
||||
}
|
||||
]
|
||||
@@ -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",
|
||||
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
import { FormattingOptionsType } from "types"
|
||||
|
||||
const cacheOptions: FormattingOptionsType = {
|
||||
"^cache/.*ICacheService": {
|
||||
reflectionGroups: {
|
||||
Constructors: false,
|
||||
},
|
||||
reflectionDescription: `In this document, you’ll 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
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
import { FormattingOptionsType } from "types"
|
||||
|
||||
const eventOptions: FormattingOptionsType = {
|
||||
"^event/.*IEventBusModuleService": {
|
||||
reflectionGroups: {
|
||||
Constructors: false,
|
||||
},
|
||||
reflectionDescription: `In this document, you’ll 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
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
import { FormattingOptionsType } from "types"
|
||||
|
||||
const fileServiceOptions: FormattingOptionsType = {
|
||||
"^file_service/.*IFileModuleService": {
|
||||
reflectionGroups: {
|
||||
Constructors: false,
|
||||
},
|
||||
reflectionDescription: `In this document, you’ll 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
|
||||
+8
@@ -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,
|
||||
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
import { FormattingOptionsType } from "types"
|
||||
|
||||
const notificationServiceOptions: FormattingOptionsType = {
|
||||
"^notification_service/.*INotificationModuleService": {
|
||||
reflectionGroups: {
|
||||
Constructors: false,
|
||||
},
|
||||
reflectionDescription: `In this document, you’ll 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
|
||||
Reference in new issue
Block a user