chore: fix documentation links in TSDocs (#10511)

This commit is contained in:
Shahed Nasser
2024-12-09 18:52:02 +02:00
committed by GitHub
parent a04238a7f1
commit 7c76ee24cb
14 changed files with 67 additions and 19 deletions

View File

@@ -7,7 +7,7 @@ export const createLinksStepId = "create-remote-links"
/**
* This step creates remote links between two records of linked data models.
*
* Learn more in the [Remote Link documentation.](https://docs.medusajs.com/advanced-development/modules/remote-link#create-link).
* Learn more in the [Remote Link documentation.](https://docs.medusajs.com/learn/fundamentals/module-links/remote-link#create-link).
*
* @example
* import {

View File

@@ -11,7 +11,7 @@ export const dismissRemoteLinkStepId = "dismiss-remote-links"
/**
* This step removes remote links between two records of linked data models.
*
* Learn more in the [Remote Link documentation.](https://docs.medusajs.com/advanced-development/modules/remote-link#dismiss-link).
* Learn more in the [Remote Link documentation.](https://docs.medusajs.com/learn/fundamentals/module-links/remote-link#dismiss-link).
*
* @example
* import {

View File

@@ -9,7 +9,7 @@ export const removeRemoteLinkStepId = "remove-remote-links"
/**
* This step deletes linked records of a record.
*
* Learn more in the [Remote Link documentation](https://docs.medusajs.com/advanced-development/modules/remote-link#cascade-delete-linked-records)
* Learn more in the [Remote Link documentation](https://docs.medusajs.com/learn/fundamentals/module-links/remote-link#cascade-delete-linked-records)
*
* @example
* import {

View File

@@ -29,7 +29,7 @@ const step = createStep(
/**
* This step fetches data across modules using the Query.
*
* Learn more in the [Query documentation](https://docs.medusajs.com/learn/advanced-development/module-links/query).
* Learn more in the [Query documentation](https://docs.medusajs.com/learn/fundamentals/module-links/query).
*
* @example
* To retrieve a list of records of a data model:

View File

@@ -50,7 +50,7 @@ export const useRemoteQueryStepId = "use-remote-query"
/**
* This step fetches data across modules using the remote query.
*
* Learn more in the [Remote Query documentation](https://docs.medusajs.com/learn/advanced-development/module-links/query).
* Learn more in the [Remote Query documentation](https://docs.medusajs.com/learn/fundamentals/module-links/query).
*
* :::note
*

View File

@@ -23,7 +23,7 @@ export interface IAuthModuleService extends IModuleService {
* underlying provider is called, passing it the `providerData` parameter as a parameter. The method
* returns the data returned by the provider.
*
* Refer to [this guide](https://docs.medusajs.com/experimental/auth/auth-flows) to learn more about the authentication flows.
* Refer to [this guide](https://docs.medusajs.com/resources/commerce-modules/auth/authentication-route) to learn more about the authentication flows.
*
* @param {string} provider - The ID of the provider to authenticate the user with.
* @param {AuthenticationInput} providerData - The data to pass to the provider to authenticate the user.
@@ -70,7 +70,7 @@ export interface IAuthModuleService extends IModuleService {
* In that API route, you can call this method to validate the third-party provider's
* callback and authenticate the user.
*
* Learn more about this authentication flow in [this guide](https://docs.medusajs.com/experimental/auth/auth-flows#authentication-with-third-party-service).
* Learn more about this authentication flow in [this guide](https://docs.medusajs.com/resources/commerce-modules/auth/authentication-route#2-third-party-service-authenticate-flow).
*
* @param {string} provider - The ID of the provider to use to validate the callback.
* @param {AuthenticationInput} providerData - The data to pass to the provider to validate the callback.

View File

@@ -513,7 +513,7 @@ export interface IPaymentModuleService extends IModuleService {
/**
* This method authorizes a payment session using its associated payment provider. This creates a payment that can later be captured.
*
* Learn more about the payment flow in [this guide](https://docs.medusajs.com/experimental/payment/payment-flow/)
* Learn more about the payment flow in [this guide](https://docs.medusajs.com/resources/commerce-modules/payment/payment-flow)
*
* @param {string} id - The payment session's ID.
* @param {Record<string, unknown>} context - Context data to pass to the associated payment provider.
@@ -663,7 +663,7 @@ export interface IPaymentModuleService extends IModuleService {
/**
* This method captures a payment using its associated payment provider.
*
* Learn more about the payment flow in [this guide](https://docs.medusajs.com/experimental/payment/payment-flow/)
* Learn more about the payment flow in [this guide](https://docs.medusajs.com/resources/commerce-modules/payment/payment-flow)
*
* @param {CreateCaptureDTO} data - The payment capture to be created.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
@@ -1058,7 +1058,7 @@ export interface IPaymentModuleService extends IModuleService {
/**
* This method retrieves webhook event data with the associated payment provider.
*
* Learn more about handling webhook events in [this guide](https://docs.medusajs.com/experimental/payment/webhook-events/)
* Learn more about handling webhook events in [this guide](https://docs.medusajs.com/resources/commerce-modules/payment/webhook-events)
*
* @param {ProviderWebhookPayload} data - The webhook event's details.
* @returns {Promise<void>} Resolves when the webhook event is handled successfully.

View File

@@ -257,7 +257,7 @@ export interface TaxRateRuleDTO {
* The snake-case name of the data model that the tax rule references.
* For example, `product`.
*
* Learn more in [this guide](https://docs.medusajs.com/experimental/tax/tax-rates-and-rules/#what-are-tax-rules).
* Learn more in [this guide](https://docs.medusajs.com/resources/commerce-modules/tax/tax-rates-and-rules#override-tax-rates-with-rules).
*/
reference: string
@@ -265,7 +265,7 @@ export interface TaxRateRuleDTO {
* The ID of the record of the data model that the tax rule references.
* For example, `prod_123`.
*
* Learn more in [this guide](https://docs.medusajs.com/experimental/tax/tax-rates-and-rules/#what-are-tax-rules).
* Learn more in [this guide](https://docs.medusajs.com/resources/commerce-modules/tax/tax-rates-and-rules#override-tax-rates-with-rules).
*/
reference_id: string

View File

@@ -234,7 +234,7 @@ export interface CreateTaxRateRuleDTO {
* The snake-case name of the data model that the tax rule references.
* For example, `product`.
*
* Learn more in [this guide](https://docs.medusajs.com/experimental/tax/tax-rates-and-rules/#what-are-tax-rules).
* Learn more in [this guide](https://docs.medusajs.com/resources/commerce-modules/tax/tax-rates-and-rules#override-tax-rates-with-rules).
*/
reference: string
@@ -242,7 +242,7 @@ export interface CreateTaxRateRuleDTO {
* The ID of the record of the data model that the tax rule references.
* For example, `prod_123`.
*
* Learn more in [this guide](https://docs.medusajs.com/experimental/tax/tax-rates-and-rules/#what-are-tax-rules).
* Learn more in [this guide](https://docs.medusajs.com/resources/commerce-modules/tax/tax-rates-and-rules#override-tax-rates-with-rules).
*/
reference_id: string

View File

@@ -667,7 +667,7 @@ export interface ITaxModuleService extends IModuleService {
/**
* This method retrieves tax lines for taxable items and shipping methods in a cart.
*
* Learn more in [this guide](https://docs.medusajs.com/experimental/tax/tax-calculation-with-provider/).
* Learn more in [this guide](https://docs.medusajs.com/resources/commerce-modules/tax/tax-calculation-with-provider).
*
* @param {(TaxableItemDTO | TaxableShippingDTO)[]} items - The items and shipping methods to retrieve their tax lines.
* @param {TaxCalculationContext} calculationContext - The context to pass to the underlying tax provider. It provides more

View File

@@ -23,7 +23,7 @@ export type Hook<Name extends string, Input> = {
*
* A handler hook can later be registered to consume the hook and perform custom functionality.
*
* Learn more in [this documentation](https://docs.medusajs.com/advanced-development/workflows/add-workflow-hook).
* Learn more in [this documentation](https://docs.medusajs.com/learn/fundamentals/workflows/workflow-hooks).
*
* @param name - The hook's name. This is used when the hook handler is registered to consume the workflow.
* @param input - The input to pass to the hook handler.

View File

@@ -42,7 +42,7 @@ global[OrchestrationUtils.SymbolMedusaWorkflowComposerContext] = null
* createWorkflow,
* WorkflowResponse
* } from "@medusajs/framework/workflows-sdk"
* import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
* import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
* import {
* createProductStep,
* getProductStep,

View File

@@ -229,7 +229,7 @@ export type ReturnWorkflow<TData, TResult, THooks extends any[]> = {
/**
* This method executes the workflow as a step. Useful when running a workflow within another.
*
* Learn more in [this documentation](https://docs.medusajs.com/advanced-development/workflows/execute-another-workflow).
* Learn more in [this documentation](https://docs.medusajs.com/learn/fundamentals/workflows/execute-another-workflow).
*
* @param param0 - The options to execute the workflow.
* @returns The workflow's result
@@ -266,7 +266,7 @@ export type ReturnWorkflow<TData, TResult, THooks extends any[]> = {
/**
* The workflow's exposed hooks, used to register a handler to consume the hook.
*
* Learn more in [this documentation](https://docs.medusajs.com/advanced-development/workflows/add-workflow-hook#how-to-consume-a-hook).
* Learn more in [this documentation](https://docs.medusajs.com/learn/fundamentals/workflows/workflow-hooks#how-to-consume-a-hook).
*/
hooks: ConvertHooksToFunctions<THooks>
}

View File

@@ -19,6 +19,48 @@ type ThenFunc = <ThenResolver extends () => any>(
? WorkflowData<ReturnedWorkflowData> | undefined
: ReturnType<ThenResolver>
/**
* This function allows you to execute steps only if a condition is satisfied. As you can't use if conditions in
* a workflow's constructor function, use `when-then` instead.
*
* Learn more about why you can't use if conditions and `when-then` in [this documentation](https://docs.medusajs.com/learn/fundamentals/workflows/conditions).
*
* @param values - The data to pass to the second parameter function.
* @param condition - A function that returns a boolean value, indicating whether the steps in `then` should be executed.
*
* @example
* import {
* createWorkflow,
* WorkflowResponse,
* when,
* } from "@medusajs/framework/workflows-sdk"
* // step imports...
*
* const workflow = createWorkflow(
* "workflow",
* function (input: {
* is_active: boolean
* }) {
*
* const result = when(
* input,
* (input) => {
* return input.is_active
* }
* ).then(() => {
* const stepResult = isActiveStep()
* return stepResult
* })
*
* // executed without condition
* const anotherStepResult = anotherStep(result)
*
* return new WorkflowResponse(
* anotherStepResult
* )
* }
* )
*/
export function when<T extends object | WorkflowData, Then extends Function>(
values: T,
condition: ConditionFunction<T>
@@ -26,6 +68,9 @@ export function when<T extends object | WorkflowData, Then extends Function>(
then: ThenFunc
}
/**
* @internal
*/
export function when<T extends object | WorkflowData, Then extends Function>(
name: string,
values: T,
@@ -34,6 +79,9 @@ export function when<T extends object | WorkflowData, Then extends Function>(
then: ThenFunc
}
/**
* @internal
*/
export function when(...args) {
let [name, input, condition] = args
if (args.length === 2) {