docs: added documentation for db commands (#8846)
* docs: added documentation for db commands * fix lint errors
This commit is contained in:
1 parent
c86a9fe864
commit
70f2290a22
18 files changed
+1324
-761
No files matched your search
@@ -376,7 +376,7 @@ module.exports = defineConfig({
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ export default async function productCreateHandler({
|
|||||||
attachments: [ // optional var
|
attachments: [ // optional var
|
||||||
{
|
{
|
||||||
content: base64,
|
content: base64,
|
||||||
content_type: MIME type,
|
content_type: "image/png", // mime type
|
||||||
filename: filename.ext,
|
filename: filename.ext,
|
||||||
disposition: "attachment or inline attachment",
|
disposition: "attachment or inline attachment",
|
||||||
id: "id", // only needed for inline attachment
|
id: "id", // only needed for inline attachment
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ You'll need the following resources for the taxes calculation:
|
|||||||
```ts
|
```ts
|
||||||
// other imports...
|
// other imports...
|
||||||
import {
|
import {
|
||||||
ModuleRegistrationName
|
ModuleRegistrationName,
|
||||||
} from "@medusajs/utils"
|
} from "@medusajs/utils"
|
||||||
|
|
||||||
// In an API route, workflow step, etc...
|
// In an API route, workflow step, etc...
|
||||||
@@ -48,19 +48,19 @@ const query = remoteQueryObjectFromString({
|
|||||||
fields: [
|
fields: [
|
||||||
"*",
|
"*",
|
||||||
"variants.*",
|
"variants.*",
|
||||||
"variants.calculated_price.*"
|
"variants.calculated_price.*",
|
||||||
],
|
],
|
||||||
variables: {
|
variables: {
|
||||||
filters: {
|
filters: {
|
||||||
id
|
id,
|
||||||
},
|
},
|
||||||
"variants.calculated_price": {
|
"variants.calculated_price": {
|
||||||
context: {
|
context: {
|
||||||
region_id,
|
region_id,
|
||||||
currency_code,
|
currency_code,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const products = await remoteQuery(query)
|
const products = await remoteQuery(query)
|
||||||
@@ -82,7 +82,7 @@ To retrieve the tax line of each product, first, add the following utility metho
|
|||||||
// other imports...
|
// other imports...
|
||||||
import {
|
import {
|
||||||
HttpTypes,
|
HttpTypes,
|
||||||
TaxableItemDTO
|
TaxableItemDTO,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
@@ -118,7 +118,7 @@ Then, use it when retrieving the tax lines of the products retrieved earlier:
|
|||||||
```ts
|
```ts
|
||||||
// other imports...
|
// other imports...
|
||||||
import {
|
import {
|
||||||
ItemTaxLineDTO
|
ItemTaxLineDTO,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
@@ -128,7 +128,7 @@ const taxLines = (await taxModuleService.getTaxLines(
|
|||||||
// example of context properties. You can pass other ones.
|
// example of context properties. You can pass other ones.
|
||||||
address: {
|
address: {
|
||||||
country_code,
|
country_code,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
)) as unknown as ItemTaxLineDTO[]
|
)) as unknown as ItemTaxLineDTO[]
|
||||||
```
|
```
|
||||||
@@ -181,7 +181,7 @@ export const calculateTaxHighlights = [
|
|||||||
```ts highlights={calculateTaxHighlights}
|
```ts highlights={calculateTaxHighlights}
|
||||||
// other imports...
|
// other imports...
|
||||||
import {
|
import {
|
||||||
calculateAmountsWithTax
|
calculateAmountsWithTax,
|
||||||
} from "@medusajs/utils"
|
} from "@medusajs/utils"
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
|
|||||||
@@ -0,0 +1,468 @@
|
|||||||
|
---
|
||||||
|
sidebar_label: "db"
|
||||||
|
sidebar_position: 5
|
||||||
|
---
|
||||||
|
|
||||||
|
import { Table } from "docs-ui"
|
||||||
|
|
||||||
|
export const metadata = {
|
||||||
|
title: `db Commands - Medusa CLI Reference`,
|
||||||
|
}
|
||||||
|
|
||||||
|
# {metadata.title}
|
||||||
|
|
||||||
|
Commands starting with `db:` perform actions on the database.
|
||||||
|
|
||||||
|
## db\:setup
|
||||||
|
|
||||||
|
Creates a database for the Medusa application with the specified name, if it doesn't exit. Then, it runs migrations and syncs links.
|
||||||
|
|
||||||
|
It also updates your `.env` file with the database name.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx medusa db:setup --db <name>
|
||||||
|
```
|
||||||
|
|
||||||
|
<Note title="Tip">
|
||||||
|
|
||||||
|
Use this command if you're setting up a Medusa project or database manually.
|
||||||
|
|
||||||
|
</Note>
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
<Table>
|
||||||
|
<Table.Header>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.HeaderCell>Option</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Description</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Required</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Default</Table.HeaderCell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Header>
|
||||||
|
<Table.Body>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`--db <name>`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
The database name.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Yes
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
\-
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`--skip-links`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Skip syncing links to the database.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
No
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Links are synced by default.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`--execute-safe-links`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Skip prompts when syncing links and execute only safe actions.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
No
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Prompts are shown for unsafe actions, by default.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`--execute-all-links`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Skip prompts when syncing links and execute all (including unsafe) actions.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
No
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Prompts are shown for unsafe actions, by default.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`--no-interactive`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Disable the command's prompts.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
No
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
\-
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
|
|
||||||
|
## db\:create
|
||||||
|
|
||||||
|
Creates a database for the Medusa application with the specified name, if it doesn't exit.
|
||||||
|
|
||||||
|
It also updates your `.env` file with the database name.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx medusa db:create --db <name>
|
||||||
|
```
|
||||||
|
|
||||||
|
<Note title="Tip">
|
||||||
|
|
||||||
|
Use this command if you want to only create a database.
|
||||||
|
|
||||||
|
</Note>
|
||||||
|
|
||||||
|
## Options
|
||||||
|
|
||||||
|
<Table>
|
||||||
|
<Table.Header>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.HeaderCell>Option</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Description</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Required</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Default</Table.HeaderCell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Header>
|
||||||
|
<Table.Body>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`--db <name>`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
The database name.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Yes
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
\-
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`--no-interactive`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Disable the command's prompts.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
No
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
\-
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
|
|
||||||
|
## db\:generate
|
||||||
|
|
||||||
|
Generate a migration file for the latest changes in one or more modules.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx medusa db:generate <module_names...>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Arguments
|
||||||
|
|
||||||
|
<Table>
|
||||||
|
<Table.Header>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.HeaderCell>Argument</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Description</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Required</Table.HeaderCell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Header>
|
||||||
|
<Table.Body>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`module_names`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
The name of one or more module (separated by spaces) to generate migrations for. For example, `helloModuleService`.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Yes
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
|
|
||||||
|
## db\:migrate
|
||||||
|
|
||||||
|
Run the latest migrations to reflect changes on the database, and sync link definitions with the database.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx medusa db:migrate
|
||||||
|
```
|
||||||
|
|
||||||
|
<Note title="Tip">
|
||||||
|
|
||||||
|
Use this command if you've updated the Medusa packages, or you've created customizations and want to reflect them in the database.
|
||||||
|
|
||||||
|
</Note>
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
<Table>
|
||||||
|
<Table.Header>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.HeaderCell>Option</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Description</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Required</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Default</Table.HeaderCell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Header>
|
||||||
|
<Table.Body>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`--skip-links`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Skip syncing links to the database.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
No
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Links are synced by default.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`--execute-safe-links`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Skip prompts when syncing links and execute only safe actions.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
No
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Prompts are shown for unsafe actions, by default.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`--execute-all-links`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Skip prompts when syncing links and execute all (including unsafe) actions.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
No
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Prompts are shown for unsafe actions, by default.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
|
|
||||||
|
## db\:rollback
|
||||||
|
|
||||||
|
Revert the last migrations ran on one or more modules.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx medusa db:rollback <module_names...>
|
||||||
|
```
|
||||||
|
|
||||||
|
<Table>
|
||||||
|
<Table.Header>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.HeaderCell>Argument</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Description</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Required</Table.HeaderCell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Header>
|
||||||
|
<Table.Body>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`module_names`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
The name of one or more module (separated by spaces) to rollback their migrations for. For example, `helloModuleService`.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Yes
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
|
|
||||||
|
## db\:sync-links
|
||||||
|
|
||||||
|
Sync the database with the link definitions in your application, including the definitions in Medusa's modules.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx medusa db:sync-links
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
<Table>
|
||||||
|
<Table.Header>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.HeaderCell>Option</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Description</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Required</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Default</Table.HeaderCell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Header>
|
||||||
|
<Table.Body>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`--execute-safe`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Skip prompts when syncing links and execute only safe actions.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
No
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Prompts are shown for unsafe actions, by default.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`--execute-all`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Skip prompts when syncing links and execute all (including unsafe) actions.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
No
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Prompts are shown for unsafe actions, by default.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
---
|
||||||
|
sidebar_label: "develop"
|
||||||
|
sidebar_position: 2
|
||||||
|
---
|
||||||
|
|
||||||
|
import { Table } from "docs-ui"
|
||||||
|
|
||||||
|
export const metadata = {
|
||||||
|
title: `develop Command - Medusa CLI Reference`,
|
||||||
|
}
|
||||||
|
|
||||||
|
# {metadata.title}
|
||||||
|
|
||||||
|
Start Medusa application in development. This command watches files for any changes, then rebuilds the files and restarts the Medusa application.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx medusa develop
|
||||||
|
```
|
||||||
|
|
||||||
|
## Options
|
||||||
|
|
||||||
|
<Table>
|
||||||
|
<Table.Header>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.HeaderCell>Option</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Description</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Default</Table.HeaderCell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Header>
|
||||||
|
<Table.Body>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`-H <host>`, `--host <host>`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Set host of the Medusa server.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`localhost`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`-p <port>`, `--port <port>`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Set port of the Medusa server.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`9000`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
---
|
||||||
|
sidebar_label: "exec"
|
||||||
|
sidebar_position: 6
|
||||||
|
---
|
||||||
|
|
||||||
|
import { Table } from "docs-ui"
|
||||||
|
|
||||||
|
export const metadata = {
|
||||||
|
title: `exec Command - Medusa CLI Reference`,
|
||||||
|
}
|
||||||
|
|
||||||
|
# {metadata.title}
|
||||||
|
|
||||||
|
Run a custom CLI script. Learn more about it in [this guide](!docs!/advanced-development/custom-cli-scripts).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx medusa exec [file] [args...]
|
||||||
|
```
|
||||||
|
|
||||||
|
## Arguments
|
||||||
|
|
||||||
|
<Table>
|
||||||
|
<Table.Header>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.HeaderCell>Argument</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Description</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Required</Table.HeaderCell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Header>
|
||||||
|
<Table.Body>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`file`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
The path to the TypeScript or JavaScript file holding the function to execute.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Yes
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`args`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
A list of arguments to pass to the function. These arguments are passed in the `args` property of the function's object parameter.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
No
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
@@ -0,0 +1,198 @@
|
|||||||
|
---
|
||||||
|
sidebar_label: "new"
|
||||||
|
sidebar_position: 1
|
||||||
|
---
|
||||||
|
|
||||||
|
import { Table } from "docs-ui"
|
||||||
|
|
||||||
|
export const metadata = {
|
||||||
|
title: `new Command - Medusa CLI Reference`,
|
||||||
|
}
|
||||||
|
|
||||||
|
# {metadata.title}
|
||||||
|
|
||||||
|
Create a new Medusa application. Unlike the `create-medusa-app` CLI tool, this command provides more flexibility for experienced Medusa developers in creating and configuring their project.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
medusa new [<dir_name> [<starter_url>]]
|
||||||
|
```
|
||||||
|
|
||||||
|
## Arguments
|
||||||
|
|
||||||
|
<Table>
|
||||||
|
<Table.Header>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.HeaderCell>Argument</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Description</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Required</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Default</Table.HeaderCell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Header>
|
||||||
|
<Table.Body>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`dir_name`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
The name of the directory to create the Medusa application in.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Yes
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
\-
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`starter_url`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
The name of the directory to create the Medusa application in.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
No
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`https://github.com/medusajs/medusa-starter-default`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
|
|
||||||
|
## Options
|
||||||
|
|
||||||
|
<Table>
|
||||||
|
<Table.Header>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.HeaderCell>Option</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Description</Table.HeaderCell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Header>
|
||||||
|
<Table.Body>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`-y`, `--useDefaults`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Skip all prompts, such as databaes prompts. A database might not be created if default PostgreSQL credentials don't work.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`--skip-db`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Skip database creation.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`--skip-env`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Skip populating `.env`.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`--db-user <user>`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
The database user to use for database setup.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`--db-database <database>`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
The name of the database used for database setup.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`--db-pass <password>`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
The database password to use for database setup.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`--db-port <port>`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
The database port to use for database setup.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`--db-host <host>`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
The database host to use for database setup.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`--v2`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Installs Medusa v2, which is still not ready for production.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
---
|
||||||
|
sidebar_label: "start-cluster"
|
||||||
|
sidebar_position: 7
|
||||||
|
---
|
||||||
|
|
||||||
|
import { Table } from "docs-ui"
|
||||||
|
|
||||||
|
export const metadata = {
|
||||||
|
title: `start-cluster Command - Medusa CLI Reference`,
|
||||||
|
}
|
||||||
|
|
||||||
|
# {metadata.title}
|
||||||
|
|
||||||
|
Starts the Medusa application in [cluster mode](https://expressjs.com/en/advanced/best-practice-performance.html#run-your-app-in-a-cluster).
|
||||||
|
|
||||||
|
Running in cluster mode significantly improves performance as the workload and tasks are distributed among all available instances instead of a single one.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx medusa start-cluster
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Options
|
||||||
|
|
||||||
|
<Table>
|
||||||
|
<Table.Header>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.HeaderCell>Option</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Description</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Default</Table.HeaderCell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Header>
|
||||||
|
<Table.Body>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`-c <number>`, `--cpus <number>`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
The number of CPUs that Medusa can consume.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Medusa will try to consume all CPUs.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`-H <host>`, `--host <host>`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Set host of the Medusa server.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`localhost`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`-p <port>`, `--port <port>`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Set port of the Medusa server.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`9000`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
---
|
||||||
|
sidebar_label: "start"
|
||||||
|
sidebar_position: 3
|
||||||
|
---
|
||||||
|
|
||||||
|
import { Table } from "docs-ui"
|
||||||
|
|
||||||
|
export const metadata = {
|
||||||
|
title: `start Command - Medusa CLI Reference`,
|
||||||
|
}
|
||||||
|
|
||||||
|
# {metadata.title}
|
||||||
|
|
||||||
|
Start the Medusa application in production.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx medusa start
|
||||||
|
```
|
||||||
|
|
||||||
|
## Options
|
||||||
|
|
||||||
|
<Table>
|
||||||
|
<Table.Header>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.HeaderCell>Option</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Description</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Default</Table.HeaderCell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Header>
|
||||||
|
<Table.Body>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`-H <host>`, `--host <host>`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Set host of the Medusa server.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`localhost`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`-p <port>`, `--port <port>`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Set port of the Medusa server.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`9000`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
---
|
||||||
|
sidebar_label: "telemetry"
|
||||||
|
sidebar_position: 8
|
||||||
|
---
|
||||||
|
|
||||||
|
import { Table } from "docs-ui"
|
||||||
|
|
||||||
|
export const metadata = {
|
||||||
|
title: `telemetry Command - Medusa CLI Reference`,
|
||||||
|
}
|
||||||
|
|
||||||
|
# {metadata.title}
|
||||||
|
|
||||||
|
Enable or disable the collection of anonymous data usage. If no option is provided, the command enables the collection of anonymous data usage.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx medusa telemetry
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Options
|
||||||
|
|
||||||
|
<Table>
|
||||||
|
<Table.Header>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.HeaderCell>Option</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Description</Table.HeaderCell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Header>
|
||||||
|
<Table.Body>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`--enable`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Enable telemetry (default).
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`--disable`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Disable telemetry.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
---
|
||||||
|
sidebar_label: "user"
|
||||||
|
sidebar_position: 4
|
||||||
|
---
|
||||||
|
|
||||||
|
import { Table } from "docs-ui"
|
||||||
|
|
||||||
|
export const metadata = {
|
||||||
|
title: `user Command - Medusa CLI Reference`,
|
||||||
|
}
|
||||||
|
|
||||||
|
# {metadata.title}
|
||||||
|
|
||||||
|
Create a new admin user.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx medusa user --email <email> [--password <password>]
|
||||||
|
```
|
||||||
|
|
||||||
|
## Options
|
||||||
|
|
||||||
|
<Table>
|
||||||
|
<Table.Header>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.HeaderCell>Option</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Description</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Required</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>Default</Table.HeaderCell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Header>
|
||||||
|
<Table.Body>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`-e <email>`, `--email <email>`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
The user's email.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
Yes
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
\-
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`-p <password>`, `--password <password>`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
The user's password.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
No
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
\-
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`-i <id>`, `--id <id>`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
The user's ID.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
No
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
An automatically generated ID.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`--invite`
|
||||||
|
|
||||||
|
</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.
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
No
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>
|
||||||
|
|
||||||
|
`false`
|
||||||
|
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Table, Prerequisites } from "docs-ui"
|
import { Table, Prerequisites, ChildDocs } from "docs-ui"
|
||||||
|
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: `Medusa CLI Tool`,
|
title: `Medusa CLI Reference`,
|
||||||
}
|
}
|
||||||
|
|
||||||
# {metadata.title}
|
# {metadata.title}
|
||||||
@@ -35,711 +35,4 @@ npx medusa --help
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Commands
|
<ChildDocs hideItems={["Overview"]} />
|
||||||
|
|
||||||
### new
|
|
||||||
|
|
||||||
Create a new Medusa application. Unlike the `create-medusa-app` CLI tool, this command provides more flexibility for experienced Medusa developers in creating and configuring their project.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
medusa new [<dir_name> [<starter_url>]]
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Arguments
|
|
||||||
|
|
||||||
<Table>
|
|
||||||
<Table.Header>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.HeaderCell>Argument</Table.HeaderCell>
|
|
||||||
<Table.HeaderCell>Description</Table.HeaderCell>
|
|
||||||
<Table.HeaderCell>Required</Table.HeaderCell>
|
|
||||||
<Table.HeaderCell>Default</Table.HeaderCell>
|
|
||||||
</Table.Row>
|
|
||||||
</Table.Header>
|
|
||||||
<Table.Body>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`dir_name`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
The name of the directory to create the Medusa application in.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
Yes
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
\-
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`starter_url`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
The name of the directory to create the Medusa application in.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
No
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`https://github.com/medusajs/medusa-starter-default`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
</Table.Body>
|
|
||||||
</Table>
|
|
||||||
|
|
||||||
#### Options
|
|
||||||
|
|
||||||
<Table>
|
|
||||||
<Table.Header>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.HeaderCell>Option</Table.HeaderCell>
|
|
||||||
<Table.HeaderCell>Description</Table.HeaderCell>
|
|
||||||
</Table.Row>
|
|
||||||
</Table.Header>
|
|
||||||
<Table.Body>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`-y`, `--useDefaults`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
Skip all prompts, such as databaes prompts. A database might not be created if default PostgreSQL credentials don't work.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`--skip-db`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
Skip database creation.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`--skip-env`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
Skip populating `.env`.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`--db-user <user>`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
The database user to use for database setup.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`--db-database <database>`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
The name of the database used for database setup.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`--db-pass <password>`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
The database password to use for database setup.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`--db-port <port>`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
The database port to use for database setup.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`--db-host <host>`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
The database host to use for database setup.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`--v2`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
Installs Medusa v2, which is still not ready for production.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
</Table.Body>
|
|
||||||
</Table>
|
|
||||||
|
|
||||||
### develop
|
|
||||||
|
|
||||||
Start Medusa application in development. This command watches files for any changes, then rebuilds the files and restarts the Medusa application.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npx medusa develop
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Options
|
|
||||||
|
|
||||||
<Table>
|
|
||||||
<Table.Header>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.HeaderCell>Option</Table.HeaderCell>
|
|
||||||
<Table.HeaderCell>Description</Table.HeaderCell>
|
|
||||||
<Table.HeaderCell>Default</Table.HeaderCell>
|
|
||||||
</Table.Row>
|
|
||||||
</Table.Header>
|
|
||||||
<Table.Body>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`-H <host>`, `--host <host>`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
Set host of the Medusa server.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`localhost`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`-p <port>`, `--port <port>`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
Set port of the Medusa server.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`9000`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
</Table.Body>
|
|
||||||
</Table>
|
|
||||||
|
|
||||||
### start
|
|
||||||
|
|
||||||
Start the Medusa application in production.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npx medusa start
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Options
|
|
||||||
|
|
||||||
<Table>
|
|
||||||
<Table.Header>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.HeaderCell>Option</Table.HeaderCell>
|
|
||||||
<Table.HeaderCell>Description</Table.HeaderCell>
|
|
||||||
<Table.HeaderCell>Default</Table.HeaderCell>
|
|
||||||
</Table.Row>
|
|
||||||
</Table.Header>
|
|
||||||
<Table.Body>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`-H <host>`, `--host <host>`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
Set host of the Medusa server.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`localhost`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`-p <port>`, `--port <port>`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
Set port of the Medusa server.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`9000`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
</Table.Body>
|
|
||||||
</Table>
|
|
||||||
|
|
||||||
### migrations run
|
|
||||||
|
|
||||||
Run the latest migrations to reflect changes on the database.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npx medusa migrations run
|
|
||||||
```
|
|
||||||
|
|
||||||
### migrations revert
|
|
||||||
|
|
||||||
Revert the last migrations ran on one or more modules.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npx medusa migrations revert <module_names...>
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Arguments
|
|
||||||
|
|
||||||
<Table>
|
|
||||||
<Table.Header>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.HeaderCell>Argument</Table.HeaderCell>
|
|
||||||
<Table.HeaderCell>Description</Table.HeaderCell>
|
|
||||||
<Table.HeaderCell>Required</Table.HeaderCell>
|
|
||||||
</Table.Row>
|
|
||||||
</Table.Header>
|
|
||||||
<Table.Body>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`module_names`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
The name of one or more module (separated by spaces) to rever their migrations. For example, `helloModuleService`.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
Yes
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
</Table.Body>
|
|
||||||
</Table>
|
|
||||||
|
|
||||||
### migrations generate
|
|
||||||
|
|
||||||
Generate a migration file for the latest changes in one or more modules.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npx medusa migrations generate <module_names...>
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Arguments
|
|
||||||
|
|
||||||
<Table>
|
|
||||||
<Table.Header>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.HeaderCell>Argument</Table.HeaderCell>
|
|
||||||
<Table.HeaderCell>Description</Table.HeaderCell>
|
|
||||||
<Table.HeaderCell>Required</Table.HeaderCell>
|
|
||||||
</Table.Row>
|
|
||||||
</Table.Header>
|
|
||||||
<Table.Body>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`module_names`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
The name of one or more module (separated by spaces) to generate migrations for. For example, `helloModuleService`.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
Yes
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
</Table.Body>
|
|
||||||
</Table>
|
|
||||||
|
|
||||||
### links
|
|
||||||
|
|
||||||
Manage module links in the database.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npx medusa links <action>
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Actions
|
|
||||||
|
|
||||||
The `links` command receive an action name as an argument.
|
|
||||||
|
|
||||||
<Table>
|
|
||||||
<Table.Header>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.HeaderCell>Name</Table.HeaderCell>
|
|
||||||
<Table.HeaderCell>Description</Table.HeaderCell>
|
|
||||||
</Table.Row>
|
|
||||||
</Table.Header>
|
|
||||||
<Table.Body>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`sync`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
Add, update, or delete links based on the definitions in the `src/links` directory of your project.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
</Table.Body>
|
|
||||||
</Table>
|
|
||||||
|
|
||||||
### user
|
|
||||||
|
|
||||||
Create a new admin user.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npx medusa user --email <email> [--password <password>]
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Options
|
|
||||||
|
|
||||||
<Table>
|
|
||||||
<Table.Header>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.HeaderCell>Option</Table.HeaderCell>
|
|
||||||
<Table.HeaderCell>Description</Table.HeaderCell>
|
|
||||||
<Table.HeaderCell>Required</Table.HeaderCell>
|
|
||||||
<Table.HeaderCell>Default</Table.HeaderCell>
|
|
||||||
</Table.Row>
|
|
||||||
</Table.Header>
|
|
||||||
<Table.Body>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`-e <email>`, `--email <email>`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
The user's email.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
Yes
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
\-
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`-p <password>`, `--password <password>`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
The user's password.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
No
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
\-
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`-i <id>`, `--id <id>`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
The user's ID.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
No
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
An automatically generated ID.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`--invite`
|
|
||||||
|
|
||||||
</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.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
No
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`false`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
</Table.Body>
|
|
||||||
</Table>
|
|
||||||
|
|
||||||
### exec
|
|
||||||
|
|
||||||
Run a custom CLI script. Learn more about it in [this guide](!docs!/advanced-development/custom-cli-scripts).
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npx medusa exec [file] [args...]
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Arguments
|
|
||||||
|
|
||||||
<Table>
|
|
||||||
<Table.Header>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.HeaderCell>Argument</Table.HeaderCell>
|
|
||||||
<Table.HeaderCell>Description</Table.HeaderCell>
|
|
||||||
<Table.HeaderCell>Required</Table.HeaderCell>
|
|
||||||
</Table.Row>
|
|
||||||
</Table.Header>
|
|
||||||
<Table.Body>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`file`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
The path to the TypeScript or JavaScript file holding the function to execute.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
Yes
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`args`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
A list of arguments to pass to the function. These arguments are passed in the `args` property of the function's object parameter.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
No
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
</Table.Body>
|
|
||||||
</Table>
|
|
||||||
|
|
||||||
### start-cluster
|
|
||||||
|
|
||||||
Starts the Medusa application in [cluster mode](https://expressjs.com/en/advanced/best-practice-performance.html#run-your-app-in-a-cluster). Running in cluster mode significantly improves performance as the workload and tasks are distributed among all available instances instead of a single one.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npx medusa start-cluster
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Options
|
|
||||||
|
|
||||||
<Table>
|
|
||||||
<Table.Header>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.HeaderCell>Option</Table.HeaderCell>
|
|
||||||
<Table.HeaderCell>Description</Table.HeaderCell>
|
|
||||||
<Table.HeaderCell>Default</Table.HeaderCell>
|
|
||||||
</Table.Row>
|
|
||||||
</Table.Header>
|
|
||||||
<Table.Body>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`-c <number>`, `--cpus <number>`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
The number of CPUs that Medusa can consume.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
Medusa will try to consume all CPUs.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`-H <host>`, `--host <host>`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
Set host of the Medusa server.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`localhost`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`-p <port>`, `--port <port>`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
Set port of the Medusa server.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`9000`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
</Table.Body>
|
|
||||||
</Table>
|
|
||||||
|
|
||||||
### telemetry
|
|
||||||
|
|
||||||
Enable or disable the collection of anonymous data usage. If no option is provided, the command enables the collection of anonymous data usage.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npx medusa telemetry
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Options
|
|
||||||
|
|
||||||
<Table>
|
|
||||||
<Table.Header>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.HeaderCell>Option</Table.HeaderCell>
|
|
||||||
<Table.HeaderCell>Description</Table.HeaderCell>
|
|
||||||
</Table.Row>
|
|
||||||
</Table.Header>
|
|
||||||
<Table.Body>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`--enable`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
Enable telemetry (default).
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`--disable`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
Disable telemetry.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
</Table.Body>
|
|
||||||
</Table>
|
|
||||||
@@ -527,7 +527,7 @@ export const createDpWorkflowHighlights = [
|
|||||||
import {
|
import {
|
||||||
createWorkflow,
|
createWorkflow,
|
||||||
transform,
|
transform,
|
||||||
WorkflowResponse
|
WorkflowResponse,
|
||||||
} from "@medusajs/workflows-sdk"
|
} from "@medusajs/workflows-sdk"
|
||||||
import {
|
import {
|
||||||
CreateProductWorkflowInputDTO,
|
CreateProductWorkflowInputDTO,
|
||||||
@@ -1515,8 +1515,8 @@ Finally, register the module provider in `medusa-config.js`:
|
|||||||
```js title="medusa-config.js"
|
```js title="medusa-config.js"
|
||||||
// other imports...
|
// other imports...
|
||||||
import {
|
import {
|
||||||
Modules
|
Modules,
|
||||||
} from '@medusajs/utils'
|
} from "@medusajs/utils"
|
||||||
|
|
||||||
module.exports = defineConfig({
|
module.exports = defineConfig({
|
||||||
modules: {
|
modules: {
|
||||||
@@ -1531,12 +1531,12 @@ module.exports = defineConfig({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
resolve: "./modules/digital-product-fulfillment",
|
resolve: "./modules/digital-product-fulfillment",
|
||||||
id: "digital"
|
id: "digital",
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -1671,14 +1671,14 @@ import {
|
|||||||
createWorkflow,
|
createWorkflow,
|
||||||
transform,
|
transform,
|
||||||
when,
|
when,
|
||||||
WorkflowResponse
|
WorkflowResponse,
|
||||||
} from "@medusajs/workflows-sdk"
|
} from "@medusajs/workflows-sdk"
|
||||||
import {
|
import {
|
||||||
completeCartWorkflow,
|
completeCartWorkflow,
|
||||||
useRemoteQueryStep,
|
useRemoteQueryStep,
|
||||||
createRemoteLinkStep,
|
createRemoteLinkStep,
|
||||||
createOrderFulfillmentWorkflow,
|
createOrderFulfillmentWorkflow,
|
||||||
emitEventStep
|
emitEventStep,
|
||||||
} from "@medusajs/core-flows"
|
} from "@medusajs/core-flows"
|
||||||
import { Modules } from "@medusajs/utils"
|
import { Modules } from "@medusajs/utils"
|
||||||
import createDigitalProductOrderStep from "./steps/create-digital-product-order"
|
import createDigitalProductOrderStep from "./steps/create-digital-product-order"
|
||||||
@@ -1693,8 +1693,8 @@ const createDigitalProductOrderWorkflow = createWorkflow(
|
|||||||
(input: WorkflowInput) => {
|
(input: WorkflowInput) => {
|
||||||
const order = completeCartWorkflow.runAsStep({
|
const order = completeCartWorkflow.runAsStep({
|
||||||
input: {
|
input: {
|
||||||
id: input.cart_id
|
id: input.cart_id,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const { items } = useRemoteQueryStep({
|
const { items } = useRemoteQueryStep({
|
||||||
@@ -1703,19 +1703,19 @@ const createDigitalProductOrderWorkflow = createWorkflow(
|
|||||||
"*",
|
"*",
|
||||||
"items.*",
|
"items.*",
|
||||||
"items.variant.*",
|
"items.variant.*",
|
||||||
"items.variant.digital_product.*"
|
"items.variant.digital_product.*",
|
||||||
],
|
],
|
||||||
variables: {
|
variables: {
|
||||||
filters: {
|
filters: {
|
||||||
id: order.id
|
id: order.id,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
throw_if_key_not_found: true,
|
throw_if_key_not_found: true,
|
||||||
list: false
|
list: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
const itemsWithDigitalProducts = transform({
|
const itemsWithDigitalProducts = transform({
|
||||||
items
|
items,
|
||||||
},
|
},
|
||||||
(data) => {
|
(data) => {
|
||||||
return data.items.filter((item) => item.variant.digital_product !== undefined)
|
return data.items.filter((item) => item.variant.digital_product !== undefined)
|
||||||
@@ -1732,32 +1732,32 @@ const createDigitalProductOrderWorkflow = createWorkflow(
|
|||||||
|
|
||||||
createRemoteLinkStep([{
|
createRemoteLinkStep([{
|
||||||
[DIGITAL_PRODUCT_MODULE]: {
|
[DIGITAL_PRODUCT_MODULE]: {
|
||||||
digital_product_order_id: digital_product_order.id
|
digital_product_order_id: digital_product_order.id,
|
||||||
},
|
},
|
||||||
[Modules.ORDER]: {
|
[Modules.ORDER]: {
|
||||||
order_id: order.id
|
order_id: order.id,
|
||||||
}
|
},
|
||||||
}])
|
}])
|
||||||
|
|
||||||
createOrderFulfillmentWorkflow.runAsStep({
|
createOrderFulfillmentWorkflow.runAsStep({
|
||||||
input: {
|
input: {
|
||||||
order_id: order.id,
|
order_id: order.id,
|
||||||
items: transform({
|
items: transform({
|
||||||
itemsWithDigitalProducts
|
itemsWithDigitalProducts,
|
||||||
}, (data) => {
|
}, (data) => {
|
||||||
return data.itemsWithDigitalProducts.map((item) => ({
|
return data.itemsWithDigitalProducts.map((item) => ({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
quantity: item.quantity
|
quantity: item.quantity,
|
||||||
}))
|
}))
|
||||||
})
|
}),
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
emitEventStep({
|
emitEventStep({
|
||||||
eventName: "digital_product_order.created",
|
eventName: "digital_product_order.created",
|
||||||
data: {
|
data: {
|
||||||
id: digital_product_order.id
|
id: digital_product_order.id,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
return digital_product_order
|
return digital_product_order
|
||||||
@@ -1765,7 +1765,7 @@ const createDigitalProductOrderWorkflow = createWorkflow(
|
|||||||
|
|
||||||
return new WorkflowResponse({
|
return new WorkflowResponse({
|
||||||
order,
|
order,
|
||||||
digital_product_order
|
digital_product_order,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -1846,11 +1846,11 @@ import type {
|
|||||||
} from "@medusajs/medusa"
|
} from "@medusajs/medusa"
|
||||||
import {
|
import {
|
||||||
INotificationModuleService,
|
INotificationModuleService,
|
||||||
IFileModuleService
|
IFileModuleService,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import {
|
import {
|
||||||
ModuleRegistrationName,
|
ModuleRegistrationName,
|
||||||
remoteQueryObjectFromString
|
remoteQueryObjectFromString,
|
||||||
} from "@medusajs/utils"
|
} from "@medusajs/utils"
|
||||||
import { MediaType } from "../modules/digital-product/types"
|
import { MediaType } from "../modules/digital-product/types"
|
||||||
|
|
||||||
@@ -1871,13 +1871,13 @@ async function digitalProductOrderCreatedHandler({
|
|||||||
"*",
|
"*",
|
||||||
"products.*",
|
"products.*",
|
||||||
"products.medias.*",
|
"products.medias.*",
|
||||||
"order.*"
|
"order.*",
|
||||||
],
|
],
|
||||||
variables: {
|
variables: {
|
||||||
filters: {
|
filters: {
|
||||||
id: data.id
|
id: data.id,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const digitalProductOrder = (await remoteQuery(query))[0]
|
const digitalProductOrder = (await remoteQuery(query))[0]
|
||||||
@@ -1920,7 +1920,7 @@ const notificationData = await Promise.all(
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
name: product.name,
|
name: product.name,
|
||||||
medias
|
medias,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
@@ -1930,8 +1930,8 @@ await notificationModuleService.createNotifications({
|
|||||||
template: "digital-order-template",
|
template: "digital-order-template",
|
||||||
channel: "email",
|
channel: "email",
|
||||||
data: {
|
data: {
|
||||||
products: notificationData
|
products: notificationData,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -590,7 +590,7 @@ export const createSubscriptionWorkflowHighlights = [
|
|||||||
```ts title="src/workflows/create-subscription/index.ts" highlights={createSubscriptionWorkflowHighlights} collapsibleLines="1-13" expandMoreLabel="Show Imports"
|
```ts title="src/workflows/create-subscription/index.ts" highlights={createSubscriptionWorkflowHighlights} collapsibleLines="1-13" expandMoreLabel="Show Imports"
|
||||||
import {
|
import {
|
||||||
createWorkflow,
|
createWorkflow,
|
||||||
WorkflowResponse
|
WorkflowResponse,
|
||||||
} from "@medusajs/workflows-sdk"
|
} from "@medusajs/workflows-sdk"
|
||||||
import {
|
import {
|
||||||
createRemoteLinkStep,
|
createRemoteLinkStep,
|
||||||
@@ -1765,7 +1765,7 @@ export const createSubscriptionOrderWorkflowHighlights = [
|
|||||||
```ts title="src/workflows/create-subscription-order/index.ts" highlights={createSubscriptionOrderWorkflowHighlights} collapsibleLines="1-25" expandMoreLabel="Show Imports"
|
```ts title="src/workflows/create-subscription-order/index.ts" highlights={createSubscriptionOrderWorkflowHighlights} collapsibleLines="1-25" expandMoreLabel="Show Imports"
|
||||||
import {
|
import {
|
||||||
createWorkflow,
|
createWorkflow,
|
||||||
WorkflowResponse
|
WorkflowResponse,
|
||||||
} from "@medusajs/workflows-sdk"
|
} from "@medusajs/workflows-sdk"
|
||||||
import {
|
import {
|
||||||
useRemoteQueryStep,
|
useRemoteQueryStep,
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ export const generatedEditDates = {
|
|||||||
"app/deployment/storefront/vercel/page.mdx": "2024-07-26T07:21:31+00:00",
|
"app/deployment/storefront/vercel/page.mdx": "2024-07-26T07:21:31+00:00",
|
||||||
"app/deployment/page.mdx": "2024-07-25T09:55:22+03:00",
|
"app/deployment/page.mdx": "2024-07-25T09:55:22+03:00",
|
||||||
"app/integrations/page.mdx": "2024-07-19T08:49:08+00:00",
|
"app/integrations/page.mdx": "2024-07-19T08:49:08+00:00",
|
||||||
"app/medusa-cli/page.mdx": "2024-08-05T11:10:55+03:00",
|
"app/medusa-cli/page.mdx": "2024-08-28T11:25:32.382Z",
|
||||||
"app/medusa-container-resources/page.mdx": "2024-08-05T07:24:27+00:00",
|
"app/medusa-container-resources/page.mdx": "2024-08-05T07:24:27+00:00",
|
||||||
"app/medusa-workflows-reference/page.mdx": "2024-08-15T12:13:13+03:00",
|
"app/medusa-workflows-reference/page.mdx": "2024-08-15T12:13:13+03:00",
|
||||||
"app/nextjs-starter/page.mdx": "2024-07-01T10:21:19+03:00",
|
"app/nextjs-starter/page.mdx": "2024-07-01T10:21:19+03:00",
|
||||||
@@ -561,5 +561,13 @@ export const generatedEditDates = {
|
|||||||
"references/types/interfaces/types.BaseReturn/page.mdx": "2024-08-28T00:11:05.678Z",
|
"references/types/interfaces/types.BaseReturn/page.mdx": "2024-08-28T00:11:05.678Z",
|
||||||
"references/types/types.DmlTypes/page.mdx": "2024-08-28T00:11:04.914Z",
|
"references/types/types.DmlTypes/page.mdx": "2024-08-28T00:11:04.914Z",
|
||||||
"references/types/types.ModulesSdkTypes/page.mdx": "2024-08-28T00:11:05.834Z",
|
"references/types/types.ModulesSdkTypes/page.mdx": "2024-08-28T00:11:05.834Z",
|
||||||
"references/types/types/types.FlowRunOptions/page.mdx": "2024-08-28T00:11:06.110Z"
|
"references/types/types/types.FlowRunOptions/page.mdx": "2024-08-28T00:11:06.110Z",
|
||||||
|
"app/medusa-cli/commands/db/page.mdx": "2024-08-28T11:26:33.889Z",
|
||||||
|
"app/medusa-cli/commands/develop/page.mdx": "2024-08-28T10:43:45.452Z",
|
||||||
|
"app/medusa-cli/commands/exec/page.mdx": "2024-08-28T10:45:31.229Z",
|
||||||
|
"app/medusa-cli/commands/new/page.mdx": "2024-08-28T10:43:34.110Z",
|
||||||
|
"app/medusa-cli/commands/start-cluster/page.mdx": "2024-08-28T11:25:05.257Z",
|
||||||
|
"app/medusa-cli/commands/start/page.mdx": "2024-08-28T10:44:19.952Z",
|
||||||
|
"app/medusa-cli/commands/telemtry/page.mdx": "2024-08-28T11:25:08.553Z",
|
||||||
|
"app/medusa-cli/commands/user/page.mdx": "2024-08-28T10:44:52.489Z"
|
||||||
}
|
}
|
||||||
@@ -675,6 +675,38 @@ export const filesMap = [
|
|||||||
"filePath": "/www/apps/resources/app/integrations/page.mdx",
|
"filePath": "/www/apps/resources/app/integrations/page.mdx",
|
||||||
"pathname": "/integrations"
|
"pathname": "/integrations"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"filePath": "/www/apps/resources/app/medusa-cli/commands/db/page.mdx",
|
||||||
|
"pathname": "/medusa-cli/commands/db"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filePath": "/www/apps/resources/app/medusa-cli/commands/develop/page.mdx",
|
||||||
|
"pathname": "/medusa-cli/commands/develop"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filePath": "/www/apps/resources/app/medusa-cli/commands/exec/page.mdx",
|
||||||
|
"pathname": "/medusa-cli/commands/exec"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filePath": "/www/apps/resources/app/medusa-cli/commands/new/page.mdx",
|
||||||
|
"pathname": "/medusa-cli/commands/new"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filePath": "/www/apps/resources/app/medusa-cli/commands/start/page.mdx",
|
||||||
|
"pathname": "/medusa-cli/commands/start"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filePath": "/www/apps/resources/app/medusa-cli/commands/start-cluster/page.mdx",
|
||||||
|
"pathname": "/medusa-cli/commands/start-cluster"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filePath": "/www/apps/resources/app/medusa-cli/commands/telemtry/page.mdx",
|
||||||
|
"pathname": "/medusa-cli/commands/telemtry"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filePath": "/www/apps/resources/app/medusa-cli/commands/user/page.mdx",
|
||||||
|
"pathname": "/medusa-cli/commands/user"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"filePath": "/www/apps/resources/app/medusa-cli/page.mdx",
|
"filePath": "/www/apps/resources/app/medusa-cli/page.mdx",
|
||||||
"pathname": "/medusa-cli"
|
"pathname": "/medusa-cli"
|
||||||
|
|||||||
@@ -7629,7 +7629,94 @@ export const generatedSidebar = [
|
|||||||
"type": "link",
|
"type": "link",
|
||||||
"path": "/medusa-cli",
|
"path": "/medusa-cli",
|
||||||
"title": "Medusa CLI",
|
"title": "Medusa CLI",
|
||||||
"children": []
|
"isChildSidebar": true,
|
||||||
|
"childSidebarTitle": "Medusa CLI Reference",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"loaded": true,
|
||||||
|
"isPathHref": true,
|
||||||
|
"type": "link",
|
||||||
|
"path": "/medusa-cli",
|
||||||
|
"title": "Overview",
|
||||||
|
"children": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "separator"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"loaded": true,
|
||||||
|
"isPathHref": true,
|
||||||
|
"type": "category",
|
||||||
|
"title": "Commands",
|
||||||
|
"autogenerate_path": "medusa-cli/commands",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"loaded": true,
|
||||||
|
"isPathHref": true,
|
||||||
|
"type": "link",
|
||||||
|
"path": "/medusa-cli/commands/new",
|
||||||
|
"title": "new",
|
||||||
|
"children": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"loaded": true,
|
||||||
|
"isPathHref": true,
|
||||||
|
"type": "link",
|
||||||
|
"path": "/medusa-cli/commands/develop",
|
||||||
|
"title": "develop",
|
||||||
|
"children": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"loaded": true,
|
||||||
|
"isPathHref": true,
|
||||||
|
"type": "link",
|
||||||
|
"path": "/medusa-cli/commands/start",
|
||||||
|
"title": "start",
|
||||||
|
"children": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"loaded": true,
|
||||||
|
"isPathHref": true,
|
||||||
|
"type": "link",
|
||||||
|
"path": "/medusa-cli/commands/user",
|
||||||
|
"title": "user",
|
||||||
|
"children": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"loaded": true,
|
||||||
|
"isPathHref": true,
|
||||||
|
"type": "link",
|
||||||
|
"path": "/medusa-cli/commands/db",
|
||||||
|
"title": "db",
|
||||||
|
"children": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"loaded": true,
|
||||||
|
"isPathHref": true,
|
||||||
|
"type": "link",
|
||||||
|
"path": "/medusa-cli/commands/exec",
|
||||||
|
"title": "exec",
|
||||||
|
"children": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"loaded": true,
|
||||||
|
"isPathHref": true,
|
||||||
|
"type": "link",
|
||||||
|
"path": "/medusa-cli/commands/start-cluster",
|
||||||
|
"title": "start-cluster",
|
||||||
|
"children": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"loaded": true,
|
||||||
|
"isPathHref": true,
|
||||||
|
"type": "link",
|
||||||
|
"path": "/medusa-cli/commands/telemtry",
|
||||||
|
"title": "telemetry",
|
||||||
|
"children": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"loaded": true,
|
"loaded": true,
|
||||||
|
|||||||
@@ -1660,6 +1660,23 @@ export const sidebar = sidebarAttachHrefCommonOptions([
|
|||||||
type: "link",
|
type: "link",
|
||||||
path: "/medusa-cli",
|
path: "/medusa-cli",
|
||||||
title: "Medusa CLI",
|
title: "Medusa CLI",
|
||||||
|
isChildSidebar: true,
|
||||||
|
childSidebarTitle: "Medusa CLI Reference",
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
path: "/medusa-cli",
|
||||||
|
title: "Overview",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "separator",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "category",
|
||||||
|
title: "Commands",
|
||||||
|
autogenerate_path: "medusa-cli/commands",
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "link",
|
type: "link",
|
||||||
|
|||||||
Reference in new issue
Block a user