docs: revise main docs outline (#10502)
This commit is contained in:
@@ -10,11 +10,11 @@ In the [previous chapter](../service/page.mdx), you created a CMS Module that in
|
||||
|
||||
In another previous chapter, you [added a workflow](../../custom-features/workflow/page.mdx) that creates a brand. After integrating the CMS, you want to sync that brand to the third-party system as well.
|
||||
|
||||
Medusa has an event system that emits events when an operation is performed. It allows you to listen to those events and perform an asynchronous action in a function called a [subscriber](../../../basics/events-and-subscribers/page.mdx). This is useful to perform actions that aren't integral to the original flow, such as syncing data to a third-party system.
|
||||
Medusa has an event system that emits events when an operation is performed. It allows you to listen to those events and perform an asynchronous action in a function called a [subscriber](../../../fundamentals/events-and-subscribers/page.mdx). This is useful to perform actions that aren't integral to the original flow, such as syncing data to a third-party system.
|
||||
|
||||
<Note>
|
||||
|
||||
Learn more about Medusa's event system and subscribers in [this chapter](../../../basics/events-and-subscribers/page.mdx).
|
||||
Learn more about Medusa's event system and subscribers in [this chapter](../../../fundamentals/events-and-subscribers/page.mdx).
|
||||
|
||||
</Note>
|
||||
|
||||
@@ -87,13 +87,13 @@ Workflows have a built-in durable execution engine that helps you complete tasks
|
||||
|
||||
<Note>
|
||||
|
||||
Learn more about workflows in [this chapter](../../../basics/workflows/page.mdx).
|
||||
Learn more about workflows in [this chapter](../../../fundamentals/workflows/page.mdx).
|
||||
|
||||
</Note>
|
||||
|
||||
You'll create a `syncBrandToSystemWorkflow` that has two steps:
|
||||
|
||||
- `useQueryGraphStep`: a step that Medusa provides to retrieve data using [Query](../../../advanced-development/module-links/query/page.mdx). You'll use this to retrieve the brand's details using its ID.
|
||||
- `useQueryGraphStep`: a step that Medusa provides to retrieve data using [Query](../../../fundamentals/module-links/query/page.mdx). You'll use this to retrieve the brand's details using its ID.
|
||||
- `syncBrandToCmsStep`: a step that you'll create to sync the brand to the CMS.
|
||||
|
||||
### syncBrandToCmsStep
|
||||
@@ -142,13 +142,13 @@ const syncBrandToCmsStep = createStep(
|
||||
)
|
||||
```
|
||||
|
||||
You create the `syncBrandToCmsStep` that accepts a brand as an input. In the step, you resolve the CMS Module's service from the [Medusa container](../../../basics/medusa-container/page.mdx) and use its `createBrand` method. This method will create the brand in the third-party CMS.
|
||||
You create the `syncBrandToCmsStep` that accepts a brand as an input. In the step, you resolve the CMS Module's service from the [Medusa container](../../../fundamentals/medusa-container/page.mdx) and use its `createBrand` method. This method will create the brand in the third-party CMS.
|
||||
|
||||
You also pass the brand's ID to the step's compensation function. In this function, you delete the brand in the third-party CMS if an error occurs during the workflow's execution.
|
||||
|
||||
<Note>
|
||||
|
||||
Learn more about compensation functions in [this chapter](../../../advanced-development/workflows/compensation-function/page.mdx).
|
||||
Learn more about compensation functions in [this chapter](../../../fundamentals/workflows/compensation-function/page.mdx).
|
||||
|
||||
</Note>
|
||||
|
||||
@@ -270,7 +270,7 @@ In the function, you execute the `syncBrandToCmsWorkflow`, passing it the data p
|
||||
|
||||
<Note>
|
||||
|
||||
Learn more about subscribers in [this chapter](../../../basics/events-and-subscribers/page.mdx).
|
||||
Learn more about subscribers in [this chapter](../../../fundamentals/events-and-subscribers/page.mdx).
|
||||
|
||||
</Note>
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ In Medusa, you integrate a third-party system by:
|
||||
|
||||
1. Creating a module whose service provides the methods to connect to and perform operations in the third-party system.
|
||||
2. Building workflows that complete tasks spanning across systems. You use the module that integrates a third-party system in the workflow's steps.
|
||||
3. Executing the workflows you built in an [API route](../../basics/api-routes/page.mdx), at a scheduled time, or when an event is emitted.
|
||||
3. Executing the workflows you built in an [API route](../../fundamentals/api-routes/page.mdx), at a scheduled time, or when an event is emitted.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ You can create an action to be automatically executed at a specified interval us
|
||||
|
||||
<Note>
|
||||
|
||||
Learn more about scheduled jobs in [this chapter](../../../basics/scheduled-jobs/page.mdx).
|
||||
Learn more about scheduled jobs in [this chapter](../../../fundamentals/scheduled-jobs/page.mdx).
|
||||
|
||||
</Note>
|
||||
|
||||
@@ -39,7 +39,7 @@ Workflows have a built-in durable execution engine that helps you complete tasks
|
||||
|
||||
<Note>
|
||||
|
||||
Learn more about workflows in [this chapter](../../../basics/workflows/page.mdx).
|
||||
Learn more about workflows in [this chapter](../../../fundamentals/workflows/page.mdx).
|
||||
|
||||
</Note>
|
||||
|
||||
@@ -134,7 +134,7 @@ The step passes the created brands to the compensation function, which deletes t
|
||||
|
||||
<Note>
|
||||
|
||||
Learn more about compensation functions in [this chapter](../../../advanced-development/workflows/compensation-function/page.mdx).
|
||||
Learn more about compensation functions in [this chapter](../../../fundamentals/workflows/compensation-function/page.mdx).
|
||||
|
||||
</Note>
|
||||
|
||||
@@ -220,11 +220,11 @@ export const syncBrandsFromSystemWorkflow = createWorkflow(
|
||||
|
||||
In the workflow, you only use the `retrieveBrandsFromSystemStep` for now, which retrieves the brands from the third-party CMS.
|
||||
|
||||
Next, you need to identify which brands must be created or updated. Since workflows are constructed internally and are only evaluated during execution, you can't access values to perform data manipulation directly. Instead, use [transform](../../../advanced-development/workflows/variable-manipulation/page.mdx) from the Workflows SDK that gives you access to the real-time values of the data, allowing you to create new variables using those values.
|
||||
Next, you need to identify which brands must be created or updated. Since workflows are constructed internally and are only evaluated during execution, you can't access values to perform data manipulation directly. Instead, use [transform](../../../fundamentals/workflows/variable-manipulation/page.mdx) from the Workflows SDK that gives you access to the real-time values of the data, allowing you to create new variables using those values.
|
||||
|
||||
<Note>
|
||||
|
||||
Learn more about data manipulation using `transform` in [this chapter](../../../advanced-development/workflows/variable-manipulation/page.mdx).
|
||||
Learn more about data manipulation using `transform` in [this chapter](../../../fundamentals/workflows/variable-manipulation/page.mdx).
|
||||
|
||||
</Note>
|
||||
|
||||
@@ -320,7 +320,7 @@ A scheduled job file must export:
|
||||
- `name`: A unique name for the scheduled job.
|
||||
- `schedule`: A string that holds a [cron expression](https://crontab.guru/) indicating the schedule to run the job.
|
||||
|
||||
The scheduled job function accepts as a parameter the [Medusa container](../../../basics/medusa-container/page.mdx) used to resolve framework and commerce tools. You then execute the `syncBrandsFromCmsWorkflow` and use its result to log how many brands were created or updated.
|
||||
The scheduled job function accepts as a parameter the [Medusa container](../../../fundamentals/medusa-container/page.mdx) used to resolve framework and commerce tools. You then execute the `syncBrandsFromCmsWorkflow` and use its result to log how many brands were created or updated.
|
||||
|
||||
Based on the cron expression specified in `config.schedule`, Medusa will run the scheduled job every day at midnight. You can also change it to `* * * * *` to run it every minute for easier debugging.
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ In the previous chapters, you've created a [Brand Module](../../custom-features/
|
||||
|
||||
<Note>
|
||||
|
||||
Learn more about modules in [this chapter](../../../basics/modules/page.mdx).
|
||||
Learn more about modules in [this chapter](../../../fundamentals/modules/page.mdx).
|
||||
|
||||
</Note>
|
||||
|
||||
@@ -66,7 +66,7 @@ export default CmsModuleService
|
||||
|
||||
You create a `CmsModuleService` that will hold the methods to connect to the third-party CMS. A service's constructor accepts two parameters:
|
||||
|
||||
1. The module's container. Since a module is [isolated](../../../advanced-development/modules/isolation/page.mdx), it has a [local container](../../../advanced-development/modules/container/page.mdx) different than the Medusa container you use in other customizations. This container holds framework tools like the [Logger utility](../../../debugging-and-testing/logging/page.mdx) and resources within the module.
|
||||
1. The module's container. Since a module is [isolated](../../../fundamentals/modules/isolation/page.mdx), it has a [local container](../../../fundamentals/modules/container/page.mdx) different than the Medusa container you use in other customizations. This container holds framework tools like the [Logger utility](../../../debugging-and-testing/logging/page.mdx) and resources within the module.
|
||||
2. Options passed to the module when it's later added in Medusa's configurations. These options are useful to pass secret keys or configurations that ensure your module is re-usable across applications. For the CMS Module, you accept the API key to connect to the dummy CMS as an option.
|
||||
|
||||
When integrating a third-party system that has a Node.js SDK or client, you can initialize that client in the constructor to be used in the service's methods.
|
||||
|
||||
Reference in New Issue
Block a user