diff --git a/packages/core/core-flows/src/tax/steps/create-tax-rate-rules.ts b/packages/core/core-flows/src/tax/steps/create-tax-rate-rules.ts index cba622eb23515..80bdc76e0bfab 100644 --- a/packages/core/core-flows/src/tax/steps/create-tax-rate-rules.ts +++ b/packages/core/core-flows/src/tax/steps/create-tax-rate-rules.ts @@ -3,6 +3,9 @@ import { ModuleRegistrationName } from "@medusajs/utils" import { StepResponse, createStep } from "@medusajs/workflows-sdk" export const createTaxRateRulesStepId = "create-tax-rate-rules" +/** + * This step creates one or more tax rate rules. + */ export const createTaxRateRulesStep = createStep( createTaxRateRulesStepId, async (data: CreateTaxRateRuleDTO[], { container }) => { diff --git a/packages/core/core-flows/src/tax/steps/create-tax-rates.ts b/packages/core/core-flows/src/tax/steps/create-tax-rates.ts index f09287bd1a2f2..4da05d7278aff 100644 --- a/packages/core/core-flows/src/tax/steps/create-tax-rates.ts +++ b/packages/core/core-flows/src/tax/steps/create-tax-rates.ts @@ -3,6 +3,9 @@ import { ModuleRegistrationName } from "@medusajs/utils" import { StepResponse, createStep } from "@medusajs/workflows-sdk" export const createTaxRatesStepId = "create-tax-rates" +/** + * This step creates one or more tax rates. + */ export const createTaxRatesStep = createStep( createTaxRatesStepId, async (data: CreateTaxRateDTO[], { container }) => { diff --git a/packages/core/core-flows/src/tax/steps/create-tax-regions.ts b/packages/core/core-flows/src/tax/steps/create-tax-regions.ts index 46e1dea1112d9..72c7a4e7e2d52 100644 --- a/packages/core/core-flows/src/tax/steps/create-tax-regions.ts +++ b/packages/core/core-flows/src/tax/steps/create-tax-regions.ts @@ -3,6 +3,9 @@ import { ModuleRegistrationName } from "@medusajs/utils" import { StepResponse, createStep } from "@medusajs/workflows-sdk" export const createTaxRegionsStepId = "create-tax-regions" +/** + * This step creates one or more tax regions. + */ export const createTaxRegionsStep = createStep( createTaxRegionsStepId, async (data: CreateTaxRegionDTO[], { container }) => { diff --git a/packages/core/core-flows/src/tax/steps/delete-tax-rate-rules.ts b/packages/core/core-flows/src/tax/steps/delete-tax-rate-rules.ts index 1dfdb2c21fd7c..4c57ba5f6bffd 100644 --- a/packages/core/core-flows/src/tax/steps/delete-tax-rate-rules.ts +++ b/packages/core/core-flows/src/tax/steps/delete-tax-rate-rules.ts @@ -3,6 +3,9 @@ import { ModuleRegistrationName } from "@medusajs/utils" import { StepResponse, createStep } from "@medusajs/workflows-sdk" export const deleteTaxRateRulesStepId = "delete-tax-rate-rules" +/** + * This step deletes one or more tax rate rules. + */ export const deleteTaxRateRulesStep = createStep( deleteTaxRateRulesStepId, async (ids: string[], { container }) => { diff --git a/packages/core/core-flows/src/tax/steps/delete-tax-rates.ts b/packages/core/core-flows/src/tax/steps/delete-tax-rates.ts index 9b1a2f0e84e48..89b2102d74b01 100644 --- a/packages/core/core-flows/src/tax/steps/delete-tax-rates.ts +++ b/packages/core/core-flows/src/tax/steps/delete-tax-rates.ts @@ -3,6 +3,9 @@ import { ModuleRegistrationName } from "@medusajs/utils" import { createStep, StepResponse } from "@medusajs/workflows-sdk" export const deleteTaxRatesStepId = "delete-tax-rates" +/** + * This step deletes one or more tax rates. + */ export const deleteTaxRatesStep = createStep( deleteTaxRatesStepId, async (ids: string[], { container }) => { diff --git a/packages/core/core-flows/src/tax/steps/delete-tax-regions.ts b/packages/core/core-flows/src/tax/steps/delete-tax-regions.ts index 489237967e7aa..8a33fb7adb081 100644 --- a/packages/core/core-flows/src/tax/steps/delete-tax-regions.ts +++ b/packages/core/core-flows/src/tax/steps/delete-tax-regions.ts @@ -3,6 +3,9 @@ import { ModuleRegistrationName } from "@medusajs/utils" import { StepResponse, createStep } from "@medusajs/workflows-sdk" export const deleteTaxRegionsStepId = "delete-tax-regions" +/** + * This step deletes one or more tax regions. + */ export const deleteTaxRegionsStep = createStep( deleteTaxRegionsStepId, async (ids: string[], { container }) => { diff --git a/packages/core/core-flows/src/tax/steps/list-tax-rate-ids.ts b/packages/core/core-flows/src/tax/steps/list-tax-rate-ids.ts index 2bf8e612b6d51..f945060cde10a 100644 --- a/packages/core/core-flows/src/tax/steps/list-tax-rate-ids.ts +++ b/packages/core/core-flows/src/tax/steps/list-tax-rate-ids.ts @@ -2,14 +2,17 @@ import { FilterableTaxRateProps, ITaxModuleService } from "@medusajs/types" import { ModuleRegistrationName } from "@medusajs/utils" import { createStep, StepResponse } from "@medusajs/workflows-sdk" -type StepInput = { +export type ListTaxRateIdsStepInput = { selector: FilterableTaxRateProps } export const listTaxRateIdsStepId = "list-tax-rate-ids" +/** + * This step retrieves the IDs of tax rates matching the specified filters. + */ export const listTaxRateIdsStep = createStep( listTaxRateIdsStepId, - async (input: StepInput, { container }) => { + async (input: ListTaxRateIdsStepInput, { container }) => { const service = container.resolve( ModuleRegistrationName.TAX ) diff --git a/packages/core/core-flows/src/tax/steps/list-tax-rate-rule-ids.ts b/packages/core/core-flows/src/tax/steps/list-tax-rate-rule-ids.ts index af67e1ab084ef..93fddc41d3d20 100644 --- a/packages/core/core-flows/src/tax/steps/list-tax-rate-rule-ids.ts +++ b/packages/core/core-flows/src/tax/steps/list-tax-rate-rule-ids.ts @@ -2,14 +2,17 @@ import { FilterableTaxRateRuleProps, ITaxModuleService } from "@medusajs/types" import { ModuleRegistrationName } from "@medusajs/utils" import { createStep, StepResponse } from "@medusajs/workflows-sdk" -type StepInput = { +export type ListTaxRateRuleIdsStepInput = { selector: FilterableTaxRateRuleProps } export const listTaxRateRuleIdsStepId = "list-tax-rate-rule-ids" +/** + * This step retrieves the IDs of tax rate rules matching the specified filters. + */ export const listTaxRateRuleIdsStep = createStep( listTaxRateRuleIdsStepId, - async (input: StepInput, { container }) => { + async (input: ListTaxRateRuleIdsStepInput, { container }) => { const service = container.resolve( ModuleRegistrationName.TAX ) diff --git a/packages/core/core-flows/src/tax/steps/update-tax-rates.ts b/packages/core/core-flows/src/tax/steps/update-tax-rates.ts index 25b998aa7765f..f824d58136e8b 100644 --- a/packages/core/core-flows/src/tax/steps/update-tax-rates.ts +++ b/packages/core/core-flows/src/tax/steps/update-tax-rates.ts @@ -9,12 +9,15 @@ import { } from "@medusajs/utils" import { StepResponse, createStep } from "@medusajs/workflows-sdk" -type UpdateTaxRatesStepInput = { +export type UpdateTaxRatesStepInput = { selector: FilterableTaxRateProps update: UpdateTaxRateDTO } export const updateTaxRatesStepId = "update-tax-rates" +/** + * This step updates tax rates matching the specified filters. + */ export const updateTaxRatesStep = createStep( updateTaxRatesStepId, async (data: UpdateTaxRatesStepInput, { container }) => { diff --git a/packages/core/core-flows/src/tax/workflows/create-tax-rate-rules.ts b/packages/core/core-flows/src/tax/workflows/create-tax-rate-rules.ts index 406b2e775b68e..d57a251b4d163 100644 --- a/packages/core/core-flows/src/tax/workflows/create-tax-rate-rules.ts +++ b/packages/core/core-flows/src/tax/workflows/create-tax-rate-rules.ts @@ -6,14 +6,17 @@ import { } from "@medusajs/workflows-sdk" import { createTaxRateRulesStep } from "../steps" -type WorkflowInput = { +export type CreateTaxRateRulesWorkflowInput = { rules: CreateTaxRateRuleDTO[] } export const createTaxRateRulesWorkflowId = "create-tax-rate-rules" +/** + * This workflow creates one or more tax rate rules. + */ export const createTaxRateRulesWorkflow = createWorkflow( createTaxRateRulesWorkflowId, - (input: WorkflowData): WorkflowResponse => { + (input: WorkflowData): WorkflowResponse => { return new WorkflowResponse(createTaxRateRulesStep(input.rules)) } ) diff --git a/packages/core/core-flows/src/tax/workflows/create-tax-rates.ts b/packages/core/core-flows/src/tax/workflows/create-tax-rates.ts index 4e859a2712c16..69c9b1d92e706 100644 --- a/packages/core/core-flows/src/tax/workflows/create-tax-rates.ts +++ b/packages/core/core-flows/src/tax/workflows/create-tax-rates.ts @@ -6,12 +6,13 @@ import { } from "@medusajs/workflows-sdk" import { createTaxRatesStep } from "../steps" -type WorkflowInput = CreateTaxRateDTO[] - export const createTaxRatesWorkflowId = "create-tax-rates" +/** + * This workflow creates one or more tax rates. + */ export const createTaxRatesWorkflow = createWorkflow( createTaxRatesWorkflowId, - (input: WorkflowData): WorkflowResponse => { + (input: WorkflowData): WorkflowResponse => { return new WorkflowResponse(createTaxRatesStep(input)) } ) diff --git a/packages/core/core-flows/src/tax/workflows/create-tax-regions.ts b/packages/core/core-flows/src/tax/workflows/create-tax-regions.ts index 90309dc44f37f..81057874f67a3 100644 --- a/packages/core/core-flows/src/tax/workflows/create-tax-regions.ts +++ b/packages/core/core-flows/src/tax/workflows/create-tax-regions.ts @@ -6,12 +6,13 @@ import { } from "@medusajs/workflows-sdk" import { createTaxRegionsStep } from "../steps" -type WorkflowInput = CreateTaxRegionDTO[] - export const createTaxRegionsWorkflowId = "create-tax-regions" +/** + * This workflow creates one or more tax regions. + */ export const createTaxRegionsWorkflow = createWorkflow( createTaxRegionsWorkflowId, - (input: WorkflowData): WorkflowResponse => { + (input: WorkflowData): WorkflowResponse => { return new WorkflowResponse(createTaxRegionsStep(input)) } ) diff --git a/packages/core/core-flows/src/tax/workflows/delete-tax-rate-rules.ts b/packages/core/core-flows/src/tax/workflows/delete-tax-rate-rules.ts index 8c25d1d1ba94f..257cea20ea095 100644 --- a/packages/core/core-flows/src/tax/workflows/delete-tax-rate-rules.ts +++ b/packages/core/core-flows/src/tax/workflows/delete-tax-rate-rules.ts @@ -5,12 +5,15 @@ import { } from "@medusajs/workflows-sdk" import { deleteTaxRateRulesStep } from "../steps" -type WorkflowInput = { ids: string[] } +export type DeleteTaxRateRulesWorkflowInput = { ids: string[] } export const deleteTaxRateRulesWorkflowId = "delete-tax-rate-rules" +/** + * This workflow deletes one or more tax rate rules. + */ export const deleteTaxRateRulesWorkflow = createWorkflow( deleteTaxRateRulesWorkflowId, - (input: WorkflowData): WorkflowResponse => { + (input: WorkflowData): WorkflowResponse => { return new WorkflowResponse(deleteTaxRateRulesStep(input.ids)) } ) diff --git a/packages/core/core-flows/src/tax/workflows/delete-tax-rates.ts b/packages/core/core-flows/src/tax/workflows/delete-tax-rates.ts index f91455f5111f7..28b7735dbb555 100644 --- a/packages/core/core-flows/src/tax/workflows/delete-tax-rates.ts +++ b/packages/core/core-flows/src/tax/workflows/delete-tax-rates.ts @@ -5,12 +5,15 @@ import { } from "@medusajs/workflows-sdk" import { deleteTaxRatesStep } from "../steps" -type WorkflowInput = { ids: string[] } +export type DeleteTaxRatesWorkflowInput = { ids: string[] } export const deleteTaxRatesWorkflowId = "delete-tax-rates" +/** + * This workflow deletes one or more tax rates. + */ export const deleteTaxRatesWorkflow = createWorkflow( deleteTaxRatesWorkflowId, - (input: WorkflowData): WorkflowResponse => { + (input: WorkflowData): WorkflowResponse => { return new WorkflowResponse(deleteTaxRatesStep(input.ids)) } ) diff --git a/packages/core/core-flows/src/tax/workflows/delete-tax-regions.ts b/packages/core/core-flows/src/tax/workflows/delete-tax-regions.ts index 7c98eb8e6c0f1..06e685412c187 100644 --- a/packages/core/core-flows/src/tax/workflows/delete-tax-regions.ts +++ b/packages/core/core-flows/src/tax/workflows/delete-tax-regions.ts @@ -5,12 +5,15 @@ import { } from "@medusajs/workflows-sdk" import { deleteTaxRegionsStep } from "../steps" -type WorkflowInput = { ids: string[] } +export type DeleteTaxRegionsWorkflowInput = { ids: string[] } export const deleteTaxRegionsWorkflowId = "delete-tax-regions" +/** + * This workflow deletes one or more tax regions. + */ export const deleteTaxRegionsWorkflow = createWorkflow( deleteTaxRegionsWorkflowId, - (input: WorkflowData): WorkflowResponse => { + (input: WorkflowData): WorkflowResponse => { return new WorkflowResponse(deleteTaxRegionsStep(input.ids)) } ) diff --git a/packages/core/core-flows/src/tax/workflows/set-tax-rate-rules.ts b/packages/core/core-flows/src/tax/workflows/set-tax-rate-rules.ts index f5c98ea11b574..974945861e51f 100644 --- a/packages/core/core-flows/src/tax/workflows/set-tax-rate-rules.ts +++ b/packages/core/core-flows/src/tax/workflows/set-tax-rate-rules.ts @@ -11,15 +11,18 @@ import { listTaxRateRuleIdsStep, } from "../steps" -type WorkflowInput = { +export type SetTaxRatesRulesWorkflowInput = { tax_rate_ids: string[] rules: Omit[] } export const setTaxRateRulesWorkflowId = "set-tax-rate-rules" +/** + * This workflow sets the rules of tax rates. + */ export const setTaxRateRulesWorkflow = createWorkflow( setTaxRateRulesWorkflowId, - (input: WorkflowData): WorkflowResponse => { + (input: WorkflowData): WorkflowResponse => { const ruleIds = listTaxRateRuleIdsStep({ selector: { tax_rate_id: input.tax_rate_ids }, }) diff --git a/packages/core/core-flows/src/tax/workflows/update-tax-rates.ts b/packages/core/core-flows/src/tax/workflows/update-tax-rates.ts index c2dbbed21d461..811558b5f5ca9 100644 --- a/packages/core/core-flows/src/tax/workflows/update-tax-rates.ts +++ b/packages/core/core-flows/src/tax/workflows/update-tax-rates.ts @@ -20,14 +20,12 @@ import { } from "../steps" // import { setTaxRateRulesWorkflow } from "./set-tax-rate-rules" -type UpdateTaxRatesStepInput = { +export type UpdateTaxRatesWorkflowInput = { selector: FilterableTaxRateProps update: UpdateTaxRateDTO } -type WorkflowInput = UpdateTaxRatesStepInput - -type StepInput = { +export type MaybeListTaxRateRuleIdsStepInput = { tax_rate_ids: string[] update: UpdateTaxRateDTO } @@ -65,9 +63,12 @@ type StepInput = { // ) const maybeListTaxRateRuleIdsStepId = "maybe-list-tax-rate-rule-ids" -const maybeListTaxRateRuleIdsStep = createStep( +/** + * This step lists the rules to update in a tax rate update object. + */ +export const maybeListTaxRateRuleIdsStep = createStep( maybeListTaxRateRuleIdsStepId, - async (input: StepInput, { container }) => { + async (input: MaybeListTaxRateRuleIdsStepInput, { container }) => { const { update, tax_rate_ids } = input if (!update.rules) { @@ -88,9 +89,12 @@ const maybeListTaxRateRuleIdsStep = createStep( ) export const updateTaxRatesWorkflowId = "update-tax-rates" +/** + * This workflow updates tax rates matching specified filters. + */ export const updateTaxRatesWorkflow = createWorkflow( updateTaxRatesWorkflowId, - (input: WorkflowData): WorkflowResponse => { + (input: WorkflowData): WorkflowResponse => { const cleanedUpdateInput = transform(input, (data) => { // Transform clones data so we can safely modify it if (data.update.rules) {