chore(workflows, core-flows): Split workflows tooling and definitions (#5705)
This commit is contained in:
committed by
GitHub
parent
fc1ef29ed9
commit
ddbeed4ea6
8
.changeset/fresh-birds-serve.md
Normal file
8
.changeset/fresh-birds-serve.md
Normal 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
|
||||
@@ -22,7 +22,8 @@ packages/*
|
||||
!packages/create-medusa-app
|
||||
!packages/product
|
||||
!packages/orchestration
|
||||
!packages/workflows
|
||||
!packages/workflows-sdk
|
||||
!packages/core-flows
|
||||
|
||||
|
||||
**/models/*
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
parallelize,
|
||||
StepResponse,
|
||||
transform,
|
||||
} from "@medusajs/workflows"
|
||||
} from "@medusajs/workflows-sdk"
|
||||
|
||||
jest.setTimeout(30000)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
1
packages/core-flows/CHANGELOG.md
Normal file
1
packages/core-flows/CHANGELOG.md
Normal file
@@ -0,0 +1 @@
|
||||
# @medusajs/core-flows
|
||||
42
packages/core-flows/package.json
Normal file
42
packages/core-flows/package.json
Normal 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"
|
||||
}
|
||||
}
|
||||
@@ -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",
|
||||
@@ -1,4 +1,4 @@
|
||||
export * from "./cart"
|
||||
export * from "./product"
|
||||
export * from "./inventory"
|
||||
export * from './price-list'
|
||||
export * from "./price-list"
|
||||
@@ -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"
|
||||
@@ -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"
|
||||
@@ -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"
|
||||
@@ -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[]
|
||||
>(
|
||||
@@ -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"
|
||||
@@ -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"
|
||||
@@ -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"
|
||||
@@ -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"
|
||||
@@ -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"
|
||||
@@ -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 {
|
||||
@@ -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
|
||||
@@ -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"
|
||||
@@ -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,
|
||||
})),
|
||||
@@ -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
|
||||
@@ -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: {
|
||||
@@ -1,5 +1,5 @@
|
||||
import { CartDTO } from "@medusajs/types"
|
||||
import { WorkflowArguments } from "../../helper"
|
||||
import { WorkflowArguments } from "@medusajs/workflows-sdk"
|
||||
|
||||
enum Aliases {
|
||||
SalesChannel = "SalesChannel",
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WorkflowArguments } from "../../helper"
|
||||
import { WorkflowArguments } from "@medusajs/workflows-sdk"
|
||||
|
||||
enum Aliases {
|
||||
Cart = "cart",
|
||||
@@ -1,5 +1,5 @@
|
||||
import { CartDTO } from "@medusajs/types"
|
||||
import { WorkflowArguments } from "../../helper"
|
||||
import { WorkflowArguments } from "@medusajs/workflows-sdk"
|
||||
|
||||
type HandlerInputData = {
|
||||
cart: {
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WorkflowArguments } from "../../helper"
|
||||
import { WorkflowArguments } from "@medusajs/workflows-sdk"
|
||||
|
||||
type ContextDTO = {
|
||||
context?: Record<any, any>
|
||||
@@ -1,6 +1,6 @@
|
||||
import { validateEmail } from "@medusajs/utils"
|
||||
|
||||
import { WorkflowArguments } from "../../helper"
|
||||
import { WorkflowArguments } from "@medusajs/workflows-sdk"
|
||||
|
||||
type CustomerDTO = {
|
||||
customer_id?: string
|
||||
@@ -1,5 +1,5 @@
|
||||
import { InventoryItemDTO } from "@medusajs/types"
|
||||
import { WorkflowArguments } from "../../helper"
|
||||
import { WorkflowArguments } from "@medusajs/workflows-sdk"
|
||||
|
||||
export async function attachInventoryItems({
|
||||
container,
|
||||
@@ -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 = {
|
||||
@@ -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({
|
||||
@@ -1,5 +1,5 @@
|
||||
import { InventoryItemDTO } from "@medusajs/types"
|
||||
import { WorkflowArguments } from "../../helper"
|
||||
import { WorkflowArguments } from "@medusajs/workflows-sdk"
|
||||
|
||||
export async function removeInventoryItems({
|
||||
container,
|
||||
@@ -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,
|
||||
@@ -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 = {
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ProductTypes } from "@medusajs/types"
|
||||
|
||||
import { WorkflowArguments } from "../../helper"
|
||||
import { WorkflowArguments } from "@medusajs/workflows-sdk"
|
||||
|
||||
export async function extractVariants({
|
||||
data,
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WorkflowArguments } from "../../helper"
|
||||
import { WorkflowArguments } from "@medusajs/workflows-sdk"
|
||||
|
||||
/**
|
||||
* Middleware for map input data to a key/s.
|
||||
@@ -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({
|
||||
@@ -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({
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WorkflowArguments } from "../../helper"
|
||||
import { WorkflowArguments } from "@medusajs/workflows-sdk"
|
||||
import { IInventoryService, ProductVariantDTO } from "@medusajs/types"
|
||||
|
||||
export async function useVariantsInventoryItems({
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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[]
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WorkflowArguments } from "../../helper"
|
||||
import { WorkflowArguments } from "@medusajs/workflows-sdk"
|
||||
import { prepareCreatePriceLists } from "./prepare-create-price-list"
|
||||
|
||||
type Result = {
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WorkflowArguments } from "../../helper"
|
||||
import { WorkflowArguments } from "@medusajs/workflows-sdk"
|
||||
import { prepareCreatePriceLists } from "./prepare-create-price-list"
|
||||
|
||||
type Result = {
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
UpdatePriceListDTO,
|
||||
WorkflowTypes,
|
||||
} from "@medusajs/types"
|
||||
import { WorkflowArguments } from "../../helper"
|
||||
import { WorkflowArguments } from "@medusajs/workflows-sdk"
|
||||
|
||||
type Result = {
|
||||
priceLists: UpdatePriceListDTO[]
|
||||
@@ -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,
|
||||
@@ -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({
|
||||
@@ -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[]
|
||||
@@ -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[]
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WorkflowArguments } from "../../helper"
|
||||
import { WorkflowArguments } from "@medusajs/workflows-sdk"
|
||||
import { promiseAll } from "@medusajs/utils"
|
||||
|
||||
type ProductHandle = string
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WorkflowArguments } from "../../helper"
|
||||
import { WorkflowArguments } from "@medusajs/workflows-sdk"
|
||||
import { promiseAll } from "@medusajs/utils"
|
||||
|
||||
type ProductHandle = string
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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 = {
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WorkflowArguments } from "../../helper"
|
||||
import { WorkflowArguments } from "@medusajs/workflows-sdk"
|
||||
import { promiseAll } from "@medusajs/utils"
|
||||
|
||||
type ProductHandle = string
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WorkflowArguments } from "../../helper"
|
||||
import { WorkflowArguments } from "@medusajs/workflows-sdk"
|
||||
import { promiseAll } from "@medusajs/utils"
|
||||
|
||||
type ProductHandle = string
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ProductTypes, WorkflowTypes } from "@medusajs/types"
|
||||
import { WorkflowArguments } from "../../helper"
|
||||
import { WorkflowArguments } from "@medusajs/workflows-sdk"
|
||||
|
||||
type HandlerInput = {
|
||||
ids: string[]
|
||||
@@ -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 }[] }
|
||||
|
||||
@@ -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 }[] }
|
||||
@@ -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 & {
|
||||
@@ -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>[]
|
||||
@@ -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
|
||||
@@ -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[]>
|
||||
@@ -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[]
|
||||
@@ -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 = {
|
||||
@@ -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[]
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
3
packages/core-flows/src/index.ts
Normal file
3
packages/core-flows/src/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from "./definition"
|
||||
export * from "./definitions"
|
||||
export * as Handlers from "./handlers"
|
||||
@@ -1,4 +1,5 @@
|
||||
# @medusajs/inventory
|
||||
# @medusajs/inventory
|
||||
|
||||
## 1.11.3
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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
Reference in New Issue
Block a user