docs: rename remoteLink and remoteQueryConfig (#10836)
* docs: rename remoteLink and remoteQueryConfig * change version number
This commit is contained in:
@@ -25,7 +25,7 @@ Replace or create the `GET` API route at `src/api/admin/brands/route.ts` with th
|
||||
|
||||
export const apiRouteHighlights = [
|
||||
["15", "metadata", "Pagination details, such as the total count or how many items were skipped."],
|
||||
["18", "remoteQueryConfig", "Query configurations parsed from the request."],
|
||||
["18", "queryConfig", "Query configurations parsed from the request."],
|
||||
]
|
||||
|
||||
```ts title="src/api/admin/brands/route.ts" highlights={apiRouteHighlights}
|
||||
@@ -46,7 +46,7 @@ export const GET = async (
|
||||
metadata: { count, take, skip },
|
||||
} = await query.graph({
|
||||
entity: "brand",
|
||||
...req.remoteQueryConfig,
|
||||
...req.queryConfig,
|
||||
})
|
||||
|
||||
res.json({
|
||||
@@ -58,7 +58,7 @@ export const GET = async (
|
||||
}
|
||||
```
|
||||
|
||||
In the API route, you use Query's `graph` method to retrieve the brands. In the method's object parameter, you spread the `remoteQueryConfig` property of the request object. This property holds configurations for pagination and retrieved fields.
|
||||
In the API route, you use Query's `graph` method to retrieve the brands. In the method's object parameter, you spread the `queryConfig` property of the request object. This property holds configurations for pagination and retrieved fields.
|
||||
|
||||
The query configurations are combined from default configurations, which you'll add next, and the request's query parameters:
|
||||
|
||||
|
||||
@@ -93,25 +93,25 @@ In the step, if a brand ID is passed in `additional_data`, you resolve the Brand
|
||||
|
||||
### Link Brand to Product
|
||||
|
||||
Next, you want to create a link between the created products and the brand. To do so, you use Remote Link, which is a class from the Modules SDK that provides methods to manage linked records.
|
||||
Next, you want to create a link between the created products and the brand. To do so, you use Link, which is a class from the Modules SDK that provides methods to manage linked records.
|
||||
|
||||
<Note>
|
||||
|
||||
Learn more about the remote link in [this chapter](../../../fundamentals/module-links/remote-link/page.mdx).
|
||||
Learn more about Link in [this chapter](../../../fundamentals/module-links/link/page.mdx).
|
||||
|
||||
</Note>
|
||||
|
||||
To use the remote link in the `productCreated` hook, replace the `TODO` with the following:
|
||||
To use Link in the `productCreated` hook, replace the `TODO` with the following:
|
||||
|
||||
export const hook2Highlights = [
|
||||
["1", `"remoteLink"`, "Resolve the remote link from the container."]
|
||||
["1", `"link"`, "Resolve Link from the container."]
|
||||
["4", "links", "Define an array to store the links in."],
|
||||
["7", "push", "Add a link to be created."],
|
||||
["17", "create", "Create the links."]
|
||||
]
|
||||
|
||||
```ts title="src/workflows/hooks/created-product.ts" highlights={hook2Highlights}
|
||||
const remoteLink = container.resolve("remoteLink")
|
||||
const link = container.resolve("link")
|
||||
const logger = container.resolve("logger")
|
||||
|
||||
const links: LinkDefinition[] = []
|
||||
@@ -127,14 +127,14 @@ for (const product of products) {
|
||||
})
|
||||
}
|
||||
|
||||
await remoteLink.create(links)
|
||||
await link.create(links)
|
||||
|
||||
logger.info("Linked brand to products")
|
||||
|
||||
return new StepResponse(links, links)
|
||||
```
|
||||
|
||||
You resolve the remote link from the container. Then you loop over the created products to assemble an array of links to be created. After that, you pass the array of links to remote link's `create` method, which will link the product and brand records.
|
||||
You resolve Link from the container. Then you loop over the created products to assemble an array of links to be created. After that, you pass the array of links to Link's `create` method, which will link the product and brand records.
|
||||
|
||||
Each property in the link object is the name of a module, and its value is an object having a `{model_name}_id` property, where `{model_name}` is the snake-case name of the module's data model. Its value is the ID of the record to be linked. The link object's properties must be set in the same order as the link configurations passed to `defineLink`.
|
||||
|
||||
@@ -156,14 +156,14 @@ createProductsWorkflow.hooks.productsCreated(
|
||||
return
|
||||
}
|
||||
|
||||
const remoteLink = container.resolve("remoteLink")
|
||||
const link = container.resolve("link")
|
||||
|
||||
await remoteLink.dismiss(links)
|
||||
await link.dismiss(links)
|
||||
})
|
||||
)
|
||||
```
|
||||
|
||||
In the compensation function, if the `links` parameter isn't empty, you resolve remote link from the container and use its `dismiss` method. This method removes a link between two records. It accepts the same parameter as the `create` method.
|
||||
In the compensation function, if the `links` parameter isn't empty, you resolve Link from the container and use its `dismiss` method. This method removes a link between two records. It accepts the same parameter as the `create` method.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -81,18 +81,18 @@ The column's configurations object accepts the following properties:
|
||||
|
||||
## Set Custom Column when Creating Link
|
||||
|
||||
The object you pass to the remote link's `create` method accepts a `data` property. Its value is an object whose keys are custom column names, and values are the value of the custom column for this link.
|
||||
The object you pass to Link's `create` method accepts a `data` property. Its value is an object whose keys are custom column names, and values are the value of the custom column for this link.
|
||||
|
||||
For example:
|
||||
|
||||
<Note>
|
||||
|
||||
Learn more about the remote link, how to resolve it, and its methods in [this chapter](../remote-link/page.mdx).
|
||||
Learn more about Link, how to resolve it, and its methods in [this chapter](../link/page.mdx).
|
||||
|
||||
</Note>
|
||||
|
||||
```ts
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.PRODUCT]: {
|
||||
product_id: "123",
|
||||
},
|
||||
@@ -145,14 +145,14 @@ In the `fields` array you pass `metadata`, which is the custom column to retriev
|
||||
|
||||
## Update Custom Column's Value
|
||||
|
||||
The remote link's `create` method updates a link's data if the link between the specified records already exists.
|
||||
Link's `create` method updates a link's data if the link between the specified records already exists.
|
||||
|
||||
So, to update the value of a custom column in a created link, use the `create` method again passing it a new value for the custom column.
|
||||
|
||||
For example:
|
||||
|
||||
```ts
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.PRODUCT]: {
|
||||
product_id: "123",
|
||||
},
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
export const metadata = {
|
||||
title: `${pageNumber} Remote Link`,
|
||||
title: `${pageNumber} Link`,
|
||||
}
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
In this chapter, you’ll learn what the remote link is and how to use it to manage links.
|
||||
In this chapter, you’ll learn what Link is and how to use it to manage links.
|
||||
|
||||
## What is the Remote Link?
|
||||
<Note>
|
||||
|
||||
The remote link is a class with utility methods to manage links between data models. It’s registered in the Medusa container under the `remoteLink` registration name.
|
||||
As of [Medusa v2.2.0](https://github.com/medusajs/medusa/releases/tag/v2.2.0), Remote Link has been deprecated in favor of Link. They have the same usage, so you only need to change the key used to resolve the tool from the Medusa container as explained below.
|
||||
|
||||
</Note>
|
||||
|
||||
## What is Link?
|
||||
|
||||
Link is a class with utility methods to manage links between data models. It’s registered in the Medusa container under the `link` registration name.
|
||||
|
||||
For example:
|
||||
|
||||
@@ -20,16 +26,13 @@ import {
|
||||
import {
|
||||
ContainerRegistrationKeys,
|
||||
} from "@medusajs/framework/utils"
|
||||
import {
|
||||
RemoteLink,
|
||||
} from "@medusajs/framework/modules-sdk"
|
||||
|
||||
export async function POST(
|
||||
req: MedusaRequest,
|
||||
res: MedusaResponse
|
||||
): Promise<void> {
|
||||
const remoteLink: RemoteLink = req.scope.resolve(
|
||||
ContainerRegistrationKeys.REMOTE_LINK
|
||||
const link = req.scope.resolve(
|
||||
ContainerRegistrationKeys.LINK
|
||||
)
|
||||
|
||||
// ...
|
||||
@@ -42,7 +45,7 @@ You can use its methods to manage links, such as create or delete links.
|
||||
|
||||
## Create Link
|
||||
|
||||
To create a link between records of two data models, use the `create` method of the remote link.
|
||||
To create a link between records of two data models, use the `create` method of Link.
|
||||
|
||||
For example:
|
||||
|
||||
@@ -51,7 +54,7 @@ import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.PRODUCT]: {
|
||||
product_id: "prod_123",
|
||||
},
|
||||
@@ -65,7 +68,7 @@ The `create` method accepts as a parameter an object. The object’s keys are th
|
||||
|
||||
<Note title="Important">
|
||||
|
||||
The keys (names of linked modules) must be in the same direction of the link definition.
|
||||
The keys (names of linked modules) must be in the same [direction](../directions/page.mdx) of the link definition.
|
||||
|
||||
</Note>
|
||||
|
||||
@@ -77,7 +80,7 @@ So, in the example above, you link a record of the `MyCustom` data model in a `h
|
||||
|
||||
## Dismiss Link
|
||||
|
||||
To remove a link between records of two data models, use the `dismiss` method of the remote link.
|
||||
To remove a link between records of two data models, use the `dismiss` method of Link.
|
||||
|
||||
For example:
|
||||
|
||||
@@ -86,7 +89,7 @@ import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.dismiss({
|
||||
await link.dismiss({
|
||||
[Modules.PRODUCT]: {
|
||||
product_id: "prod_123",
|
||||
},
|
||||
@@ -100,7 +103,7 @@ The `dismiss` method accepts the same parameter type as the [create method](#cre
|
||||
|
||||
<Note title="Important">
|
||||
|
||||
The keys (names of linked modules) must be in the same direction of the link definition.
|
||||
The keys (names of linked modules) must be in the same [direction](../directions/page.mdx) of the link definition.
|
||||
|
||||
</Note>
|
||||
|
||||
@@ -108,7 +111,7 @@ The keys (names of linked modules) must be in the same direction of the link def
|
||||
|
||||
## Cascade Delete Linked Records
|
||||
|
||||
If a record is deleted, use the `delete` method of the remote link to delete all linked records.
|
||||
If a record is deleted, use the `delete` method of Link to delete all linked records.
|
||||
|
||||
For example:
|
||||
|
||||
@@ -119,7 +122,7 @@ import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
await productModuleService.deleteVariants([variant.id])
|
||||
|
||||
await remoteLink.delete({
|
||||
await link.delete({
|
||||
[Modules.PRODUCT]: {
|
||||
product_id: "prod_123",
|
||||
},
|
||||
@@ -132,7 +135,7 @@ This deletes all records linked to the deleted product.
|
||||
|
||||
## Restore Linked Records
|
||||
|
||||
If a record that was previously soft-deleted is now restored, use the `restore` method of the remote link to restore all linked records.
|
||||
If a record that was previously soft-deleted is now restored, use the `restore` method of Link to restore all linked records.
|
||||
|
||||
For example:
|
||||
|
||||
@@ -143,7 +146,7 @@ import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
await productModuleService.restoreProducts(["prod_123"])
|
||||
|
||||
await remoteLink.restore({
|
||||
await link.restore({
|
||||
[Modules.PRODUCT]: {
|
||||
product_id: "prod_123",
|
||||
},
|
||||
@@ -346,12 +346,18 @@ The `validateAndTransformQuery` accepts two parameters:
|
||||
|
||||
After applying this middleware, your API route now accepts the `fields`, `offset`, `limit`, and `order` query parameters mentioned above.
|
||||
|
||||
The middleware transforms these parameters to configurations that you can pass to Query in your API route handler. These configurations are stored in the `remoteQueryConfig` parameter of the `MedusaRequest` object.
|
||||
The middleware transforms these parameters to configurations that you can pass to Query in your API route handler. These configurations are stored in the `queryConfig` parameter of the `MedusaRequest` object.
|
||||
|
||||
<Note>
|
||||
|
||||
As of [Medusa v2.2.0](https://github.com/medusajs/medusa/releases/tag/v2.2.0), `remoteQueryConfig` has been depercated in favor of `queryConfig`. Their usage is still the same, only the property name has changed.
|
||||
|
||||
</Note>
|
||||
|
||||
For example, Create the file `src/api/customs/route.ts` with the following content:
|
||||
|
||||
export const queryConfigHighlights = [
|
||||
["17", "req.remoteQueryConfig", "Pass the parsed request Query configurations to the Query graph execution."]
|
||||
["17", "req.queryConfig", "Pass the parsed request Query configurations to the Query graph execution."]
|
||||
]
|
||||
|
||||
```ts title="src/api/customs/route.ts"
|
||||
@@ -371,7 +377,7 @@ export const GET = async (
|
||||
|
||||
const { data: myCustoms } = await query.graph({
|
||||
entity: "my_custom",
|
||||
...req.remoteQueryConfig,
|
||||
...req.queryConfig,
|
||||
})
|
||||
|
||||
res.json({ my_customs: myCustoms })
|
||||
@@ -380,7 +386,7 @@ export const GET = async (
|
||||
|
||||
This adds a `GET` API route at `/customs`, which is the API route you added the middleware for.
|
||||
|
||||
In the API route, you pass `req.remoteQueryConfig` to `query.graph`. `remoteQueryConfig` has properties like `fields` and `pagination` to configure the query based on the default values you specified in the middleware, and the query parameters passed in the request.
|
||||
In the API route, you pass `req.queryConfig` to `query.graph`. `queryConfig` has properties like `fields` and `pagination` to configure the query based on the default values you specified in the middleware, and the query parameters passed in the request.
|
||||
|
||||
### Test it Out
|
||||
|
||||
|
||||
@@ -72,11 +72,10 @@ export const generatedEditDates = {
|
||||
"app/learn/fundamentals/admin/constraints/page.mdx": "2024-10-21T13:30:21.366Z",
|
||||
"app/learn/debugging-and-testing/testing-tools/modules-tests/module-example/page.mdx": "2024-12-09T15:52:22.185Z",
|
||||
"app/learn/debugging-and-testing/testing-tools/modules-tests/page.mdx": "2024-12-09T15:52:57.091Z",
|
||||
"app/learn/fundamentals/module-links/custom-columns/page.mdx": "2024-11-20T14:32:09.764Z",
|
||||
"app/learn/fundamentals/module-links/custom-columns/page.mdx": "2025-01-06T11:19:13.178Z",
|
||||
"app/learn/fundamentals/module-links/directions/page.mdx": "2024-12-12T15:31:31.555Z",
|
||||
"app/learn/fundamentals/module-links/page.mdx": "2024-12-09T14:39:26.668Z",
|
||||
"app/learn/fundamentals/module-links/query/page.mdx": "2024-12-09T15:54:44.798Z",
|
||||
"app/learn/fundamentals/module-links/remote-link/page.mdx": "2024-10-28T04:22:21.328Z",
|
||||
"app/learn/fundamentals/modules/db-operations/page.mdx": "2024-12-09T14:40:50.581Z",
|
||||
"app/learn/fundamentals/modules/multiple-services/page.mdx": "2024-10-21T13:30:21.370Z",
|
||||
"app/learn/fundamentals/modules/page.mdx": "2024-12-09T15:55:25.858Z",
|
||||
@@ -86,7 +85,7 @@ export const generatedEditDates = {
|
||||
"app/learn/customization/custom-features/api-route/page.mdx": "2024-12-09T10:39:30.046Z",
|
||||
"app/learn/customization/custom-features/module/page.mdx": "2024-12-09T14:36:02.100Z",
|
||||
"app/learn/customization/custom-features/workflow/page.mdx": "2024-12-09T14:36:29.482Z",
|
||||
"app/learn/customization/extend-features/extend-create-product/page.mdx": "2024-12-23T15:42:23.863Z",
|
||||
"app/learn/customization/extend-features/extend-create-product/page.mdx": "2025-01-06T11:18:58.250Z",
|
||||
"app/learn/customization/custom-features/page.mdx": "2024-12-09T10:46:28.593Z",
|
||||
"app/learn/customization/customize-admin/page.mdx": "2024-12-09T11:02:38.801Z",
|
||||
"app/learn/customization/customize-admin/route/page.mdx": "2024-12-24T15:08:46.095Z",
|
||||
@@ -108,5 +107,6 @@ export const generatedEditDates = {
|
||||
"app/learn/deployment/general/page.mdx": "2024-11-25T14:33:50.439Z",
|
||||
"app/learn/fundamentals/workflows/multiple-step-usage/page.mdx": "2024-11-25T16:19:32.169Z",
|
||||
"app/learn/installation/page.mdx": "2024-12-12T15:22:29.182Z",
|
||||
"app/learn/fundamentals/data-models/check-constraints/page.mdx": "2024-12-06T14:34:50.384Z"
|
||||
"app/learn/fundamentals/data-models/check-constraints/page.mdx": "2024-12-06T14:34:50.384Z",
|
||||
"app/learn/fundamentals/module-links/link/page.mdx": "2025-01-06T09:27:25.604Z"
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
import { generateEditedDates } from "build-scripts"
|
||||
import path from "path"
|
||||
import { generateTags } from "tags"
|
||||
|
||||
async function main() {
|
||||
await generateEditedDates()
|
||||
await generateTags(path.resolve("..", "..", "packages", "tags"))
|
||||
}
|
||||
|
||||
void main()
|
||||
|
||||
@@ -108,6 +108,11 @@ const redirects = async () => {
|
||||
destination: "/resources/nextjs-starter",
|
||||
permanent: true,
|
||||
},
|
||||
{
|
||||
source: "/learn/fundamentals/module-links/remote-link",
|
||||
destination: "/learn/fundamentals/module-links/link",
|
||||
permanent: true,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -65,19 +65,19 @@ const { data: apiKeys } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the sales channels of an API key, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the sales channels of an API key, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.API_KEY]: {
|
||||
api_key_id: "apk_123",
|
||||
},
|
||||
|
||||
@@ -121,19 +121,19 @@ const { data: carts } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the order of a cart, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the order of a cart, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.CART]: {
|
||||
cart_id: "cart_123",
|
||||
},
|
||||
@@ -214,19 +214,19 @@ const { data: carts } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the payment collection of a cart, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the payment collection of a cart, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.CART]: {
|
||||
cart_id: "cart_123",
|
||||
},
|
||||
@@ -368,19 +368,19 @@ const { data: carts } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the promotions of a cart, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the promotions of a cart, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.CART]: {
|
||||
cart_id: "cart_123",
|
||||
},
|
||||
|
||||
@@ -77,19 +77,19 @@ const { data: fulfillments } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the order of a cart, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the order of a cart, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.ORDER]: {
|
||||
order_id: "order_123",
|
||||
},
|
||||
@@ -170,19 +170,19 @@ const { data: shippingOptions } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the price set of a shipping option, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the price set of a shipping option, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.FULFILLMENT]: {
|
||||
shipping_option_id: "so_123",
|
||||
},
|
||||
@@ -273,19 +273,19 @@ const { data: fulfillmentSets } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the stock location of a fulfillment set, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the stock location of a fulfillment set, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.STOCK_LOCATION]: {
|
||||
stock_location_id: "sloc_123",
|
||||
},
|
||||
|
||||
@@ -70,19 +70,19 @@ const { data: inventoryItems } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the variants of an inventory item, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the variants of an inventory item, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.PRODUCT]: {
|
||||
variant_id: "variant_123",
|
||||
},
|
||||
|
||||
@@ -124,19 +124,19 @@ const { data: orders } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the cart of an order, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the cart of an order, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.ORDER]: {
|
||||
order_id: "order_123",
|
||||
},
|
||||
@@ -225,19 +225,19 @@ const { data: orders } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the fulfillments of an order, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the fulfillments of an order, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.ORDER]: {
|
||||
order_id: "order_123",
|
||||
},
|
||||
@@ -318,19 +318,19 @@ const { data: orders } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the payment collections of an order, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the payment collections of an order, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.ORDER]: {
|
||||
order_id: "order_123",
|
||||
},
|
||||
@@ -463,19 +463,19 @@ const { data: orders } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the promotion of an order, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the promotion of an order, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.ORDER]: {
|
||||
order_id: "order_123",
|
||||
},
|
||||
|
||||
@@ -67,19 +67,19 @@ const { data: paymentCollections } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the payment collection of a cart, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the payment collection of a cart, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.CART]: {
|
||||
cart_id: "cart_123",
|
||||
},
|
||||
@@ -159,19 +159,19 @@ const { data: paymentCollections } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the payment collections of an order, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the payment collections of an order, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.ORDER]: {
|
||||
order_id: "order_123",
|
||||
},
|
||||
@@ -252,19 +252,19 @@ const { data: paymentProviders } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the payment providers in a region, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the payment providers in a region, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.REGION]: {
|
||||
region_id: "reg_123",
|
||||
},
|
||||
|
||||
@@ -49,12 +49,12 @@ import {
|
||||
|
||||
// ...
|
||||
|
||||
// resolve the remote link
|
||||
const remoteLink = container.resolve(
|
||||
ContainerRegistrationKeys
|
||||
// resolve Link
|
||||
const link = container.resolve(
|
||||
ContainerRegistrationKeys.LINK
|
||||
)
|
||||
|
||||
remoteLink.create({
|
||||
link.create({
|
||||
[Modules.CART]: {
|
||||
cart_id: "cart_123",
|
||||
},
|
||||
@@ -66,7 +66,7 @@ remoteLink.create({
|
||||
|
||||
<Note title="Tip">
|
||||
|
||||
Learn more about the remote link in [this documentation](!docs!/learn/fundamentals/module-links/remote-link).
|
||||
Learn more about Link in [this documentation](!docs!/learn/fundamentals/module-links/link).
|
||||
|
||||
</Note>
|
||||
|
||||
|
||||
@@ -64,19 +64,19 @@ const { data: priceSets } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the price set of a shipping option, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the price set of a shipping option, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.FULFILLMENT]: {
|
||||
shipping_option_id: "so_123",
|
||||
},
|
||||
@@ -161,19 +161,19 @@ const { data: priceSets } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the price set of a variant, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the price set of a variant, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.PRODUCT]: {
|
||||
variant_id: "variant_123",
|
||||
},
|
||||
|
||||
@@ -129,19 +129,19 @@ const { data: variants } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the inventory items of a variant, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the inventory items of a variant, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.PRODUCT]: {
|
||||
variant_id: "variant_123",
|
||||
},
|
||||
@@ -278,19 +278,19 @@ const { data: variants } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the price set of a variant, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the price set of a variant, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.PRODUCT]: {
|
||||
variant_id: "variant_123",
|
||||
},
|
||||
@@ -371,19 +371,19 @@ const { data: products } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the sales channels of a product, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the sales channels of a product, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.PRODUCT]: {
|
||||
product_id: "prod_123",
|
||||
},
|
||||
|
||||
@@ -77,19 +77,19 @@ const { data: promotions } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the promotions of a cart, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the promotions of a cart, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.CART]: {
|
||||
cart_id: "cart_123",
|
||||
},
|
||||
@@ -168,19 +168,19 @@ const { data: promotions } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the promotion of an order, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the promotion of an order, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.ORDER]: {
|
||||
order_id: "order_123",
|
||||
},
|
||||
|
||||
@@ -161,19 +161,19 @@ const { data: regions } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the payment providers in a region, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the payment providers in a region, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.REGION]: {
|
||||
region_id: "reg_123",
|
||||
},
|
||||
|
||||
@@ -73,19 +73,19 @@ const { data: salesChannels } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the sales channels of an API key, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the sales channels of an API key, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.API_KEY]: {
|
||||
api_key_id: "apk_123",
|
||||
},
|
||||
@@ -256,19 +256,19 @@ const { data: salesChannels } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the sales channels of a product, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the sales channels of a product, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.PRODUCT]: {
|
||||
product_id: "prod_123",
|
||||
},
|
||||
@@ -349,19 +349,19 @@ const { data: salesChannels } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the stock locations of a sales channel, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the stock locations of a sales channel, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.SALES_CHANNEL]: {
|
||||
sales_channel_id: "sc_123",
|
||||
},
|
||||
|
||||
@@ -82,19 +82,19 @@ const { data: stockLocations } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the stock location of a fulfillment set, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the stock location of a fulfillment set, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.STOCK_LOCATION]: {
|
||||
stock_location_id: "sloc_123",
|
||||
},
|
||||
@@ -220,19 +220,19 @@ const { data: stockLocations } = useQueryGraphStep({
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
### Manage with Remote Link
|
||||
### Manage with Link
|
||||
|
||||
To manage the stock locations of a sales channel, use [Remote Link](!docs!/learn/fundamentals/module-links/remote-link):
|
||||
To manage the stock locations of a sales channel, use [Link](!docs!/learn/fundamentals/module-links/link):
|
||||
|
||||
<CodeTabs group="relation-link">
|
||||
<CodeTab label="remoteLink.create" value="method">
|
||||
<CodeTab label="link.create" value="method">
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.SALES_CHANNEL]: {
|
||||
sales_channel_id: "sc_123",
|
||||
},
|
||||
|
||||
@@ -1784,7 +1784,7 @@ export default defineLink(
|
||||
Then, to set the custom column when creating or updating a link between records:
|
||||
|
||||
```ts
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.PRODUCT]: {
|
||||
product_id: "123",
|
||||
},
|
||||
@@ -1819,7 +1819,7 @@ Learn more in [this documentation](!docs!/learn/fundamentals/module-links/custom
|
||||
|
||||
### Create Link Between Records
|
||||
|
||||
To create a link between two records using remote link:
|
||||
To create a link between two records using Link:
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
@@ -1827,7 +1827,7 @@ import { HELLO_MODULE } from "../../modules/hello"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[Modules.PRODUCT]: {
|
||||
product_id: "prod_123",
|
||||
},
|
||||
@@ -1837,11 +1837,11 @@ await remoteLink.create({
|
||||
})
|
||||
```
|
||||
|
||||
Learn more in [this documentation](!docs!/learn/fundamentals/module-links/remote-link#create-link).
|
||||
Learn more in [this documentation](!docs!/learn/fundamentals/module-links/link#create-link).
|
||||
|
||||
### Dismiss Link Between Records
|
||||
|
||||
To dismiss links between records using remote link:
|
||||
To dismiss links between records using Link:
|
||||
|
||||
```ts
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
@@ -1849,7 +1849,7 @@ import { HELLO_MODULE } from "../../modules/hello"
|
||||
|
||||
// ...
|
||||
|
||||
await remoteLink.dismiss({
|
||||
await link.dismiss({
|
||||
[Modules.PRODUCT]: {
|
||||
product_id: "prod_123",
|
||||
},
|
||||
@@ -1859,7 +1859,7 @@ await remoteLink.dismiss({
|
||||
})
|
||||
```
|
||||
|
||||
Learn more in [this documentation](!docs!/learn/fundamentals/module-links/remote-link#dismiss-link).
|
||||
Learn more in [this documentation](!docs!/learn/fundamentals/module-links/link#dismiss-link).
|
||||
|
||||
### Cascade Delete Linked Records
|
||||
|
||||
@@ -1872,14 +1872,14 @@ import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
await productModuleService.deleteVariants([variant.id])
|
||||
|
||||
await remoteLink.delete({
|
||||
await link.delete({
|
||||
[Modules.PRODUCT]: {
|
||||
product_id: "prod_123",
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
Learn more in [this documentation](!docs!/learn/fundamentals/module-links/remote-link#cascade-delete-linked-records).
|
||||
Learn more in [this documentation](!docs!/learn/fundamentals/module-links/link#cascade-delete-linked-records).
|
||||
|
||||
### Restore Linked Records
|
||||
|
||||
@@ -1892,14 +1892,14 @@ import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
await productModuleService.restoreProducts(["prod_123"])
|
||||
|
||||
await remoteLink.restore({
|
||||
await link.restore({
|
||||
[Modules.PRODUCT]: {
|
||||
product_id: "prod_123",
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
Learn more in [this documentation](!docs!/learn/fundamentals/module-links/remote-link#restore-linked-records).
|
||||
Learn more in [this documentation](!docs!/learn/fundamentals/module-links/link#restore-linked-records).
|
||||
|
||||
---
|
||||
|
||||
@@ -3703,13 +3703,13 @@ const paymentCollection =
|
||||
amount: 5000,
|
||||
})
|
||||
|
||||
// resolve the remote link
|
||||
const remoteLink = container.resolve(
|
||||
ContainerRegistrationKeys
|
||||
// resolve Link
|
||||
const link = container.resolve(
|
||||
ContainerRegistrationKeys.LINK
|
||||
)
|
||||
|
||||
// create a link between the cart and payment collection
|
||||
remoteLink.create({
|
||||
link.create({
|
||||
[Modules.CART]: {
|
||||
cart_id: "cart_123",
|
||||
},
|
||||
|
||||
@@ -85,7 +85,7 @@ Use the `ContainerRegistrationKeys` enum imported from `@medusajs/framework/util
|
||||
<Table.Row>
|
||||
<Table.Cell>
|
||||
|
||||
Query
|
||||
[Query](!docs!/learn/fundamentals/module-links/query)
|
||||
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
@@ -103,17 +103,17 @@ Use the `ContainerRegistrationKeys` enum imported from `@medusajs/framework/util
|
||||
<Table.Row>
|
||||
<Table.Cell>
|
||||
|
||||
Remote Link
|
||||
[Link](!docs!/learn/fundamentals/module-links/link)
|
||||
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
The remote link function.
|
||||
Link function to manage links between records of two modules' data models.
|
||||
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
`remoteLink` or `ContainerRegistrationKeys.REMOTE_LINK`
|
||||
`link` or `ContainerRegistrationKeys.LINK`
|
||||
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
|
||||
@@ -671,7 +671,7 @@ You’ll test out the workflow in the next section.
|
||||
|
||||
- [How to Create a Workflow](!docs!/learn/fundamentals/workflows)
|
||||
- [What is the Compensation Function](!docs!/learn/fundamentals/workflows/compensation-function)
|
||||
- [Learn more about the remote link function](!docs!/learn/fundamentals/module-links/remote-link)
|
||||
- [Learn more about Link functions](!docs!/learn/fundamentals/module-links/link)
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -123,14 +123,14 @@ Create workflows to implement these flows, then utilize these workflows in other
|
||||
|
||||
## Manage Linked Records
|
||||
|
||||
If you've defined links between data models of two modules, you can manage them through two functions: remote link and Query.
|
||||
If you've defined links between data models of two modules, you can manage them through two tools: Link and Query.
|
||||
|
||||
Use the remote link to create a link between two records, and use Query to fetch data across linked data models.
|
||||
Use Link to create a link between two records, and use Query to fetch data across linked data models.
|
||||
|
||||
<CardList itemsPerRow={2} items={[
|
||||
{
|
||||
href: "!docs!/learn/fundamentals/module-links/remote-link",
|
||||
title: "How to Use the Remote Link",
|
||||
href: "!docs!/learn/fundamentals/module-links/link",
|
||||
title: "How to Use Link",
|
||||
text: "Learn how to link data models of different modules.",
|
||||
icon: AcademicCapSolid,
|
||||
},
|
||||
|
||||
@@ -682,7 +682,7 @@ export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<RequestType>,
|
||||
res: MedusaResponse
|
||||
) => {
|
||||
const remoteLink = req.scope.resolve("remoteLink")
|
||||
const link = req.scope.resolve("link")
|
||||
const marketplaceModuleService: MarketplaceModuleService =
|
||||
req.scope.resolve(MARKETPLACE_MODULE)
|
||||
const productModuleService: IProductModuleService = req.scope
|
||||
@@ -725,7 +725,7 @@ const { result } = await createProductsWorkflow(req.scope)
|
||||
})
|
||||
|
||||
// link product to vendor
|
||||
await remoteLink.create({
|
||||
await link.create({
|
||||
[MARKETPLACE_MODULE]: {
|
||||
vendor_id: vendorAdmin.vendor.id,
|
||||
},
|
||||
@@ -826,7 +826,7 @@ curl 'http://localhost:9000/vendors/products' \
|
||||
### Further Reads
|
||||
|
||||
- [How to use Query](!docs!/learn/fundamentals/module-links/query)
|
||||
- [How to use the Remote Link](!docs!/learn/fundamentals/module-links/remote-link)
|
||||
- [How to use Link](!docs!/learn/fundamentals/module-links/link)
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -710,7 +710,7 @@ The workflow returns the created subscription and order.
|
||||
|
||||
- [How to Create a Workflow](!docs!/learn/fundamentals/workflows)
|
||||
- [Learn more about the compensation function](!docs!/learn/fundamentals/workflows/compensation-function)
|
||||
- [How to use the Remote Link](!docs!/learn/fundamentals/module-links/remote-link)
|
||||
- [How to use Link](!docs!/learn/fundamentals/module-links/link)
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ export const generatedEditDates = {
|
||||
"app/commerce-modules/payment/module-options/page.mdx": "2024-10-15T12:51:40.574Z",
|
||||
"app/commerce-modules/payment/payment/page.mdx": "2024-10-09T10:59:08.463Z",
|
||||
"app/commerce-modules/payment/payment-collection/page.mdx": "2024-10-09T10:56:49.510Z",
|
||||
"app/commerce-modules/payment/payment-flow/page.mdx": "2024-10-09T11:18:53.332Z",
|
||||
"app/commerce-modules/payment/payment-flow/page.mdx": "2025-01-06T11:19:35.592Z",
|
||||
"app/commerce-modules/payment/payment-provider/stripe/page.mdx": "2024-12-16T13:21:03.554Z",
|
||||
"app/commerce-modules/payment/payment-provider/page.mdx": "2024-10-09T11:07:27.269Z",
|
||||
"app/commerce-modules/payment/payment-session/page.mdx": "2024-10-09T10:58:00.960Z",
|
||||
@@ -107,23 +107,23 @@ export const generatedEditDates = {
|
||||
"app/deployment/page.mdx": "2024-11-25T14:31:45.277Z",
|
||||
"app/integrations/page.mdx": "2024-12-16T16:46:12.395Z",
|
||||
"app/medusa-cli/page.mdx": "2024-08-28T11:25:32.382Z",
|
||||
"app/medusa-container-resources/page.mdx": "2024-12-09T16:18:38.852Z",
|
||||
"app/medusa-container-resources/page.mdx": "2025-01-06T11:19:35.623Z",
|
||||
"app/medusa-workflows-reference/page.mdx": "2024-12-09T16:22:32.129Z",
|
||||
"app/nextjs-starter/page.mdx": "2025-01-06T12:19:31.143Z",
|
||||
"app/recipes/b2b/page.mdx": "2024-10-03T13:07:44.153Z",
|
||||
"app/recipes/commerce-automation/page.mdx": "2024-10-16T08:52:01.585Z",
|
||||
"app/recipes/digital-products/examples/standard/page.mdx": "2025-01-06T09:03:35.202Z",
|
||||
"app/recipes/digital-products/page.mdx": "2024-10-03T13:07:44.147Z",
|
||||
"app/recipes/digital-products/examples/standard/page.mdx": "2025-01-06T11:19:35.640Z",
|
||||
"app/recipes/digital-products/page.mdx": "2025-01-06T11:19:35.623Z",
|
||||
"app/recipes/ecommerce/page.mdx": "2024-10-22T11:01:01.218Z",
|
||||
"app/recipes/integrate-ecommerce-stack/page.mdx": "2024-12-09T13:03:35.846Z",
|
||||
"app/recipes/marketplace/examples/vendors/page.mdx": "2024-12-11T10:06:16.586Z",
|
||||
"app/recipes/marketplace/examples/vendors/page.mdx": "2025-01-06T11:19:35.639Z",
|
||||
"app/recipes/marketplace/page.mdx": "2024-10-03T13:07:44.153Z",
|
||||
"app/recipes/multi-region-store/page.mdx": "2024-10-03T13:07:13.813Z",
|
||||
"app/recipes/omnichannel/page.mdx": "2024-10-03T13:07:14.384Z",
|
||||
"app/recipes/oms/page.mdx": "2024-07-01T10:21:19+03:00",
|
||||
"app/recipes/personalized-products/page.mdx": "2024-10-03T13:07:44.153Z",
|
||||
"app/recipes/pos/page.mdx": "2024-10-03T13:07:13.964Z",
|
||||
"app/recipes/subscriptions/examples/standard/page.mdx": "2024-12-11T10:05:39.227Z",
|
||||
"app/recipes/subscriptions/examples/standard/page.mdx": "2025-01-06T11:19:35.640Z",
|
||||
"app/recipes/subscriptions/page.mdx": "2024-10-03T13:07:44.155Z",
|
||||
"app/recipes/page.mdx": "2024-07-11T15:56:41+00:00",
|
||||
"app/service-factory-reference/methods/create/page.mdx": "2024-07-31T17:01:33+03:00",
|
||||
@@ -2133,21 +2133,21 @@ export const generatedEditDates = {
|
||||
"app/admin-components/components/forms/page.mdx": "2024-10-09T12:48:04.229Z",
|
||||
"app/commerce-modules/auth/reset-password/page.mdx": "2024-12-25T13:26:32.595Z",
|
||||
"app/storefront-development/customers/reset-password/page.mdx": "2024-12-19T16:32:00.724Z",
|
||||
"app/commerce-modules/api-key/links-to-other-modules/page.mdx": "2024-12-24T14:36:06.109Z",
|
||||
"app/commerce-modules/api-key/links-to-other-modules/page.mdx": "2025-01-06T11:19:22.450Z",
|
||||
"app/commerce-modules/cart/extend/page.mdx": "2024-12-25T12:48:59.149Z",
|
||||
"app/commerce-modules/cart/links-to-other-modules/page.mdx": "2024-12-24T14:46:49.847Z",
|
||||
"app/commerce-modules/cart/links-to-other-modules/page.mdx": "2025-01-06T11:19:35.593Z",
|
||||
"app/commerce-modules/customer/extend/page.mdx": "2024-12-25T15:54:37.789Z",
|
||||
"app/commerce-modules/fulfillment/links-to-other-modules/page.mdx": "2024-12-24T14:49:54.535Z",
|
||||
"app/commerce-modules/inventory/links-to-other-modules/page.mdx": "2024-12-24T14:50:25.574Z",
|
||||
"app/commerce-modules/pricing/links-to-other-modules/page.mdx": "2024-12-24T14:53:39.198Z",
|
||||
"app/commerce-modules/fulfillment/links-to-other-modules/page.mdx": "2025-01-06T11:19:35.593Z",
|
||||
"app/commerce-modules/inventory/links-to-other-modules/page.mdx": "2025-01-06T11:19:35.600Z",
|
||||
"app/commerce-modules/pricing/links-to-other-modules/page.mdx": "2025-01-06T11:19:35.607Z",
|
||||
"app/commerce-modules/product/extend/page.mdx": "2024-12-11T09:07:25.252Z",
|
||||
"app/commerce-modules/product/links-to-other-modules/page.mdx": "2024-12-24T14:55:21.779Z",
|
||||
"app/commerce-modules/product/links-to-other-modules/page.mdx": "2025-01-06T11:19:35.606Z",
|
||||
"app/commerce-modules/promotion/extend/page.mdx": "2024-12-11T09:07:24.137Z",
|
||||
"app/commerce-modules/promotion/links-to-other-modules/page.mdx": "2024-12-24T14:56:11.410Z",
|
||||
"app/commerce-modules/promotion/links-to-other-modules/page.mdx": "2025-01-06T11:19:35.608Z",
|
||||
"app/commerce-modules/order/edit/page.mdx": "2024-10-09T08:50:05.334Z",
|
||||
"app/commerce-modules/order/links-to-other-modules/page.mdx": "2024-12-24T14:52:22.813Z",
|
||||
"app/commerce-modules/order/links-to-other-modules/page.mdx": "2025-01-06T11:19:35.604Z",
|
||||
"app/commerce-modules/order/order-change/page.mdx": "2024-10-09T09:59:40.745Z",
|
||||
"app/commerce-modules/payment/links-to-other-modules/page.mdx": "2024-12-24T14:53:08.217Z",
|
||||
"app/commerce-modules/payment/links-to-other-modules/page.mdx": "2025-01-06T11:19:35.593Z",
|
||||
"references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.useQueryGraphStep/page.mdx": "2024-12-25T08:43:13.528Z",
|
||||
"references/core_flows/Payment/Workflows_Payment/functions/core_flows.Payment.Workflows_Payment.processPaymentWorkflow/page.mdx": "2024-12-25T08:43:15.375Z",
|
||||
"references/helper_steps/functions/helper_steps.useQueryGraphStep/page.mdx": "2024-12-10T14:55:09.191Z",
|
||||
@@ -2196,11 +2196,11 @@ export const generatedEditDates = {
|
||||
"references/fulfillment/interfaces/fulfillment.IFulfillmentModuleService/page.mdx": "2024-12-17T16:57:25.097Z",
|
||||
"references/types/CommonTypes/interfaces/types.CommonTypes.RequestQueryFields/page.mdx": "2024-12-09T13:21:32.865Z",
|
||||
"references/utils/utils.ProductUtils/page.mdx": "2024-12-10T14:54:57.156Z",
|
||||
"app/commerce-modules/region/links-to-other-modules/page.mdx": "2024-12-24T14:56:43.092Z",
|
||||
"app/commerce-modules/sales-channel/links-to-other-modules/page.mdx": "2024-12-24T14:57:34.314Z",
|
||||
"app/commerce-modules/stock-location/links-to-other-modules/page.mdx": "2024-12-24T14:58:09.715Z",
|
||||
"app/commerce-modules/region/links-to-other-modules/page.mdx": "2025-01-06T11:19:35.617Z",
|
||||
"app/commerce-modules/sales-channel/links-to-other-modules/page.mdx": "2025-01-06T11:19:35.620Z",
|
||||
"app/commerce-modules/stock-location/links-to-other-modules/page.mdx": "2025-01-06T11:19:35.619Z",
|
||||
"app/commerce-modules/store/links-to-other-modules/page.mdx": "2024-12-24T14:58:24.038Z",
|
||||
"app/examples/page.mdx": "2024-12-11T09:07:47.589Z",
|
||||
"app/examples/page.mdx": "2025-01-06T11:19:35.623Z",
|
||||
"app/medusa-cli/commands/build/page.mdx": "2024-11-11T11:00:49.665Z",
|
||||
"app/js-sdk/page.mdx": "2024-12-12T11:41:51.152Z",
|
||||
"references/js_sdk/admin/Admin/properties/js_sdk.admin.Admin.apiKey/page.mdx": "2024-12-26T11:37:18.120Z",
|
||||
|
||||
Reference in New Issue
Block a user