docs: update to next 15 + eslint 9 (#9839)
* update next * updated react * update eslint * finish updating eslint * fix content lint errors * fix docs test * fix vale action * fix installation errors
This commit is contained in:
@@ -68,13 +68,13 @@ Learn more about module links in [this guide](!docs!/module-links).
|
||||
Create the file `src/links/product-custom.ts` with the following content:
|
||||
|
||||
```ts title="src/links/product-custom.ts"
|
||||
import { defineLink } from "@medusajs/framework/utils";
|
||||
import { defineLink } from "@medusajs/framework/utils"
|
||||
import HelloModule from "../modules/hello"
|
||||
import ProductModule from "@medusajs/medusa/product"
|
||||
|
||||
export default defineLink(
|
||||
ProductModule.linkable.product,
|
||||
HelloModule.linkable.custom,
|
||||
HelloModule.linkable.custom
|
||||
)
|
||||
```
|
||||
|
||||
@@ -234,29 +234,29 @@ export const createCustomFromProductWorkflow = createWorkflow(
|
||||
(input: CreateCustomFromProductWorkflowInput) => {
|
||||
const customName = transform(
|
||||
{
|
||||
input
|
||||
input,
|
||||
},
|
||||
(data) => data.input.additional_data.custom_name || ""
|
||||
)
|
||||
|
||||
const custom = createCustomStep({
|
||||
custom_name: customName
|
||||
custom_name: customName,
|
||||
})
|
||||
|
||||
when(({ custom }), ({ custom }) => custom !== undefined)
|
||||
.then(() => {
|
||||
createRemoteLinkStep([{
|
||||
[Modules.PRODUCT]: {
|
||||
product_id: input.product.id
|
||||
product_id: input.product.id,
|
||||
},
|
||||
[HELLO_MODULE]: {
|
||||
custom_id: custom.id
|
||||
}
|
||||
custom_id: custom.id,
|
||||
},
|
||||
}])
|
||||
})
|
||||
|
||||
return new WorkflowResponse({
|
||||
custom
|
||||
custom,
|
||||
})
|
||||
}
|
||||
)
|
||||
@@ -282,19 +282,19 @@ To consume the hook, create the file `src/workflow/hooks/product-created.ts` wit
|
||||
import { createProductsWorkflow } from "@medusajs/medusa/core-flows"
|
||||
import {
|
||||
createCustomFromProductWorkflow,
|
||||
CreateCustomFromProductWorkflowInput
|
||||
CreateCustomFromProductWorkflowInput,
|
||||
} from "../create-custom-from-product"
|
||||
|
||||
createProductsWorkflow.hooks.productsCreated(
|
||||
async ({ products, additional_data }, { container }) => {
|
||||
const workflow = createCustomFromProductWorkflow(container)
|
||||
|
||||
for (let product of products) {
|
||||
for (const product of products) {
|
||||
await workflow.run({
|
||||
input: {
|
||||
product,
|
||||
additional_data
|
||||
} as CreateCustomFromProductWorkflowInput
|
||||
additional_data,
|
||||
} as CreateCustomFromProductWorkflowInput,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -556,16 +556,16 @@ const created = when({
|
||||
)
|
||||
.then(() => {
|
||||
const custom = createCustomStep({
|
||||
custom_name: input.additional_data.custom_name
|
||||
custom_name: input.additional_data.custom_name,
|
||||
})
|
||||
|
||||
createRemoteLinkStep([{
|
||||
[Modules.PRODUCT]: {
|
||||
product_id: input.product.id
|
||||
product_id: input.product.id,
|
||||
},
|
||||
[HELLO_MODULE]: {
|
||||
custom_id: custom.id
|
||||
}
|
||||
custom_id: custom.id,
|
||||
},
|
||||
}])
|
||||
|
||||
return custom
|
||||
@@ -628,7 +628,7 @@ const updated = when({
|
||||
return new WorkflowResponse({
|
||||
created,
|
||||
updated,
|
||||
deleted
|
||||
deleted,
|
||||
})
|
||||
```
|
||||
|
||||
@@ -646,19 +646,19 @@ Create the file `src/workflows/hooks/product-updated.ts` with the following cont
|
||||
import { updateProductsWorkflow } from "@medusajs/medusa/core-flows"
|
||||
import {
|
||||
UpdateCustomFromProductStepInput,
|
||||
updateCustomFromProductWorkflow
|
||||
updateCustomFromProductWorkflow,
|
||||
} from "../update-custom-from-product"
|
||||
|
||||
updateProductsWorkflow.hooks.productsUpdated(
|
||||
async ({ products, additional_data }, { container }) => {
|
||||
const workflow = updateCustomFromProductWorkflow(container)
|
||||
|
||||
for (let product of products) {
|
||||
for (const product of products) {
|
||||
await workflow.run({
|
||||
input: {
|
||||
product,
|
||||
additional_data
|
||||
} as UpdateCustomFromProductStepInput
|
||||
additional_data,
|
||||
} as UpdateCustomFromProductStepInput,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user