chore(workflows, core-flows): Split workflows tooling and definitions (#5705)

This commit is contained in:
Adrien de Peretti
2023-11-24 14:55:48 +01:00
committed by GitHub
parent fc1ef29ed9
commit ddbeed4ea6
138 changed files with 274 additions and 241 deletions

View File

@@ -0,0 +1,8 @@
---
"@medusajs/core-flows": patch
"@medusajs/orchestration": patch
"@medusajs/medusa": patch
"@medusajs/workflows-sdk": patch
---
chore(workflows, core-flows, ...): Split workflows tooling and definitions

View File

@@ -22,7 +22,8 @@ packages/*
!packages/create-medusa-app
!packages/product
!packages/orchestration
!packages/workflows
!packages/workflows-sdk
!packages/core-flows
**/models/*

View File

@@ -97,7 +97,8 @@ module.exports = {
"./packages/create-medusa-app/tsconfig.json",
"./packages/product/tsconfig.json",
"./packages/orchestration/tsconfig.json",
"./packages/workflows/tsconfig.spec.json",
"./packages/workflows-sdk/tsconfig.spec.json",
"./packages/core-flows/tsconfig.spec.json",
],
},
rules: {

View File

@@ -3,8 +3,9 @@ import { IInventoryService, WorkflowTypes } from "@medusajs/types"
import {
CreateInventoryItemActions,
createInventoryItems,
pipe,
} from "@medusajs/workflows"
} from "@medusajs/core-flows"
import { pipe } from "@medusajs/workflows-sdk"
import path from "path"
import { startBootstrapApp } from "../../../../environment-helpers/bootstrap-app"
import { getContainer } from "../../../../environment-helpers/use-container"

View File

@@ -1,15 +1,15 @@
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { IProductModuleService, WorkflowTypes } from "@medusajs/types"
import {
createProducts,
CreateProductsActions,
Handlers,
createProducts,
pipe,
} from "@medusajs/workflows"
} from "@medusajs/core-flows"
import path from "path"
import { startBootstrapApp } from "../../../../environment-helpers/bootstrap-app"
import { getContainer } from "../../../../environment-helpers/use-container"
import { initDb, useDb } from "../../../../environment-helpers/use-db"
import { pipe } from "@medusajs/workflows-sdk"
jest.setTimeout(30000)

View File

@@ -1,10 +1,10 @@
import { WorkflowTypes } from "@medusajs/types"
import {
Handlers,
pipe,
updateProducts,
UpdateProductsActions,
} from "@medusajs/workflows"
} from "@medusajs/core-flows"
import { pipe } from "@medusajs/workflows-sdk"
import path from "path"
import { startBootstrapApp } from "../../../../environment-helpers/bootstrap-app"

View File

@@ -6,7 +6,7 @@ import {
parallelize,
StepResponse,
transform,
} from "@medusajs/workflows"
} from "@medusajs/workflows-sdk"
jest.setTimeout(30000)

View File

@@ -1,5 +1,5 @@
const { Modules } = require("@medusajs/modules-sdk")
const { Workflows } = require("@medusajs/workflows")
const { Workflows } = require("@medusajs/core-flows")
const DB_HOST = process.env.DB_HOST
const DB_USERNAME = process.env.DB_USERNAME
const DB_PASSWORD = process.env.DB_PASSWORD

View File

@@ -0,0 +1 @@
# @medusajs/core-flows

View File

@@ -0,0 +1,42 @@
{
"name": "@medusajs/core-flows",
"version": "0.0.1",
"description": "Set of workflow definitions for Medusa",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/medusajs/medusa",
"directory": "packages/core-flows"
},
"publishConfig": {
"access": "public"
},
"files": [
"dist"
],
"author": "Medusa",
"license": "MIT",
"devDependencies": {
"@medusajs/types": "^1.11.7",
"cross-env": "^5.2.1",
"jest": "^29.6.3",
"rimraf": "^5.0.1",
"ts-jest": "^29.1.1",
"typescript": "^5.1.6"
},
"dependencies": {
"@medusajs/modules-sdk": "^1.12.3",
"@medusajs/orchestration": "^0.4.4",
"@medusajs/utils": "^1.11.0",
"@medusajs/workflows-sdk": "^0.1.0",
"awilix": "^8.0.1",
"ulid": "^2.3.0"
},
"scripts": {
"prepublishOnly": "cross-env NODE_ENV=production tsc --build",
"build": "rimraf dist && tsc --build",
"watch": "tsc --build --watch",
"test": "jest --runInBand --bail --forceExit --passWithNoTests"
}
}

View File

@@ -13,7 +13,7 @@ import {
RegionHandlers,
SalesChannelHandlers,
} from "../../handlers"
import { exportWorkflow, pipe } from "../../helper"
import { exportWorkflow, pipe } from "@medusajs/workflows-sdk"
enum CreateCartActions {
setContext = "setContext",

View File

@@ -1,4 +1,4 @@
export * from "./cart"
export * from "./product"
export * from "./inventory"
export * from './price-list'
export * from "./price-list"

View File

@@ -3,7 +3,7 @@ import {
TransactionStepsDefinition,
WorkflowManager,
} from "@medusajs/orchestration"
import { exportWorkflow, pipe } from "../../helper"
import { exportWorkflow, pipe } from "@medusajs/workflows-sdk"
import { InventoryTypes, WorkflowTypes } from "@medusajs/types"
import { InventoryHandlers } from "../../handlers"

View File

@@ -3,7 +3,7 @@ import {
WorkflowManager,
} from "@medusajs/orchestration"
import { PricingTypes, WorkflowTypes } from "@medusajs/types"
import { exportWorkflow, pipe } from "../../helper"
import { exportWorkflow, pipe } from "@medusajs/workflows-sdk"
import { Workflows } from "../../definitions"
import { PriceListHandlers } from "../../handlers"

View File

@@ -1,5 +1,6 @@
export * from "./create-price-lists"
export * from "./remove-price-lists"
export * from "./remove-price-list-prices"
export * from "./remove-product-prices"
export * from "./remove-variant-prices"
export * from "./update-price-lists"

View File

@@ -3,7 +3,7 @@ import {
WorkflowManager,
} from "@medusajs/orchestration"
import { WorkflowTypes } from "@medusajs/types"
import { exportWorkflow, pipe } from "../../helper"
import { exportWorkflow, pipe } from "@medusajs/workflows-sdk"
import { Workflows } from "../../definitions"
import { PriceListHandlers } from "../../handlers"
@@ -62,7 +62,7 @@ WorkflowManager.register(
handlers
)
export const removePriceListProductPrices = exportWorkflow<
export const removePriceListPrices = exportWorkflow<
WorkflowTypes.PriceListWorkflow.RemovePriceListPricesWorkflowInputDTO,
string[]
>(

View File

@@ -3,7 +3,7 @@ import {
TransactionStepsDefinition,
WorkflowManager,
} from "@medusajs/orchestration"
import { exportWorkflow, pipe } from "../../helper"
import { exportWorkflow, pipe } from "@medusajs/workflows-sdk"
import { PriceListHandlers } from "../../handlers"
import { Workflows } from "../../definitions"

View File

@@ -3,7 +3,7 @@ import {
WorkflowManager,
} from "@medusajs/orchestration"
import { WorkflowTypes } from "@medusajs/types"
import { exportWorkflow, pipe } from "../../helper"
import { exportWorkflow, pipe } from "@medusajs/workflows-sdk"
import { Workflows } from "../../definitions"
import { PriceListHandlers } from "../../handlers"

View File

@@ -3,7 +3,7 @@ import {
WorkflowManager,
} from "@medusajs/orchestration"
import { WorkflowTypes } from "@medusajs/types"
import { exportWorkflow, pipe } from "../../helper"
import { exportWorkflow, pipe } from "@medusajs/workflows-sdk"
import { Workflows } from "../../definitions"
import { PriceListHandlers } from "../../handlers"

View File

@@ -3,7 +3,7 @@ import {
WorkflowManager,
} from "@medusajs/orchestration"
import { WorkflowTypes } from "@medusajs/types"
import { exportWorkflow, pipe } from "../../helper"
import { exportWorkflow, pipe } from "@medusajs/workflows-sdk"
import { Workflows } from "../../definitions"
import { PriceListHandlers } from "../../handlers"

View File

@@ -3,7 +3,7 @@ import {
WorkflowManager,
} from "@medusajs/orchestration"
import { InputAlias, Workflows } from "../../definitions"
import { exportWorkflow, pipe } from "../../helper"
import { exportWorkflow, pipe } from "@medusajs/workflows-sdk"
import { ProductTypes, WorkflowTypes } from "@medusajs/types"
import { ProductHandlers } from "../../handlers"

View File

@@ -3,7 +3,7 @@ import {
TransactionStepsDefinition,
WorkflowManager,
} from "@medusajs/orchestration"
import { exportWorkflow, pipe } from "../../helper"
import { exportWorkflow, pipe } from "@medusajs/workflows-sdk"
import { ProductTypes, WorkflowTypes } from "@medusajs/types"
import {

View File

@@ -1,5 +1,5 @@
import { ProductTypes } from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type AssociationTaggedVariant = ProductTypes.ProductVariantDTO & {
_associationTag?: string

View File

@@ -3,7 +3,7 @@ import {
WorkflowManager,
} from "@medusajs/orchestration"
import { InputAlias, Workflows } from "../../definitions"
import { exportWorkflow, pipe } from "../../helper"
import { exportWorkflow, pipe } from "@medusajs/workflows-sdk"
import { ProductTypes, WorkflowTypes } from "@medusajs/types"
import { ProductHandlers } from "../../handlers"

View File

@@ -8,7 +8,7 @@ import { InputAlias, Workflows } from "../../definitions"
import { InventoryHandlers, ProductHandlers } from "../../handlers"
import * as MiddlewareHandlers from "../../handlers/middlewares"
import { detachSalesChannelFromProducts } from "../../handlers/product"
import { exportWorkflow, pipe } from "../../helper"
import { exportWorkflow, pipe } from "@medusajs/workflows-sdk"
import { CreateProductsActions } from "./create-products"
import { prepareCreateInventoryItems } from "./prepare-create-inventory-items"
import { UpdateProductVariantsActions } from "./update-product-variants"
@@ -137,7 +137,7 @@ const handlers = new Map<string, any>([
},
],
},
MiddlewareHandlers.mapData((d) => ({
MiddlewareHandlers.mapData((d: any) => ({
productsHandleSalesChannelsMap:
d.preparedData.productHandleAddedChannelsMap,
})),
@@ -157,7 +157,7 @@ const handlers = new Map<string, any>([
},
],
},
MiddlewareHandlers.mapData((d) => ({
MiddlewareHandlers.mapData((d: any) => ({
productsHandleSalesChannelsMap:
d.preparedData.productHandleAddedChannelsMap,
})),
@@ -183,7 +183,7 @@ const handlers = new Map<string, any>([
},
],
},
MiddlewareHandlers.mapData((d) => ({
MiddlewareHandlers.mapData((d: any) => ({
productsHandleSalesChannelsMap:
d.preparedData.productHandleRemovedChannelsMap,
})),
@@ -204,7 +204,7 @@ const handlers = new Map<string, any>([
},
],
},
MiddlewareHandlers.mapData((d) => ({
MiddlewareHandlers.mapData((d: any) => ({
productsHandleSalesChannelsMap:
d.preparedData.productHandleRemovedChannelsMap,
})),

View File

@@ -1,7 +1,7 @@
import { AddressDTO } from "@medusajs/types"
import { MedusaError } from "@medusajs/utils"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type AddressesDTO = {
shipping_address_id?: string

View File

@@ -1,7 +1,7 @@
import { CartWorkflow } from "@medusajs/types"
import { SalesChannelFeatureFlag } from "@medusajs/utils"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type HandlerInputData = {
line_items: {

View File

@@ -1,5 +1,5 @@
import { CartDTO } from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
enum Aliases {
SalesChannel = "SalesChannel",

View File

@@ -1,4 +1,4 @@
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
enum Aliases {
Cart = "cart",

View File

@@ -1,5 +1,5 @@
import { CartDTO } from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type HandlerInputData = {
cart: {

View File

@@ -1,4 +1,4 @@
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type ContextDTO = {
context?: Record<any, any>

View File

@@ -1,6 +1,6 @@
import { validateEmail } from "@medusajs/utils"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type CustomerDTO = {
customer_id?: string

View File

@@ -1,5 +1,5 @@
import { InventoryItemDTO } from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
export async function attachInventoryItems({
container,

View File

@@ -1,5 +1,5 @@
import { IInventoryService, InventoryItemDTO } from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
import { promiseAll } from "@medusajs/utils"
type Result = {

View File

@@ -1,5 +1,5 @@
import { InventoryItemDTO } from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
import { promiseAll } from "@medusajs/utils"
export async function detachInventoryItems({

View File

@@ -1,5 +1,5 @@
import { InventoryItemDTO } from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
export async function removeInventoryItems({
container,

View File

@@ -3,7 +3,7 @@ import {
InventoryItemDTO,
SharedContext,
} from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
export async function restoreInventoryItems({
container,

View File

@@ -1,5 +1,5 @@
import { ProductTypes, WorkflowTypes } from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type ProductHandle = string
type VariantIndexAndPrices = {

View File

@@ -1,6 +1,6 @@
import { ProductTypes } from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
export async function extractVariants({
data,

View File

@@ -1,4 +1,4 @@
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
/**
* Middleware for map input data to a key/s.

View File

@@ -1,6 +1,6 @@
import { ProductTypes, ProductVariantDTO } from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
import { UpdateProductsPreparedData } from "../product"
export async function updateProductsExtractCreatedVariants({

View File

@@ -1,6 +1,6 @@
import { ProductTypes, ProductVariantDTO } from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
import { UpdateProductsPreparedData } from "../product"
export async function updateProductsExtractDeletedVariants({

View File

@@ -1,4 +1,4 @@
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
import { IInventoryService, ProductVariantDTO } from "@medusajs/types"
export async function useVariantsInventoryItems({

View File

@@ -5,7 +5,7 @@ import {
} from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type Result = {
priceList: PriceListDTO

View File

@@ -1,6 +1,6 @@
import { CreatePriceListDTO, PriceListWorkflow } from "@medusajs/types"
import { MedusaError } from "@medusajs/utils"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type Result = {
tag?: string

View File

@@ -1,6 +1,6 @@
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { IPricingModuleService } from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type Result = {
moneyAmountIds: string[]

View File

@@ -1,4 +1,4 @@
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
import { prepareCreatePriceLists } from "./prepare-create-price-list"
type Result = {

View File

@@ -1,4 +1,4 @@
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
import { prepareCreatePriceLists } from "./prepare-create-price-list"
type Result = {

View File

@@ -3,7 +3,7 @@ import {
UpdatePriceListDTO,
WorkflowTypes,
} from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type Result = {
priceLists: UpdatePriceListDTO[]

View File

@@ -1,7 +1,7 @@
import { IPricingModuleService, PriceListDTO } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
export async function removePriceLists({
container,

View File

@@ -1,6 +1,6 @@
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { IPricingModuleService } from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
import { prepareCreatePriceLists } from "./prepare-create-price-list"
export async function removePriceListPriceSetPrices({

View File

@@ -1,6 +1,6 @@
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { IPricingModuleService } from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type Result = {
deletedPriceIds: string[]

View File

@@ -8,7 +8,7 @@ import {
} from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type Result = {
priceLists: PriceListDTO[]

View File

@@ -1,4 +1,4 @@
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
import { promiseAll } from "@medusajs/utils"
type ProductHandle = string

View File

@@ -1,4 +1,4 @@
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
import { promiseAll } from "@medusajs/utils"
type ProductHandle = string

View File

@@ -1,6 +1,6 @@
import { ProductWorkflow, WorkflowTypes } from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type VariantPrice = {
region_id?: string

View File

@@ -1,6 +1,6 @@
import { Modules, ModulesDefinition } from "@medusajs/modules-sdk"
import { ProductTypes } from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type VariantPrice = {
region_id?: string

View File

@@ -4,7 +4,7 @@ import {
kebabCase,
ShippingProfileUtils,
} from "@medusajs/utils"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type ShippingProfileId = string
type SalesChannelId = string

View File

@@ -1,5 +1,5 @@
import { ProductTypes } from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
import { Modules, ModulesDefinition } from "@medusajs/modules-sdk"
type HandlerInput = {

View File

@@ -1,4 +1,4 @@
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
import { promiseAll } from "@medusajs/utils"
type ProductHandle = string

View File

@@ -1,4 +1,4 @@
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
import { promiseAll } from "@medusajs/utils"
type ProductHandle = string

View File

@@ -1,5 +1,5 @@
import { ProductTypes, WorkflowTypes } from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type HandlerInput = {
ids: string[]

View File

@@ -1,6 +1,6 @@
import { Modules, ModulesDefinition } from "@medusajs/modules-sdk"
import { IProductModuleService } from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type HandlerInput = { productVariants: { id: string }[] }

View File

@@ -1,5 +1,5 @@
import { ProductTypes } from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
import { Modules, ModulesDefinition } from "@medusajs/modules-sdk"
type HandlerInput = { products: { id: string }[] }

View File

@@ -6,7 +6,7 @@ import {
UpdateProductDTO,
} from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
import { UpdateProductsPreparedData } from "./update-products-prepare-data"
type HandlerInput = UpdateProductsPreparedData & {

View File

@@ -1,6 +1,6 @@
import { PricingTypes } from "@medusajs/types"
import { MedusaV2Flag } from "@medusajs/utils"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type HandlerInput = {
createdLinks: Record<any, any>[]

View File

@@ -1,7 +1,7 @@
import { Modules, ModulesDefinition } from "@medusajs/modules-sdk"
import { ProductTypes, ProductWorkflow, WorkflowTypes } from "@medusajs/types"
import { MedusaV2Flag } from "@medusajs/utils"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type VariantPrice = {
region_id?: string

View File

@@ -1,6 +1,6 @@
import { Modules, ModulesDefinition } from "@medusajs/modules-sdk"
import { ProductTypes, UpdateProductVariantOnlyDTO } from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type HandlerInput = {
productVariantsMap: Map<string, ProductTypes.UpdateProductVariantDTO[]>

View File

@@ -1,6 +1,6 @@
import { ProductDTO, SalesChannelDTO, WorkflowTypes } from "@medusajs/types"
import { MedusaV2Flag } from "@medusajs/utils"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type ProductWithSalesChannelsDTO = ProductDTO & {
sales_channels?: SalesChannelDTO[]

View File

@@ -2,7 +2,7 @@ import { ProductTypes, WorkflowTypes } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { MedusaError, MedusaV2Flag } from "@medusajs/utils"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type ProductHandle = string
type VariantIndexAndPrices = {

View File

@@ -1,7 +1,7 @@
import { Modules, ModulesDefinition } from "@medusajs/modules-sdk"
import { ProductDTO, ProductTypes } from "@medusajs/types"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type HandlerInput = {
products: ProductTypes.UpdateProductDTO[]

View File

@@ -1,6 +1,6 @@
import { PricingTypes } from "@medusajs/types"
import { MedusaV2Flag } from "@medusajs/utils"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type VariantPrice = {
id?: string

View File

@@ -1,7 +1,7 @@
import { MedusaError } from "@medusajs/utils"
import { isDefined } from "medusa-core-utils"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type RegionDTO = {
region_id?: string

View File

@@ -1,7 +1,7 @@
import { MedusaError } from "@medusajs/utils"
import { isDefined } from "medusa-core-utils"
import { WorkflowArguments } from "../../helper"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
type AttachSalesChannelDTO = {
sales_channel_id?: string

View File

@@ -0,0 +1,3 @@
export * from "./definition"
export * from "./definitions"
export * as Handlers from "./handlers"

View File

@@ -1,4 +1,5 @@
# @medusajs/inventory
# @medusajs/inventory
## 1.11.3

View File

@@ -47,12 +47,13 @@
"typeorm": "^0.3.16"
},
"dependencies": {
"@medusajs/core-flows": "^0.0.1",
"@medusajs/link-modules": "^0.2.3",
"@medusajs/medusa-cli": "^1.3.21",
"@medusajs/modules-sdk": "^1.12.3",
"@medusajs/orchestration": "^0.4.4",
"@medusajs/utils": "^1.11.0",
"@medusajs/workflows": "^0.3.0",
"@medusajs/workflows-sdk": "^0.1.0",
"awilix": "^8.0.0",
"body-parser": "^1.19.0",
"boxen": "^5.0.1",

View File

@@ -1,14 +1,17 @@
import { FlagRouter, ManyToManyInventoryFeatureFlag } from "@medusajs/utils"
import {
FlagRouter,
ManyToManyInventoryFeatureFlag,
MedusaError,
} from "@medusajs/utils"
import { IsNumber, IsObject, IsOptional, IsString } from "class-validator"
import {
createInventoryItems,
CreateInventoryItemActions,
pipe,
} from "@medusajs/workflows"
createInventoryItems,
} from "@medusajs/core-flows"
import { pipe } from "@medusajs/workflows-sdk"
import { ProductVariantInventoryService } from "../../../../services"
import { FindParams } from "../../../../types/common"
import { MedusaError } from "@medusajs/utils"
/**
* @oas [post] /admin/inventory-items

View File

@@ -1,5 +1,5 @@
import { MedusaV2Flag } from "@medusajs/utils"
import { updatePriceLists } from "@medusajs/workflows"
import { updatePriceLists } from "@medusajs/core-flows"
import { Type } from "class-transformer"
import { IsArray, IsBoolean, IsOptional, ValidateNested } from "class-validator"
import { EntityManager } from "typeorm"

View File

@@ -5,7 +5,7 @@ import {
PriceListStatus,
PriceListType,
} from "@medusajs/utils"
import { createPriceLists } from "@medusajs/workflows"
import { createPriceLists } from "@medusajs/core-flows"
import { Type } from "class-transformer"
import {
IsArray,

View File

@@ -1,6 +1,6 @@
import { WorkflowTypes } from "@medusajs/types"
import { FlagRouter, MedusaV2Flag } from "@medusajs/utils"
import { removePriceLists } from "@medusajs/workflows"
import { removePriceLists } from "@medusajs/core-flows"
import { EntityManager } from "typeorm"
import PriceListService from "../../../../services/price-list"

View File

@@ -1,10 +1,10 @@
import { FlagRouter, MedusaV2Flag } from "@medusajs/utils"
import { removePriceListProductPrices } from "@medusajs/workflows/dist/definition/price-list/remove-price-list-prices"
import { ArrayNotEmpty, IsString } from "class-validator"
import { EntityManager } from "typeorm"
import PriceListService from "../../../../services/price-list"
import { validator } from "../../../../utils/validator"
import { WorkflowTypes } from "@medusajs/types"
import { removePriceListPrices } from "@medusajs/core-flows"
/**
* @oas [delete] /admin/price-lists/{id}/prices/batch
@@ -92,9 +92,7 @@ export default async (req, res) => {
)
if (isMedusaV2FlagEnabled) {
const deletePriceListPricesWorkflow = removePriceListProductPrices(
req.scope
)
const deletePriceListPricesWorkflow = removePriceListPrices(req.scope)
const input = {
price_list_id: id,

Some files were not shown because too many files have changed in this diff Show More