chore(core-flows): [17] export types and steps, add basic TSDocs (#8528)
This commit is contained in:
+5
-2
@@ -6,16 +6,19 @@ import {
|
|||||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
interface StepInput {
|
export interface ListShippingOptionsForContextStepInput {
|
||||||
context: Record<string, unknown>
|
context: Record<string, unknown>
|
||||||
config?: FindConfig<ShippingOptionDTO>
|
config?: FindConfig<ShippingOptionDTO>
|
||||||
}
|
}
|
||||||
|
|
||||||
export const listShippingOptionsForContextStepId =
|
export const listShippingOptionsForContextStepId =
|
||||||
"list-shipping-options-for-context"
|
"list-shipping-options-for-context"
|
||||||
|
/**
|
||||||
|
* This step retrieves shipping options that can be used in the specified context.
|
||||||
|
*/
|
||||||
export const listShippingOptionsForContextStep = createStep(
|
export const listShippingOptionsForContextStep = createStep(
|
||||||
listShippingOptionsForContextStepId,
|
listShippingOptionsForContextStepId,
|
||||||
async (data: StepInput, { container }) => {
|
async (data: ListShippingOptionsForContextStepInput, { container }) => {
|
||||||
const fulfillmentService = container.resolve<IFulfillmentModuleService>(
|
const fulfillmentService = container.resolve<IFulfillmentModuleService>(
|
||||||
ModuleRegistrationName.FULFILLMENT
|
ModuleRegistrationName.FULFILLMENT
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ import { ModuleRegistrationName } from "@medusajs/utils"
|
|||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
export const deleteShippingProfilesStepId = "delete-shipping-profile"
|
export const deleteShippingProfilesStepId = "delete-shipping-profile"
|
||||||
|
/**
|
||||||
|
* This step deletes one or more shipping profiles.
|
||||||
|
*/
|
||||||
export const deleteShippingProfilesStep = createStep(
|
export const deleteShippingProfilesStep = createStep(
|
||||||
deleteShippingProfilesStepId,
|
deleteShippingProfilesStepId,
|
||||||
async (ids: string[], { container }) => {
|
async (ids: string[], { container }) => {
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import { Modules } from "@medusajs/utils"
|
|||||||
|
|
||||||
export const deleteShippingProfileWorkflowId =
|
export const deleteShippingProfileWorkflowId =
|
||||||
"delete-shipping-profile-workflow"
|
"delete-shipping-profile-workflow"
|
||||||
|
/**
|
||||||
|
* This workflow deletes one or more shipping profiles.
|
||||||
|
*/
|
||||||
export const deleteShippingProfileWorkflow = createWorkflow(
|
export const deleteShippingProfileWorkflow = createWorkflow(
|
||||||
deleteShippingProfileWorkflowId,
|
deleteShippingProfileWorkflowId,
|
||||||
(input: WorkflowData<{ ids: string[] }>) => {
|
(input: WorkflowData<{ ids: string[] }>) => {
|
||||||
|
|||||||
+5
-2
@@ -1,7 +1,7 @@
|
|||||||
import { ContainerRegistrationKeys, Modules } from "@medusajs/utils"
|
import { ContainerRegistrationKeys, Modules } from "@medusajs/utils"
|
||||||
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
|
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
interface StepInput {
|
export interface AssociateFulfillmentSetsWithLocationStepInput {
|
||||||
input: {
|
input: {
|
||||||
location_id: string
|
location_id: string
|
||||||
fulfillment_set_ids: string[]
|
fulfillment_set_ids: string[]
|
||||||
@@ -10,9 +10,12 @@ interface StepInput {
|
|||||||
|
|
||||||
export const associateFulfillmentSetsWithLocationStepId =
|
export const associateFulfillmentSetsWithLocationStepId =
|
||||||
"associate-fulfillment-sets-with-location-step"
|
"associate-fulfillment-sets-with-location-step"
|
||||||
|
/**
|
||||||
|
* This step creates links between location and fulfillment set records.
|
||||||
|
*/
|
||||||
export const associateFulfillmentSetsWithLocationStep = createStep(
|
export const associateFulfillmentSetsWithLocationStep = createStep(
|
||||||
associateFulfillmentSetsWithLocationStepId,
|
associateFulfillmentSetsWithLocationStepId,
|
||||||
async (data: StepInput, { container }) => {
|
async (data: AssociateFulfillmentSetsWithLocationStepInput, { container }) => {
|
||||||
if (!data.input.length) {
|
if (!data.input.length) {
|
||||||
return new StepResponse([], [])
|
return new StepResponse([], [])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
|||||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||||
|
|
||||||
export const createStockLocationsStepId = "create-stock-locations"
|
export const createStockLocationsStepId = "create-stock-locations"
|
||||||
|
/**
|
||||||
|
* This step creates one or more stock locations.
|
||||||
|
*/
|
||||||
export const createStockLocations = createStep(
|
export const createStockLocations = createStep(
|
||||||
createStockLocationsStepId,
|
createStockLocationsStepId,
|
||||||
async (data: CreateStockLocationInput[], { container }) => {
|
async (data: CreateStockLocationInput[], { container }) => {
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ import { ModuleRegistrationName, Modules } from "@medusajs/utils"
|
|||||||
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
|
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
export const deleteStockLocationsStepId = "delete-stock-locations-step"
|
export const deleteStockLocationsStepId = "delete-stock-locations-step"
|
||||||
|
/**
|
||||||
|
* This step deletes one or more stock locations.
|
||||||
|
*/
|
||||||
export const deleteStockLocationsStep = createStep(
|
export const deleteStockLocationsStep = createStep(
|
||||||
deleteStockLocationsStepId,
|
deleteStockLocationsStepId,
|
||||||
async (input: string[], { container }) => {
|
async (input: string[], { container }) => {
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ interface StepInput {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const updateStockLocationsStepId = "update-stock-locations-step"
|
export const updateStockLocationsStepId = "update-stock-locations-step"
|
||||||
|
/**
|
||||||
|
* This step updates stock locations matching the specified filters.
|
||||||
|
*/
|
||||||
export const updateStockLocationsStep = createStep(
|
export const updateStockLocationsStep = createStep(
|
||||||
updateStockLocationsStepId,
|
updateStockLocationsStepId,
|
||||||
async (input: StepInput, { container }) => {
|
async (input: StepInput, { container }) => {
|
||||||
|
|||||||
+3
@@ -9,6 +9,9 @@ import { associateFulfillmentSetsWithLocationStep } from "../steps/associate-loc
|
|||||||
|
|
||||||
export const createLocationFulfillmentSetWorkflowId =
|
export const createLocationFulfillmentSetWorkflowId =
|
||||||
"create-location-fulfillment-set"
|
"create-location-fulfillment-set"
|
||||||
|
/**
|
||||||
|
* This workflow creates links between location and fulfillment set records.
|
||||||
|
*/
|
||||||
export const createLocationFulfillmentSetWorkflow = createWorkflow(
|
export const createLocationFulfillmentSetWorkflow = createWorkflow(
|
||||||
createLocationFulfillmentSetWorkflowId,
|
createLocationFulfillmentSetWorkflowId,
|
||||||
(input: WorkflowData<CreateLocationFulfillmentSetWorkflowInputDTO>) => {
|
(input: WorkflowData<CreateLocationFulfillmentSetWorkflowInputDTO>) => {
|
||||||
|
|||||||
@@ -7,14 +7,17 @@ import {
|
|||||||
import { CreateStockLocationInput } from "@medusajs/types"
|
import { CreateStockLocationInput } from "@medusajs/types"
|
||||||
import { createStockLocations } from "../steps"
|
import { createStockLocations } from "../steps"
|
||||||
|
|
||||||
interface WorkflowInput {
|
export interface CreateStockLocationsWorkflowInput {
|
||||||
locations: CreateStockLocationInput[]
|
locations: CreateStockLocationInput[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export const createStockLocationsWorkflowId = "create-stock-locations-workflow"
|
export const createStockLocationsWorkflowId = "create-stock-locations-workflow"
|
||||||
|
/**
|
||||||
|
* This workflow creates one or more stock locations.
|
||||||
|
*/
|
||||||
export const createStockLocationsWorkflow = createWorkflow(
|
export const createStockLocationsWorkflow = createWorkflow(
|
||||||
createStockLocationsWorkflowId,
|
createStockLocationsWorkflowId,
|
||||||
(input: WorkflowData<WorkflowInput>) => {
|
(input: WorkflowData<CreateStockLocationsWorkflowInput>) => {
|
||||||
return new WorkflowResponse(createStockLocations(input.locations))
|
return new WorkflowResponse(createStockLocations(input.locations))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,14 +3,17 @@ import { WorkflowData, createWorkflow } from "@medusajs/workflows-sdk"
|
|||||||
import { removeRemoteLinkStep } from "../../common/steps/remove-remote-links"
|
import { removeRemoteLinkStep } from "../../common/steps/remove-remote-links"
|
||||||
import { deleteStockLocationsStep } from "../steps"
|
import { deleteStockLocationsStep } from "../steps"
|
||||||
|
|
||||||
interface WorkflowInput {
|
export interface DeleteStockLocationWorkflowInput {
|
||||||
ids: string[]
|
ids: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export const deleteStockLocationsWorkflowId = "delete-stock-locations-workflow"
|
export const deleteStockLocationsWorkflowId = "delete-stock-locations-workflow"
|
||||||
|
/**
|
||||||
|
* This workflow deletes one or more stock locations.
|
||||||
|
*/
|
||||||
export const deleteStockLocationsWorkflow = createWorkflow(
|
export const deleteStockLocationsWorkflow = createWorkflow(
|
||||||
deleteStockLocationsWorkflowId,
|
deleteStockLocationsWorkflowId,
|
||||||
(input: WorkflowData<WorkflowInput>) => {
|
(input: WorkflowData<DeleteStockLocationWorkflowInput>) => {
|
||||||
const softDeletedEntities = deleteStockLocationsStep(input.ids)
|
const softDeletedEntities = deleteStockLocationsStep(input.ids)
|
||||||
removeRemoteLinkStep(softDeletedEntities)
|
removeRemoteLinkStep(softDeletedEntities)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
@@ -8,6 +8,9 @@ import {
|
|||||||
|
|
||||||
export const linkSalesChannelsToStockLocationWorkflowId =
|
export const linkSalesChannelsToStockLocationWorkflowId =
|
||||||
"link-sales-channels-to-stock-location"
|
"link-sales-channels-to-stock-location"
|
||||||
|
/**
|
||||||
|
* This workflow creates and dismisses links between location and sales channel records.
|
||||||
|
*/
|
||||||
export const linkSalesChannelsToStockLocationWorkflow = createWorkflow(
|
export const linkSalesChannelsToStockLocationWorkflow = createWorkflow(
|
||||||
linkSalesChannelsToStockLocationWorkflowId,
|
linkSalesChannelsToStockLocationWorkflowId,
|
||||||
(input: WorkflowData<LinkWorkflowInput>): void => {
|
(input: WorkflowData<LinkWorkflowInput>): void => {
|
||||||
|
|||||||
@@ -11,15 +11,18 @@ import {
|
|||||||
|
|
||||||
import { updateStockLocationsStep } from "../steps"
|
import { updateStockLocationsStep } from "../steps"
|
||||||
|
|
||||||
interface WorkflowInput {
|
export interface UpdateStockLocationsWorkflowInput {
|
||||||
selector: FilterableStockLocationProps
|
selector: FilterableStockLocationProps
|
||||||
update: UpdateStockLocationInput
|
update: UpdateStockLocationInput
|
||||||
}
|
}
|
||||||
export const updateStockLocationsWorkflowId = "update-stock-locations-workflow"
|
export const updateStockLocationsWorkflowId = "update-stock-locations-workflow"
|
||||||
|
/**
|
||||||
|
* This workflow updates stock locations matching the specified filters.
|
||||||
|
*/
|
||||||
export const updateStockLocationsWorkflow = createWorkflow(
|
export const updateStockLocationsWorkflow = createWorkflow(
|
||||||
updateStockLocationsWorkflowId,
|
updateStockLocationsWorkflowId,
|
||||||
(
|
(
|
||||||
input: WorkflowData<WorkflowInput>
|
input: WorkflowData<UpdateStockLocationsWorkflowInput>
|
||||||
): WorkflowResponse<StockLocationDTO[]> => {
|
): WorkflowResponse<StockLocationDTO[]> => {
|
||||||
return new WorkflowResponse(updateStockLocationsStep(input))
|
return new WorkflowResponse(updateStockLocationsStep(input))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,13 @@ import { CreateStoreDTO, IStoreModuleService } from "@medusajs/types"
|
|||||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
type CreateStoresStepInput = CreateStoreDTO[]
|
|
||||||
|
|
||||||
export const createStoresStepId = "create-stores"
|
export const createStoresStepId = "create-stores"
|
||||||
|
/**
|
||||||
|
* This step creates one or more stores.
|
||||||
|
*/
|
||||||
export const createStoresStep = createStep(
|
export const createStoresStep = createStep(
|
||||||
createStoresStepId,
|
createStoresStepId,
|
||||||
async (data: CreateStoresStepInput, { container }) => {
|
async (data: CreateStoreDTO[], { container }) => {
|
||||||
const service = container.resolve<IStoreModuleService>(
|
const service = container.resolve<IStoreModuleService>(
|
||||||
ModuleRegistrationName.STORE
|
ModuleRegistrationName.STORE
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ import { ModuleRegistrationName } from "@medusajs/utils"
|
|||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
export const deleteStoresStepId = "delete-stores"
|
export const deleteStoresStepId = "delete-stores"
|
||||||
|
/**
|
||||||
|
* This step deletes one or more stores.
|
||||||
|
*/
|
||||||
export const deleteStoresStep = createStep(
|
export const deleteStoresStep = createStep(
|
||||||
deleteStoresStepId,
|
deleteStoresStepId,
|
||||||
async (ids: string[], { container }) => {
|
async (ids: string[], { container }) => {
|
||||||
|
|||||||
@@ -9,15 +9,18 @@ import {
|
|||||||
} from "@medusajs/utils"
|
} from "@medusajs/utils"
|
||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
type WorkflowInputData = {
|
export type UpdateStoresStepInput = {
|
||||||
selector: FilterableStoreProps
|
selector: FilterableStoreProps
|
||||||
update: UpdateStoreDTO
|
update: UpdateStoreDTO
|
||||||
}
|
}
|
||||||
|
|
||||||
export const updateStoresStepId = "update-stores"
|
export const updateStoresStepId = "update-stores"
|
||||||
|
/**
|
||||||
|
* This step updates stores matching the specified filters.
|
||||||
|
*/
|
||||||
export const updateStoresStep = createStep(
|
export const updateStoresStep = createStep(
|
||||||
updateStoresStepId,
|
updateStoresStepId,
|
||||||
async (data: WorkflowInputData, { container }) => {
|
async (data: UpdateStoresStepInput, { container }) => {
|
||||||
const service = container.resolve<IStoreModuleService>(
|
const service = container.resolve<IStoreModuleService>(
|
||||||
ModuleRegistrationName.STORE
|
ModuleRegistrationName.STORE
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -8,12 +8,15 @@ import {
|
|||||||
import { createStoresStep } from "../steps"
|
import { createStoresStep } from "../steps"
|
||||||
import { updatePricePreferencesAsArrayStep } from "../../pricing"
|
import { updatePricePreferencesAsArrayStep } from "../../pricing"
|
||||||
|
|
||||||
type WorkflowInputData = { stores: StoreWorkflow.CreateStoreWorkflowInput[] }
|
type CreateStoresWorkflowInput = { stores: StoreWorkflow.CreateStoreWorkflowInput[] }
|
||||||
|
|
||||||
export const createStoresWorkflowId = "create-stores"
|
export const createStoresWorkflowId = "create-stores"
|
||||||
|
/**
|
||||||
|
* This workflow creates one or more stores.
|
||||||
|
*/
|
||||||
export const createStoresWorkflow = createWorkflow(
|
export const createStoresWorkflow = createWorkflow(
|
||||||
createStoresWorkflowId,
|
createStoresWorkflowId,
|
||||||
(input: WorkflowData<WorkflowInputData>): WorkflowResponse<StoreDTO[]> => {
|
(input: WorkflowData<CreateStoresWorkflowInput>): WorkflowResponse<StoreDTO[]> => {
|
||||||
const normalizedInput = transform({ input }, (data) => {
|
const normalizedInput = transform({ input }, (data) => {
|
||||||
return data.input.stores.map((store) => {
|
return data.input.stores.map((store) => {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
import { WorkflowData, createWorkflow } from "@medusajs/workflows-sdk"
|
import { WorkflowData, createWorkflow } from "@medusajs/workflows-sdk"
|
||||||
import { deleteStoresStep } from "../steps"
|
import { deleteStoresStep } from "../steps"
|
||||||
|
|
||||||
type WorkflowInput = { ids: string[] }
|
export type DeleteStoresWorkflowInput = { ids: string[] }
|
||||||
|
|
||||||
export const deleteStoresWorkflowId = "delete-stores"
|
export const deleteStoresWorkflowId = "delete-stores"
|
||||||
|
/**
|
||||||
|
* This workflow deletes one or more stores.
|
||||||
|
*/
|
||||||
export const deleteStoresWorkflow = createWorkflow(
|
export const deleteStoresWorkflow = createWorkflow(
|
||||||
deleteStoresWorkflowId,
|
deleteStoresWorkflowId,
|
||||||
(input: WorkflowData<WorkflowInput>): WorkflowData<void> => {
|
(input: WorkflowData<DeleteStoresWorkflowInput>): WorkflowData<void> => {
|
||||||
return deleteStoresStep(input.ids)
|
return deleteStoresStep(input.ids)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -9,12 +9,13 @@ import {
|
|||||||
import { updateStoresStep } from "../steps"
|
import { updateStoresStep } from "../steps"
|
||||||
import { updatePricePreferencesAsArrayStep } from "../../pricing"
|
import { updatePricePreferencesAsArrayStep } from "../../pricing"
|
||||||
|
|
||||||
type WorkflowInputData = StoreWorkflow.UpdateStoreWorkflowInput
|
|
||||||
|
|
||||||
export const updateStoresWorkflowId = "update-stores"
|
export const updateStoresWorkflowId = "update-stores"
|
||||||
|
/**
|
||||||
|
* This workflow updates stores matching the specified filters.
|
||||||
|
*/
|
||||||
export const updateStoresWorkflow = createWorkflow(
|
export const updateStoresWorkflow = createWorkflow(
|
||||||
updateStoresWorkflowId,
|
updateStoresWorkflowId,
|
||||||
(input: WorkflowData<WorkflowInputData>): WorkflowResponse<StoreDTO[]> => {
|
(input: WorkflowData<StoreWorkflow.UpdateStoreWorkflowInput>): WorkflowResponse<StoreDTO[]> => {
|
||||||
const normalizedInput = transform({ input }, (data) => {
|
const normalizedInput = transform({ input }, (data) => {
|
||||||
if (!data.input.update.supported_currencies?.length) {
|
if (!data.input.update.supported_currencies?.length) {
|
||||||
return data.input
|
return data.input
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ import { ModuleRegistrationName } from "@medusajs/utils"
|
|||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
export const createUsersStepId = "create-users-step"
|
export const createUsersStepId = "create-users-step"
|
||||||
|
/**
|
||||||
|
* This step creates one or more users.
|
||||||
|
*/
|
||||||
export const createUsersStep = createStep(
|
export const createUsersStep = createStep(
|
||||||
createUsersStepId,
|
createUsersStepId,
|
||||||
async (input: CreateUserDTO[], { container }) => {
|
async (input: CreateUserDTO[], { container }) => {
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ import { ModuleRegistrationName } from "@medusajs/utils"
|
|||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
export const deleteUsersStepId = "delete-users-step"
|
export const deleteUsersStepId = "delete-users-step"
|
||||||
|
/**
|
||||||
|
* This step deletes one or more stores.
|
||||||
|
*/
|
||||||
export const deleteUsersStep = createStep(
|
export const deleteUsersStep = createStep(
|
||||||
deleteUsersStepId,
|
deleteUsersStepId,
|
||||||
async (input: string[], { container }) => {
|
async (input: string[], { container }) => {
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ import { ModuleRegistrationName } from "@medusajs/utils"
|
|||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
export const updateUsersStepId = "update-users-step"
|
export const updateUsersStepId = "update-users-step"
|
||||||
|
/**
|
||||||
|
* This step updates one or more stores.
|
||||||
|
*/
|
||||||
export const updateUsersStep = createStep(
|
export const updateUsersStep = createStep(
|
||||||
updateUsersStepId,
|
updateUsersStepId,
|
||||||
async (input: UpdateUserDTO[], { container }) => {
|
async (input: UpdateUserDTO[], { container }) => {
|
||||||
|
|||||||
@@ -8,15 +8,18 @@ import {
|
|||||||
import { createUsersStep } from "../steps"
|
import { createUsersStep } from "../steps"
|
||||||
import { setAuthAppMetadataStep } from "../../auth"
|
import { setAuthAppMetadataStep } from "../../auth"
|
||||||
|
|
||||||
type WorkflowInput = {
|
export type CreateUserAccountWorkflowInput = {
|
||||||
authIdentityId: string
|
authIdentityId: string
|
||||||
userData: CreateUserDTO
|
userData: CreateUserDTO
|
||||||
}
|
}
|
||||||
|
|
||||||
export const createUserAccountWorkflowId = "create-user-account"
|
export const createUserAccountWorkflowId = "create-user-account"
|
||||||
|
/**
|
||||||
|
* This workflow creates an authentication identity for a user.
|
||||||
|
*/
|
||||||
export const createUserAccountWorkflow = createWorkflow(
|
export const createUserAccountWorkflow = createWorkflow(
|
||||||
createUserAccountWorkflowId,
|
createUserAccountWorkflowId,
|
||||||
(input: WorkflowData<WorkflowInput>): WorkflowResponse<UserDTO> => {
|
(input: WorkflowData<CreateUserAccountWorkflowInput>): WorkflowResponse<UserDTO> => {
|
||||||
const users = createUsersStep([input.userData])
|
const users = createUsersStep([input.userData])
|
||||||
const user = transform(users, (users: UserDTO[]) => users[0])
|
const user = transform(users, (users: UserDTO[]) => users[0])
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ import { createUsersStep } from "../steps"
|
|||||||
import { UserWorkflow } from "@medusajs/types"
|
import { UserWorkflow } from "@medusajs/types"
|
||||||
|
|
||||||
export const createUsersWorkflowId = "create-users-workflow"
|
export const createUsersWorkflowId = "create-users-workflow"
|
||||||
|
/**
|
||||||
|
* This workflow creates one or more users.
|
||||||
|
*/
|
||||||
export const createUsersWorkflow = createWorkflow(
|
export const createUsersWorkflow = createWorkflow(
|
||||||
createUsersWorkflowId,
|
createUsersWorkflowId,
|
||||||
(
|
(
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ import { deleteUsersStep } from "../steps"
|
|||||||
import { UserWorkflow } from "@medusajs/types"
|
import { UserWorkflow } from "@medusajs/types"
|
||||||
|
|
||||||
export const deleteUsersWorkflowId = "delete-user"
|
export const deleteUsersWorkflowId = "delete-user"
|
||||||
|
/**
|
||||||
|
* This workflow deletes one or more users.
|
||||||
|
*/
|
||||||
export const deleteUsersWorkflow = createWorkflow(
|
export const deleteUsersWorkflow = createWorkflow(
|
||||||
deleteUsersWorkflowId,
|
deleteUsersWorkflowId,
|
||||||
(
|
(
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ import { updateUsersStep } from "../steps"
|
|||||||
import { UserWorkflow } from "@medusajs/types"
|
import { UserWorkflow } from "@medusajs/types"
|
||||||
|
|
||||||
export const updateUsersWorkflowId = "update-users-workflow"
|
export const updateUsersWorkflowId = "update-users-workflow"
|
||||||
|
/**
|
||||||
|
* This workflow updates one or more users.
|
||||||
|
*/
|
||||||
export const updateUsersWorkflow = createWorkflow(
|
export const updateUsersWorkflow = createWorkflow(
|
||||||
updateUsersWorkflowId,
|
updateUsersWorkflowId,
|
||||||
(
|
(
|
||||||
|
|||||||
Reference in New Issue
Block a user