docs-util: reorder workflow execution examples (#10955)

* docs-util: reorder workflow execution examples

* reorder again

* add examples header
This commit is contained in:
Shahed Nasser
2025-01-14 11:52:50 +02:00
committed by GitHub
parent 4bc3f5b845
commit 98e77fad89
473 changed files with 13139 additions and 12637 deletions

View File

@@ -8,7 +8,7 @@ import { TypeList } from "docs-ui"
## Parameters
<TypeList types={[{"name":"messageData","type":"[RawMessageFormat](../../../types/api_key.RawMessageFormat/page.mdx)&#60;T&#62; \\| [RawMessageFormat](../../../types/api_key.RawMessageFormat/page.mdx)&#60;T&#62;[]","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"eventName","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"data","type":"TData","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"source","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"object","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"eventName","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"data","type":"TData","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"source","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"object","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"action","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"context","type":"Pick&#60;[Context](../../../interfaces/api_key.Context/page.mdx), \"eventGroupId\"&#62;","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"eventGroupId","type":"`string`","description":"A string indicating the ID of the group to aggregate the events to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"options","type":"`Record<string, any>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"action","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"context","type":"Pick&#60;[Context](../../../interfaces/api_key.Context/page.mdx), \"eventGroupId\"&#62;","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"eventGroupId","type":"`string`","description":"A string indicating the ID of the group to aggregate the events to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"options","type":"`Record<string, any>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"options","type":"`Record<string, unknown>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="saveRawMessageData"/>
<TypeList types={[{"name":"messageData","type":"[RawMessageFormat](../../../types/api_key.RawMessageFormat/page.mdx)&#60;T&#62; \\| [RawMessageFormat](../../../types/api_key.RawMessageFormat/page.mdx)&#60;T&#62;[]","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"eventName","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"data","type":"TData","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"source","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"object","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"action","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"context","type":"Pick&#60;[Context](../../../interfaces/api_key.Context/page.mdx), \"eventGroupId\"&#62;","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"eventGroupId","type":"`string`","description":"A string indicating the ID of the group to aggregate the events to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"options","type":"`Record<string, any>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"options","type":"`Record<string, unknown>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="saveRawMessageData"/>
## Returns

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -8,7 +8,7 @@ import { TypeList } from "docs-ui"
## Parameters
<TypeList types={[{"name":"messageData","type":"[RawMessageFormat](../../../types/auth.RawMessageFormat/page.mdx)&#60;T&#62; \\| [RawMessageFormat](../../../types/auth.RawMessageFormat/page.mdx)&#60;T&#62;[]","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"eventName","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"data","type":"TData","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"source","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"object","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"eventName","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"data","type":"TData","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"source","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"object","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"action","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"context","type":"Pick&#60;[Context](../../../interfaces/auth.Context/page.mdx), \"eventGroupId\"&#62;","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"eventGroupId","type":"`string`","description":"A string indicating the ID of the group to aggregate the events to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"options","type":"`Record<string, any>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"action","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"context","type":"Pick&#60;[Context](../../../interfaces/auth.Context/page.mdx), \"eventGroupId\"&#62;","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"eventGroupId","type":"`string`","description":"A string indicating the ID of the group to aggregate the events to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"options","type":"`Record<string, any>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"options","type":"`Record<string, unknown>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="saveRawMessageData"/>
<TypeList types={[{"name":"messageData","type":"[RawMessageFormat](../../../types/auth.RawMessageFormat/page.mdx)&#60;T&#62; \\| [RawMessageFormat](../../../types/auth.RawMessageFormat/page.mdx)&#60;T&#62;[]","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"eventName","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"data","type":"TData","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"source","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"object","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"action","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"context","type":"Pick&#60;[Context](../../../interfaces/auth.Context/page.mdx), \"eventGroupId\"&#62;","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"eventGroupId","type":"`string`","description":"A string indicating the ID of the group to aggregate the events to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"options","type":"`Record<string, any>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"options","type":"`Record<string, unknown>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="saveRawMessageData"/>
## Returns

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -8,7 +8,7 @@ import { TypeList } from "docs-ui"
## Parameters
<TypeList types={[{"name":"messageData","type":"[RawMessageFormat](../../../types/cart.RawMessageFormat/page.mdx)&#60;T&#62; \\| [RawMessageFormat](../../../types/cart.RawMessageFormat/page.mdx)&#60;T&#62;[]","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"eventName","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"data","type":"TData","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"source","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"object","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"eventName","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"data","type":"TData","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"source","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"object","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"action","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"context","type":"Pick&#60;[Context](../../../interfaces/cart.Context/page.mdx), \"eventGroupId\"&#62;","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"eventGroupId","type":"`string`","description":"A string indicating the ID of the group to aggregate the events to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"options","type":"`Record<string, any>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"action","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"context","type":"Pick&#60;[Context](../../../interfaces/cart.Context/page.mdx), \"eventGroupId\"&#62;","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"eventGroupId","type":"`string`","description":"A string indicating the ID of the group to aggregate the events to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"options","type":"`Record<string, any>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"options","type":"`Record<string, unknown>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="saveRawMessageData"/>
<TypeList types={[{"name":"messageData","type":"[RawMessageFormat](../../../types/cart.RawMessageFormat/page.mdx)&#60;T&#62; \\| [RawMessageFormat](../../../types/cart.RawMessageFormat/page.mdx)&#60;T&#62;[]","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"eventName","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"data","type":"TData","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"source","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"object","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"action","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"context","type":"Pick&#60;[Context](../../../interfaces/cart.Context/page.mdx), \"eventGroupId\"&#62;","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"eventGroupId","type":"`string`","description":"A string indicating the ID of the group to aggregate the events to be emitted at a later point.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"options","type":"`Record<string, any>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"options","type":"`Record<string, unknown>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="saveRawMessageData"/>
## Returns

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -23,9 +23,9 @@ const myWorkflow = createWorkflow(
() => {
const data = createApiKeysStep({
"api_keys": [{
"title": "acervus",
"title": "derideo",
"type": "secret",
"created_by": "user_VvjemccZRm1P9fT0"
"created_by": "user_NaVGVsHtBHlMwdJ"
}]
})
}

View File

@@ -22,7 +22,7 @@ const myWorkflow = createWorkflow(
"my-workflow",
() => {
const data = linkSalesChannelsToApiKeyStep({
"id": "id_lIAGOo3vxm"
"id": "id_vb6fZX5fJAEOWY"
})
}
)

View File

@@ -16,31 +16,9 @@ This workflow creates one or more API keys.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/api-key/workflows/create-api-keys.ts#L15" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { createApiKeysWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = createApiKeysWorkflow
.runAsStep({
input: {
"api_keys": [{
"title": "subvenio",
"type": "publishable",
"created_by": "user_lFoawrDa6j3BQZPV"
}]
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -58,9 +36,9 @@ export async function POST(
.run({
input: {
"api_keys": [{
"title": "subvenio",
"title": "suscipio",
"type": "publishable",
"created_by": "user_lFoawrDa6j3BQZPV"
"created_by": "user_svZrl7Ubex"
}]
}
})
@@ -87,9 +65,9 @@ export default async function handleOrderPlaced({
.run({
input: {
"api_keys": [{
"title": "subvenio",
"title": "suscipio",
"type": "publishable",
"created_by": "user_lFoawrDa6j3BQZPV"
"created_by": "user_svZrl7Ubex"
}]
}
})
@@ -116,9 +94,9 @@ export default async function myCustomJob(
.run({
input: {
"api_keys": [{
"title": "subvenio",
"title": "suscipio",
"type": "publishable",
"created_by": "user_lFoawrDa6j3BQZPV"
"created_by": "user_svZrl7Ubex"
}]
}
})
@@ -130,6 +108,30 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { createApiKeysWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = createApiKeysWorkflow
.runAsStep({
input: {
"api_keys": [{
"title": "suscipio",
"type": "publishable",
"created_by": "user_svZrl7Ubex"
}]
}
})
}
)
```
</CodeTab>

View File

@@ -17,29 +17,9 @@ This workflow deletes one or more API keys.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/api-key/workflows/delete-api-keys.ts#L12" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { deleteApiKeysWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = deleteApiKeysWorkflow
.runAsStep({
input: {
"ids": [
"id_oAdfP14QUoqh"
]
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -57,7 +37,7 @@ export async function POST(
.run({
input: {
"ids": [
"id_oAdfP14QUoqh"
"id_iMZLYsRAs2bbPci"
]
}
})
@@ -84,7 +64,7 @@ export default async function handleOrderPlaced({
.run({
input: {
"ids": [
"id_oAdfP14QUoqh"
"id_iMZLYsRAs2bbPci"
]
}
})
@@ -111,7 +91,7 @@ export default async function myCustomJob(
.run({
input: {
"ids": [
"id_oAdfP14QUoqh"
"id_iMZLYsRAs2bbPci"
]
}
})
@@ -123,6 +103,28 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { deleteApiKeysWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = deleteApiKeysWorkflow
.runAsStep({
input: {
"ids": [
"id_iMZLYsRAs2bbPci"
]
}
})
}
)
```
</CodeTab>

View File

@@ -17,27 +17,9 @@ This workflow links sales channels to API keys.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/api-key/workflows/link-sales-channels-to-publishable-key.ts#L13" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { linkSalesChannelsToApiKeyWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = linkSalesChannelsToApiKeyWorkflow
.runAsStep({
input: {
"id": "id_fzIS54SNGIfmYj8Ad"
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -54,7 +36,7 @@ export async function POST(
const { result } = await linkSalesChannelsToApiKeyWorkflow(req.scope)
.run({
input: {
"id": "id_fzIS54SNGIfmYj8Ad"
"id": "id_ho4tqCcF0SooZ"
}
})
@@ -79,7 +61,7 @@ export default async function handleOrderPlaced({
const { result } = await linkSalesChannelsToApiKeyWorkflow(container)
.run({
input: {
"id": "id_fzIS54SNGIfmYj8Ad"
"id": "id_ho4tqCcF0SooZ"
}
})
@@ -104,7 +86,7 @@ export default async function myCustomJob(
const { result } = await linkSalesChannelsToApiKeyWorkflow(container)
.run({
input: {
"id": "id_fzIS54SNGIfmYj8Ad"
"id": "id_ho4tqCcF0SooZ"
}
})
@@ -115,6 +97,26 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { linkSalesChannelsToApiKeyWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = linkSalesChannelsToApiKeyWorkflow
.runAsStep({
input: {
"id": "id_ho4tqCcF0SooZ"
}
})
}
)
```
</CodeTab>

View File

@@ -16,30 +16,9 @@ This workflow revokes one or more API keys.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/api-key/workflows/revoke-api-keys.ts#L22" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { revokeApiKeysWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = revokeApiKeysWorkflow
.runAsStep({
input: {
"selector": {},
"revoke": {
"revoked_by": "{value}"
}
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -126,6 +105,29 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { revokeApiKeysWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = revokeApiKeysWorkflow
.runAsStep({
input: {
"selector": {},
"revoke": {
"revoked_by": "{value}"
}
}
})
}
)
```
</CodeTab>

View File

@@ -16,28 +16,9 @@ This workflow creates one or more API keys.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/api-key/workflows/update-api-keys.ts#L22" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { updateApiKeysWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = updateApiKeysWorkflow
.runAsStep({
input: {
"selector": {},
"update": {}
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -118,6 +99,27 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { updateApiKeysWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = updateApiKeysWorkflow
.runAsStep({
input: {
"selector": {},
"update": {}
}
})
}
)
```
</CodeTab>

View File

@@ -15,30 +15,9 @@ This documentation provides a reference to the `generateResetPasswordTokenWorkfl
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/auth/workflows/generate-reset-password-token.ts#L13" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { generateResetPasswordTokenWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = generateResetPasswordTokenWorkflow
.runAsStep({
input: {
"entityId": "{value}",
"actorType": "{value}",
"provider": "{value}",
"secret": "{value}"
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -125,6 +104,29 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { generateResetPasswordTokenWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = generateResetPasswordTokenWorkflow
.runAsStep({
input: {
"entityId": "{value}",
"actorType": "{value}",
"provider": "{value}",
"secret": "{value}"
}
})
}
)
```
</CodeTab>

View File

@@ -23,9 +23,9 @@ const myWorkflow = createWorkflow(
() => {
const data = addShippingMethodToCartStep({
"shipping_methods": [{
"name": "Emory",
"name": "Kareem",
"cart_id": "{value}",
"amount": 46
"amount": 38
}]
})
}

View File

@@ -24,9 +24,9 @@ const myWorkflow = createWorkflow(
const data = confirmInventoryStep({
"items": [{
"inventory_item_id": "{value}",
"required_quantity": 48,
"allow_backorder": true,
"quantity": 33,
"required_quantity": 11,
"allow_backorder": false,
"quantity": 23,
"location_ids": [
"{value}"
]

View File

@@ -24,7 +24,7 @@ const myWorkflow = createWorkflow(
const data = createLineItemAdjustmentsStep({
"lineItemAdjustmentsToCreate": [{
"code": "{value}",
"amount": 27,
"amount": 38,
"item_id": "{value}"
}]
})

View File

@@ -22,11 +22,11 @@ const myWorkflow = createWorkflow(
"my-workflow",
() => {
const data = createLineItemsStep({
"id": "id_Qz07MRX126D4QhT",
"id": "id_6rFekk11aJQdOk",
"items": [{
"title": "bardus",
"quantity": 11,
"unit_price": 8,
"title": "terebro",
"quantity": 15,
"unit_price": 47,
"cart_id": "{value}"
}]
})

View File

@@ -24,7 +24,7 @@ const myWorkflow = createWorkflow(
const data = createPaymentCollectionsStep([{
"region_id": "{value}",
"currency_code": "{value}",
"amount": 44
"amount": 39
}])
}
)

View File

@@ -25,7 +25,7 @@ const myWorkflow = createWorkflow(
"shippingMethodAdjustmentsToCreate": [{
"shipping_method_id": "{value}",
"code": "{value}",
"amount": 34
"amount": 42
}]
})
}

View File

@@ -24,74 +24,74 @@ const myWorkflow = createWorkflow(
() => {
const data = getActionsToComputeFromPromotionsStep({
"cart": {
"id": "id_QqBWCiL5Mq0aqsfLRiM",
"id": "id_zo2WfWgPkxMjG",
"currency_code": "{value}",
"original_item_total": {
"numeric": 41
"numeric": 0
},
"original_item_subtotal": {
"numeric": 3
"numeric": 16
},
"original_item_tax_total": {
"numeric": 45
"numeric": 50
},
"item_total": {
"numeric": 37
"numeric": 5
},
"item_subtotal": {
"numeric": 41
"numeric": 31
},
"item_tax_total": {
"numeric": 19
"numeric": 16
},
"original_total": {
"numeric": 30
"numeric": 7
},
"original_subtotal": {
"numeric": 15
"numeric": 4
},
"original_tax_total": {
"numeric": 35
"numeric": 2
},
"total": {
"numeric": 1
"numeric": 8
},
"subtotal": {
"numeric": 27
"numeric": 50
},
"tax_total": {
"numeric": 29
"numeric": 42
},
"discount_total": {
"numeric": 27
"numeric": 48
},
"discount_tax_total": {
"numeric": 21
},
"gift_card_total": {
"numeric": 23
},
"gift_card_tax_total": {
"numeric": 25
},
"shipping_total": {
"numeric": 19
},
"shipping_subtotal": {
"numeric": 34
},
"shipping_tax_total": {
"numeric": 1
},
"original_shipping_total": {
"numeric": 41
},
"original_shipping_subtotal": {
"numeric": 43
},
"original_shipping_tax_total": {
"gift_card_total": {
"numeric": 40
},
"gift_card_tax_total": {
"numeric": 21
},
"shipping_total": {
"numeric": 41
},
"shipping_subtotal": {
"numeric": 4
},
"shipping_tax_total": {
"numeric": 47
},
"original_shipping_total": {
"numeric": 13
},
"original_shipping_subtotal": {
"numeric": 21
},
"original_shipping_tax_total": {
"numeric": 32
},
"raw_original_item_total": {
"value": "{value}"
},

View File

@@ -23,11 +23,11 @@ const myWorkflow = createWorkflow(
"my-workflow",
() => {
const data = getLineItemActionsStep({
"id": "id_DVg8cS9mkh8GBzj",
"id": "id_XFQdKL3gqtUVNd",
"items": [{
"title": "quidem",
"quantity": 33,
"unit_price": 36,
"title": "tener",
"quantity": 50,
"unit_price": 46,
"cart_id": "{value}"
}]
})

View File

@@ -26,7 +26,7 @@ const myWorkflow = createWorkflow(
"actions": [{
"action": "{value}",
"item_id": "{value}",
"amount": 41,
"amount": 26,
"code": "{value}",
"adjustment_id": "{value}",
"shipping_method_id": "{value}"

View File

@@ -26,9 +26,9 @@ const myWorkflow = createWorkflow(
const data = reserveInventoryStep({
"items": [{
"inventory_item_id": "{value}",
"required_quantity": 29,
"required_quantity": 40,
"allow_backorder": false,
"quantity": 37,
"quantity": 44,
"location_ids": [
"{value}"
]

View File

@@ -19,7 +19,7 @@ const myWorkflow = createWorkflow(
"my-workflow",
() => {
const data = retrieveCartStep({
"id": "id_Al0pN6inqwdqSOMfCYdp"
"id": "id_8DpKO8h0vK4"
})
}
)

View File

@@ -23,32 +23,32 @@ const myWorkflow = createWorkflow(
() => {
const data = setTaxLinesForItemsStep({
"cart": {
"id": "id_QGs7DVFYtBnAC01YYLu",
"id": "id_SE0IrhFUnQnFNLiQqe",
"payment_collection": {
"id": "id_uzQSnUuzKkPJ0cZEXPD",
"id": "id_YhuROrBan2lyBmDB1M",
"currency_code": "{value}",
"region_id": "{value}",
"amount": {
"numeric": 42
"numeric": 9
},
"status": "partially_authorized",
"status": "not_paid",
"payment_providers": [{
"id": "id_dod8tvJed0DpEL",
"id": "id_NpxxM0ouevvB1c",
"is_enabled": true
}]
}
},
"item_tax_lines": [{
"rate": 34,
"rate": 48,
"code": {},
"name": "Cameron",
"name": "Vernon",
"provider_id": "{value}",
"line_item_id": "{value}"
}],
"shipping_tax_lines": [{
"rate": 23,
"rate": 49,
"code": {},
"name": "Lauryn",
"name": "Jasen",
"provider_id": "{value}",
"shipping_line_id": "{value}"
}]

View File

@@ -24,7 +24,7 @@ const myWorkflow = createWorkflow(
"my-workflow",
() => {
const data = updateCartPromotionsStep({
"id": "id_XKHrtCG62Q"
"id": "id_FMMyyyKUjF2KjYp"
})
}
)

View File

@@ -22,7 +22,7 @@ const myWorkflow = createWorkflow(
"my-workflow",
() => {
const data = updateCartsStep([{
"id": "id_VkY7iHaYRI"
"id": "id_6MzWGTzXtywkrtb"
}])
}
)

View File

@@ -22,7 +22,7 @@ const myWorkflow = createWorkflow(
"my-workflow",
() => {
const data = updateLineItemsStep({
"id": "id_CvqQujmairnOWwNpb",
"id": "id_Luh6C6I3Rle6E4j",
"items": [{
"selector": "{value}",
"data": "{value}"

View File

@@ -23,18 +23,18 @@ const myWorkflow = createWorkflow(
() => {
const data = validateCartPaymentsStep({
"cart": {
"id": "id_hJ8eQupUnBXPwu3XmA",
"id": "id_48kB6S6mQoqDPvLilUfK",
"payment_collection": {
"id": "id_Stg7R7qDiLOdVGxT",
"id": "id_vj9fGZtJOqtMGdubl",
"currency_code": "{value}",
"region_id": "{value}",
"amount": {
"numeric": 14
"numeric": 40
},
"status": "partially_authorized",
"status": "not_paid",
"payment_providers": [{
"id": "id_cFquXPwY4GOVkBmc",
"is_enabled": true
"id": "id_QBTxhwnkN4f0ULXVv",
"is_enabled": false
}]
}
}

View File

@@ -23,73 +23,73 @@ const myWorkflow = createWorkflow(
() => {
const data = validateCartShippingOptionsStep({
"cart": {
"id": "id_7nHH3S5HORwltFT5",
"id": "id_1WDBYIkJWevCocwcdK",
"currency_code": "{value}",
"original_item_total": {
"numeric": 49
"numeric": 26
},
"original_item_subtotal": {
"numeric": 36
"numeric": 8
},
"original_item_tax_total": {
"numeric": 33
"numeric": 3
},
"item_total": {
"numeric": 0
"numeric": 34
},
"item_subtotal": {
"numeric": 27
"numeric": 19
},
"item_tax_total": {
"numeric": 50
},
"original_total": {
"numeric": 16
},
"original_subtotal": {
"numeric": 18
},
"original_tax_total": {
"numeric": 36
},
"total": {
"numeric": 21
},
"original_subtotal": {
"numeric": 38
},
"original_tax_total": {
"numeric": 50
},
"total": {
"numeric": 17
},
"subtotal": {
"numeric": 4
"numeric": 29
},
"tax_total": {
"numeric": 18
"numeric": 22
},
"discount_total": {
"numeric": 30
"numeric": 42
},
"discount_tax_total": {
"numeric": 27
},
"gift_card_total": {
"numeric": 47
},
"gift_card_tax_total": {
"numeric": 16
},
"shipping_total": {
"numeric": 16
},
"shipping_subtotal": {
"numeric": 33
},
"shipping_tax_total": {
"numeric": 18
},
"original_shipping_total": {
"numeric": 1
},
"gift_card_total": {
"numeric": 4
},
"gift_card_tax_total": {
"numeric": 41
},
"shipping_total": {
"numeric": 19
},
"shipping_subtotal": {
"numeric": 43
},
"shipping_tax_total": {
"numeric": 34
},
"original_shipping_total": {
"numeric": 4
},
"original_shipping_subtotal": {
"numeric": 16
"numeric": 47
},
"original_shipping_tax_total": {
"numeric": 20
"numeric": 42
},
"raw_original_item_total": {
"value": "{value}"

View File

@@ -22,7 +22,7 @@ const myWorkflow = createWorkflow(
() => {
const data = validateVariantPricesStep({
"variants": [{
"id": "id_Z5G91ooGu6tQYK"
"id": "id_c7o56DosdFnI"
}]
})
}

View File

@@ -20,30 +20,9 @@ This workflow adds shipping methods to a cart.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/cart/workflows/add-shipping-method-to-cart.ts#L34" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { addShippingMethodToCartWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = addShippingMethodToCartWorkflow
.runAsStep({
input: {
"cart_id": "{value}",
"options": [{
"id": "id_KDqNxUUvYbyo"
}]
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -62,7 +41,7 @@ export async function POST(
input: {
"cart_id": "{value}",
"options": [{
"id": "id_KDqNxUUvYbyo"
"id": "id_qChCECxNY9vE"
}]
}
})
@@ -90,7 +69,7 @@ export default async function handleOrderPlaced({
input: {
"cart_id": "{value}",
"options": [{
"id": "id_KDqNxUUvYbyo"
"id": "id_qChCECxNY9vE"
}]
}
})
@@ -118,7 +97,7 @@ export default async function myCustomJob(
input: {
"cart_id": "{value}",
"options": [{
"id": "id_KDqNxUUvYbyo"
"id": "id_qChCECxNY9vE"
}]
}
})
@@ -130,6 +109,29 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { addShippingMethodToCartWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = addShippingMethodToCartWorkflow
.runAsStep({
input: {
"cart_id": "{value}",
"options": [{
"id": "id_qChCECxNY9vE"
}]
}
})
}
)
```
</CodeTab>

View File

@@ -20,30 +20,9 @@ This workflow adds items to a cart.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/cart/workflows/add-to-cart.ts#L38" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { addToCartWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = addToCartWorkflow
.runAsStep({
input: {
"cart_id": "{value}",
"items": [{
"quantity": 39
}]
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -62,7 +41,7 @@ export async function POST(
input: {
"cart_id": "{value}",
"items": [{
"quantity": 39
"quantity": 25
}]
}
})
@@ -90,7 +69,7 @@ export default async function handleOrderPlaced({
input: {
"cart_id": "{value}",
"items": [{
"quantity": 39
"quantity": 25
}]
}
})
@@ -118,7 +97,7 @@ export default async function myCustomJob(
input: {
"cart_id": "{value}",
"items": [{
"quantity": 39
"quantity": 25
}]
}
})
@@ -130,6 +109,29 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { addToCartWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = addToCartWorkflow
.runAsStep({
input: {
"cart_id": "{value}",
"items": [{
"quantity": 25
}]
}
})
}
)
```
</CodeTab>

View File

@@ -25,27 +25,9 @@ This workflow completes a cart.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/cart/workflows/complete-cart.ts#L48" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { completeCartWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = completeCartWorkflow
.runAsStep({
input: {
"id": "id_9q9ZC6uMIpc99zWSXD"
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -62,7 +44,7 @@ export async function POST(
const { result } = await completeCartWorkflow(req.scope)
.run({
input: {
"id": "id_9q9ZC6uMIpc99zWSXD"
"id": "id_aqIwIQaawJI96nsq"
}
})
@@ -87,7 +69,7 @@ export default async function handleOrderPlaced({
const { result } = await completeCartWorkflow(container)
.run({
input: {
"id": "id_9q9ZC6uMIpc99zWSXD"
"id": "id_aqIwIQaawJI96nsq"
}
})
@@ -112,7 +94,7 @@ export default async function myCustomJob(
const { result } = await completeCartWorkflow(container)
.run({
input: {
"id": "id_9q9ZC6uMIpc99zWSXD"
"id": "id_aqIwIQaawJI96nsq"
}
})
@@ -123,6 +105,26 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { completeCartWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = completeCartWorkflow
.runAsStep({
input: {
"id": "id_aqIwIQaawJI96nsq"
}
})
}
)
```
</CodeTab>

View File

@@ -16,42 +16,9 @@ This workflow confirms for one or more variants that their inventory has a requi
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/cart/workflows/confirm-variant-inventory.ts#L27" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { confirmVariantInventoryWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = confirmVariantInventoryWorkflow
.runAsStep({
input: {
"sales_channel_id": "{value}",
"variants": [{
"id": "id_VLKE0Uxl925CCyfZYn0",
"manage_inventory": true,
"inventory_items": [{
"inventory_item_id": "{value}",
"variant_id": "{value}",
"required_quantity": 21,
"inventory": [{
"location_levels": {}
}]
}]
}],
"items": [{
"quantity": 30
}]
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -70,19 +37,19 @@ export async function POST(
input: {
"sales_channel_id": "{value}",
"variants": [{
"id": "id_VLKE0Uxl925CCyfZYn0",
"id": "id_KTOvaT83mYSDyTJ7qdw",
"manage_inventory": true,
"inventory_items": [{
"inventory_item_id": "{value}",
"variant_id": "{value}",
"required_quantity": 21,
"required_quantity": 16,
"inventory": [{
"location_levels": {}
}]
}]
}],
"items": [{
"quantity": 30
"quantity": 47
}]
}
})
@@ -110,19 +77,19 @@ export default async function handleOrderPlaced({
input: {
"sales_channel_id": "{value}",
"variants": [{
"id": "id_VLKE0Uxl925CCyfZYn0",
"id": "id_KTOvaT83mYSDyTJ7qdw",
"manage_inventory": true,
"inventory_items": [{
"inventory_item_id": "{value}",
"variant_id": "{value}",
"required_quantity": 21,
"required_quantity": 16,
"inventory": [{
"location_levels": {}
}]
}]
}],
"items": [{
"quantity": 30
"quantity": 47
}]
}
})
@@ -150,19 +117,19 @@ export default async function myCustomJob(
input: {
"sales_channel_id": "{value}",
"variants": [{
"id": "id_VLKE0Uxl925CCyfZYn0",
"id": "id_KTOvaT83mYSDyTJ7qdw",
"manage_inventory": true,
"inventory_items": [{
"inventory_item_id": "{value}",
"variant_id": "{value}",
"required_quantity": 21,
"required_quantity": 16,
"inventory": [{
"location_levels": {}
}]
}]
}],
"items": [{
"quantity": 30
"quantity": 47
}]
}
})
@@ -174,6 +141,41 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { confirmVariantInventoryWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = confirmVariantInventoryWorkflow
.runAsStep({
input: {
"sales_channel_id": "{value}",
"variants": [{
"id": "id_KTOvaT83mYSDyTJ7qdw",
"manage_inventory": true,
"inventory_items": [{
"inventory_item_id": "{value}",
"variant_id": "{value}",
"required_quantity": 16,
"inventory": [{
"location_levels": {}
}]
}]
}],
"items": [{
"quantity": 47
}]
}
})
}
)
```
</CodeTab>

View File

@@ -33,35 +33,9 @@ You can also use this workflow within your own custom workflows, allowing you to
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/cart/workflows/create-carts.ts#L77" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { createCartWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = createCartWorkflow
.runAsStep({
input: {
region_id: "reg_123",
items: [{
variant_id: "var_123",
quantity: 1,
}],
customer_id: "cus_123",
additional_data: {
external_id: "123"
}
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -163,6 +137,34 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { createCartWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = createCartWorkflow
.runAsStep({
input: {
region_id: "reg_123",
items: [{
variant_id: "var_123",
quantity: 1,
}],
customer_id: "cus_123",
additional_data: {
external_id: "123"
}
}
})
}
)
```
</CodeTab>

View File

@@ -18,27 +18,9 @@ This workflow creates a payment collection for a cart.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/cart/workflows/create-payment-collection-for-cart.ts#L35" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { createPaymentCollectionForCartWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = createPaymentCollectionForCartWorkflow
.runAsStep({
input: {
"cart_id": "{value}"
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -116,6 +98,26 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { createPaymentCollectionForCartWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = createPaymentCollectionForCartWorkflow
.runAsStep({
input: {
"cart_id": "{value}"
}
})
}
)
```
</CodeTab>

View File

@@ -18,27 +18,9 @@ This workflow lists the shipping options of a cart.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/cart/workflows/list-shipping-options-for-cart-with-pricing.ts#L44" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { listShippingOptionsForCartWithPricingWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = listShippingOptionsForCartWithPricingWorkflow
.runAsStep({
input: {
"cart_id": "{value}"
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -119,6 +101,26 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { listShippingOptionsForCartWithPricingWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = listShippingOptionsForCartWithPricingWorkflow
.runAsStep({
input: {
"cart_id": "{value}"
}
})
}
)
```
</CodeTab>

View File

@@ -17,27 +17,9 @@ This workflow lists the shipping options of a cart.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/cart/workflows/list-shipping-options-for-cart.ts#L16" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { listShippingOptionsForCartWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = listShippingOptionsForCartWorkflow
.runAsStep({
input: {
"cart_id": "{value}"
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -115,6 +97,26 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { listShippingOptionsForCartWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = listShippingOptionsForCartWorkflow
.runAsStep({
input: {
"cart_id": "{value}"
}
})
}
)
```
</CodeTab>

View File

@@ -18,27 +18,9 @@ This workflow refreshes the payment collections of a cart.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/cart/workflows/refresh-payment-collection.ts#L22" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { refreshPaymentCollectionForCartWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = refreshPaymentCollectionForCartWorkflow
.runAsStep({
input: {
"cart_id": "{value}"
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -116,6 +98,26 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { refreshPaymentCollectionForCartWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = refreshPaymentCollectionForCartWorkflow
.runAsStep({
input: {
"cart_id": "{value}"
}
})
}
)
```
</CodeTab>

View File

@@ -17,28 +17,9 @@ This workflow transfers cart's customer.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/cart/workflows/transfer-cart-customer.ts#L15" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { transferCartCustomerWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = transferCartCustomerWorkflow
.runAsStep({
input: {
"id": "id_bBYMRZAzM816",
"customer_id": "{value}"
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -55,7 +36,7 @@ export async function POST(
const { result } = await transferCartCustomerWorkflow(req.scope)
.run({
input: {
"id": "id_bBYMRZAzM816",
"id": "id_2QsAtdSaG9b4ARfkN",
"customer_id": "{value}"
}
})
@@ -81,7 +62,7 @@ export default async function handleOrderPlaced({
const { result } = await transferCartCustomerWorkflow(container)
.run({
input: {
"id": "id_bBYMRZAzM816",
"id": "id_2QsAtdSaG9b4ARfkN",
"customer_id": "{value}"
}
})
@@ -107,7 +88,7 @@ export default async function myCustomJob(
const { result } = await transferCartCustomerWorkflow(container)
.run({
input: {
"id": "id_bBYMRZAzM816",
"id": "id_2QsAtdSaG9b4ARfkN",
"customer_id": "{value}"
}
})
@@ -119,6 +100,27 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { transferCartCustomerWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = transferCartCustomerWorkflow
.runAsStep({
input: {
"id": "id_2QsAtdSaG9b4ARfkN",
"customer_id": "{value}"
}
})
}
)
```
</CodeTab>

View File

@@ -19,27 +19,9 @@ This workflow updates a cart's promotions.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/cart/workflows/update-cart-promotions.ts#L34" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { updateCartPromotionsWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = updateCartPromotionsWorkflow
.runAsStep({
input: {
"cart_id": "{value}"
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -117,6 +99,26 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { updateCartPromotionsWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = updateCartPromotionsWorkflow
.runAsStep({
input: {
"cart_id": "{value}"
}
})
}
)
```
</CodeTab>

View File

@@ -34,40 +34,9 @@ You can also use this workflow within your own custom workflows, allowing you to
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/cart/workflows/update-cart.ts#L80" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { updateCartWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = updateCartWorkflow
.runAsStep({
input: {
id: "cart_123",
region_id: "region_123",
shipping_address: {
first_name: "John",
last_name: "Doe",
address_1: "1234 Main St",
city: "San Francisco",
country_code: "US",
postal_code: "94111",
phone: "1234567890",
},
additional_data: {
external_id: "123"
}
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -184,6 +153,39 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { updateCartWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = updateCartWorkflow
.runAsStep({
input: {
id: "cart_123",
region_id: "region_123",
shipping_address: {
first_name: "John",
last_name: "Doe",
address_1: "1234 Main St",
city: "San Francisco",
country_code: "US",
postal_code: "94111",
phone: "1234567890",
},
additional_data: {
external_id: "123"
}
}
})
}
)
```
</CodeTab>

View File

@@ -19,29 +19,9 @@ This workflow updates a cart's line item.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/cart/workflows/update-line-item-in-cart.ts#L27" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { updateLineItemInCartWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = updateLineItemInCartWorkflow
.runAsStep({
input: {
"cart_id": "{value}",
"item_id": "{value}",
"update": "{value}"
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -125,6 +105,28 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { updateLineItemInCartWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = updateLineItemInCartWorkflow
.runAsStep({
input: {
"cart_id": "{value}",
"item_id": "{value}",
"update": "{value}"
}
})
}
)
```
</CodeTab>

View File

@@ -18,27 +18,9 @@ This workflow updates a cart's tax lines.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/cart/workflows/update-tax-lines.ts#L74" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { updateTaxLinesWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = updateTaxLinesWorkflow
.runAsStep({
input: {
"cart_id": "{value}"
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -116,6 +98,26 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { updateTaxLinesWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = updateTaxLinesWorkflow
.runAsStep({
input: {
"cart_id": "{value}"
}
})
}
)
```
</CodeTab>

View File

@@ -22,73 +22,73 @@ const myWorkflow = createWorkflow(
() => {
const data = validateExistingPaymentCollectionStep({
"cart": {
"id": "id_sol4HzZNPK",
"id": "id_6KeDjKcLAixlmaV",
"currency_code": "{value}",
"original_item_total": {
"numeric": 42
"numeric": 29
},
"original_item_subtotal": {
"numeric": 30
},
"original_item_tax_total": {
"numeric": 24
},
"item_total": {
"numeric": 41
},
"item_subtotal": {
"numeric": 38
},
"item_tax_total": {
"numeric": 44
},
"original_total": {
"numeric": 36
},
"original_subtotal": {
"numeric": 18
},
"original_tax_total": {
"numeric": 44
},
"total": {
"numeric": 42
},
"subtotal": {
"numeric": 3
},
"tax_total": {
"numeric": 14
"original_item_tax_total": {
"numeric": 5
},
"discount_total": {
"numeric": 37
},
"discount_tax_total": {
"numeric": 23
},
"gift_card_total": {
"numeric": 8
},
"gift_card_tax_total": {
"numeric": 23
},
"shipping_total": {
"numeric": 6
},
"shipping_subtotal": {
"numeric": 49
},
"shipping_tax_total": {
"item_total": {
"numeric": 28
},
"original_shipping_total": {
"item_subtotal": {
"numeric": 3
},
"item_tax_total": {
"numeric": 8
},
"original_total": {
"numeric": 12
},
"original_subtotal": {
"numeric": 31
},
"original_tax_total": {
"numeric": 36
},
"total": {
"numeric": 32
},
"subtotal": {
"numeric": 11
},
"tax_total": {
"numeric": 13
},
"discount_total": {
"numeric": 45
},
"discount_tax_total": {
"numeric": 37
},
"gift_card_total": {
"numeric": 17
},
"gift_card_tax_total": {
"numeric": 12
},
"shipping_total": {
"numeric": 39
},
"shipping_subtotal": {
"numeric": 21
},
"shipping_tax_total": {
"numeric": 24
},
"original_shipping_total": {
"numeric": 41
},
"original_shipping_subtotal": {
"numeric": 14
"numeric": 17
},
"original_shipping_tax_total": {
"numeric": 10
"numeric": 1
},
"raw_original_item_total": {
"value": "{value}"

View File

@@ -16,25 +16,9 @@ This workflow manages one or more links to create, update, or dismiss them.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/common/workflows/batch-links.ts#L16" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { batchLinksWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = batchLinksWorkflow
.runAsStep({
input: {}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -106,6 +90,24 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { batchLinksWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = batchLinksWorkflow
.runAsStep({
input: {}
})
}
)
```
</CodeTab>

View File

@@ -16,27 +16,9 @@ This workflow creates one or more links between records.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/common/workflows/create-links.ts#L13" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { createLinksWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = createLinksWorkflow
.runAsStep({
input: [
{}
]
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -114,6 +96,26 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { createLinksWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = createLinksWorkflow
.runAsStep({
input: [
{}
]
})
}
)
```
</CodeTab>

View File

@@ -16,27 +16,9 @@ This workflow dismisses one or more links between records.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/common/workflows/dismiss-links.ts#L13" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { dismissLinksWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = dismissLinksWorkflow
.runAsStep({
input: [
{}
]
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -114,6 +96,26 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { dismissLinksWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = dismissLinksWorkflow
.runAsStep({
input: [
{}
]
})
}
)
```
</CodeTab>

View File

@@ -16,27 +16,9 @@ This workflow updates one or more links between records.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/common/workflows/update-links.ts#L13" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { updateLinksWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = updateLinksWorkflow
.runAsStep({
input: [
{}
]
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -114,6 +96,26 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { updateLinksWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = updateLinksWorkflow
.runAsStep({
input: [
{}
]
})
}
)
```
</CodeTab>

View File

@@ -18,28 +18,9 @@ This workflow creates an authentication account for a customer.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/customer/workflows/create-customer-account.ts#L21" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { createCustomerAccountWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = createCustomerAccountWorkflow
.runAsStep({
input: {
"authIdentityId": "{value}",
"customerData": {}
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -120,6 +101,27 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { createCustomerAccountWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = createCustomerAccountWorkflow
.runAsStep({
input: {
"authIdentityId": "{value}",
"customerData": {}
}
})
}
)
```
</CodeTab>

View File

@@ -22,48 +22,9 @@ You can also use this workflow within your own custom workflows, allowing you to
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/customer/workflows/create-addresses.ts#L74" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { createCustomerAddressesWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = createCustomerAddressesWorkflow
.runAsStep({
input: {
addresses: [{
customer_id: "cus_123",
address_1: "456 Elm St",
city: "Los Angeles",
country_code: "us",
postal_code: "90001",
first_name: "Jane",
last_name: "Smith",
},
{
customer_id: "cus_321",
address_1: "789 Oak St",
city: "New York",
country_code: "us",
postal_code: "10001",
first_name: "Alice",
last_name: "Johnson",
}
],
additional_data: {
crm_id: "123"
}
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -204,6 +165,47 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { createCustomerAddressesWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = createCustomerAddressesWorkflow
.runAsStep({
input: {
addresses: [{
customer_id: "cus_123",
address_1: "456 Elm St",
city: "Los Angeles",
country_code: "us",
postal_code: "90001",
first_name: "Jane",
last_name: "Smith",
},
{
customer_id: "cus_321",
address_1: "789 Oak St",
city: "New York",
country_code: "us",
postal_code: "10001",
first_name: "Alice",
last_name: "Johnson",
}
],
additional_data: {
crm_id: "123"
}
}
})
}
)
```
</CodeTab>

View File

@@ -21,34 +21,9 @@ You can also use this workflow within your own custom workflows, allowing you to
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/customer/workflows/create-customers.ts#L53" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { createCustomersWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = createCustomersWorkflow
.runAsStep({
input: {
customersData: [{
first_name: "John",
last_name: "Doe",
email: "john.doe@example.com",
}, ],
additional_data: {
position_name: "Editor",
}
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -147,6 +122,33 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { createCustomersWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = createCustomersWorkflow
.runAsStep({
input: {
customersData: [{
first_name: "John",
last_name: "Doe",
email: "john.doe@example.com",
}, ],
additional_data: {
position_name: "Editor",
}
}
})
}
)
```
</CodeTab>

View File

@@ -16,29 +16,9 @@ This workflow deletes one or more customer addresses.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/customer/workflows/delete-addresses.ts#L15" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { deleteCustomerAddressesWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = deleteCustomerAddressesWorkflow
.runAsStep({
input: {
"ids": [
"id_aMbyMBeBAP3a7KPCIXCa"
]
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -56,7 +36,7 @@ export async function POST(
.run({
input: {
"ids": [
"id_aMbyMBeBAP3a7KPCIXCa"
"id_IRZjwuK6l3RnpPQQ"
]
}
})
@@ -83,7 +63,7 @@ export default async function handleOrderPlaced({
.run({
input: {
"ids": [
"id_aMbyMBeBAP3a7KPCIXCa"
"id_IRZjwuK6l3RnpPQQ"
]
}
})
@@ -110,7 +90,7 @@ export default async function myCustomJob(
.run({
input: {
"ids": [
"id_aMbyMBeBAP3a7KPCIXCa"
"id_IRZjwuK6l3RnpPQQ"
]
}
})
@@ -122,6 +102,28 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { deleteCustomerAddressesWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = deleteCustomerAddressesWorkflow
.runAsStep({
input: {
"ids": [
"id_IRZjwuK6l3RnpPQQ"
]
}
})
}
)
```
</CodeTab>

View File

@@ -17,29 +17,9 @@ This workflow deletes one or more customers.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/customer/workflows/delete-customers.ts#L18" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { deleteCustomersWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = deleteCustomersWorkflow
.runAsStep({
input: {
"ids": [
"id_CAKCZqXNMHsyXYxqkzd"
]
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -57,7 +37,7 @@ export async function POST(
.run({
input: {
"ids": [
"id_CAKCZqXNMHsyXYxqkzd"
"id_u8jbRquADYmhFumllb"
]
}
})
@@ -84,7 +64,7 @@ export default async function handleOrderPlaced({
.run({
input: {
"ids": [
"id_CAKCZqXNMHsyXYxqkzd"
"id_u8jbRquADYmhFumllb"
]
}
})
@@ -111,7 +91,7 @@ export default async function myCustomJob(
.run({
input: {
"ids": [
"id_CAKCZqXNMHsyXYxqkzd"
"id_u8jbRquADYmhFumllb"
]
}
})
@@ -123,6 +103,28 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { deleteCustomersWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = deleteCustomersWorkflow
.runAsStep({
input: {
"ids": [
"id_u8jbRquADYmhFumllb"
]
}
})
}
)
```
</CodeTab>

View File

@@ -19,27 +19,9 @@ This workflow deletes a user and remove the association in the auth identity.
<SourceCodeLink link="https://github.com/medusajs/medusa/blob/1b86c17b7293f3b810c062d78ec6ef563f968366/packages/core/core-flows/src/customer/workflows/remove-customer-account.ts#L20" />
## Examples
<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { removeCustomerAccountWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = removeCustomerAccountWorkflow
.runAsStep({
input: {
"customerId": "{value}"
}
})
}
)
```
</CodeTab>
<CodeTab label="API Route" value="api-route">
```ts title="src/api/workflow/route.ts"
@@ -117,6 +99,26 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}
```
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { removeCustomerAccountWorkflow } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
const result = removeCustomerAccountWorkflow
.runAsStep({
input: {
"customerId": "{value}"
}
})
}
)
```
</CodeTab>

Some files were not shown because too many files have changed in this diff Show More