docs: show the source code link in order models reference (#13398)

This commit is contained in:
Shahed Nasser authored and GitHub committed 2025-09-03 10:36:59 +03:00
1 parent 1578e1ad22
commit f1149ea170
23 files changed
+29 -29

No files matched your search

@@ -10,4 +10,4 @@ import { TypeList } from "docs-ui"
This documentation provides a reference to the OrderChange data model. It belongs to the Order Module. This documentation provides a reference to the OrderChange data model. It belongs to the Order Module.
`Const` **OrderChange**: `any` = `_OrderChange` <SourceCodeLink link="https://github.com/medusajs/medusa/blob/9069e9279ee230384cf09c553f60ab6caa0e7012/packages/modules/order/src/models/order-change.ts#L85" />
@@ -10,4 +10,4 @@ import { TypeList } from "docs-ui"
This documentation provides a reference to the OrderChangeAction data model. It belongs to the Order Module. This documentation provides a reference to the OrderChangeAction data model. It belongs to the Order Module.
`Const` **OrderChangeAction**: `any` = `_OrderChangeAction` <SourceCodeLink link="https://github.com/medusajs/medusa/blob/9069e9279ee230384cf09c553f60ab6caa0e7012/packages/modules/order/src/models/order-change-action.ts#L72" />
@@ -10,4 +10,4 @@ import { TypeList } from "docs-ui"
This documentation provides a reference to the OrderClaim data model. It belongs to the Order Module. This documentation provides a reference to the OrderClaim data model. It belongs to the Order Module.
`Const` **OrderClaim**: `any` = `_OrderClaim` <SourceCodeLink link="https://github.com/medusajs/medusa/blob/9069e9279ee230384cf09c553f60ab6caa0e7012/packages/modules/order/src/models/claim.ts#L84" />
@@ -10,4 +10,4 @@ import { TypeList } from "docs-ui"
This documentation provides a reference to the OrderClaimItem data model. It belongs to the Order Module. This documentation provides a reference to the OrderClaimItem data model. It belongs to the Order Module.
`Const` **OrderClaimItem**: `any` = `_OrderClaimItem` <SourceCodeLink link="https://github.com/medusajs/medusa/blob/9069e9279ee230384cf09c553f60ab6caa0e7012/packages/modules/order/src/models/claim-item.ts#L51" />
@@ -10,4 +10,4 @@ import { TypeList } from "docs-ui"
This documentation provides a reference to the OrderClaimItemImage data model. It belongs to the Order Module. This documentation provides a reference to the OrderClaimItemImage data model. It belongs to the Order Module.
`Const` **OrderClaimItemImage**: `any` = `_OrderClaimItemImage` <SourceCodeLink link="https://github.com/medusajs/medusa/blob/9069e9279ee230384cf09c553f60ab6caa0e7012/packages/modules/order/src/models/claim-item-image.ts#L31" />
@@ -10,4 +10,4 @@ import { TypeList } from "docs-ui"
This documentation provides a reference to the OrderExchange data model. It belongs to the Order Module. This documentation provides a reference to the OrderExchange data model. It belongs to the Order Module.
`Const` **OrderExchange**: `any` = `_OrderExchange` <SourceCodeLink link="https://github.com/medusajs/medusa/blob/9069e9279ee230384cf09c553f60ab6caa0e7012/packages/modules/order/src/models/exchange.ts#L78" />
@@ -10,4 +10,4 @@ import { TypeList } from "docs-ui"
This documentation provides a reference to the OrderExchangeItem data model. It belongs to the Order Module. This documentation provides a reference to the OrderExchangeItem data model. It belongs to the Order Module.
`Const` **OrderExchangeItem**: `any` = `_OrderExchangeItem` <SourceCodeLink link="https://github.com/medusajs/medusa/blob/9069e9279ee230384cf09c553f60ab6caa0e7012/packages/modules/order/src/models/exchange-item.ts#L39" />
@@ -10,4 +10,4 @@ import { TypeList } from "docs-ui"
This documentation provides a reference to the OrderLineItem data model. It belongs to the Order Module. This documentation provides a reference to the OrderLineItem data model. It belongs to the Order Module.
`Const` **OrderLineItem**: `any` = `_OrderLineItem` <SourceCodeLink link="https://github.com/medusajs/medusa/blob/9069e9279ee230384cf09c553f60ab6caa0e7012/packages/modules/order/src/models/line-item.ts#L75" />
@@ -10,4 +10,4 @@ import { TypeList } from "docs-ui"
This documentation provides a reference to the OrderLineItemAdjustment data model. It belongs to the Order Module. This documentation provides a reference to the OrderLineItemAdjustment data model. It belongs to the Order Module.
`Const` **OrderLineItemAdjustment**: `any` = `_OrderLineItemAdjustment` <SourceCodeLink link="https://github.com/medusajs/medusa/blob/9069e9279ee230384cf09c553f60ab6caa0e7012/packages/modules/order/src/models/line-item-adjustment.ts#L25" />
@@ -10,4 +10,4 @@ import { TypeList } from "docs-ui"
This documentation provides a reference to the OrderLineItemTaxLine data model. It belongs to the Order Module. This documentation provides a reference to the OrderLineItemTaxLine data model. It belongs to the Order Module.
`Const` **OrderLineItemTaxLine**: `any` = `_OrderLineItemTaxLine` <SourceCodeLink link="https://github.com/medusajs/medusa/blob/9069e9279ee230384cf09c553f60ab6caa0e7012/packages/modules/order/src/models/line-item-tax-line.ts#L24" />
@@ -10,4 +10,4 @@ import { TypeList } from "docs-ui"
This documentation provides a reference to the OrderShipping data model. It belongs to the Order Module. This documentation provides a reference to the OrderShipping data model. It belongs to the Order Module.
`Const` **OrderShipping**: `any` = `_OrderShipping` <SourceCodeLink link="https://github.com/medusajs/medusa/blob/9069e9279ee230384cf09c553f60ab6caa0e7012/packages/modules/order/src/models/order-shipping-method.ts#L83" />
@@ -10,4 +10,4 @@ import { TypeList } from "docs-ui"
This documentation provides a reference to the OrderShippingMethod data model. It belongs to the Order Module. This documentation provides a reference to the OrderShippingMethod data model. It belongs to the Order Module.
`Const` **OrderShippingMethod**: `any` = `_OrderShippingMethod` <SourceCodeLink link="https://github.com/medusajs/medusa/blob/9069e9279ee230384cf09c553f60ab6caa0e7012/packages/modules/order/src/models/shipping-method.ts#L40" />
@@ -10,4 +10,4 @@ import { TypeList } from "docs-ui"
This documentation provides a reference to the OrderShippingMethodAdjustment data model. It belongs to the Order Module. This documentation provides a reference to the OrderShippingMethodAdjustment data model. It belongs to the Order Module.
`Const` **OrderShippingMethodAdjustment**: `any` = `_OrderShippingMethodAdjustment` <SourceCodeLink link="https://github.com/medusajs/medusa/blob/9069e9279ee230384cf09c553f60ab6caa0e7012/packages/modules/order/src/models/shipping-method-adjustment.ts#L33" />
@@ -10,4 +10,4 @@ import { TypeList } from "docs-ui"
This documentation provides a reference to the OrderShippingMethodTaxLine data model. It belongs to the Order Module. This documentation provides a reference to the OrderShippingMethodTaxLine data model. It belongs to the Order Module.
`Const` **OrderShippingMethodTaxLine**: `any` = `_OrderShippingMethodTaxLine` <SourceCodeLink link="https://github.com/medusajs/medusa/blob/9069e9279ee230384cf09c553f60ab6caa0e7012/packages/modules/order/src/models/shipping-method-tax-line.ts#L33" />
@@ -10,4 +10,4 @@ import { TypeList } from "docs-ui"
This documentation provides a reference to the OrderTransaction data model. It belongs to the Order Module. This documentation provides a reference to the OrderTransaction data model. It belongs to the Order Module.
`Const` **OrderTransaction**: `any` <SourceCodeLink link="https://github.com/medusajs/medusa/blob/9069e9279ee230384cf09c553f60ab6caa0e7012/packages/modules/order/src/models/transaction.ts#L89" />
@@ -10,4 +10,4 @@ import { TypeList } from "docs-ui"
This documentation provides a reference to the Return data model. It belongs to the Order Module. This documentation provides a reference to the Return data model. It belongs to the Order Module.
`Const` **Return**: `any` = `_Return` <SourceCodeLink link="https://github.com/medusajs/medusa/blob/9069e9279ee230384cf09c553f60ab6caa0e7012/packages/modules/order/src/models/return.ts#L90" />
@@ -10,4 +10,4 @@ import { TypeList } from "docs-ui"
This documentation provides a reference to the ReturnItem data model. It belongs to the Order Module. This documentation provides a reference to the ReturnItem data model. It belongs to the Order Module.
`Const` **ReturnItem**: `any` = `_ReturnItem` <SourceCodeLink link="https://github.com/medusajs/medusa/blob/9069e9279ee230384cf09c553f60ab6caa0e7012/packages/modules/order/src/models/return-item.ts#L59" />
@@ -192,6 +192,7 @@ You should only use the methods in this reference when implementing complex cust
Functions: false, Functions: false,
Methods: false, Methods: false,
}, },
internalType: "model-ref",
}, },
[`^modules/${snakeCaseModuleName}_models`]: { [`^modules/${snakeCaseModuleName}_models`]: {
reflectionDescription: `This documentation provides a reference to the data models in the ${titleModuleName} Module`, reflectionDescription: `This documentation provides a reference to the data models in the ${titleModuleName} Module`,
@@ -207,6 +208,7 @@ You should only use the methods in this reference when implementing complex cust
Variables: "Data Models", Variables: "Data Models",
} }
: {}, : {},
internalType: "model-ref",
}, },
} as FormattingOptionsType) } as FormattingOptionsType)
}, {} as FormattingOptionsType), }, {} as FormattingOptionsType),
@@ -180,7 +180,7 @@ export function registerHelpers(theme: MarkdownTheme) {
shouldExpandPropertiesHelper(theme) shouldExpandPropertiesHelper(theme)
shouldExpandDeclarationChildrenHelper(theme) shouldExpandDeclarationChildrenHelper(theme)
startSectionsHelper(theme) startSectionsHelper(theme)
ifDmlEntityHelper() ifDmlEntityHelper(theme)
dmlPropertiesHelper() dmlPropertiesHelper()
ifWorkflowStepHelper() ifWorkflowStepHelper()
stepInputHelper(theme) stepInputHelper(theme)
@@ -1,12 +1,16 @@
import Handlebars from "handlebars" import Handlebars from "handlebars"
import { DeclarationReflection } from "typedoc" import { DeclarationReflection } from "typedoc"
import { isDmlEntity } from "utils" import { isDmlEntity } from "utils"
import { MarkdownTheme } from "../../theme.js"
export default function () { export default function (theme: MarkdownTheme) {
Handlebars.registerHelper( Handlebars.registerHelper(
"ifDmlEntity", "ifDmlEntity",
function (this: DeclarationReflection, options: Handlebars.HelperOptions) { function (this: DeclarationReflection, options: Handlebars.HelperOptions) {
return isDmlEntity(this) ? options.fn(this) : options.inverse(this) const { internalType } = theme.getFormattingOptionsForLocation()
return isDmlEntity(this) || internalType === "model-ref"
? options.fn(this)
: options.inverse(this)
} }
) )
} }
@@ -115,10 +115,7 @@ export default function (theme: MarkdownTheme) {
str += `Handlers consuming this hook accept the following input.\n\n` str += `Handlers consuming this hook accept the following input.\n\n`
str += Handlebars.helpers.parameterComponent.call( str += Handlebars.helpers.parameterComponent.call(
cleanUpHookInput( cleanUpHookInput(signatures[0].parameters),
signatures[0].parameters,
this.name === "addToCartWorkflow" && hook.name === "validate"
),
{ {
hash: { hash: {
sectionTitle: hook.name, sectionTitle: hook.name,
+1
View File
@@ -103,6 +103,7 @@ export type FormattingOptionType = {
workflowDiagramComponent?: string workflowDiagramComponent?: string
isEventsReference?: boolean isEventsReference?: boolean
sortMembers?: boolean sortMembers?: boolean
internalType?: string
} }
export type AllowedProjectDocumentsOption = { export type AllowedProjectDocumentsOption = {
+1 -5
View File
@@ -41,15 +41,11 @@ export function getHookChildren(
} }
export function cleanUpHookInput( export function cleanUpHookInput(
parameters: ParameterReflection[], parameters: ParameterReflection[]
debug = false
): (ParameterReflection | DeclarationReflection)[] { ): (ParameterReflection | DeclarationReflection)[] {
const hasInvokeParameter = parameters.some( const hasInvokeParameter = parameters.some(
(parameter) => parameter.name === "invoke" (parameter) => parameter.name === "invoke"
) )
if (debug) {
console.log(parameters, hasInvokeParameter)
}
if (hasInvokeParameter) { if (hasInvokeParameter) {
return getHookInputFromInvoke(parameters) return getHookInputFromInvoke(parameters)
} }