docs: general updates and fixes (#13374)
* docs: general updates and fixes * fix lint errors
This commit is contained in:
@@ -32,7 +32,7 @@ The order’s total amounts are stored in the `OrderSummary`'s `totals` property
|
||||
}
|
||||
```
|
||||
|
||||
To check the outstanding amount of the order, its transaction amounts are summed. Then, the following conditions are checked:
|
||||
To check the outstanding amount of the order, its transaction amounts (from the `Transaction` records) are summed. Then, the following conditions are checked:
|
||||
|
||||
<Table>
|
||||
<Table.Header>
|
||||
|
||||
@@ -10,7 +10,7 @@ export const metadata = {
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
In this document, you'll learn about the options of the Payment Module.
|
||||
In this document, you'll learn about the options you can pass to the Payment Module.
|
||||
|
||||
## All Module Options
|
||||
|
||||
@@ -97,7 +97,7 @@ In this document, you'll learn about the options of the Payment Module.
|
||||
|
||||
## providers Option
|
||||
|
||||
The `providers` option is an array of payment module providers.
|
||||
The `providers` option is an array of payment module providers to be registered in your Medusa application.
|
||||
|
||||
When the Medusa application starts, these providers are registered and can be used to process payments.
|
||||
|
||||
@@ -131,6 +131,8 @@ module.exports = defineConfig({
|
||||
|
||||
The `providers` option is an array of objects that accept the following properties:
|
||||
|
||||
- `resolve`: A string indicating the package name of the module provider or the path to it relative to the `src` directory.
|
||||
- `resolve`: A string indicating the package name of the module provider or the path to it.
|
||||
- `id`: A string indicating the provider's unique name or ID.
|
||||
- `options`: An optional object of the module provider's options.
|
||||
- `options`: An optional object of the module provider's options.
|
||||
|
||||
Refer to the [Payment Module Providers](../payment-provider/page.mdx) documentation to learn more.
|
||||
@@ -12,7 +12,7 @@ A payment collection stores payment details related to a resource, such as a car
|
||||
|
||||
Every purchase or request for payment starts with a payment collection. The collection holds details necessary to complete the payment, including:
|
||||
|
||||
- The [payment sessions](../payment-session/page.mdx) that represents the payment amount to authorize.
|
||||
- The [payment sessions](../payment-session/page.mdx) that represent the payment amount to authorize.
|
||||
- The [payments](../payment/page.mdx) that are created when a payment session is authorized. They can be captured and refunded.
|
||||
- The [payment providers](../payment-provider/page.mdx) that handle the processing of each payment session, including the authorization, capture, and refund.
|
||||
|
||||
@@ -32,8 +32,6 @@ You can use this to accept payments in increments or split payments across payme
|
||||
|
||||
The Cart Module provides cart management features. However, it doesn’t provide any features related to accepting payment.
|
||||
|
||||
During checkout, the Medusa application links a cart to a payment collection, which will be used for further payment processing.
|
||||
|
||||
It also implements the payment flow during checkout as explained in [this documentation](../payment-flow/page.mdx).
|
||||
During checkout, the Medusa application links a cart to a payment collection, which will be used for further payment processing. It also implements the [payment flow](../payment-flow/page.mdx) during checkout.
|
||||
|
||||

|
||||
|
||||
@@ -4,13 +4,13 @@ export const metadata = {
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
In this document, you’ll learn about the main concepts in the Pricing Module.
|
||||
In this guide, you’ll learn about the main concepts in the Pricing Module.
|
||||
|
||||
## Price Data Model
|
||||
|
||||
The [Price](/references/pricing/models/Price) data model represents a specific price for a resource. For example, the price of a product variant in the USD currency.
|
||||
|
||||
The `Price` data model has an `amount` property that represents the monetary value of the price. It's stored as an integer in base units. For example, `$20.00` is stored as `20`.
|
||||
The `Price` data model has an `amount` property that represents the monetary value of the price. It's stored as an integer in base or major units. For example, `$20.00` is stored as `20`, and `$20.5` is stored as `20.5`.
|
||||
|
||||
The `Price` data model belongs to other data models like `PriceSet` and `PriceList` to provide a variety of pricing features, as explained below.
|
||||
|
||||
@@ -18,9 +18,9 @@ The `Price` data model belongs to other data models like `PriceSet` and `PriceLi
|
||||
|
||||
## Price Set
|
||||
|
||||
A [PriceSet](/references/pricing/models/PriceSet) represents a collection of prices that are linked to a resource (for example, a product variant or a shipping option).
|
||||
A [PriceSet](/references/pricing/models/PriceSet) represents a collection of prices that are linked to a resource. For example, a product variant can have a price set that includes prices in multiple currencies, such as USD and EUR.
|
||||
|
||||
Each of these prices is represented by the [Price data model](/references/pricing/models/Price).
|
||||
Each of these prices is represented by the [Price data model](#price-data-model).
|
||||
|
||||

|
||||
|
||||
@@ -28,8 +28,10 @@ Each of these prices is represented by the [Price data model](/references/pricin
|
||||
|
||||
## Price List
|
||||
|
||||
A [PriceList](/references/pricing/models/PriceList) is a group of prices only enabled if their conditions and rules are satisfied.
|
||||
A [PriceList](/references/pricing/models/PriceList) is a group of prices that are only enabled when their conditions and rules are satisfied. For example, you can apply special prices to customers in the VIP group.
|
||||
|
||||
When the conditions are met, the prices in the price list override the default prices in a price set.
|
||||
|
||||
A price list has optional `start_date` and `end_date` properties that indicate the date range in which a price list can be applied.
|
||||
|
||||
Its associated prices are represented by the `Price` data model.
|
||||
Its associated prices are represented by the [Price data model](#price-data-model).
|
||||
@@ -6,11 +6,11 @@ export const metadata = {
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
In this document, you'll learn what an application method is.
|
||||
In this guide, you'll learn what an application method is in the Promotion Module.
|
||||
|
||||
## What is an Application Method?
|
||||
|
||||
The [ApplicationMethod data model](/references/promotion/models/ApplicationMethod) defines how a promotion is applied:
|
||||
The [ApplicationMethod data model](/references/promotion/models/ApplicationMethod) defines how a promotion is applied. It has the following properties that determine its behavior:
|
||||
|
||||
<Table>
|
||||
<Table.Header>
|
||||
@@ -24,6 +24,11 @@ The [ApplicationMethod data model](/references/promotion/models/ApplicationMetho
|
||||
|
||||
Purpose
|
||||
|
||||
</Table.HeaderCell>
|
||||
<Table.HeaderCell>
|
||||
|
||||
Possible Values
|
||||
|
||||
</Table.HeaderCell>
|
||||
</Table.Row>
|
||||
</Table.Header>
|
||||
@@ -38,6 +43,11 @@ The [ApplicationMethod data model](/references/promotion/models/ApplicationMetho
|
||||
|
||||
Does the promotion discount a fixed amount or a percentage?
|
||||
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
`fixed`, `percentage`
|
||||
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
<Table.Row>
|
||||
@@ -48,7 +58,12 @@ The [ApplicationMethod data model](/references/promotion/models/ApplicationMetho
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
Is the promotion applied on a cart item, shipping method, or the entire order?
|
||||
Is the promotion applied to a cart item, shipping method, or the entire order?
|
||||
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
`items`, `shipping_methods`, `order`
|
||||
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
@@ -60,7 +75,12 @@ The [ApplicationMethod data model](/references/promotion/models/ApplicationMetho
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
Is the discounted amount applied on each item or split between the applicable items?
|
||||
Is the discounted amount applied to each item or split between the applicable items?
|
||||
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
`each`, `across`
|
||||
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
@@ -69,13 +89,13 @@ The [ApplicationMethod data model](/references/promotion/models/ApplicationMetho
|
||||
|
||||
## Target Promotion Rules
|
||||
|
||||
When the promotion is applied to a cart item or a shipping method, you can restrict which items/shipping methods the promotion is applied to.
|
||||
When the promotion is applied to a cart item or a shipping method (in other words, when `target_type` is `items` or `shipping_methods`), you can restrict which items/shipping methods the promotion is applied to.
|
||||
|
||||
The `ApplicationMethod` data model has a collection of `PromotionRule` records to restrict which items or shipping methods the promotion applies to. The `target_rules` property represents this relation.
|
||||
The `ApplicationMethod` data model has a collection of [PromotionRule](/references/promotion/models/PromotionRule) records to restrict which items or shipping methods the promotion applies to. The `target_rules` property in the `ApplicationMethod` represents this relation.
|
||||
|
||||

|
||||
|
||||
In this example, the promotion is only applied on products in the cart having the SKU `SHIRT`.
|
||||
In this example, the promotion is only applied to product variants in the cart that have the SKU `SHIRT`.
|
||||
|
||||
---
|
||||
|
||||
@@ -83,8 +103,8 @@ In this example, the promotion is only applied on products in the cart having th
|
||||
|
||||
When the promotion’s type is `buyget`, you must specify the “buy X” condition. For example, a cart must have two shirts before the promotion can be applied.
|
||||
|
||||
The application method has a collection of `PromotionRule` items to define the “buy X” rule. The `buy_rules` property represents this relation.
|
||||
The application method has a collection of `PromotionRule` items to define the “buy X” rule. The `buy_rules` property in the `ApplicationMethod` represents this relation.
|
||||
|
||||

|
||||
|
||||
In this example, the cart must have two products with the SKU `SHIRT` for the promotion to be applied.
|
||||
In this example, the cart must have two product variants with the SKU `SHIRT` for the promotion to be applied.
|
||||
@@ -4,16 +4,16 @@ export const metadata = {
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
In this document, you’ll learn about the main concepts in the Stock Location Module.
|
||||
In this guide, you’ll learn about the main concepts in the Stock Location Module.
|
||||
|
||||
## Stock Location
|
||||
|
||||
A stock location, represented by the `StockLocation` data model, represents a location where stock items are kept. For example, a warehouse.
|
||||
A stock location, represented by the [StockLocation data model](/references/stock-location-next/models/StockLocation), represents a location where stock items are kept. For example, a warehouse.
|
||||
|
||||
Medusa uses stock locations to provide inventory details, from the Inventory Module, per location.
|
||||
Medusa uses stock locations to provide inventory details, stored and managed by the [Inventory Module](../../inventory/concepts/page.mdx), per location.
|
||||
|
||||
---
|
||||
|
||||
## StockLocationAddress
|
||||
|
||||
The `StockLocationAddress` data model belongs to the `StockLocation` data model. It provides more detailed information of the location, such as country code or street address.
|
||||
The [StockLocationAddress data model](/references/stock-location-next/models/StockLocationAddress) belongs to the `StockLocation` data model. It provides more detailed information about the location, such as country code or street address.
|
||||
|
||||
@@ -10,7 +10,7 @@ export const metadata = {
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
In this document, you'll learn about the options of the User Module.
|
||||
In this guide, you'll learn about the options you can pass to the User Module.
|
||||
|
||||
## Module Options
|
||||
|
||||
@@ -63,7 +63,7 @@ module.exports = defineConfig({
|
||||
|
||||
### Environment Variables
|
||||
|
||||
Make sure to add the necessary environment variables for the above options in `.env`:
|
||||
Make sure to add the necessary environment variables for the above options to your `.env` file:
|
||||
|
||||
```bash
|
||||
JWT_SECRET=supersecret
|
||||
|
||||
@@ -760,9 +760,9 @@ Now that you've created the collections, you need to add them to Payload's confi
|
||||
In `src/payload.config.ts`, add the following imports at the top of the file:
|
||||
|
||||
```ts title="src/payload.config.ts" badgeLabel="Storefront" badgeColor="blue"
|
||||
import { Users } from './collections/Users'
|
||||
import { Products } from './collections/Products'
|
||||
import { Media } from './collections/Media'
|
||||
import { Users } from "./collections/Users"
|
||||
import { Products } from "./collections/Products"
|
||||
import { Media } from "./collections/Media"
|
||||
```
|
||||
|
||||
Then, add the collections to the `collections` array of the `buildConfig` function:
|
||||
@@ -2626,9 +2626,9 @@ The `updatePayloadItemsStep` will update an item in a Payload collection, such a
|
||||
To create the step, create the file `src/workflows/steps/update-payload-items.ts` with the following content:
|
||||
|
||||
```ts title="src/workflows/steps/update-payload-items.ts" badgeLabel="Medusa application" badgeColor="green"
|
||||
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk";
|
||||
import { PayloadItemResult, PayloadUpsertData } from "../../modules/payload/types";
|
||||
import { PAYLOAD_MODULE } from "../../modules/payload";
|
||||
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
|
||||
import { PayloadItemResult, PayloadUpsertData } from "../../modules/payload/types"
|
||||
import { PAYLOAD_MODULE } from "../../modules/payload"
|
||||
|
||||
type StepInput = {
|
||||
collection: string;
|
||||
@@ -2639,20 +2639,20 @@ export const updatePayloadItemsStep = createStep(
|
||||
"update-payload-items",
|
||||
async ({ items, collection }: StepInput, { container }) => {
|
||||
const payloadModuleService = container.resolve(PAYLOAD_MODULE)
|
||||
const ids: string[] = items.map(item => item.id);
|
||||
const ids: string[] = items.map((item) => item.id)
|
||||
|
||||
const prevData = await payloadModuleService.find(collection, {
|
||||
where: {
|
||||
id: {
|
||||
in: ids.join(",")
|
||||
}
|
||||
}
|
||||
in: ids.join(","),
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const updatedItems: PayloadItemResult[] = []
|
||||
|
||||
for (const item of items) {
|
||||
const { id, ...data } = item;
|
||||
const { id, ...data } = item
|
||||
updatedItems.push(
|
||||
await payloadModuleService.update(
|
||||
collection,
|
||||
@@ -2660,16 +2660,16 @@ export const updatePayloadItemsStep = createStep(
|
||||
{
|
||||
where: {
|
||||
id: {
|
||||
equals: id
|
||||
}
|
||||
}
|
||||
equals: id,
|
||||
},
|
||||
},
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
return new StepResponse({
|
||||
items: updatedItems.map(item => item.doc)
|
||||
items: updatedItems.map((item) => item.doc),
|
||||
}, {
|
||||
prevData,
|
||||
collection,
|
||||
@@ -2677,11 +2677,11 @@ export const updatePayloadItemsStep = createStep(
|
||||
},
|
||||
async (data, { container }) => {
|
||||
if (!data) {
|
||||
return;
|
||||
return
|
||||
}
|
||||
const { prevData, collection } = data;
|
||||
const { prevData, collection } = data
|
||||
|
||||
const payloadModuleService = container.resolve(PAYLOAD_MODULE);
|
||||
const payloadModuleService = container.resolve(PAYLOAD_MODULE)
|
||||
|
||||
await Promise.all(
|
||||
prevData.docs.map(async ({
|
||||
@@ -2694,9 +2694,9 @@ export const updatePayloadItemsStep = createStep(
|
||||
{
|
||||
where: {
|
||||
id: {
|
||||
equals: id
|
||||
}
|
||||
}
|
||||
equals: id,
|
||||
},
|
||||
},
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
@@ -11,20 +11,20 @@ export const metadata = {
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
Create a standalone build of the Medusa application.
|
||||
Create a standalone build of the Medusa application that you can deploy to production.
|
||||
|
||||
This creates a build that:
|
||||
|
||||
- Doesn't rely on the source TypeScript files.
|
||||
- Can be copied to a production server reliably.
|
||||
|
||||
The build is outputted to a new `.medusa/server` directory.
|
||||
The build is output to a new `.medusa/server` directory.
|
||||
|
||||
```bash
|
||||
npx medusa build
|
||||
```
|
||||
|
||||
Refer to [this section](#run-built-medusa-application) for next steps.
|
||||
Refer to the [Build Medusa Application](!docs!/learn/build) guide for next steps.
|
||||
|
||||
## Options
|
||||
|
||||
@@ -44,7 +44,7 @@ Refer to [this section](#run-built-medusa-application) for next steps.
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
Whether to only build the admin to host it separately. If this option is not passed, the admin is built to the `.medusa/server/public/admin`. When this option is passed, the admin is built to the `.medusa/admin` directory instead.
|
||||
Whether to build only the admin to host it separately. If this option is not passed, the admin is built to the `.medusa/server/public/admin` directory. When this option is passed, the admin is built to the `.medusa/admin` directory instead.
|
||||
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
@@ -53,38 +53,8 @@ Refer to [this section](#run-built-medusa-application) for next steps.
|
||||
|
||||
---
|
||||
|
||||
## Run Built Medusa Application
|
||||
|
||||
After running the `build` command, use the following step to run the built Medusa application:
|
||||
|
||||
- Change to the `.medusa/server` directory and install the dependencies:
|
||||
|
||||
```bash npm2yarn
|
||||
cd .medusa/server && npm install
|
||||
```
|
||||
|
||||
- When running the application locally, make sure to copy the `.env` file from the root project's directory. In production, use system environment variables instead.
|
||||
|
||||
```bash npm2yarn
|
||||
cp .env .medusa/server/.env.production
|
||||
```
|
||||
|
||||
- In the system environment variables, set `NODE_ENV` to `production`:
|
||||
|
||||
```bash
|
||||
NODE_ENV=production
|
||||
```
|
||||
|
||||
- Use the `start` command to run the application:
|
||||
|
||||
```bash npm2yarn
|
||||
cd .medusa/server && npm run start
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Build Medusa Admin
|
||||
|
||||
By default, the Medusa Admin is built to the `.medusa/server/public/admin` directory.
|
||||
|
||||
If you want a separate build to host the admin standalone, such as on Vercel, pass the `--admin-only` option as explained in the [Options](#options) section. This outputs the admin to the `.medusa/admin` directory instead.
|
||||
If you want a separate build to host the admin as a standalone application, such as on Vercel, pass the `--admin-only` option as explained in the [Options](#options) section. This outputs the admin to the `.medusa/admin` directory instead.
|
||||
|
||||
@@ -11,7 +11,9 @@ export const metadata = {
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
Start Medusa application in development. This command watches files for any changes, then rebuilds the files and restarts the Medusa application.
|
||||
Start the Medusa application in development.
|
||||
|
||||
This command watches files for any changes, then rebuilds the files and restarts the Medusa application.
|
||||
|
||||
```bash
|
||||
npx medusa develop
|
||||
@@ -36,7 +38,7 @@ npx medusa develop
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
Set host of the Medusa server.
|
||||
Set the host of the Medusa server.
|
||||
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
@@ -53,7 +55,7 @@ npx medusa develop
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
Set port of the Medusa server.
|
||||
Set the port of the Medusa server.
|
||||
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
@@ -91,7 +91,7 @@ npx medusa user --email <email> [--password <password>]
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
An automatically generated ID.
|
||||
An automatically generated ID is used.
|
||||
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
@@ -103,9 +103,8 @@ npx medusa user --email <email> [--password <password>]
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
Whether to create an invite instead of a user. When using this option, you don't need to specify a password.
|
||||
If ran successfully, you'll receive the invite token in the output.
|
||||
|
||||
Whether to create a user invite instead of directly creating a user. Learn more in the [Create User Invite](#create-user-invite-with-medusa-cli) section.
|
||||
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
@@ -119,4 +118,21 @@ npx medusa user --email <email> [--password <password>]
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
</Table.Body>
|
||||
</Table>
|
||||
</Table>
|
||||
|
||||
---
|
||||
|
||||
## Create User Invite with Medusa CLI
|
||||
|
||||
The `user` command accepts the `--invite` option to create a user invite. The user must accept the invite before they can log into the Medusa Admin.
|
||||
|
||||
For example:
|
||||
|
||||
```bash
|
||||
npx medusa user --email user@example.com --invite
|
||||
```
|
||||
|
||||
The command will create a user invite and output the invite token. You can then either:
|
||||
|
||||
- Accept the invite in the Medusa Admin at the path `/app/invite?token=<invite_token>`
|
||||
- Accept the invite using the [Accept Invite API route](!api!/admin#invites_postinvitesaccept).
|
||||
|
||||
@@ -8,7 +8,9 @@ export const metadata = {
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
This method creates one or more records of the data model.
|
||||
This method of a module's service creates one or more records of a data model.
|
||||
|
||||
The method's name is of the format `createDataModel`, where `DataModel` is the plural pascal-case name of the data model.
|
||||
|
||||
## Create One Record
|
||||
|
||||
@@ -22,7 +24,7 @@ const post = await postModuleService.createPosts({
|
||||
})
|
||||
```
|
||||
|
||||
If an object is passed of the method, an object of the created record is also returned.
|
||||
If an object is passed to the method, the created record object is returned.
|
||||
|
||||
---
|
||||
|
||||
@@ -41,4 +43,4 @@ const posts = await postModuleService.createPosts([
|
||||
])
|
||||
```
|
||||
|
||||
If an array is passed of the method, an array of the created records is also returned.
|
||||
If an array of objects is passed to the method, an array containing the created records is returned.
|
||||
|
||||
@@ -8,7 +8,9 @@ export const metadata = {
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
This method deletes one or more records.
|
||||
This method of a module's service deletes one or more records.
|
||||
|
||||
The method's name is `deleteDataModel`, where `DataModel` is the plural pascal-case name of the data model.
|
||||
|
||||
## Delete One Record
|
||||
|
||||
@@ -16,7 +18,7 @@ This method deletes one or more records.
|
||||
await postModuleService.deletePosts("123")
|
||||
```
|
||||
|
||||
To delete one record, pass its ID as a parameter of the method.
|
||||
To delete one record, pass its ID as a parameter to the method.
|
||||
|
||||
---
|
||||
|
||||
@@ -29,7 +31,7 @@ await postModuleService.deletePosts([
|
||||
])
|
||||
```
|
||||
|
||||
To delete multiple records, pass an array of IDs as a parameter of the method.
|
||||
To delete multiple records, pass an array of IDs as a parameter to the method.
|
||||
|
||||
---
|
||||
|
||||
@@ -41,10 +43,10 @@ await postModuleService.deletePosts({
|
||||
})
|
||||
```
|
||||
|
||||
To delete records matching a set of filters, pass an object of filters as a parameter.
|
||||
To delete records matching a set of filters, pass an object of filters as a parameter to the method.
|
||||
|
||||
<Note>
|
||||
|
||||
Learn more about accepted filters in [this documentation](../../tips/filtering/page.mdx).
|
||||
Refer to the [Filtering](../../tips/filtering/page.mdx) reference for more information on accepted filters and examples.
|
||||
|
||||
</Note>
|
||||
@@ -8,7 +8,9 @@ export const metadata = {
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
This method retrieves a list of records.
|
||||
This method of a module's service retrieves a list of records.
|
||||
|
||||
The method's name is `listDataModel`, where `DataModel` is the plural pascal-case name of the data model.
|
||||
|
||||
## Retrieve List of Records
|
||||
|
||||
@@ -30,11 +32,11 @@ const posts = await postModuleService.listPosts({
|
||||
|
||||
### Parameters
|
||||
|
||||
To retrieve records matching a set of filters, pass an object of the filters as a first parameter.
|
||||
To retrieve records matching a set of filters, pass an object of the filters as the first parameter.
|
||||
|
||||
<Note>
|
||||
|
||||
Learn more about accepted filters in [this documentation](../../tips/filtering/page.mdx).
|
||||
Refer to the [Filtering](../../tips/filtering/page.mdx) reference for more information on accepted filters and examples.
|
||||
|
||||
</Note>
|
||||
|
||||
@@ -60,7 +62,7 @@ const posts = await postModuleService.listPosts({}, {
|
||||
|
||||
### Parameters
|
||||
|
||||
To retrieve records with their relations, pass as a second parameter an object having a `relations` property. `relations`'s value is an array of relation names.
|
||||
To retrieve records with their relations, pass an object with a `relations` property as the second parameter. `relations`'s value is an array of relation names.
|
||||
|
||||
### Returns
|
||||
|
||||
@@ -78,7 +80,7 @@ const posts = await postModuleService.listPosts({}, {
|
||||
|
||||
### Parameters
|
||||
|
||||
By default, retrieved records have all their properties. To select specific properties to retrieve, pass in the second object parameter a `select` property.
|
||||
By default, retrieved records have all their properties. To select specific properties to retrieve, pass a `select` property in the second object parameter.
|
||||
|
||||
`select`'s value is an array of property names to retrieve.
|
||||
|
||||
@@ -88,7 +90,7 @@ The method returns an array of the first `15` records matching the filters.
|
||||
|
||||
---
|
||||
|
||||
## Paginate Relations
|
||||
## Paginate Records
|
||||
|
||||
```ts
|
||||
const posts = await postModuleService.listPosts({}, {
|
||||
@@ -122,7 +124,7 @@ const posts = await postModuleService.listPosts({}, {
|
||||
|
||||
### Parameters
|
||||
|
||||
To sort records by one or more properties, pass to the second object parameter the `order` property. Its value is an object whose keys are the property names, and values can either be:
|
||||
To sort records by one or more properties, pass an `order` property in the second object parameter. Its value is an object whose keys are the property names, and values can either be:
|
||||
|
||||
- `ASC` to sort by this property in the ascending order.
|
||||
- `DESC` to sort by this property in the descending order.
|
||||
|
||||
@@ -8,7 +8,9 @@ export const metadata = {
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
This method retrieves a list of records with the total count.
|
||||
This method of a module's service retrieves a list of records with the total count.
|
||||
|
||||
The method's name is `listAndCountDataModel`, where `DataModel` is the plural pascal-case name of the data model.
|
||||
|
||||
## Retrieve List of Records
|
||||
|
||||
@@ -33,11 +35,11 @@ const [posts, count] = await postModuleService.listAndCountPosts({
|
||||
|
||||
### Parameters
|
||||
|
||||
To retrieve records matching a set of filters, pass an object of the filters as a first parameter.
|
||||
To retrieve records matching a set of filters, pass an object of the filters as the first parameter.
|
||||
|
||||
<Note>
|
||||
|
||||
Learn more about accepted filters in [this documentation](../../tips/filtering/page.mdx).
|
||||
Refer to the [Filtering](../../tips/filtering/page.mdx) reference for more information on accepted filters and examples.
|
||||
|
||||
</Note>
|
||||
|
||||
@@ -66,7 +68,7 @@ const [posts, count] = await postModuleService.listAndCountPosts({}, {
|
||||
|
||||
### Parameters
|
||||
|
||||
To retrieve records with their relations, pass as a second parameter an object having a `relations` property. Its value is an array of relation names.
|
||||
To retrieve records with their relations, pass an object with a `relations` property as the second parameter. Its value is an array of relation names.
|
||||
|
||||
### Returns
|
||||
|
||||
@@ -87,7 +89,7 @@ const [posts, count] = await postModuleService.listAndCountPosts({}, {
|
||||
|
||||
### Parameters
|
||||
|
||||
By default, retrieved records have all their properties. To select specific properties to retrieve, pass in the second object parameter a `select` property.
|
||||
By default, retrieved records have all their properties. To select specific properties to retrieve, pass a `select` property in the second object parameter.
|
||||
|
||||
`select`'s value is an array of property names to retrieve.
|
||||
|
||||
@@ -100,7 +102,7 @@ The method returns an array with two items:
|
||||
|
||||
---
|
||||
|
||||
## Paginate Relations
|
||||
## Paginate Records
|
||||
|
||||
```ts
|
||||
const [posts, count] = await postModuleService.listAndCountPosts({}, {
|
||||
@@ -137,7 +139,7 @@ const [posts, count] = await postModuleService.listAndCountPosts({}, {
|
||||
|
||||
### Parameters
|
||||
|
||||
To sort records by one or more properties, pass to the second object parameter the `order` property. Its value is an object whose keys are the property names, and values can either be:
|
||||
To sort records by one or more properties, pass an `order` property in the second object parameter. Its value is an object whose keys are the property names, and values can either be:
|
||||
|
||||
- `ASC` to sort by this property in the ascending order.
|
||||
- `DESC` to sort by this property in the descending order.
|
||||
|
||||
@@ -8,7 +8,9 @@ export const metadata = {
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
This method restores one or more records of the data model that were [soft-deleted](../soft-delete/page.mdx).
|
||||
This method of a module's service restores one or more records of a data model that were [soft-deleted](../soft-delete/page.mdx).
|
||||
|
||||
The method's name is of the format `restoreDataModel`, where `DataModel` is the plural pascal-case name of the data model.
|
||||
|
||||
## Restore One Record
|
||||
|
||||
@@ -18,7 +20,7 @@ const restoredPosts = await postModuleService.restorePosts("123")
|
||||
|
||||
### Parameters
|
||||
|
||||
To restore one record, pass its ID as a parameter of the method.
|
||||
To restore one record, pass its ID as a parameter to the method.
|
||||
|
||||
### Returns
|
||||
|
||||
@@ -26,9 +28,9 @@ The method returns an object, whose keys are of the format `{camel_case_data_mod
|
||||
|
||||
For example, the returned object of the above example is:
|
||||
|
||||
```ts
|
||||
restoredPosts = {
|
||||
post_id: ["123"],
|
||||
```json
|
||||
{
|
||||
"post_id": ["123"],
|
||||
}
|
||||
```
|
||||
|
||||
@@ -45,7 +47,7 @@ const restoredPosts = await postModuleService.restorePosts([
|
||||
|
||||
### Parameters
|
||||
|
||||
To restore multiple records, pass an array of IDs as a parameter of the method.
|
||||
To restore multiple records, pass an array of IDs as a parameter to the method.
|
||||
|
||||
### Returns
|
||||
|
||||
@@ -53,9 +55,9 @@ The method returns an object, whose keys are of the format `{camel_case_data_mod
|
||||
|
||||
For example, the returned object of the above example is:
|
||||
|
||||
```ts
|
||||
restoredPosts = {
|
||||
post_id: [
|
||||
```json
|
||||
{
|
||||
"post_id": [
|
||||
"123",
|
||||
"321",
|
||||
],
|
||||
@@ -74,11 +76,11 @@ const restoredPosts = await postModuleService.restorePosts({
|
||||
|
||||
### Parameters
|
||||
|
||||
To restore records matching a set of filters, pass an object of fitlers as a parameter of the method.
|
||||
To restore records matching a set of filters, pass an object of filters as a parameter to the method.
|
||||
|
||||
<Note>
|
||||
|
||||
Learn more about accepted filters in [this documentation](../../tips/filtering/page.mdx).
|
||||
Refer to the [Filtering](../../tips/filtering/page.mdx) reference for more information on accepted filters and examples.
|
||||
|
||||
</Note>
|
||||
|
||||
@@ -88,9 +90,9 @@ The method returns an object, whose keys are of the format `{camel_case_data_mod
|
||||
|
||||
For example, the returned object of the above example is:
|
||||
|
||||
```ts
|
||||
restoredPosts = {
|
||||
post_id: [
|
||||
```json
|
||||
{
|
||||
"post_id": [
|
||||
"123",
|
||||
],
|
||||
}
|
||||
|
||||
@@ -8,7 +8,9 @@ export const metadata = {
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
This method retrieves one record of the data model by its ID.
|
||||
This method retrieves one record of a data model by its ID.
|
||||
|
||||
The method's name is `retrieveDataModel`, where `DataModel` is the singular pascal-case name of the data model.
|
||||
|
||||
## Retrieve a Record
|
||||
|
||||
@@ -42,7 +44,7 @@ const post = await postModuleService.retrievePost("123", {
|
||||
|
||||
### Parameters
|
||||
|
||||
To retrieve the data model with relations, pass as a second parameter of the method an object with the property `relations`. `relations`'s value is an array of relation names.
|
||||
To retrieve the data model with relations, pass an object with the property `relations` as the second parameter. `relations`'s value is an array of relation names.
|
||||
|
||||
### Returns
|
||||
|
||||
@@ -60,7 +62,7 @@ const post = await postModuleService.retrievePost("123", {
|
||||
|
||||
### Parameters
|
||||
|
||||
By default, all of the record's properties are retrieved. To select specific ones, pass in the second object parameter a `select` property. Its value is an array of property names.
|
||||
By default, all of the record's properties are retrieved. To select specific ones, pass a `select` property in the second object parameter. Its value is an array of property names.
|
||||
|
||||
### Returns
|
||||
|
||||
|
||||
@@ -8,7 +8,9 @@ export const metadata = {
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
This method soft deletes one or more records of the data model.
|
||||
This method of a module's service soft deletes one or more records of a data model.
|
||||
|
||||
The method's name is of the format `softDeleteDataModel`, where `DataModel` is the plural pascal-case name of the data model.
|
||||
|
||||
## Soft Delete One Record
|
||||
|
||||
@@ -20,7 +22,7 @@ const deletedPosts = await postModuleService.softDeletePosts(
|
||||
|
||||
### Parameters
|
||||
|
||||
To soft delete a record, pass its ID as a parameter of the method.
|
||||
To soft delete a record, pass its ID as a parameter to the method.
|
||||
|
||||
### Returns
|
||||
|
||||
@@ -28,9 +30,9 @@ The method returns an object, whose keys are of the format `{camel_case_data_mod
|
||||
|
||||
For example, the returned object of the above example is:
|
||||
|
||||
```ts
|
||||
deletedPosts = {
|
||||
post_id: ["123"],
|
||||
```json
|
||||
{
|
||||
"post_id": ["123"]
|
||||
}
|
||||
```
|
||||
|
||||
@@ -47,7 +49,7 @@ const deletedPosts = await postModuleService.softDeletePosts([
|
||||
|
||||
### Parameters
|
||||
|
||||
To soft delete multiple records, pass an array of IDs as a parameter of the method.
|
||||
To soft delete multiple records, pass an array of IDs as a parameter to the method.
|
||||
|
||||
### Returns
|
||||
|
||||
@@ -55,12 +57,12 @@ The method returns an object, whose keys are of the format `{camel_case_data_mod
|
||||
|
||||
For example, the returned object of the above example is:
|
||||
|
||||
```ts
|
||||
deletedPosts = {
|
||||
post_id: [
|
||||
```json
|
||||
{
|
||||
"post_id": [
|
||||
"123",
|
||||
"321",
|
||||
],
|
||||
"321"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
@@ -76,11 +78,11 @@ const deletedPosts = await postModuleService.softDeletePosts({
|
||||
|
||||
### Parameters
|
||||
|
||||
To soft delete records matching a set of filters, pass an object of filters as a parameter.
|
||||
To soft delete records matching a set of filters, pass an object of filters as a parameter to the method.
|
||||
|
||||
<Note>
|
||||
|
||||
Learn more about accepted filters in [this documentation](../../tips/filtering/page.mdx).
|
||||
Refer to the [Filtering](../../tips/filtering/page.mdx) reference for more information on accepted filters and examples.
|
||||
|
||||
</Note>
|
||||
|
||||
@@ -90,8 +92,8 @@ The method returns an object, whose keys are of the format `{camel_case_data_mod
|
||||
|
||||
For example, the returned object of the above example is:
|
||||
|
||||
```ts
|
||||
deletedPosts = {
|
||||
post_id: ["123"],
|
||||
```json
|
||||
{
|
||||
"post_id": ["123"]
|
||||
}
|
||||
```
|
||||
@@ -8,7 +8,9 @@ export const metadata = {
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
This method updates one or more records of the data model.
|
||||
This method of a module's service updates one or more records.
|
||||
|
||||
The method's name is `updateDataModel`, where `DataModel` is the plural pascal-case name of the data model.
|
||||
|
||||
## Update One Record
|
||||
|
||||
@@ -21,7 +23,7 @@ const post = await postModuleService.updatePosts({
|
||||
|
||||
### Parameters
|
||||
|
||||
To update one record, pass an object that at least has an `id` property, identifying the ID of the record to update.
|
||||
To update one record, pass an object that has at least an `id` property, identifying the ID of the record to update.
|
||||
|
||||
You can pass in the same object any other properties to update.
|
||||
|
||||
@@ -48,13 +50,13 @@ const posts = await postModuleService.updatePosts([
|
||||
|
||||
### Parameters
|
||||
|
||||
To update multiple records, pass an array of objects. Each object has at least an `id` property, identifying the ID of the record to update.
|
||||
To update multiple records, pass an array of objects. Each object must have at least an `id` property, identifying the ID of the record to update.
|
||||
|
||||
You can pass in each object any other properties to update.
|
||||
|
||||
### Returns
|
||||
|
||||
The method returns an array of objects of updated records.
|
||||
The method returns an array of updated record objects.
|
||||
|
||||
---
|
||||
|
||||
@@ -73,7 +75,7 @@ const posts = await postModuleService.updatePosts({
|
||||
|
||||
### Parameters
|
||||
|
||||
To update records that match specified filters, pass as a parameter an object having two properties:
|
||||
To update records that match specified filters, pass an object with two properties as a parameter:
|
||||
|
||||
- `selector`: An object of filters that a record must match to be updated.
|
||||
- `data`: An object of the properties to update in every record that match the filters in `selector`.
|
||||
@@ -82,13 +84,13 @@ In the example above, you update the `published_at` property of every post recor
|
||||
|
||||
<Note>
|
||||
|
||||
Learn more about accepted filters in [this documentation](../../tips/filtering/page.mdx).
|
||||
Refer to the [Filtering](../../tips/filtering/page.mdx) reference for more information on accepted filters and examples.
|
||||
|
||||
</Note>
|
||||
|
||||
### Returns
|
||||
|
||||
The method returns an array of objects of updated records.
|
||||
The method returns an array of updated record objects.
|
||||
|
||||
---
|
||||
|
||||
@@ -128,19 +130,23 @@ In the example above, you update the `published_at` property of post records who
|
||||
|
||||
<Note>
|
||||
|
||||
Learn more about accepted filters in [this documentation](../../tips/filtering/page.mdx).
|
||||
Refer to the [Filtering](../../tips/filtering/page.mdx) reference for more information on accepted filters and examples.
|
||||
|
||||
</Note>
|
||||
|
||||
### Returns
|
||||
|
||||
The method returns an array of objects of updated records.
|
||||
The method returns an array of updated record objects.
|
||||
|
||||
---
|
||||
|
||||
## Update a JSON Property
|
||||
|
||||
```ts
|
||||
export const highlights = [
|
||||
["4", "metadata", "`metadata` is a JSON property."]
|
||||
]
|
||||
|
||||
```ts highlights={highlights}
|
||||
const post = await postModuleService.updatePosts({
|
||||
id: "123",
|
||||
name: "My Post",
|
||||
@@ -151,13 +157,14 @@ const post = await postModuleService.updatePosts({
|
||||
})
|
||||
```
|
||||
|
||||
When you have a JSON property in your data model, you can update it by adding, updating, or removing properties within that JSON object. Medusa will merge the properties you pass in the `update` method with the existing JSON object.
|
||||
When you have a [JSON property](!docs!/learn/fundamentals/data-models/json-properties) in your data model, you can update it by adding, updating, or removing properties within that JSON object. Medusa will merge the properties you pass in the `update` method with the existing JSON object.
|
||||
|
||||
### Remove a Property from the JSON Property
|
||||
|
||||
```ts
|
||||
```ts highlights={highlights}
|
||||
const post = await postModuleService.updatePosts({
|
||||
id: "123",
|
||||
name: "My Post",
|
||||
metadata: {
|
||||
is_featured: "",
|
||||
},
|
||||
|
||||
@@ -18,22 +18,22 @@ Refer to the [Service Factory](!docs!/learn/fundamentals/modules/service-factory
|
||||
|
||||
When your module's main service extends the service factory, Medusa will:
|
||||
|
||||
1. Generate data-management methods in your main service for each of the data models passed to the `MedusaService` function.
|
||||
2. Generate internal services for each of the data models passed to the `MedusaService` function, which can be resolved in loaders.
|
||||
1. Generate [data-management methods in your main service](#main-service-methods) for each of the data models passed to the `MedusaService` function.
|
||||
2. Generate [internal services](#internal-generated-service-methods) for each of the data models passed to the `MedusaService` function, which can be resolved in loaders.
|
||||
|
||||
### Main Service Methods
|
||||
|
||||
The names of the generated methods for a service extending the service factory are of the format `{operationName}_{dataModelName}`, where:
|
||||
The names of the generated methods for a service extending the service factory are of the format `{operationName}{DataModelName}`, where:
|
||||
|
||||
- `{operationName}` is the name of the operation. For example, `create`.
|
||||
- `{dataModelName}` is the pascal-case version of the data model's key that's passed in the object parameter of `MedusaService`. The name is pluralized for all operations except the `retrieve` operation.
|
||||
- `{DataModelName}` is the pascal-case version of the data model's key that's passed in the object parameter of `MedusaService`. The name is pluralized for all operations except the `retrieve` operation.
|
||||
|
||||
Some examples of method names:
|
||||
|
||||
- `createPosts`
|
||||
- `createMyPosts`
|
||||
- `retrievePost`
|
||||
- `listPosts`
|
||||
- `createPosts` (`Post` data model)
|
||||
- `createMyPosts` (`MyPost` data model)
|
||||
- `retrievePost` (`Post` data model)
|
||||
- `listPosts` (`Post` data model)
|
||||
|
||||
### Internal Generated Service Methods
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ export const metadata = {
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
This document provides a reference to the `medusaIntegrationTestRunner` function provided by the `@medusajs/test-utils` package.
|
||||
This is a reference to the `medusaIntegrationTestRunner` function provided by the `@medusajs/test-utils` package.
|
||||
|
||||
## Example
|
||||
|
||||
@@ -30,36 +30,69 @@ medusaIntegrationTestRunner({
|
||||
description: "Object parameter of test options.",
|
||||
children: [
|
||||
{
|
||||
type: "`() => void`",
|
||||
type: "`(options: MedusaSuiteOptions) => void`",
|
||||
name: "testSuite",
|
||||
description: "The Jest tests to run.",
|
||||
optional: false
|
||||
description: "The Jest tests to run. It accepts [Test Suite Parameters](#test-suite-parameters)",
|
||||
},
|
||||
{
|
||||
type: "`string`",
|
||||
name: "dbName",
|
||||
description: "A name to use for the database. By default, a random name is generated.",
|
||||
description: "A name to use for the database. If not specified, the database name will be of the format `medusa-<moduleName>-integration-<randomNumber>`.",
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
type: "`string`",
|
||||
name: "schema",
|
||||
description: "The PostgreSQL schema that the database is created in.",
|
||||
defaultValue: "public",
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
type: "`Record<string, any>`",
|
||||
name: "env",
|
||||
description: "Environment variables to use in the test suite."
|
||||
description: "Environment variables to pass to the test suite.",
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
type: "`boolean`",
|
||||
name: "debug",
|
||||
description: "Whether to show database log messages.",
|
||||
defaultValue: "false"
|
||||
defaultValue: "false",
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
type: "`string`",
|
||||
name: "moduleName",
|
||||
description: "The name of the module being tested. If not specified, a random name will be generated.",
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
type: "`string`",
|
||||
name: "medusaConfigFile",
|
||||
description: "The path to the `medusa-config.ts` file, excluding `medusa-config.ts`. This path is used as the current working directory as well.",
|
||||
defaultValue: "cwd (current working directory)",
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
type: "`object`",
|
||||
name: "hooks",
|
||||
description: "An object containing hooks to run at different points in the test lifecycle.",
|
||||
optional: true,
|
||||
children: [
|
||||
{
|
||||
type: "`(container: MedusaContainer) => Promise<void>`",
|
||||
name: "beforeServerStart",
|
||||
description: "A hook that runs before the Medusa server starts.",
|
||||
optional: true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]}
|
||||
openedLevel={2}
|
||||
sectionTitle="Parameters"
|
||||
|
||||
/>
|
||||
|
||||
## Test Suite Parameters
|
||||
@@ -99,7 +132,7 @@ The function passed to `testSuite` accepts the following parameters:
|
||||
{
|
||||
type: "`() => MedusaContainer`",
|
||||
name: "getContainer",
|
||||
description: "A name to use for the database. By default, a random name is generated.",
|
||||
description: "A function that returns the Medusa container.",
|
||||
},
|
||||
{
|
||||
type: "`Record<string, string>`",
|
||||
@@ -144,9 +177,22 @@ The function passed to `testSuite` accepts the following parameters:
|
||||
description: "Drops a database."
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "`object`",
|
||||
name: "utils",
|
||||
description: "A set of utility functions for the test suite.",
|
||||
children: [
|
||||
{
|
||||
type: "`() => Promise<void>`",
|
||||
name: "waitWorkflowExecutions",
|
||||
description: "Waits for all workflow executions to complete."
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]}
|
||||
sectionTitle="Test Suite Parameters"
|
||||
openedLevel={2}
|
||||
/>
|
||||
|
||||
@@ -6,7 +6,7 @@ export const metadata = {
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
This document provides a reference to the `moduleIntegrationTestRunner` function provided by the `@medusajs/test-utils` package.
|
||||
This is a reference to the `moduleIntegrationTestRunner` function provided by the `@medusajs/test-utils` package.
|
||||
|
||||
## Example
|
||||
|
||||
@@ -39,51 +39,59 @@ moduleIntegrationTestRunner<BlogModuleService>({
|
||||
type: "`string`",
|
||||
name: "moduleName",
|
||||
description: "The module's name.",
|
||||
optional: false
|
||||
},
|
||||
{
|
||||
type: "DmlEntity[]",
|
||||
name: "moduleModels",
|
||||
description: "The module's data models.",
|
||||
optional: false
|
||||
},
|
||||
{
|
||||
type: "string",
|
||||
name: "resolve",
|
||||
description: "The path to the module relative to the `src` directory.",
|
||||
optional: false
|
||||
},
|
||||
{
|
||||
type: "`() => void`",
|
||||
name: "testSuite",
|
||||
description: "The Jest tests to run.",
|
||||
optional: false
|
||||
},
|
||||
{
|
||||
type: "DmlEntity[]",
|
||||
name: "moduleModels",
|
||||
description: "The module's data models.",
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
type: "`Record<string, any>`",
|
||||
name: "moduleOptions",
|
||||
description: "Options to pass to the module.",
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
type: "`Record<string, any>`",
|
||||
name: "injectedDependencies",
|
||||
description: "Dependencies to inject into the module's container. They key is the registration name, and the value is the instance of the dependency.",
|
||||
description: "Dependencies to inject into the module's container. The key is the registration name, and the value is the instance of the dependency.",
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
type: "`string`",
|
||||
name: "schema",
|
||||
description: "The PostgreSQL schema that the database is created in.",
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
type: "`boolean`",
|
||||
name: "debug",
|
||||
description: "Whether to show database log messages.",
|
||||
defaultValue: "false"
|
||||
defaultValue: "false",
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
type: "`string`",
|
||||
name: "cwd",
|
||||
description: "The current working directory. If not set, the directory that you run the test command from is considered the current working directory.",
|
||||
optional: true
|
||||
}
|
||||
]
|
||||
}
|
||||
]}
|
||||
sectionTitle="Parameters"
|
||||
openedLevel={2}
|
||||
/>
|
||||
|
||||
## Test Suite Parameters
|
||||
@@ -151,4 +159,5 @@ The function passed to `testSuite` accepts the following parameters:
|
||||
}
|
||||
]}
|
||||
sectionTitle="Test Suite Parameters"
|
||||
openedLevel={2}
|
||||
/>
|
||||
|
||||
@@ -28,8 +28,8 @@ export default async function greetingJob(container: MedusaContainer) {
|
||||
export const config = {
|
||||
name: "greeting-every-minute",
|
||||
schedule: {
|
||||
interval: 60000 // 1 minute
|
||||
}
|
||||
interval: 60000, // 1 minute
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -40,13 +40,13 @@ export const generatedEditDates = {
|
||||
"app/commerce-modules/order/promotion-adjustments/page.mdx": "2024-10-09T10:19:19.333Z",
|
||||
"app/commerce-modules/order/return/page.mdx": "2025-02-26T11:22:49.675Z",
|
||||
"app/commerce-modules/order/tax-lines/page.mdx": "2024-10-09T10:22:49.335Z",
|
||||
"app/commerce-modules/order/transactions/page.mdx": "2024-10-09T10:23:36.485Z",
|
||||
"app/commerce-modules/order/transactions/page.mdx": "2025-09-01T15:06:16.923Z",
|
||||
"app/commerce-modules/order/page.mdx": "2025-08-26T09:21:49.780Z",
|
||||
"app/commerce-modules/payment/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
|
||||
"app/commerce-modules/payment/_events/page.mdx": "2024-07-03T19:27:13+03:00",
|
||||
"app/commerce-modules/payment/module-options/page.mdx": "2024-10-15T12:51:40.574Z",
|
||||
"app/commerce-modules/payment/module-options/page.mdx": "2025-09-01T15:08:25.818Z",
|
||||
"app/commerce-modules/payment/payment/page.mdx": "2025-05-20T07:51:40.709Z",
|
||||
"app/commerce-modules/payment/payment-collection/page.mdx": "2024-10-09T10:56:49.510Z",
|
||||
"app/commerce-modules/payment/payment-collection/page.mdx": "2025-09-01T15:10:39.107Z",
|
||||
"app/commerce-modules/payment/payment-flow/page.mdx": "2025-05-20T07:51:40.708Z",
|
||||
"app/commerce-modules/payment/payment-provider/stripe/page.mdx": "2025-05-20T07:51:40.709Z",
|
||||
"app/commerce-modules/payment/payment-provider/page.mdx": "2025-05-20T07:51:40.708Z",
|
||||
@@ -55,7 +55,7 @@ export const generatedEditDates = {
|
||||
"app/commerce-modules/payment/page.mdx": "2025-04-17T08:48:11.702Z",
|
||||
"app/commerce-modules/pricing/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
|
||||
"app/commerce-modules/pricing/_events/page.mdx": "2024-07-03T19:27:13+03:00",
|
||||
"app/commerce-modules/pricing/concepts/page.mdx": "2025-09-01T06:30:15.013Z",
|
||||
"app/commerce-modules/pricing/concepts/page.mdx": "2025-09-01T15:15:07.227Z",
|
||||
"app/commerce-modules/pricing/price-calculation/page.mdx": "2025-09-01T06:32:07.141Z",
|
||||
"app/commerce-modules/pricing/price-rules/page.mdx": "2025-06-10T15:56:43.648Z",
|
||||
"app/commerce-modules/pricing/tax-inclusive-pricing/page.mdx": "2025-06-27T15:43:35.193Z",
|
||||
@@ -68,7 +68,7 @@ export const generatedEditDates = {
|
||||
"app/commerce-modules/promotion/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
|
||||
"app/commerce-modules/promotion/_events/page.mdx": "2024-07-03T19:27:13+03:00",
|
||||
"app/commerce-modules/promotion/actions/page.mdx": "2025-06-27T15:42:19.142Z",
|
||||
"app/commerce-modules/promotion/application-method/page.mdx": "2024-06-26T07:55:59+00:00",
|
||||
"app/commerce-modules/promotion/application-method/page.mdx": "2025-09-01T15:22:53.403Z",
|
||||
"app/commerce-modules/promotion/campaign/page.mdx": "2025-02-26T11:32:24.484Z",
|
||||
"app/commerce-modules/promotion/concepts/page.mdx": "2025-02-26T11:31:54.391Z",
|
||||
"app/commerce-modules/promotion/page.mdx": "2025-04-17T08:48:14.643Z",
|
||||
@@ -81,7 +81,7 @@ export const generatedEditDates = {
|
||||
"app/commerce-modules/sales-channel/page.mdx": "2025-04-17T08:48:22.065Z",
|
||||
"app/commerce-modules/stock-location/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
|
||||
"app/commerce-modules/stock-location/_events/page.mdx": "2024-07-03T19:27:13+03:00",
|
||||
"app/commerce-modules/stock-location/concepts/page.mdx": "2024-10-15T14:32:21.875Z",
|
||||
"app/commerce-modules/stock-location/concepts/page.mdx": "2025-09-01T15:25:14.233Z",
|
||||
"app/commerce-modules/stock-location/page.mdx": "2025-04-17T08:48:26.441Z",
|
||||
"app/commerce-modules/store/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
|
||||
"app/commerce-modules/store/_events/page.mdx": "2024-07-03T19:27:13+03:00",
|
||||
@@ -95,7 +95,7 @@ export const generatedEditDates = {
|
||||
"app/commerce-modules/tax/page.mdx": "2025-05-20T07:51:40.711Z",
|
||||
"app/commerce-modules/user/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
|
||||
"app/commerce-modules/user/_events/page.mdx": "2024-07-03T19:27:13+03:00",
|
||||
"app/commerce-modules/user/module-options/page.mdx": "2024-09-30T08:43:53.171Z",
|
||||
"app/commerce-modules/user/module-options/page.mdx": "2025-09-01T15:26:21.317Z",
|
||||
"app/commerce-modules/user/user-creation-flows/page.mdx": "2025-02-26T11:35:54.685Z",
|
||||
"app/commerce-modules/user/page.mdx": "2025-04-17T08:48:17.980Z",
|
||||
"app/commerce-modules/page.mdx": "2025-04-17T08:48:34.855Z",
|
||||
@@ -124,16 +124,16 @@ export const generatedEditDates = {
|
||||
"app/recipes/subscriptions/examples/standard/page.mdx": "2025-05-20T07:51:40.723Z",
|
||||
"app/recipes/subscriptions/page.mdx": "2025-05-20T07:51:40.723Z",
|
||||
"app/recipes/page.mdx": "2025-05-20T07:51:40.722Z",
|
||||
"app/service-factory-reference/methods/create/page.mdx": "2024-07-31T17:01:33+03:00",
|
||||
"app/service-factory-reference/methods/delete/page.mdx": "2024-07-31T17:01:33+03:00",
|
||||
"app/service-factory-reference/methods/list/page.mdx": "2024-07-31T17:01:33+03:00",
|
||||
"app/service-factory-reference/methods/listAndCount/page.mdx": "2024-07-31T17:01:33+03:00",
|
||||
"app/service-factory-reference/methods/restore/page.mdx": "2024-07-31T17:01:33+03:00",
|
||||
"app/service-factory-reference/methods/retrieve/page.mdx": "2024-07-31T17:01:33+03:00",
|
||||
"app/service-factory-reference/methods/soft-delete/page.mdx": "2024-07-31T17:01:33+03:00",
|
||||
"app/service-factory-reference/methods/update/page.mdx": "2025-07-31T08:24:03.685Z",
|
||||
"app/service-factory-reference/methods/create/page.mdx": "2025-09-01T15:54:53.385Z",
|
||||
"app/service-factory-reference/methods/delete/page.mdx": "2025-09-01T15:54:55.068Z",
|
||||
"app/service-factory-reference/methods/list/page.mdx": "2025-09-01T15:54:57.079Z",
|
||||
"app/service-factory-reference/methods/listAndCount/page.mdx": "2025-09-01T15:54:58.986Z",
|
||||
"app/service-factory-reference/methods/restore/page.mdx": "2025-09-01T15:55:02.709Z",
|
||||
"app/service-factory-reference/methods/retrieve/page.mdx": "2025-09-01T15:55:05.134Z",
|
||||
"app/service-factory-reference/methods/soft-delete/page.mdx": "2025-09-01T15:55:07.905Z",
|
||||
"app/service-factory-reference/methods/update/page.mdx": "2025-09-01T15:55:09.885Z",
|
||||
"app/service-factory-reference/tips/filtering/page.mdx": "2025-08-15T12:06:28.709Z",
|
||||
"app/service-factory-reference/page.mdx": "2025-07-31T13:29:12.136Z",
|
||||
"app/service-factory-reference/page.mdx": "2025-09-01T15:57:34.193Z",
|
||||
"app/storefront-development/cart/context/page.mdx": "2025-03-27T14:47:14.258Z",
|
||||
"app/storefront-development/cart/create/page.mdx": "2025-03-27T14:46:51.473Z",
|
||||
"app/storefront-development/cart/manage-items/page.mdx": "2025-03-26T15:54:31.446Z",
|
||||
@@ -563,12 +563,12 @@ export const generatedEditDates = {
|
||||
"references/types/interfaces/types.BaseProductCategory/page.mdx": "2025-04-11T09:04:47.879Z",
|
||||
"references/types/types.NotificationTypes/page.mdx": "2024-11-25T17:49:28.027Z",
|
||||
"app/medusa-cli/commands/db/page.mdx": "2025-01-16T07:34:08.014Z",
|
||||
"app/medusa-cli/commands/develop/page.mdx": "2024-08-28T10:43:45.452Z",
|
||||
"app/medusa-cli/commands/develop/page.mdx": "2025-09-01T15:31:35.072Z",
|
||||
"app/medusa-cli/commands/exec/page.mdx": "2025-01-16T09:51:17.050Z",
|
||||
"app/medusa-cli/commands/new/page.mdx": "2024-08-28T10:43:34.110Z",
|
||||
"app/medusa-cli/commands/start/page.mdx": "2025-04-08T11:56:15.522Z",
|
||||
"app/medusa-cli/commands/telemtry/page.mdx": "2025-01-16T09:51:24.323Z",
|
||||
"app/medusa-cli/commands/user/page.mdx": "2024-08-28T10:44:52.489Z",
|
||||
"app/medusa-cli/commands/user/page.mdx": "2025-09-01T15:36:38.978Z",
|
||||
"app/recipes/marketplace/examples/restaurant-delivery/page.mdx": "2025-08-25T07:30:37.299Z",
|
||||
"references/types/HttpTypes/interfaces/types.HttpTypes.AdminCreateCustomerGroup/page.mdx": "2024-12-09T13:21:33.569Z",
|
||||
"references/types/HttpTypes/interfaces/types.HttpTypes.AdminCreateReservation/page.mdx": "2025-04-11T09:04:47.498Z",
|
||||
@@ -690,8 +690,8 @@ export const generatedEditDates = {
|
||||
"references/types/HttpTypes/interfaces/types.HttpTypes.AdminWorkflowExecution/page.mdx": "2025-04-11T09:04:47.748Z",
|
||||
"references/types/HttpTypes/interfaces/types.HttpTypes.AdminWorkflowExecutionResponse/page.mdx": "2025-04-11T09:04:47.751Z",
|
||||
"references/types/interfaces/types.BaseReturnItem/page.mdx": "2025-04-11T09:04:47.951Z",
|
||||
"app/test-tools-reference/medusaIntegrationTestRunner/page.mdx": "2024-10-16T15:47:38.579Z",
|
||||
"app/test-tools-reference/moduleIntegrationTestRunner/page.mdx": "2025-03-18T15:19:56.773Z",
|
||||
"app/test-tools-reference/medusaIntegrationTestRunner/page.mdx": "2025-09-01T16:10:30.965Z",
|
||||
"app/test-tools-reference/moduleIntegrationTestRunner/page.mdx": "2025-09-01T16:13:56.959Z",
|
||||
"app/test-tools-reference/page.mdx": "2024-12-09T16:23:04.825Z",
|
||||
"references/types/HttpTypes/interfaces/types.HttpTypes.AdminGetInvitesParams/page.mdx": "2025-01-13T18:05:54.493Z",
|
||||
"references/types/HttpTypes/interfaces/types.HttpTypes.AdminInventoryLevel/page.mdx": "2024-12-23T13:57:05.362Z",
|
||||
@@ -2167,7 +2167,7 @@ export const generatedEditDates = {
|
||||
"app/commerce-modules/stock-location/links-to-other-modules/page.mdx": "2025-04-17T16:02:51.467Z",
|
||||
"app/commerce-modules/store/links-to-other-modules/page.mdx": "2025-04-17T16:03:16.419Z",
|
||||
"app/examples/page.mdx": "2025-07-16T09:53:26.163Z",
|
||||
"app/medusa-cli/commands/build/page.mdx": "2024-11-11T11:00:49.665Z",
|
||||
"app/medusa-cli/commands/build/page.mdx": "2025-09-01T15:30:05.995Z",
|
||||
"app/js-sdk/page.mdx": "2025-08-01T14:17:07.509Z",
|
||||
"references/js_sdk/admin/Admin/properties/js_sdk.admin.Admin.apiKey/page.mdx": "2025-05-20T07:51:40.924Z",
|
||||
"references/js_sdk/admin/Admin/properties/js_sdk.admin.Admin.campaign/page.mdx": "2025-05-20T07:51:40.925Z",
|
||||
|
||||
Reference in New Issue
Block a user