diff --git a/packages/core/core-flows/src/shipping-options/steps/list-shipping-options-for-context.ts b/packages/core/core-flows/src/shipping-options/steps/list-shipping-options-for-context.ts index b348dfe001..dea019cf52 100644 --- a/packages/core/core-flows/src/shipping-options/steps/list-shipping-options-for-context.ts +++ b/packages/core/core-flows/src/shipping-options/steps/list-shipping-options-for-context.ts @@ -6,16 +6,19 @@ import { import { ModuleRegistrationName } from "@medusajs/utils" import { StepResponse, createStep } from "@medusajs/workflows-sdk" -interface StepInput { +export interface ListShippingOptionsForContextStepInput { context: Record config?: FindConfig } export const listShippingOptionsForContextStepId = "list-shipping-options-for-context" +/** + * This step retrieves shipping options that can be used in the specified context. + */ export const listShippingOptionsForContextStep = createStep( listShippingOptionsForContextStepId, - async (data: StepInput, { container }) => { + async (data: ListShippingOptionsForContextStepInput, { container }) => { const fulfillmentService = container.resolve( ModuleRegistrationName.FULFILLMENT ) diff --git a/packages/core/core-flows/src/shipping-profile/steps/delete-shipping-profile.ts b/packages/core/core-flows/src/shipping-profile/steps/delete-shipping-profile.ts index 29f9fff1ad..c919ed6f29 100644 --- a/packages/core/core-flows/src/shipping-profile/steps/delete-shipping-profile.ts +++ b/packages/core/core-flows/src/shipping-profile/steps/delete-shipping-profile.ts @@ -3,6 +3,9 @@ import { ModuleRegistrationName } from "@medusajs/utils" import { StepResponse, createStep } from "@medusajs/workflows-sdk" export const deleteShippingProfilesStepId = "delete-shipping-profile" +/** + * This step deletes one or more shipping profiles. + */ export const deleteShippingProfilesStep = createStep( deleteShippingProfilesStepId, async (ids: string[], { container }) => { diff --git a/packages/core/core-flows/src/shipping-profile/workflows/delete-shipping-profile.ts b/packages/core/core-flows/src/shipping-profile/workflows/delete-shipping-profile.ts index aee55fd6a9..50d18d731e 100644 --- a/packages/core/core-flows/src/shipping-profile/workflows/delete-shipping-profile.ts +++ b/packages/core/core-flows/src/shipping-profile/workflows/delete-shipping-profile.ts @@ -6,6 +6,9 @@ import { Modules } from "@medusajs/utils" export const deleteShippingProfileWorkflowId = "delete-shipping-profile-workflow" +/** + * This workflow deletes one or more shipping profiles. + */ export const deleteShippingProfileWorkflow = createWorkflow( deleteShippingProfileWorkflowId, (input: WorkflowData<{ ids: string[] }>) => { diff --git a/packages/core/core-flows/src/stock-location/steps/associate-locations-with-fulfillment-sets.ts b/packages/core/core-flows/src/stock-location/steps/associate-locations-with-fulfillment-sets.ts index 9a141a2ce2..e24dc37d90 100644 --- a/packages/core/core-flows/src/stock-location/steps/associate-locations-with-fulfillment-sets.ts +++ b/packages/core/core-flows/src/stock-location/steps/associate-locations-with-fulfillment-sets.ts @@ -1,7 +1,7 @@ import { ContainerRegistrationKeys, Modules } from "@medusajs/utils" import { createStep, StepResponse } from "@medusajs/workflows-sdk" -interface StepInput { +export interface AssociateFulfillmentSetsWithLocationStepInput { input: { location_id: string fulfillment_set_ids: string[] @@ -10,9 +10,12 @@ interface StepInput { export const associateFulfillmentSetsWithLocationStepId = "associate-fulfillment-sets-with-location-step" +/** + * This step creates links between location and fulfillment set records. + */ export const associateFulfillmentSetsWithLocationStep = createStep( associateFulfillmentSetsWithLocationStepId, - async (data: StepInput, { container }) => { + async (data: AssociateFulfillmentSetsWithLocationStepInput, { container }) => { if (!data.input.length) { return new StepResponse([], []) } diff --git a/packages/core/core-flows/src/stock-location/steps/create-stock-locations.ts b/packages/core/core-flows/src/stock-location/steps/create-stock-locations.ts index 305c178ecb..aa84d47893 100644 --- a/packages/core/core-flows/src/stock-location/steps/create-stock-locations.ts +++ b/packages/core/core-flows/src/stock-location/steps/create-stock-locations.ts @@ -7,6 +7,9 @@ import { StepResponse, createStep } from "@medusajs/workflows-sdk" import { ModuleRegistrationName } from "@medusajs/utils" export const createStockLocationsStepId = "create-stock-locations" +/** + * This step creates one or more stock locations. + */ export const createStockLocations = createStep( createStockLocationsStepId, async (data: CreateStockLocationInput[], { container }) => { diff --git a/packages/core/core-flows/src/stock-location/steps/delete-stock-locations.ts b/packages/core/core-flows/src/stock-location/steps/delete-stock-locations.ts index b81013104f..56381cbee9 100644 --- a/packages/core/core-flows/src/stock-location/steps/delete-stock-locations.ts +++ b/packages/core/core-flows/src/stock-location/steps/delete-stock-locations.ts @@ -3,6 +3,9 @@ import { ModuleRegistrationName, Modules } from "@medusajs/utils" import { createStep, StepResponse } from "@medusajs/workflows-sdk" export const deleteStockLocationsStepId = "delete-stock-locations-step" +/** + * This step deletes one or more stock locations. + */ export const deleteStockLocationsStep = createStep( deleteStockLocationsStepId, async (input: string[], { container }) => { diff --git a/packages/core/core-flows/src/stock-location/steps/update-stock-locations.ts b/packages/core/core-flows/src/stock-location/steps/update-stock-locations.ts index ebacd66c01..8808fbf399 100644 --- a/packages/core/core-flows/src/stock-location/steps/update-stock-locations.ts +++ b/packages/core/core-flows/src/stock-location/steps/update-stock-locations.ts @@ -14,6 +14,9 @@ interface StepInput { } export const updateStockLocationsStepId = "update-stock-locations-step" +/** + * This step updates stock locations matching the specified filters. + */ export const updateStockLocationsStep = createStep( updateStockLocationsStepId, async (input: StepInput, { container }) => { diff --git a/packages/core/core-flows/src/stock-location/workflows/create-location-fulfillment-set.ts b/packages/core/core-flows/src/stock-location/workflows/create-location-fulfillment-set.ts index 9a90b892d6..cc84ce7763 100644 --- a/packages/core/core-flows/src/stock-location/workflows/create-location-fulfillment-set.ts +++ b/packages/core/core-flows/src/stock-location/workflows/create-location-fulfillment-set.ts @@ -9,6 +9,9 @@ import { associateFulfillmentSetsWithLocationStep } from "../steps/associate-loc export const createLocationFulfillmentSetWorkflowId = "create-location-fulfillment-set" +/** + * This workflow creates links between location and fulfillment set records. + */ export const createLocationFulfillmentSetWorkflow = createWorkflow( createLocationFulfillmentSetWorkflowId, (input: WorkflowData) => { diff --git a/packages/core/core-flows/src/stock-location/workflows/create-stock-locations.ts b/packages/core/core-flows/src/stock-location/workflows/create-stock-locations.ts index 02e131bcd2..179258eb2d 100644 --- a/packages/core/core-flows/src/stock-location/workflows/create-stock-locations.ts +++ b/packages/core/core-flows/src/stock-location/workflows/create-stock-locations.ts @@ -7,14 +7,17 @@ import { import { CreateStockLocationInput } from "@medusajs/types" import { createStockLocations } from "../steps" -interface WorkflowInput { +export interface CreateStockLocationsWorkflowInput { locations: CreateStockLocationInput[] } export const createStockLocationsWorkflowId = "create-stock-locations-workflow" +/** + * This workflow creates one or more stock locations. + */ export const createStockLocationsWorkflow = createWorkflow( createStockLocationsWorkflowId, - (input: WorkflowData) => { + (input: WorkflowData) => { return new WorkflowResponse(createStockLocations(input.locations)) } ) diff --git a/packages/core/core-flows/src/stock-location/workflows/delete-stock-locations.ts b/packages/core/core-flows/src/stock-location/workflows/delete-stock-locations.ts index cbab3c9e96..282c861406 100644 --- a/packages/core/core-flows/src/stock-location/workflows/delete-stock-locations.ts +++ b/packages/core/core-flows/src/stock-location/workflows/delete-stock-locations.ts @@ -3,14 +3,17 @@ import { WorkflowData, createWorkflow } from "@medusajs/workflows-sdk" import { removeRemoteLinkStep } from "../../common/steps/remove-remote-links" import { deleteStockLocationsStep } from "../steps" -interface WorkflowInput { +export interface DeleteStockLocationWorkflowInput { ids: string[] } export const deleteStockLocationsWorkflowId = "delete-stock-locations-workflow" +/** + * This workflow deletes one or more stock locations. + */ export const deleteStockLocationsWorkflow = createWorkflow( deleteStockLocationsWorkflowId, - (input: WorkflowData) => { + (input: WorkflowData) => { const softDeletedEntities = deleteStockLocationsStep(input.ids) removeRemoteLinkStep(softDeletedEntities) } diff --git a/packages/core/core-flows/src/stock-location/workflows/link-sales-channels-to-stock-location.ts b/packages/core/core-flows/src/stock-location/workflows/link-sales-channels-to-stock-location.ts index ed61c0f211..918f1dd43a 100644 --- a/packages/core/core-flows/src/stock-location/workflows/link-sales-channels-to-stock-location.ts +++ b/packages/core/core-flows/src/stock-location/workflows/link-sales-channels-to-stock-location.ts @@ -8,6 +8,9 @@ import { export const linkSalesChannelsToStockLocationWorkflowId = "link-sales-channels-to-stock-location" +/** + * This workflow creates and dismisses links between location and sales channel records. + */ export const linkSalesChannelsToStockLocationWorkflow = createWorkflow( linkSalesChannelsToStockLocationWorkflowId, (input: WorkflowData): void => { diff --git a/packages/core/core-flows/src/stock-location/workflows/update-stock-locations.ts b/packages/core/core-flows/src/stock-location/workflows/update-stock-locations.ts index d83307f5f0..cbecc2096f 100644 --- a/packages/core/core-flows/src/stock-location/workflows/update-stock-locations.ts +++ b/packages/core/core-flows/src/stock-location/workflows/update-stock-locations.ts @@ -11,15 +11,18 @@ import { import { updateStockLocationsStep } from "../steps" -interface WorkflowInput { +export interface UpdateStockLocationsWorkflowInput { selector: FilterableStockLocationProps update: UpdateStockLocationInput } export const updateStockLocationsWorkflowId = "update-stock-locations-workflow" +/** + * This workflow updates stock locations matching the specified filters. + */ export const updateStockLocationsWorkflow = createWorkflow( updateStockLocationsWorkflowId, ( - input: WorkflowData + input: WorkflowData ): WorkflowResponse => { return new WorkflowResponse(updateStockLocationsStep(input)) } diff --git a/packages/core/core-flows/src/store/steps/create-stores.ts b/packages/core/core-flows/src/store/steps/create-stores.ts index 76af9af2ec..8b369d792a 100644 --- a/packages/core/core-flows/src/store/steps/create-stores.ts +++ b/packages/core/core-flows/src/store/steps/create-stores.ts @@ -2,12 +2,13 @@ import { CreateStoreDTO, IStoreModuleService } from "@medusajs/types" import { ModuleRegistrationName } from "@medusajs/utils" import { StepResponse, createStep } from "@medusajs/workflows-sdk" -type CreateStoresStepInput = CreateStoreDTO[] - export const createStoresStepId = "create-stores" +/** + * This step creates one or more stores. + */ export const createStoresStep = createStep( createStoresStepId, - async (data: CreateStoresStepInput, { container }) => { + async (data: CreateStoreDTO[], { container }) => { const service = container.resolve( ModuleRegistrationName.STORE ) diff --git a/packages/core/core-flows/src/store/steps/delete-stores.ts b/packages/core/core-flows/src/store/steps/delete-stores.ts index 78d8363885..daaa261bf8 100644 --- a/packages/core/core-flows/src/store/steps/delete-stores.ts +++ b/packages/core/core-flows/src/store/steps/delete-stores.ts @@ -3,6 +3,9 @@ import { ModuleRegistrationName } from "@medusajs/utils" import { StepResponse, createStep } from "@medusajs/workflows-sdk" export const deleteStoresStepId = "delete-stores" +/** + * This step deletes one or more stores. + */ export const deleteStoresStep = createStep( deleteStoresStepId, async (ids: string[], { container }) => { diff --git a/packages/core/core-flows/src/store/steps/update-stores.ts b/packages/core/core-flows/src/store/steps/update-stores.ts index 5cd7368069..0ba55217ac 100644 --- a/packages/core/core-flows/src/store/steps/update-stores.ts +++ b/packages/core/core-flows/src/store/steps/update-stores.ts @@ -9,15 +9,18 @@ import { } from "@medusajs/utils" import { StepResponse, createStep } from "@medusajs/workflows-sdk" -type WorkflowInputData = { +export type UpdateStoresStepInput = { selector: FilterableStoreProps update: UpdateStoreDTO } export const updateStoresStepId = "update-stores" +/** + * This step updates stores matching the specified filters. + */ export const updateStoresStep = createStep( updateStoresStepId, - async (data: WorkflowInputData, { container }) => { + async (data: UpdateStoresStepInput, { container }) => { const service = container.resolve( ModuleRegistrationName.STORE ) diff --git a/packages/core/core-flows/src/store/workflows/create-stores.ts b/packages/core/core-flows/src/store/workflows/create-stores.ts index 747be7b62a..2c87146fea 100644 --- a/packages/core/core-flows/src/store/workflows/create-stores.ts +++ b/packages/core/core-flows/src/store/workflows/create-stores.ts @@ -8,12 +8,15 @@ import { import { createStoresStep } from "../steps" import { updatePricePreferencesAsArrayStep } from "../../pricing" -type WorkflowInputData = { stores: StoreWorkflow.CreateStoreWorkflowInput[] } +type CreateStoresWorkflowInput = { stores: StoreWorkflow.CreateStoreWorkflowInput[] } export const createStoresWorkflowId = "create-stores" +/** + * This workflow creates one or more stores. + */ export const createStoresWorkflow = createWorkflow( createStoresWorkflowId, - (input: WorkflowData): WorkflowResponse => { + (input: WorkflowData): WorkflowResponse => { const normalizedInput = transform({ input }, (data) => { return data.input.stores.map((store) => { return { diff --git a/packages/core/core-flows/src/store/workflows/delete-stores.ts b/packages/core/core-flows/src/store/workflows/delete-stores.ts index 14d5a3c49d..b596ac8a3b 100644 --- a/packages/core/core-flows/src/store/workflows/delete-stores.ts +++ b/packages/core/core-flows/src/store/workflows/delete-stores.ts @@ -1,12 +1,15 @@ import { WorkflowData, createWorkflow } from "@medusajs/workflows-sdk" import { deleteStoresStep } from "../steps" -type WorkflowInput = { ids: string[] } +export type DeleteStoresWorkflowInput = { ids: string[] } export const deleteStoresWorkflowId = "delete-stores" +/** + * This workflow deletes one or more stores. + */ export const deleteStoresWorkflow = createWorkflow( deleteStoresWorkflowId, - (input: WorkflowData): WorkflowData => { + (input: WorkflowData): WorkflowData => { return deleteStoresStep(input.ids) } ) diff --git a/packages/core/core-flows/src/store/workflows/update-stores.ts b/packages/core/core-flows/src/store/workflows/update-stores.ts index deee9746c1..8937c85d38 100644 --- a/packages/core/core-flows/src/store/workflows/update-stores.ts +++ b/packages/core/core-flows/src/store/workflows/update-stores.ts @@ -9,12 +9,13 @@ import { import { updateStoresStep } from "../steps" import { updatePricePreferencesAsArrayStep } from "../../pricing" -type WorkflowInputData = StoreWorkflow.UpdateStoreWorkflowInput - export const updateStoresWorkflowId = "update-stores" +/** + * This workflow updates stores matching the specified filters. + */ export const updateStoresWorkflow = createWorkflow( updateStoresWorkflowId, - (input: WorkflowData): WorkflowResponse => { + (input: WorkflowData): WorkflowResponse => { const normalizedInput = transform({ input }, (data) => { if (!data.input.update.supported_currencies?.length) { return data.input diff --git a/packages/core/core-flows/src/user/steps/create-users.ts b/packages/core/core-flows/src/user/steps/create-users.ts index a0c0a8399d..ddca9d922e 100644 --- a/packages/core/core-flows/src/user/steps/create-users.ts +++ b/packages/core/core-flows/src/user/steps/create-users.ts @@ -3,6 +3,9 @@ import { ModuleRegistrationName } from "@medusajs/utils" import { StepResponse, createStep } from "@medusajs/workflows-sdk" export const createUsersStepId = "create-users-step" +/** + * This step creates one or more users. + */ export const createUsersStep = createStep( createUsersStepId, async (input: CreateUserDTO[], { container }) => { diff --git a/packages/core/core-flows/src/user/steps/delete-users.ts b/packages/core/core-flows/src/user/steps/delete-users.ts index 1b58233c13..d8012b1a60 100644 --- a/packages/core/core-flows/src/user/steps/delete-users.ts +++ b/packages/core/core-flows/src/user/steps/delete-users.ts @@ -3,6 +3,9 @@ import { ModuleRegistrationName } from "@medusajs/utils" import { StepResponse, createStep } from "@medusajs/workflows-sdk" export const deleteUsersStepId = "delete-users-step" +/** + * This step deletes one or more stores. + */ export const deleteUsersStep = createStep( deleteUsersStepId, async (input: string[], { container }) => { diff --git a/packages/core/core-flows/src/user/steps/update-users.ts b/packages/core/core-flows/src/user/steps/update-users.ts index d1c883b881..cc7c3ad9fc 100644 --- a/packages/core/core-flows/src/user/steps/update-users.ts +++ b/packages/core/core-flows/src/user/steps/update-users.ts @@ -3,6 +3,9 @@ import { ModuleRegistrationName } from "@medusajs/utils" import { StepResponse, createStep } from "@medusajs/workflows-sdk" export const updateUsersStepId = "update-users-step" +/** + * This step updates one or more stores. + */ export const updateUsersStep = createStep( updateUsersStepId, async (input: UpdateUserDTO[], { container }) => { diff --git a/packages/core/core-flows/src/user/workflows/create-user-account.ts b/packages/core/core-flows/src/user/workflows/create-user-account.ts index d0de01caa6..2bda92220b 100644 --- a/packages/core/core-flows/src/user/workflows/create-user-account.ts +++ b/packages/core/core-flows/src/user/workflows/create-user-account.ts @@ -8,15 +8,18 @@ import { import { createUsersStep } from "../steps" import { setAuthAppMetadataStep } from "../../auth" -type WorkflowInput = { +export type CreateUserAccountWorkflowInput = { authIdentityId: string userData: CreateUserDTO } export const createUserAccountWorkflowId = "create-user-account" +/** + * This workflow creates an authentication identity for a user. + */ export const createUserAccountWorkflow = createWorkflow( createUserAccountWorkflowId, - (input: WorkflowData): WorkflowResponse => { + (input: WorkflowData): WorkflowResponse => { const users = createUsersStep([input.userData]) const user = transform(users, (users: UserDTO[]) => users[0]) diff --git a/packages/core/core-flows/src/user/workflows/create-users.ts b/packages/core/core-flows/src/user/workflows/create-users.ts index 4fc3744fcf..df19dd8c13 100644 --- a/packages/core/core-flows/src/user/workflows/create-users.ts +++ b/packages/core/core-flows/src/user/workflows/create-users.ts @@ -8,6 +8,9 @@ import { createUsersStep } from "../steps" import { UserWorkflow } from "@medusajs/types" export const createUsersWorkflowId = "create-users-workflow" +/** + * This workflow creates one or more users. + */ export const createUsersWorkflow = createWorkflow( createUsersWorkflowId, ( diff --git a/packages/core/core-flows/src/user/workflows/delete-users.ts b/packages/core/core-flows/src/user/workflows/delete-users.ts index 1fef9f8df2..bee77f537f 100644 --- a/packages/core/core-flows/src/user/workflows/delete-users.ts +++ b/packages/core/core-flows/src/user/workflows/delete-users.ts @@ -3,6 +3,9 @@ import { deleteUsersStep } from "../steps" import { UserWorkflow } from "@medusajs/types" export const deleteUsersWorkflowId = "delete-user" +/** + * This workflow deletes one or more users. + */ export const deleteUsersWorkflow = createWorkflow( deleteUsersWorkflowId, ( diff --git a/packages/core/core-flows/src/user/workflows/update-users.ts b/packages/core/core-flows/src/user/workflows/update-users.ts index b78051d798..693577b10a 100644 --- a/packages/core/core-flows/src/user/workflows/update-users.ts +++ b/packages/core/core-flows/src/user/workflows/update-users.ts @@ -8,6 +8,9 @@ import { updateUsersStep } from "../steps" import { UserWorkflow } from "@medusajs/types" export const updateUsersWorkflowId = "update-users-workflow" +/** + * This workflow updates one or more users. + */ export const updateUsersWorkflow = createWorkflow( updateUsersWorkflowId, (