diff --git a/.changeset/fresh-birds-serve.md b/.changeset/fresh-birds-serve.md new file mode 100644 index 0000000000000..2a4a3116cb633 --- /dev/null +++ b/.changeset/fresh-birds-serve.md @@ -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 diff --git a/.eslintignore b/.eslintignore index dbe62ec0c90a2..d05cda3f13e99 100644 --- a/.eslintignore +++ b/.eslintignore @@ -22,7 +22,8 @@ packages/* !packages/create-medusa-app !packages/product !packages/orchestration -!packages/workflows +!packages/workflows-sdk +!packages/core-flows **/models/* diff --git a/.eslintrc.js b/.eslintrc.js index 83745e590b6bb..1b7707a9e0490 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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: { diff --git a/integration-tests/plugins/__tests__/workflows/inventory/create-inventory-items.ts b/integration-tests/plugins/__tests__/workflows/inventory/create-inventory-items.ts index 8b749de8c3d4c..c8c6179180713 100644 --- a/integration-tests/plugins/__tests__/workflows/inventory/create-inventory-items.ts +++ b/integration-tests/plugins/__tests__/workflows/inventory/create-inventory-items.ts @@ -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" diff --git a/integration-tests/plugins/__tests__/workflows/product/create-product.ts b/integration-tests/plugins/__tests__/workflows/product/create-product.ts index 5953965c6a5c7..0ecc3866fba83 100644 --- a/integration-tests/plugins/__tests__/workflows/product/create-product.ts +++ b/integration-tests/plugins/__tests__/workflows/product/create-product.ts @@ -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) diff --git a/integration-tests/plugins/__tests__/workflows/product/update-product.ts b/integration-tests/plugins/__tests__/workflows/product/update-product.ts index 987637892015b..3d306ea473b95 100644 --- a/integration-tests/plugins/__tests__/workflows/product/update-product.ts +++ b/integration-tests/plugins/__tests__/workflows/product/update-product.ts @@ -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" diff --git a/integration-tests/plugins/__tests__/workflows/utils/composer/compose.ts b/integration-tests/plugins/__tests__/workflows/utils/composer/compose.ts index 0bec8edef9cc0..b913a6f42a16f 100644 --- a/integration-tests/plugins/__tests__/workflows/utils/composer/compose.ts +++ b/integration-tests/plugins/__tests__/workflows/utils/composer/compose.ts @@ -6,7 +6,7 @@ import { parallelize, StepResponse, transform, -} from "@medusajs/workflows" +} from "@medusajs/workflows-sdk" jest.setTimeout(30000) diff --git a/integration-tests/plugins/medusa-config.js b/integration-tests/plugins/medusa-config.js index 0979f20acddaa..ebdd77b7b22dc 100644 --- a/integration-tests/plugins/medusa-config.js +++ b/integration-tests/plugins/medusa-config.js @@ -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 diff --git a/packages/core-flows/CHANGELOG.md b/packages/core-flows/CHANGELOG.md new file mode 100644 index 0000000000000..1ff7ddcfe0451 --- /dev/null +++ b/packages/core-flows/CHANGELOG.md @@ -0,0 +1 @@ +# @medusajs/core-flows diff --git a/packages/workflows/jest.config.js b/packages/core-flows/jest.config.js similarity index 100% rename from packages/workflows/jest.config.js rename to packages/core-flows/jest.config.js diff --git a/packages/core-flows/package.json b/packages/core-flows/package.json new file mode 100644 index 0000000000000..88a23132ca428 --- /dev/null +++ b/packages/core-flows/package.json @@ -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" + } +} diff --git a/packages/workflows/src/definition/cart/create-cart.ts b/packages/core-flows/src/definition/cart/create-cart.ts similarity index 98% rename from packages/workflows/src/definition/cart/create-cart.ts rename to packages/core-flows/src/definition/cart/create-cart.ts index 034c597e9725f..e93819273b196 100644 --- a/packages/workflows/src/definition/cart/create-cart.ts +++ b/packages/core-flows/src/definition/cart/create-cart.ts @@ -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", diff --git a/packages/workflows/src/definition/cart/index.ts b/packages/core-flows/src/definition/cart/index.ts similarity index 100% rename from packages/workflows/src/definition/cart/index.ts rename to packages/core-flows/src/definition/cart/index.ts diff --git a/packages/workflows/src/definition/index.ts b/packages/core-flows/src/definition/index.ts similarity index 72% rename from packages/workflows/src/definition/index.ts rename to packages/core-flows/src/definition/index.ts index 805f14718f34c..3e234743cdbd2 100644 --- a/packages/workflows/src/definition/index.ts +++ b/packages/core-flows/src/definition/index.ts @@ -1,4 +1,4 @@ export * from "./cart" export * from "./product" export * from "./inventory" -export * from './price-list' \ No newline at end of file +export * from "./price-list" diff --git a/packages/workflows/src/definition/inventory/create-inventory-item.ts b/packages/core-flows/src/definition/inventory/create-inventory-item.ts similarity index 96% rename from packages/workflows/src/definition/inventory/create-inventory-item.ts rename to packages/core-flows/src/definition/inventory/create-inventory-item.ts index 1ca8aa3d37cdb..52a6ac4067a57 100644 --- a/packages/workflows/src/definition/inventory/create-inventory-item.ts +++ b/packages/core-flows/src/definition/inventory/create-inventory-item.ts @@ -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" diff --git a/packages/workflows/src/definition/inventory/index.ts b/packages/core-flows/src/definition/inventory/index.ts similarity index 100% rename from packages/workflows/src/definition/inventory/index.ts rename to packages/core-flows/src/definition/inventory/index.ts diff --git a/packages/workflows/src/definition/price-list/create-price-lists.ts b/packages/core-flows/src/definition/price-list/create-price-lists.ts similarity index 96% rename from packages/workflows/src/definition/price-list/create-price-lists.ts rename to packages/core-flows/src/definition/price-list/create-price-lists.ts index 0a54a3dbb5f25..0ab242680ae74 100644 --- a/packages/workflows/src/definition/price-list/create-price-lists.ts +++ b/packages/core-flows/src/definition/price-list/create-price-lists.ts @@ -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" diff --git a/packages/workflows/src/definition/price-list/index.ts b/packages/core-flows/src/definition/price-list/index.ts similarity index 81% rename from packages/workflows/src/definition/price-list/index.ts rename to packages/core-flows/src/definition/price-list/index.ts index 28dac74acd6b9..143f796859991 100644 --- a/packages/workflows/src/definition/price-list/index.ts +++ b/packages/core-flows/src/definition/price-list/index.ts @@ -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" diff --git a/packages/workflows/src/definition/price-list/remove-price-list-prices.ts b/packages/core-flows/src/definition/price-list/remove-price-list-prices.ts similarity index 92% rename from packages/workflows/src/definition/price-list/remove-price-list-prices.ts rename to packages/core-flows/src/definition/price-list/remove-price-list-prices.ts index 086d79cf8ff72..3bbe4f3d8bd2f 100644 --- a/packages/workflows/src/definition/price-list/remove-price-list-prices.ts +++ b/packages/core-flows/src/definition/price-list/remove-price-list-prices.ts @@ -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[] >( diff --git a/packages/workflows/src/definition/price-list/remove-price-lists.ts b/packages/core-flows/src/definition/price-list/remove-price-lists.ts similarity index 95% rename from packages/workflows/src/definition/price-list/remove-price-lists.ts rename to packages/core-flows/src/definition/price-list/remove-price-lists.ts index 6a4b3f39dc2ae..dff32564ad487 100644 --- a/packages/workflows/src/definition/price-list/remove-price-lists.ts +++ b/packages/core-flows/src/definition/price-list/remove-price-lists.ts @@ -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" diff --git a/packages/workflows/src/definition/price-list/remove-product-prices.ts b/packages/core-flows/src/definition/price-list/remove-product-prices.ts similarity index 96% rename from packages/workflows/src/definition/price-list/remove-product-prices.ts rename to packages/core-flows/src/definition/price-list/remove-product-prices.ts index 248129c00d842..275dee5f6c36b 100644 --- a/packages/workflows/src/definition/price-list/remove-product-prices.ts +++ b/packages/core-flows/src/definition/price-list/remove-product-prices.ts @@ -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" diff --git a/packages/workflows/src/definition/price-list/remove-variant-prices.ts b/packages/core-flows/src/definition/price-list/remove-variant-prices.ts similarity index 96% rename from packages/workflows/src/definition/price-list/remove-variant-prices.ts rename to packages/core-flows/src/definition/price-list/remove-variant-prices.ts index b68ef60ed75c1..a5e8bd2e17d03 100644 --- a/packages/workflows/src/definition/price-list/remove-variant-prices.ts +++ b/packages/core-flows/src/definition/price-list/remove-variant-prices.ts @@ -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" diff --git a/packages/workflows/src/definition/price-list/update-price-lists.ts b/packages/core-flows/src/definition/price-list/update-price-lists.ts similarity index 96% rename from packages/workflows/src/definition/price-list/update-price-lists.ts rename to packages/core-flows/src/definition/price-list/update-price-lists.ts index a445714199b55..210ae242b3027 100644 --- a/packages/workflows/src/definition/price-list/update-price-lists.ts +++ b/packages/core-flows/src/definition/price-list/update-price-lists.ts @@ -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" diff --git a/packages/workflows/src/definition/product/create-product-variants.ts b/packages/core-flows/src/definition/product/create-product-variants.ts similarity index 97% rename from packages/workflows/src/definition/product/create-product-variants.ts rename to packages/core-flows/src/definition/product/create-product-variants.ts index 0322af48a2ccc..27c0a3cefb395 100644 --- a/packages/workflows/src/definition/product/create-product-variants.ts +++ b/packages/core-flows/src/definition/product/create-product-variants.ts @@ -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" diff --git a/packages/workflows/src/definition/product/create-products.ts b/packages/core-flows/src/definition/product/create-products.ts similarity index 99% rename from packages/workflows/src/definition/product/create-products.ts rename to packages/core-flows/src/definition/product/create-products.ts index be93a97cab580..67bbbeb7134f2 100644 --- a/packages/workflows/src/definition/product/create-products.ts +++ b/packages/core-flows/src/definition/product/create-products.ts @@ -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 { diff --git a/packages/workflows/src/definition/product/index.ts b/packages/core-flows/src/definition/product/index.ts similarity index 100% rename from packages/workflows/src/definition/product/index.ts rename to packages/core-flows/src/definition/product/index.ts diff --git a/packages/workflows/src/definition/product/prepare-create-inventory-items.ts b/packages/core-flows/src/definition/product/prepare-create-inventory-items.ts similarity index 94% rename from packages/workflows/src/definition/product/prepare-create-inventory-items.ts rename to packages/core-flows/src/definition/product/prepare-create-inventory-items.ts index 36dbb908f8a1a..7df3cef87a0b5 100644 --- a/packages/workflows/src/definition/product/prepare-create-inventory-items.ts +++ b/packages/core-flows/src/definition/product/prepare-create-inventory-items.ts @@ -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 diff --git a/packages/workflows/src/definition/product/update-product-variants.ts b/packages/core-flows/src/definition/product/update-product-variants.ts similarity index 97% rename from packages/workflows/src/definition/product/update-product-variants.ts rename to packages/core-flows/src/definition/product/update-product-variants.ts index cf5e54d7de130..f2621ca2549af 100644 --- a/packages/workflows/src/definition/product/update-product-variants.ts +++ b/packages/core-flows/src/definition/product/update-product-variants.ts @@ -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" diff --git a/packages/workflows/src/definition/product/update-products.ts b/packages/core-flows/src/definition/product/update-products.ts similarity index 97% rename from packages/workflows/src/definition/product/update-products.ts rename to packages/core-flows/src/definition/product/update-products.ts index 3c749a412e143..126ca2e6b1c53 100644 --- a/packages/workflows/src/definition/product/update-products.ts +++ b/packages/core-flows/src/definition/product/update-products.ts @@ -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([ }, ], }, - MiddlewareHandlers.mapData((d) => ({ + MiddlewareHandlers.mapData((d: any) => ({ productsHandleSalesChannelsMap: d.preparedData.productHandleAddedChannelsMap, })), @@ -157,7 +157,7 @@ const handlers = new Map([ }, ], }, - MiddlewareHandlers.mapData((d) => ({ + MiddlewareHandlers.mapData((d: any) => ({ productsHandleSalesChannelsMap: d.preparedData.productHandleAddedChannelsMap, })), @@ -183,7 +183,7 @@ const handlers = new Map([ }, ], }, - MiddlewareHandlers.mapData((d) => ({ + MiddlewareHandlers.mapData((d: any) => ({ productsHandleSalesChannelsMap: d.preparedData.productHandleRemovedChannelsMap, })), @@ -204,7 +204,7 @@ const handlers = new Map([ }, ], }, - MiddlewareHandlers.mapData((d) => ({ + MiddlewareHandlers.mapData((d: any) => ({ productsHandleSalesChannelsMap: d.preparedData.productHandleRemovedChannelsMap, })), diff --git a/packages/workflows/src/definitions.ts b/packages/core-flows/src/definitions.ts similarity index 100% rename from packages/workflows/src/definitions.ts rename to packages/core-flows/src/definitions.ts diff --git a/packages/workflows/src/handlers/address/find-or-create-addresses.ts b/packages/core-flows/src/handlers/address/find-or-create-addresses.ts similarity index 97% rename from packages/workflows/src/handlers/address/find-or-create-addresses.ts rename to packages/core-flows/src/handlers/address/find-or-create-addresses.ts index 3f8f330410253..1b4b7b501df4b 100644 --- a/packages/workflows/src/handlers/address/find-or-create-addresses.ts +++ b/packages/core-flows/src/handlers/address/find-or-create-addresses.ts @@ -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 diff --git a/packages/workflows/src/handlers/address/index.ts b/packages/core-flows/src/handlers/address/index.ts similarity index 100% rename from packages/workflows/src/handlers/address/index.ts rename to packages/core-flows/src/handlers/address/index.ts diff --git a/packages/workflows/src/handlers/cart/attach-line-items-to-cart.ts b/packages/core-flows/src/handlers/cart/attach-line-items-to-cart.ts similarity index 96% rename from packages/workflows/src/handlers/cart/attach-line-items-to-cart.ts rename to packages/core-flows/src/handlers/cart/attach-line-items-to-cart.ts index df3ea90cf90af..1bb2520bd8998 100644 --- a/packages/workflows/src/handlers/cart/attach-line-items-to-cart.ts +++ b/packages/core-flows/src/handlers/cart/attach-line-items-to-cart.ts @@ -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: { diff --git a/packages/workflows/src/handlers/cart/create-cart.ts b/packages/core-flows/src/handlers/cart/create-cart.ts similarity index 94% rename from packages/workflows/src/handlers/cart/create-cart.ts rename to packages/core-flows/src/handlers/cart/create-cart.ts index ab82579ae44c2..bee49af29dff8 100644 --- a/packages/workflows/src/handlers/cart/create-cart.ts +++ b/packages/core-flows/src/handlers/cart/create-cart.ts @@ -1,5 +1,5 @@ import { CartDTO } from "@medusajs/types" -import { WorkflowArguments } from "../../helper" +import { WorkflowArguments } from "@medusajs/workflows-sdk" enum Aliases { SalesChannel = "SalesChannel", diff --git a/packages/workflows/src/handlers/cart/index.ts b/packages/core-flows/src/handlers/cart/index.ts similarity index 100% rename from packages/workflows/src/handlers/cart/index.ts rename to packages/core-flows/src/handlers/cart/index.ts diff --git a/packages/workflows/src/handlers/cart/remove-cart.ts b/packages/core-flows/src/handlers/cart/remove-cart.ts similarity index 88% rename from packages/workflows/src/handlers/cart/remove-cart.ts rename to packages/core-flows/src/handlers/cart/remove-cart.ts index 77598771ceeba..57493c1382d32 100644 --- a/packages/workflows/src/handlers/cart/remove-cart.ts +++ b/packages/core-flows/src/handlers/cart/remove-cart.ts @@ -1,4 +1,4 @@ -import { WorkflowArguments } from "../../helper" +import { WorkflowArguments } from "@medusajs/workflows-sdk" enum Aliases { Cart = "cart", diff --git a/packages/workflows/src/handlers/cart/retrieve-cart.ts b/packages/core-flows/src/handlers/cart/retrieve-cart.ts similarity index 92% rename from packages/workflows/src/handlers/cart/retrieve-cart.ts rename to packages/core-flows/src/handlers/cart/retrieve-cart.ts index 793704b1cc3a6..093cb6ad3ef33 100644 --- a/packages/workflows/src/handlers/cart/retrieve-cart.ts +++ b/packages/core-flows/src/handlers/cart/retrieve-cart.ts @@ -1,5 +1,5 @@ import { CartDTO } from "@medusajs/types" -import { WorkflowArguments } from "../../helper" +import { WorkflowArguments } from "@medusajs/workflows-sdk" type HandlerInputData = { cart: { diff --git a/packages/workflows/src/handlers/common/index.ts b/packages/core-flows/src/handlers/common/index.ts similarity index 100% rename from packages/workflows/src/handlers/common/index.ts rename to packages/core-flows/src/handlers/common/index.ts diff --git a/packages/workflows/src/handlers/common/set-context.ts b/packages/core-flows/src/handlers/common/set-context.ts similarity index 87% rename from packages/workflows/src/handlers/common/set-context.ts rename to packages/core-flows/src/handlers/common/set-context.ts index 63e0701d90ed1..d49e7c2fc3c18 100644 --- a/packages/workflows/src/handlers/common/set-context.ts +++ b/packages/core-flows/src/handlers/common/set-context.ts @@ -1,4 +1,4 @@ -import { WorkflowArguments } from "../../helper" +import { WorkflowArguments } from "@medusajs/workflows-sdk" type ContextDTO = { context?: Record diff --git a/packages/workflows/src/handlers/customer/find-or-create-customer.ts b/packages/core-flows/src/handlers/customer/find-or-create-customer.ts similarity index 95% rename from packages/workflows/src/handlers/customer/find-or-create-customer.ts rename to packages/core-flows/src/handlers/customer/find-or-create-customer.ts index d271b373c75be..ab04c843849f8 100644 --- a/packages/workflows/src/handlers/customer/find-or-create-customer.ts +++ b/packages/core-flows/src/handlers/customer/find-or-create-customer.ts @@ -1,6 +1,6 @@ import { validateEmail } from "@medusajs/utils" -import { WorkflowArguments } from "../../helper" +import { WorkflowArguments } from "@medusajs/workflows-sdk" type CustomerDTO = { customer_id?: string diff --git a/packages/workflows/src/handlers/customer/index.ts b/packages/core-flows/src/handlers/customer/index.ts similarity index 100% rename from packages/workflows/src/handlers/customer/index.ts rename to packages/core-flows/src/handlers/customer/index.ts diff --git a/packages/workflows/src/handlers/index.ts b/packages/core-flows/src/handlers/index.ts similarity index 100% rename from packages/workflows/src/handlers/index.ts rename to packages/core-flows/src/handlers/index.ts diff --git a/packages/workflows/src/handlers/inventory/attach-inventory-items.ts b/packages/core-flows/src/handlers/inventory/attach-inventory-items.ts similarity index 92% rename from packages/workflows/src/handlers/inventory/attach-inventory-items.ts rename to packages/core-flows/src/handlers/inventory/attach-inventory-items.ts index b4cf121035b8f..f4aa848d5733a 100644 --- a/packages/workflows/src/handlers/inventory/attach-inventory-items.ts +++ b/packages/core-flows/src/handlers/inventory/attach-inventory-items.ts @@ -1,5 +1,5 @@ import { InventoryItemDTO } from "@medusajs/types" -import { WorkflowArguments } from "../../helper" +import { WorkflowArguments } from "@medusajs/workflows-sdk" export async function attachInventoryItems({ container, diff --git a/packages/workflows/src/handlers/inventory/create-inventory-items.ts b/packages/core-flows/src/handlers/inventory/create-inventory-items.ts similarity index 95% rename from packages/workflows/src/handlers/inventory/create-inventory-items.ts rename to packages/core-flows/src/handlers/inventory/create-inventory-items.ts index 5995eb516db5c..4a772ff7f3aec 100644 --- a/packages/workflows/src/handlers/inventory/create-inventory-items.ts +++ b/packages/core-flows/src/handlers/inventory/create-inventory-items.ts @@ -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 = { diff --git a/packages/workflows/src/handlers/inventory/detach-inventory-items.ts b/packages/core-flows/src/handlers/inventory/detach-inventory-items.ts similarity index 93% rename from packages/workflows/src/handlers/inventory/detach-inventory-items.ts rename to packages/core-flows/src/handlers/inventory/detach-inventory-items.ts index fa7d48c01a184..e4f1b549826e8 100644 --- a/packages/workflows/src/handlers/inventory/detach-inventory-items.ts +++ b/packages/core-flows/src/handlers/inventory/detach-inventory-items.ts @@ -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({ diff --git a/packages/workflows/src/handlers/inventory/index.ts b/packages/core-flows/src/handlers/inventory/index.ts similarity index 100% rename from packages/workflows/src/handlers/inventory/index.ts rename to packages/core-flows/src/handlers/inventory/index.ts diff --git a/packages/workflows/src/handlers/inventory/remove-inventory-items.ts b/packages/core-flows/src/handlers/inventory/remove-inventory-items.ts similarity index 92% rename from packages/workflows/src/handlers/inventory/remove-inventory-items.ts rename to packages/core-flows/src/handlers/inventory/remove-inventory-items.ts index 5eeb14e08af96..8c15d26909d20 100644 --- a/packages/workflows/src/handlers/inventory/remove-inventory-items.ts +++ b/packages/core-flows/src/handlers/inventory/remove-inventory-items.ts @@ -1,5 +1,5 @@ import { InventoryItemDTO } from "@medusajs/types" -import { WorkflowArguments } from "../../helper" +import { WorkflowArguments } from "@medusajs/workflows-sdk" export async function removeInventoryItems({ container, diff --git a/packages/workflows/src/handlers/inventory/restore-inventory-items.ts b/packages/core-flows/src/handlers/inventory/restore-inventory-items.ts similarity index 93% rename from packages/workflows/src/handlers/inventory/restore-inventory-items.ts rename to packages/core-flows/src/handlers/inventory/restore-inventory-items.ts index d4f1c61cb0d18..35ed08a60975d 100644 --- a/packages/workflows/src/handlers/inventory/restore-inventory-items.ts +++ b/packages/core-flows/src/handlers/inventory/restore-inventory-items.ts @@ -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, diff --git a/packages/workflows/src/handlers/middlewares/create-products-prepare-create-prices-compensation.ts b/packages/core-flows/src/handlers/middlewares/create-products-prepare-create-prices-compensation.ts similarity index 96% rename from packages/workflows/src/handlers/middlewares/create-products-prepare-create-prices-compensation.ts rename to packages/core-flows/src/handlers/middlewares/create-products-prepare-create-prices-compensation.ts index 6b4c58a6a397e..fb9e5fbdb3fba 100644 --- a/packages/workflows/src/handlers/middlewares/create-products-prepare-create-prices-compensation.ts +++ b/packages/core-flows/src/handlers/middlewares/create-products-prepare-create-prices-compensation.ts @@ -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 = { diff --git a/packages/workflows/src/handlers/middlewares/extract-variants.ts b/packages/core-flows/src/handlers/middlewares/extract-variants.ts similarity index 90% rename from packages/workflows/src/handlers/middlewares/extract-variants.ts rename to packages/core-flows/src/handlers/middlewares/extract-variants.ts index 01bb535176eeb..889153aabe234 100644 --- a/packages/workflows/src/handlers/middlewares/extract-variants.ts +++ b/packages/core-flows/src/handlers/middlewares/extract-variants.ts @@ -1,6 +1,6 @@ import { ProductTypes } from "@medusajs/types" -import { WorkflowArguments } from "../../helper" +import { WorkflowArguments } from "@medusajs/workflows-sdk" export async function extractVariants({ data, diff --git a/packages/workflows/src/handlers/middlewares/index.ts b/packages/core-flows/src/handlers/middlewares/index.ts similarity index 100% rename from packages/workflows/src/handlers/middlewares/index.ts rename to packages/core-flows/src/handlers/middlewares/index.ts diff --git a/packages/workflows/src/handlers/middlewares/map-data.ts b/packages/core-flows/src/handlers/middlewares/map-data.ts similarity index 87% rename from packages/workflows/src/handlers/middlewares/map-data.ts rename to packages/core-flows/src/handlers/middlewares/map-data.ts index 9c560cf366b48..08cb812e8b8ef 100644 --- a/packages/workflows/src/handlers/middlewares/map-data.ts +++ b/packages/core-flows/src/handlers/middlewares/map-data.ts @@ -1,4 +1,4 @@ -import { WorkflowArguments } from "../../helper" +import { WorkflowArguments } from "@medusajs/workflows-sdk" /** * Middleware for map input data to a key/s. diff --git a/packages/workflows/src/handlers/middlewares/update-products-extract-created-variants.ts b/packages/core-flows/src/handlers/middlewares/update-products-extract-created-variants.ts similarity index 94% rename from packages/workflows/src/handlers/middlewares/update-products-extract-created-variants.ts rename to packages/core-flows/src/handlers/middlewares/update-products-extract-created-variants.ts index b10079acefecd..c3f6b3456a2cd 100644 --- a/packages/workflows/src/handlers/middlewares/update-products-extract-created-variants.ts +++ b/packages/core-flows/src/handlers/middlewares/update-products-extract-created-variants.ts @@ -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({ diff --git a/packages/workflows/src/handlers/middlewares/update-products-extract-deleted-variants.ts b/packages/core-flows/src/handlers/middlewares/update-products-extract-deleted-variants.ts similarity index 95% rename from packages/workflows/src/handlers/middlewares/update-products-extract-deleted-variants.ts rename to packages/core-flows/src/handlers/middlewares/update-products-extract-deleted-variants.ts index 124a2be959131..f716b76a762d7 100644 --- a/packages/workflows/src/handlers/middlewares/update-products-extract-deleted-variants.ts +++ b/packages/core-flows/src/handlers/middlewares/update-products-extract-deleted-variants.ts @@ -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({ diff --git a/packages/workflows/src/handlers/middlewares/use-variants-inventory-items.ts b/packages/core-flows/src/handlers/middlewares/use-variants-inventory-items.ts similarity index 95% rename from packages/workflows/src/handlers/middlewares/use-variants-inventory-items.ts rename to packages/core-flows/src/handlers/middlewares/use-variants-inventory-items.ts index 7c74361c34011..d163cef33a2dd 100644 --- a/packages/workflows/src/handlers/middlewares/use-variants-inventory-items.ts +++ b/packages/core-flows/src/handlers/middlewares/use-variants-inventory-items.ts @@ -1,4 +1,4 @@ -import { WorkflowArguments } from "../../helper" +import { WorkflowArguments } from "@medusajs/workflows-sdk" import { IInventoryService, ProductVariantDTO } from "@medusajs/types" export async function useVariantsInventoryItems({ diff --git a/packages/workflows/src/handlers/price-list/create-price-list.ts b/packages/core-flows/src/handlers/price-list/create-price-list.ts similarity index 93% rename from packages/workflows/src/handlers/price-list/create-price-list.ts rename to packages/core-flows/src/handlers/price-list/create-price-list.ts index 1e69066082853..b5715d28d3126 100644 --- a/packages/workflows/src/handlers/price-list/create-price-list.ts +++ b/packages/core-flows/src/handlers/price-list/create-price-list.ts @@ -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 diff --git a/packages/workflows/src/handlers/price-list/index.ts b/packages/core-flows/src/handlers/price-list/index.ts similarity index 100% rename from packages/workflows/src/handlers/price-list/index.ts rename to packages/core-flows/src/handlers/price-list/index.ts diff --git a/packages/workflows/src/handlers/price-list/prepare-create-price-list.ts b/packages/core-flows/src/handlers/price-list/prepare-create-price-list.ts similarity index 97% rename from packages/workflows/src/handlers/price-list/prepare-create-price-list.ts rename to packages/core-flows/src/handlers/price-list/prepare-create-price-list.ts index 327badb612edd..a1430502fc72c 100644 --- a/packages/workflows/src/handlers/price-list/prepare-create-price-list.ts +++ b/packages/core-flows/src/handlers/price-list/prepare-create-price-list.ts @@ -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 diff --git a/packages/workflows/src/handlers/price-list/prepare-remove-price-list-prices.ts b/packages/core-flows/src/handlers/price-list/prepare-remove-price-list-prices.ts similarity index 94% rename from packages/workflows/src/handlers/price-list/prepare-remove-price-list-prices.ts rename to packages/core-flows/src/handlers/price-list/prepare-remove-price-list-prices.ts index e31a63cb185c5..fe967abb43844 100644 --- a/packages/workflows/src/handlers/price-list/prepare-remove-price-list-prices.ts +++ b/packages/core-flows/src/handlers/price-list/prepare-remove-price-list-prices.ts @@ -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[] diff --git a/packages/workflows/src/handlers/price-list/prepare-remove-product-prices.ts b/packages/core-flows/src/handlers/price-list/prepare-remove-product-prices.ts similarity index 95% rename from packages/workflows/src/handlers/price-list/prepare-remove-product-prices.ts rename to packages/core-flows/src/handlers/price-list/prepare-remove-product-prices.ts index 34b22b9000f32..5a08aa11a8fc4 100644 --- a/packages/workflows/src/handlers/price-list/prepare-remove-product-prices.ts +++ b/packages/core-flows/src/handlers/price-list/prepare-remove-product-prices.ts @@ -1,4 +1,4 @@ -import { WorkflowArguments } from "../../helper" +import { WorkflowArguments } from "@medusajs/workflows-sdk" import { prepareCreatePriceLists } from "./prepare-create-price-list" type Result = { diff --git a/packages/workflows/src/handlers/price-list/prepare-remove-variant-prices.ts b/packages/core-flows/src/handlers/price-list/prepare-remove-variant-prices.ts similarity index 94% rename from packages/workflows/src/handlers/price-list/prepare-remove-variant-prices.ts rename to packages/core-flows/src/handlers/price-list/prepare-remove-variant-prices.ts index d903fd459ffeb..2da31e1f7d73c 100644 --- a/packages/workflows/src/handlers/price-list/prepare-remove-variant-prices.ts +++ b/packages/core-flows/src/handlers/price-list/prepare-remove-variant-prices.ts @@ -1,4 +1,4 @@ -import { WorkflowArguments } from "../../helper" +import { WorkflowArguments } from "@medusajs/workflows-sdk" import { prepareCreatePriceLists } from "./prepare-create-price-list" type Result = { diff --git a/packages/workflows/src/handlers/price-list/prepare-update-price-lists.ts b/packages/core-flows/src/handlers/price-list/prepare-update-price-lists.ts similarity index 97% rename from packages/workflows/src/handlers/price-list/prepare-update-price-lists.ts rename to packages/core-flows/src/handlers/price-list/prepare-update-price-lists.ts index 490974b395560..5831f626f95c5 100644 --- a/packages/workflows/src/handlers/price-list/prepare-update-price-lists.ts +++ b/packages/core-flows/src/handlers/price-list/prepare-update-price-lists.ts @@ -3,7 +3,7 @@ import { UpdatePriceListDTO, WorkflowTypes, } from "@medusajs/types" -import { WorkflowArguments } from "../../helper" +import { WorkflowArguments } from "@medusajs/workflows-sdk" type Result = { priceLists: UpdatePriceListDTO[] diff --git a/packages/workflows/src/handlers/price-list/remove-price-list.ts b/packages/core-flows/src/handlers/price-list/remove-price-list.ts similarity index 91% rename from packages/workflows/src/handlers/price-list/remove-price-list.ts rename to packages/core-flows/src/handlers/price-list/remove-price-list.ts index b38bd92ccaeb9..36ffa03d8cf02 100644 --- a/packages/workflows/src/handlers/price-list/remove-price-list.ts +++ b/packages/core-flows/src/handlers/price-list/remove-price-list.ts @@ -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, diff --git a/packages/workflows/src/handlers/price-list/remove-price-set-price-list-prices.ts b/packages/core-flows/src/handlers/price-list/remove-price-set-price-list-prices.ts similarity index 94% rename from packages/workflows/src/handlers/price-list/remove-price-set-price-list-prices.ts rename to packages/core-flows/src/handlers/price-list/remove-price-set-price-list-prices.ts index 09ce0a382d1c2..b5aeaa3b80154 100644 --- a/packages/workflows/src/handlers/price-list/remove-price-set-price-list-prices.ts +++ b/packages/core-flows/src/handlers/price-list/remove-price-set-price-list-prices.ts @@ -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({ diff --git a/packages/workflows/src/handlers/price-list/remove-prices.ts b/packages/core-flows/src/handlers/price-list/remove-prices.ts similarity index 90% rename from packages/workflows/src/handlers/price-list/remove-prices.ts rename to packages/core-flows/src/handlers/price-list/remove-prices.ts index 159f74050ef36..502452e126825 100644 --- a/packages/workflows/src/handlers/price-list/remove-prices.ts +++ b/packages/core-flows/src/handlers/price-list/remove-prices.ts @@ -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[] diff --git a/packages/workflows/src/handlers/price-list/update-price-lists.ts b/packages/core-flows/src/handlers/price-list/update-price-lists.ts similarity index 96% rename from packages/workflows/src/handlers/price-list/update-price-lists.ts rename to packages/core-flows/src/handlers/price-list/update-price-lists.ts index 4e62603e47f3e..fc99a167f09c7 100644 --- a/packages/workflows/src/handlers/price-list/update-price-lists.ts +++ b/packages/core-flows/src/handlers/price-list/update-price-lists.ts @@ -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[] diff --git a/packages/workflows/src/handlers/product/attach-sales-channel-to-products.ts b/packages/core-flows/src/handlers/product/attach-sales-channel-to-products.ts similarity index 96% rename from packages/workflows/src/handlers/product/attach-sales-channel-to-products.ts rename to packages/core-flows/src/handlers/product/attach-sales-channel-to-products.ts index 25d970dfd6799..dd70c33f9009d 100644 --- a/packages/workflows/src/handlers/product/attach-sales-channel-to-products.ts +++ b/packages/core-flows/src/handlers/product/attach-sales-channel-to-products.ts @@ -1,4 +1,4 @@ -import { WorkflowArguments } from "../../helper" +import { WorkflowArguments } from "@medusajs/workflows-sdk" import { promiseAll } from "@medusajs/utils" type ProductHandle = string diff --git a/packages/workflows/src/handlers/product/attach-shipping-profile-to-products.ts b/packages/core-flows/src/handlers/product/attach-shipping-profile-to-products.ts similarity index 95% rename from packages/workflows/src/handlers/product/attach-shipping-profile-to-products.ts rename to packages/core-flows/src/handlers/product/attach-shipping-profile-to-products.ts index 887aea8db8af2..2b6855f4a9fd9 100644 --- a/packages/workflows/src/handlers/product/attach-shipping-profile-to-products.ts +++ b/packages/core-flows/src/handlers/product/attach-shipping-profile-to-products.ts @@ -1,4 +1,4 @@ -import { WorkflowArguments } from "../../helper" +import { WorkflowArguments } from "@medusajs/workflows-sdk" import { promiseAll } from "@medusajs/utils" type ProductHandle = string diff --git a/packages/workflows/src/handlers/product/create-product-variants-prepare-data.ts b/packages/core-flows/src/handlers/product/create-product-variants-prepare-data.ts similarity index 96% rename from packages/workflows/src/handlers/product/create-product-variants-prepare-data.ts rename to packages/core-flows/src/handlers/product/create-product-variants-prepare-data.ts index daadc4d82734d..9ea768a403315 100644 --- a/packages/workflows/src/handlers/product/create-product-variants-prepare-data.ts +++ b/packages/core-flows/src/handlers/product/create-product-variants-prepare-data.ts @@ -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 diff --git a/packages/workflows/src/handlers/product/create-product-variants.ts b/packages/core-flows/src/handlers/product/create-product-variants.ts similarity index 95% rename from packages/workflows/src/handlers/product/create-product-variants.ts rename to packages/core-flows/src/handlers/product/create-product-variants.ts index 054877d5a59ce..40e0bd0d94d20 100644 --- a/packages/workflows/src/handlers/product/create-product-variants.ts +++ b/packages/core-flows/src/handlers/product/create-product-variants.ts @@ -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 diff --git a/packages/workflows/src/handlers/product/create-products-prepare-data.ts b/packages/core-flows/src/handlers/product/create-products-prepare-data.ts similarity index 98% rename from packages/workflows/src/handlers/product/create-products-prepare-data.ts rename to packages/core-flows/src/handlers/product/create-products-prepare-data.ts index ebce044b592d3..6cb312668faa9 100644 --- a/packages/workflows/src/handlers/product/create-products-prepare-data.ts +++ b/packages/core-flows/src/handlers/product/create-products-prepare-data.ts @@ -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 diff --git a/packages/workflows/src/handlers/product/create-products.ts b/packages/core-flows/src/handlers/product/create-products.ts similarity index 90% rename from packages/workflows/src/handlers/product/create-products.ts rename to packages/core-flows/src/handlers/product/create-products.ts index 61c305f3199ec..cfe63e9223a9d 100644 --- a/packages/workflows/src/handlers/product/create-products.ts +++ b/packages/core-flows/src/handlers/product/create-products.ts @@ -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 = { diff --git a/packages/workflows/src/handlers/product/detach-sales-channel-from-products.ts b/packages/core-flows/src/handlers/product/detach-sales-channel-from-products.ts similarity index 96% rename from packages/workflows/src/handlers/product/detach-sales-channel-from-products.ts rename to packages/core-flows/src/handlers/product/detach-sales-channel-from-products.ts index 1fafed76b9b41..2db2998ea2c3c 100644 --- a/packages/workflows/src/handlers/product/detach-sales-channel-from-products.ts +++ b/packages/core-flows/src/handlers/product/detach-sales-channel-from-products.ts @@ -1,4 +1,4 @@ -import { WorkflowArguments } from "../../helper" +import { WorkflowArguments } from "@medusajs/workflows-sdk" import { promiseAll } from "@medusajs/utils" type ProductHandle = string diff --git a/packages/workflows/src/handlers/product/detach-shipping-profile-from-products.ts b/packages/core-flows/src/handlers/product/detach-shipping-profile-from-products.ts similarity index 96% rename from packages/workflows/src/handlers/product/detach-shipping-profile-from-products.ts rename to packages/core-flows/src/handlers/product/detach-shipping-profile-from-products.ts index e3941632481d9..534d5d3c7f3ed 100644 --- a/packages/workflows/src/handlers/product/detach-shipping-profile-from-products.ts +++ b/packages/core-flows/src/handlers/product/detach-shipping-profile-from-products.ts @@ -1,4 +1,4 @@ -import { WorkflowArguments } from "../../helper" +import { WorkflowArguments } from "@medusajs/workflows-sdk" import { promiseAll } from "@medusajs/utils" type ProductHandle = string diff --git a/packages/workflows/src/handlers/product/index.ts b/packages/core-flows/src/handlers/product/index.ts similarity index 100% rename from packages/workflows/src/handlers/product/index.ts rename to packages/core-flows/src/handlers/product/index.ts diff --git a/packages/workflows/src/handlers/product/list-products.ts b/packages/core-flows/src/handlers/product/list-products.ts similarity index 95% rename from packages/workflows/src/handlers/product/list-products.ts rename to packages/core-flows/src/handlers/product/list-products.ts index fe2b783b8eec9..79a57413252c3 100644 --- a/packages/workflows/src/handlers/product/list-products.ts +++ b/packages/core-flows/src/handlers/product/list-products.ts @@ -1,5 +1,5 @@ import { ProductTypes, WorkflowTypes } from "@medusajs/types" -import { WorkflowArguments } from "../../helper" +import { WorkflowArguments } from "@medusajs/workflows-sdk" type HandlerInput = { ids: string[] diff --git a/packages/workflows/src/handlers/product/remove-product-variants.ts b/packages/core-flows/src/handlers/product/remove-product-variants.ts similarity index 91% rename from packages/workflows/src/handlers/product/remove-product-variants.ts rename to packages/core-flows/src/handlers/product/remove-product-variants.ts index d40edf7a4b732..5d83a5a186ebd 100644 --- a/packages/workflows/src/handlers/product/remove-product-variants.ts +++ b/packages/core-flows/src/handlers/product/remove-product-variants.ts @@ -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 }[] } diff --git a/packages/workflows/src/handlers/product/remove-products.ts b/packages/core-flows/src/handlers/product/remove-products.ts similarity index 90% rename from packages/workflows/src/handlers/product/remove-products.ts rename to packages/core-flows/src/handlers/product/remove-products.ts index ddfe486b53a49..85335da3c37d1 100644 --- a/packages/workflows/src/handlers/product/remove-products.ts +++ b/packages/core-flows/src/handlers/product/remove-products.ts @@ -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 }[] } diff --git a/packages/workflows/src/handlers/product/revert-update-products.ts b/packages/core-flows/src/handlers/product/revert-update-products.ts similarity index 94% rename from packages/workflows/src/handlers/product/revert-update-products.ts rename to packages/core-flows/src/handlers/product/revert-update-products.ts index a78748987c7e0..0b1eeed28929e 100644 --- a/packages/workflows/src/handlers/product/revert-update-products.ts +++ b/packages/core-flows/src/handlers/product/revert-update-products.ts @@ -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 & { diff --git a/packages/workflows/src/handlers/product/revert-variant-prices.ts b/packages/core-flows/src/handlers/product/revert-variant-prices.ts similarity index 95% rename from packages/workflows/src/handlers/product/revert-variant-prices.ts rename to packages/core-flows/src/handlers/product/revert-variant-prices.ts index f69043600275d..6a5c5ecb1be05 100644 --- a/packages/workflows/src/handlers/product/revert-variant-prices.ts +++ b/packages/core-flows/src/handlers/product/revert-variant-prices.ts @@ -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[] diff --git a/packages/workflows/src/handlers/product/update-product-variants-prepare-data.ts b/packages/core-flows/src/handlers/product/update-product-variants-prepare-data.ts similarity index 97% rename from packages/workflows/src/handlers/product/update-product-variants-prepare-data.ts rename to packages/core-flows/src/handlers/product/update-product-variants-prepare-data.ts index dce662c1a8859..46860902f0cd9 100644 --- a/packages/workflows/src/handlers/product/update-product-variants-prepare-data.ts +++ b/packages/core-flows/src/handlers/product/update-product-variants-prepare-data.ts @@ -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 diff --git a/packages/workflows/src/handlers/product/update-product-variants.ts b/packages/core-flows/src/handlers/product/update-product-variants.ts similarity index 95% rename from packages/workflows/src/handlers/product/update-product-variants.ts rename to packages/core-flows/src/handlers/product/update-product-variants.ts index e91c6775a45ab..b340fbd53537c 100644 --- a/packages/workflows/src/handlers/product/update-product-variants.ts +++ b/packages/core-flows/src/handlers/product/update-product-variants.ts @@ -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 diff --git a/packages/workflows/src/handlers/product/update-products-prepare-data.ts b/packages/core-flows/src/handlers/product/update-products-prepare-data.ts similarity index 98% rename from packages/workflows/src/handlers/product/update-products-prepare-data.ts rename to packages/core-flows/src/handlers/product/update-products-prepare-data.ts index 8464bc51a2c9e..e7d0c33df270f 100644 --- a/packages/workflows/src/handlers/product/update-products-prepare-data.ts +++ b/packages/core-flows/src/handlers/product/update-products-prepare-data.ts @@ -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[] diff --git a/packages/workflows/src/handlers/product/update-products-variants-prices.ts b/packages/core-flows/src/handlers/product/update-products-variants-prices.ts similarity index 98% rename from packages/workflows/src/handlers/product/update-products-variants-prices.ts rename to packages/core-flows/src/handlers/product/update-products-variants-prices.ts index 2174f35c01369..c561b221ac4b6 100644 --- a/packages/workflows/src/handlers/product/update-products-variants-prices.ts +++ b/packages/core-flows/src/handlers/product/update-products-variants-prices.ts @@ -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 = { diff --git a/packages/workflows/src/handlers/product/update-products.ts b/packages/core-flows/src/handlers/product/update-products.ts similarity index 94% rename from packages/workflows/src/handlers/product/update-products.ts rename to packages/core-flows/src/handlers/product/update-products.ts index ee28cadb74b5f..5684b0b31fcb3 100644 --- a/packages/workflows/src/handlers/product/update-products.ts +++ b/packages/core-flows/src/handlers/product/update-products.ts @@ -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[] diff --git a/packages/workflows/src/handlers/product/upsert-variant-prices.ts b/packages/core-flows/src/handlers/product/upsert-variant-prices.ts similarity index 98% rename from packages/workflows/src/handlers/product/upsert-variant-prices.ts rename to packages/core-flows/src/handlers/product/upsert-variant-prices.ts index 441ed9d3e1509..307a028cb3dbe 100644 --- a/packages/workflows/src/handlers/product/upsert-variant-prices.ts +++ b/packages/core-flows/src/handlers/product/upsert-variant-prices.ts @@ -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 diff --git a/packages/workflows/src/handlers/region/find-region.ts b/packages/core-flows/src/handlers/region/find-region.ts similarity index 93% rename from packages/workflows/src/handlers/region/find-region.ts rename to packages/core-flows/src/handlers/region/find-region.ts index 02b7ae2dbaea1..c727cefea49e3 100644 --- a/packages/workflows/src/handlers/region/find-region.ts +++ b/packages/core-flows/src/handlers/region/find-region.ts @@ -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 diff --git a/packages/workflows/src/handlers/region/index.ts b/packages/core-flows/src/handlers/region/index.ts similarity index 100% rename from packages/workflows/src/handlers/region/index.ts rename to packages/core-flows/src/handlers/region/index.ts diff --git a/packages/workflows/src/handlers/sales-channel/find-sales-channel.ts b/packages/core-flows/src/handlers/sales-channel/find-sales-channel.ts similarity index 96% rename from packages/workflows/src/handlers/sales-channel/find-sales-channel.ts rename to packages/core-flows/src/handlers/sales-channel/find-sales-channel.ts index b73a93b6e324c..875540c83cdc2 100644 --- a/packages/workflows/src/handlers/sales-channel/find-sales-channel.ts +++ b/packages/core-flows/src/handlers/sales-channel/find-sales-channel.ts @@ -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 diff --git a/packages/workflows/src/handlers/sales-channel/index.ts b/packages/core-flows/src/handlers/sales-channel/index.ts similarity index 100% rename from packages/workflows/src/handlers/sales-channel/index.ts rename to packages/core-flows/src/handlers/sales-channel/index.ts diff --git a/packages/core-flows/src/index.ts b/packages/core-flows/src/index.ts new file mode 100644 index 0000000000000..844b249bef9e7 --- /dev/null +++ b/packages/core-flows/src/index.ts @@ -0,0 +1,3 @@ +export * from "./definition" +export * from "./definitions" +export * as Handlers from "./handlers" diff --git a/packages/workflows/tsconfig.json b/packages/core-flows/tsconfig.json similarity index 100% rename from packages/workflows/tsconfig.json rename to packages/core-flows/tsconfig.json diff --git a/packages/workflows/tsconfig.spec.json b/packages/core-flows/tsconfig.spec.json similarity index 100% rename from packages/workflows/tsconfig.spec.json rename to packages/core-flows/tsconfig.spec.json diff --git a/packages/inventory/CHANGELOG.md b/packages/inventory/CHANGELOG.md index 1280a2a34fb38..e15e4313711a0 100644 --- a/packages/inventory/CHANGELOG.md +++ b/packages/inventory/CHANGELOG.md @@ -1,4 +1,5 @@ # @medusajs/inventory +# @medusajs/inventory ## 1.11.3 diff --git a/packages/medusa/package.json b/packages/medusa/package.json index e39bdc66ec896..1fd2a7989f881 100644 --- a/packages/medusa/package.json +++ b/packages/medusa/package.json @@ -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", diff --git a/packages/medusa/src/api/routes/admin/inventory-items/create-inventory-item.ts b/packages/medusa/src/api/routes/admin/inventory-items/create-inventory-item.ts index c5991e2e54ecc..fbc2df8d60a66 100644 --- a/packages/medusa/src/api/routes/admin/inventory-items/create-inventory-item.ts +++ b/packages/medusa/src/api/routes/admin/inventory-items/create-inventory-item.ts @@ -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 diff --git a/packages/medusa/src/api/routes/admin/price-lists/add-prices-batch.ts b/packages/medusa/src/api/routes/admin/price-lists/add-prices-batch.ts index 7e2b51109dc1e..8d76b52ac8f52 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/add-prices-batch.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/add-prices-batch.ts @@ -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" diff --git a/packages/medusa/src/api/routes/admin/price-lists/create-price-list.ts b/packages/medusa/src/api/routes/admin/price-lists/create-price-list.ts index 1d1cbaf1d9271..bb7b9f16cd2cf 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/create-price-list.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/create-price-list.ts @@ -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, diff --git a/packages/medusa/src/api/routes/admin/price-lists/delete-price-list.ts b/packages/medusa/src/api/routes/admin/price-lists/delete-price-list.ts index 94db28f0d6772..3a18ef28da7d0 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/delete-price-list.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/delete-price-list.ts @@ -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" diff --git a/packages/medusa/src/api/routes/admin/price-lists/delete-prices-batch.ts b/packages/medusa/src/api/routes/admin/price-lists/delete-prices-batch.ts index 96fa6f8d09473..7895c21027ff6 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/delete-prices-batch.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/delete-prices-batch.ts @@ -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, diff --git a/packages/medusa/src/api/routes/admin/price-lists/delete-product-prices.ts b/packages/medusa/src/api/routes/admin/price-lists/delete-product-prices.ts index d12de2e6e461f..52d657c1cda3a 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/delete-product-prices.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/delete-product-prices.ts @@ -1,6 +1,6 @@ import { WorkflowTypes } from "@medusajs/types" import { FlagRouter, MedusaV2Flag } from "@medusajs/utils" -import { removePriceListProductPrices } from "@medusajs/workflows/dist/definition/price-list/remove-product-prices" +import { removePriceListProductPrices } from "@medusajs/core-flows" import { EntityManager } from "typeorm" import PriceListService from "../../../../services/price-list" diff --git a/packages/medusa/src/api/routes/admin/price-lists/delete-products-prices-batch.ts b/packages/medusa/src/api/routes/admin/price-lists/delete-products-prices-batch.ts index 129a21ccfc74a..ce0dcaa9e3074 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/delete-products-prices-batch.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/delete-products-prices-batch.ts @@ -1,5 +1,5 @@ import { FlagRouter, MedusaV2Flag } from "@medusajs/utils" -import { removePriceListProductPrices } from "@medusajs/workflows" +import { removePriceListProductPrices } from "@medusajs/core-flows" import { ArrayNotEmpty, IsString } from "class-validator" import { Request, Response } from "express" import { EntityManager } from "typeorm" diff --git a/packages/medusa/src/api/routes/admin/price-lists/delete-variant-prices.ts b/packages/medusa/src/api/routes/admin/price-lists/delete-variant-prices.ts index 45a61d643fb3d..debcf269f33e0 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/delete-variant-prices.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/delete-variant-prices.ts @@ -1,5 +1,5 @@ import { FlagRouter, MedusaV2Flag } from "@medusajs/utils" -import { removePriceListVariantPrices } from "@medusajs/workflows" +import { removePriceListVariantPrices } from "@medusajs/core-flows" import { EntityManager } from "typeorm" import PriceListService from "../../../../services/price-list" import { WorkflowTypes } from "@medusajs/types" diff --git a/packages/medusa/src/api/routes/admin/price-lists/update-price-list.ts b/packages/medusa/src/api/routes/admin/price-lists/update-price-list.ts index b00b582659dd2..eff3b219ad0d4 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/update-price-list.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/update-price-list.ts @@ -10,7 +10,7 @@ import { } from "class-validator" import { defaultAdminPriceListFields, defaultAdminPriceListRelations } from "." -import { updatePriceLists } from "@medusajs/workflows" +import { updatePriceLists } from "@medusajs/core-flows" import { Type } from "class-transformer" import { EntityManager } from "typeorm" import { PriceList } from "../../../.." diff --git a/packages/medusa/src/api/routes/admin/products/create-product.ts b/packages/medusa/src/api/routes/admin/products/create-product.ts index 7b5406206287f..86f578043cc75 100644 --- a/packages/medusa/src/api/routes/admin/products/create-product.ts +++ b/packages/medusa/src/api/routes/admin/products/create-product.ts @@ -1,5 +1,5 @@ import { IInventoryService, WorkflowTypes } from "@medusajs/types" -import { Workflows, createProducts } from "@medusajs/workflows" +import { createProducts, Workflows } from "@medusajs/core-flows" import { IsArray, IsBoolean, diff --git a/packages/medusa/src/api/routes/admin/products/create-variant.ts b/packages/medusa/src/api/routes/admin/products/create-variant.ts index f394c73db2fe7..961a6229cafa9 100644 --- a/packages/medusa/src/api/routes/admin/products/create-variant.ts +++ b/packages/medusa/src/api/routes/admin/products/create-variant.ts @@ -1,6 +1,6 @@ import { IInventoryService, WorkflowTypes } from "@medusajs/types" import { FlagRouter, MedusaV2Flag } from "@medusajs/utils" -import { CreateProductVariants } from "@medusajs/workflows" +import { CreateProductVariants } from "@medusajs/core-flows" import { IsArray, IsBoolean, diff --git a/packages/medusa/src/api/routes/admin/products/update-product.ts b/packages/medusa/src/api/routes/admin/products/update-product.ts index e559fbf49edb9..85b7cecf703d2 100644 --- a/packages/medusa/src/api/routes/admin/products/update-product.ts +++ b/packages/medusa/src/api/routes/admin/products/update-product.ts @@ -5,7 +5,7 @@ import { MedusaV2Flag, promiseAll, } from "@medusajs/utils" -import { Workflows, updateProducts } from "@medusajs/workflows" +import { updateProducts, Workflows } from "@medusajs/core-flows" import { Type } from "class-transformer" import { IsArray, diff --git a/packages/medusa/src/api/routes/admin/products/update-variant.ts b/packages/medusa/src/api/routes/admin/products/update-variant.ts index 87dfc6b4f68ab..967e60eff3a78 100644 --- a/packages/medusa/src/api/routes/admin/products/update-variant.ts +++ b/packages/medusa/src/api/routes/admin/products/update-variant.ts @@ -1,6 +1,6 @@ import { WorkflowTypes } from "@medusajs/types" -import { FlagRouter } from "@medusajs/utils" -import { UpdateProductVariants } from "@medusajs/workflows" +import { FlagRouter, MedusaV2Flag } from "@medusajs/utils" +import { UpdateProductVariants } from "@medusajs/core-flows" import { Type } from "class-transformer" import { IsArray, @@ -12,8 +12,6 @@ import { ValidateNested, } from "class-validator" import { EntityManager } from "typeorm" - -import { MedusaV2Flag } from "@medusajs/utils" import { defaultAdminProductFields, defaultAdminProductRelations } from "." import { PricingService, diff --git a/packages/medusa/src/api/routes/store/carts/create-cart.ts b/packages/medusa/src/api/routes/store/carts/create-cart.ts index 1c3fc591ba9b3..3c6d4b8c29fcf 100644 --- a/packages/medusa/src/api/routes/store/carts/create-cart.ts +++ b/packages/medusa/src/api/routes/store/carts/create-cart.ts @@ -1,4 +1,7 @@ -import { createCart as createCartWorkflow } from "@medusajs/workflows" +import { + createCart as createCartWorkflow, + Workflows, +} from "@medusajs/core-flows" import { IsArray, IsInt, @@ -7,7 +10,7 @@ import { IsString, ValidateNested, } from "class-validator" -import { MedusaError, isDefined } from "medusa-core-utils" +import { isDefined, MedusaError } from "medusa-core-utils" import { defaultStoreCartFields, defaultStoreCartRelations } from "." import { CartService, @@ -18,7 +21,6 @@ import { import { MedusaContainer } from "@medusajs/modules-sdk" import { FlagRouter } from "@medusajs/utils" -import { Workflows } from "@medusajs/workflows" import { Type } from "class-transformer" import reqIp from "request-ip" import { EntityManager } from "typeorm" diff --git a/packages/orchestration/src/__tests__/workflow/local-workflow.ts b/packages/orchestration/src/__tests__/workflow/local-workflow.ts index 6060a375150bb..e3d07ed05a307 100644 --- a/packages/orchestration/src/__tests__/workflow/local-workflow.ts +++ b/packages/orchestration/src/__tests__/workflow/local-workflow.ts @@ -1,5 +1,5 @@ -import { LocalWorkflow } from "../../workflow/local-workflow" import { TransactionState } from "../../transaction/types" +import { LocalWorkflow } from "../../workflow/local-workflow" import { WorkflowManager } from "../../workflow/workflow-manager" describe("WorkflowManager", () => { @@ -217,4 +217,18 @@ describe("WorkflowManager", () => { WorkflowManager.getWorkflow("create-product")?.handlers_.has("xor") ).toEqual(false) }) + + it("should return the final flow definition when calling getFlow()", async () => { + const flow = new LocalWorkflow("deliver-product", container) + + expect(flow.getFlow()).toEqual({ + action: "foo", + next: { + action: "callExternal", + async: true, + noCompensation: true, + next: { action: "bar" }, + }, + }) + }) }) diff --git a/packages/orchestration/src/workflow/local-workflow.ts b/packages/orchestration/src/workflow/local-workflow.ts index fdbef1c72c244..c19d7ca45d3dc 100644 --- a/packages/orchestration/src/workflow/local-workflow.ts +++ b/packages/orchestration/src/workflow/local-workflow.ts @@ -1,19 +1,18 @@ import { Context, LoadedModule, MedusaContainer } from "@medusajs/types" +import { createMedusaContainer } from "@medusajs/utils" +import { asValue } from "awilix" import { DistributedTransaction, TransactionOrchestrator, TransactionStepsDefinition, } from "../transaction" +import { OrchestratorBuilder } from "../transaction/orchestrator-builder" import { WorkflowDefinition, WorkflowManager, WorkflowStepHandler, } from "./workflow-manager" -import { OrchestratorBuilder } from "../transaction/orchestrator-builder" -import { asValue } from "awilix" -import { createMedusaContainer } from "@medusajs/utils" - type StepHandler = { invoke: WorkflowStepHandler compensate?: WorkflowStepHandler @@ -45,7 +44,7 @@ export class LocalWorkflow { // Medusa container if (!Array.isArray(modulesLoaded) && modulesLoaded) { const cradle = modulesLoaded.cradle - for (const key in cradle) { + for (const key of Object.keys(cradle ?? {})) { container.register(key, asValue(cradle[key])) } } @@ -72,6 +71,14 @@ export class LocalWorkflow { } } + public getFlow() { + if (this.flow.hasChanges) { + this.commit() + } + + return this.workflow.flow_ + } + async run(uniqueTransactionId: string, input?: unknown, context?: Context) { if (this.flow.hasChanges) { this.commit() diff --git a/packages/workflows-sdk/jest.config.js b/packages/workflows-sdk/jest.config.js new file mode 100644 index 0000000000000..2fd636dce63a5 --- /dev/null +++ b/packages/workflows-sdk/jest.config.js @@ -0,0 +1,13 @@ +module.exports = { + transform: { + "^.+\\.[jt]s?$": [ + "ts-jest", + { + tsConfig: "tsconfig.json", + isolatedModules: true, + }, + ], + }, + testEnvironment: `node`, + moduleFileExtensions: [`js`, `ts`], +} diff --git a/packages/workflows/package.json b/packages/workflows-sdk/package.json similarity index 88% rename from packages/workflows/package.json rename to packages/workflows-sdk/package.json index f41bef9c52218..56b7e60a24364 100644 --- a/packages/workflows/package.json +++ b/packages/workflows-sdk/package.json @@ -1,7 +1,7 @@ { - "name": "@medusajs/workflows", - "version": "0.3.0", - "description": "Set of workflows for Medusa", + "name": "@medusajs/workflows-sdk", + "version": "0.1.0", + "description": "Set of workflows tooling for Medusa", "main": "dist/index.js", "types": "dist/index.d.ts", "repository": { diff --git a/packages/workflows/src/helper/__tests__/merge-data.spec.ts b/packages/workflows-sdk/src/helper/__tests__/merge-data.spec.ts similarity index 100% rename from packages/workflows/src/helper/__tests__/merge-data.spec.ts rename to packages/workflows-sdk/src/helper/__tests__/merge-data.spec.ts diff --git a/packages/workflows/src/helper/__tests__/pipe.spec.ts b/packages/workflows-sdk/src/helper/__tests__/pipe.spec.ts similarity index 100% rename from packages/workflows/src/helper/__tests__/pipe.spec.ts rename to packages/workflows-sdk/src/helper/__tests__/pipe.spec.ts diff --git a/packages/workflows/src/helper/__tests__/workflow-export.spec.ts b/packages/workflows-sdk/src/helper/__tests__/workflow-export.spec.ts similarity index 100% rename from packages/workflows/src/helper/__tests__/workflow-export.spec.ts rename to packages/workflows-sdk/src/helper/__tests__/workflow-export.spec.ts diff --git a/packages/workflows/src/helper/empty-handler.ts b/packages/workflows-sdk/src/helper/empty-handler.ts similarity index 100% rename from packages/workflows/src/helper/empty-handler.ts rename to packages/workflows-sdk/src/helper/empty-handler.ts diff --git a/packages/workflows/src/helper/index.ts b/packages/workflows-sdk/src/helper/index.ts similarity index 100% rename from packages/workflows/src/helper/index.ts rename to packages/workflows-sdk/src/helper/index.ts diff --git a/packages/workflows/src/helper/merge-data.ts b/packages/workflows-sdk/src/helper/merge-data.ts similarity index 100% rename from packages/workflows/src/helper/merge-data.ts rename to packages/workflows-sdk/src/helper/merge-data.ts diff --git a/packages/workflows/src/helper/pipe.ts b/packages/workflows-sdk/src/helper/pipe.ts similarity index 98% rename from packages/workflows/src/helper/pipe.ts rename to packages/workflows-sdk/src/helper/pipe.ts index 225a1f2c4c9a6..38b934677b80b 100644 --- a/packages/workflows/src/helper/pipe.ts +++ b/packages/workflows-sdk/src/helper/pipe.ts @@ -4,7 +4,6 @@ import { WorkflowStepHandler, } from "@medusajs/orchestration" import { Context, MedusaContainer, SharedContext } from "@medusajs/types" -import { InputAlias } from "../definitions" import { mergeData } from "./merge-data" export type WorkflowStepMiddlewareReturn = { @@ -21,7 +20,7 @@ interface PipelineInput { /** * The alias of the input data to store in */ - inputAlias?: InputAlias | string + inputAlias?: string /** * Descriptors to get the data from */ diff --git a/packages/workflows/src/helper/workflow-export.ts b/packages/workflows-sdk/src/helper/workflow-export.ts similarity index 97% rename from packages/workflows/src/helper/workflow-export.ts rename to packages/workflows-sdk/src/helper/workflow-export.ts index ed75b21d30eae..a0614c6a4ab0c 100644 --- a/packages/workflows/src/helper/workflow-export.ts +++ b/packages/workflows-sdk/src/helper/workflow-export.ts @@ -10,7 +10,6 @@ import { Context, LoadedModule, MedusaContainer } from "@medusajs/types" import { MedusaModule } from "@medusajs/modules-sdk" import { EOL } from "os" import { ulid } from "ulid" -import { Workflows } from "../definitions" import { SymbolWorkflowWorkflowData } from "../utils/composer" export type FlowRunOptions = { @@ -27,7 +26,7 @@ export type WorkflowResult = { } export const exportWorkflow = ( - workflowId: Workflows | string, + workflowId: string, defaultResult?: string, dataPreparation?: (data: TData) => Promise ) => { diff --git a/packages/workflows/src/index.ts b/packages/workflows-sdk/src/index.ts similarity index 51% rename from packages/workflows/src/index.ts rename to packages/workflows-sdk/src/index.ts index e60ea511b25cb..b7791bb21d781 100644 --- a/packages/workflows/src/index.ts +++ b/packages/workflows-sdk/src/index.ts @@ -1,6 +1,3 @@ -export * from "./definition" -export * from "./definitions" -export * as Handlers from "./handlers" export * from "./helper" export * from "./utils/composer" export * as Composer from "./utils/composer" diff --git a/packages/workflows/src/utils/composer/create-step.ts b/packages/workflows-sdk/src/utils/composer/create-step.ts similarity index 99% rename from packages/workflows/src/utils/composer/create-step.ts rename to packages/workflows-sdk/src/utils/composer/create-step.ts index e647ab60d4eb8..a63feb8e8cce1 100644 --- a/packages/workflows/src/utils/composer/create-step.ts +++ b/packages/workflows-sdk/src/utils/composer/create-step.ts @@ -197,7 +197,7 @@ function applyStep< * StepResponse, * StepExecutionContext, * WorkflowData - * } from "@medusajs/workflows" + * } from "@medusajs/workflows-sdk" * * interface CreateProductInput { * title: string diff --git a/packages/workflows/src/utils/composer/create-workflow.ts b/packages/workflows-sdk/src/utils/composer/create-workflow.ts similarity index 99% rename from packages/workflows/src/utils/composer/create-workflow.ts rename to packages/workflows-sdk/src/utils/composer/create-workflow.ts index a2c01e3cdc027..199d7ff183053 100644 --- a/packages/workflows/src/utils/composer/create-workflow.ts +++ b/packages/workflows-sdk/src/utils/composer/create-workflow.ts @@ -96,7 +96,7 @@ type ReturnWorkflow> = { * @returns The created workflow. You can later execute the workflow by invoking it, then using its `run` method. * * @example - * import { createWorkflow } from "@medusajs/workflows" + * import { createWorkflow } from "@medusajs/workflows-sdk" * import { MedusaRequest, MedusaResponse, Product } from "@medusajs/medusa" * import { * createProductStep, diff --git a/packages/workflows/src/utils/composer/helpers/index.ts b/packages/workflows-sdk/src/utils/composer/helpers/index.ts similarity index 100% rename from packages/workflows/src/utils/composer/helpers/index.ts rename to packages/workflows-sdk/src/utils/composer/helpers/index.ts diff --git a/packages/workflows/src/utils/composer/helpers/proxy.ts b/packages/workflows-sdk/src/utils/composer/helpers/proxy.ts similarity index 100% rename from packages/workflows/src/utils/composer/helpers/proxy.ts rename to packages/workflows-sdk/src/utils/composer/helpers/proxy.ts diff --git a/packages/workflows/src/utils/composer/helpers/resolve-value.ts b/packages/workflows-sdk/src/utils/composer/helpers/resolve-value.ts similarity index 100% rename from packages/workflows/src/utils/composer/helpers/resolve-value.ts rename to packages/workflows-sdk/src/utils/composer/helpers/resolve-value.ts diff --git a/packages/workflows/src/utils/composer/helpers/step-response.ts b/packages/workflows-sdk/src/utils/composer/helpers/step-response.ts similarity index 100% rename from packages/workflows/src/utils/composer/helpers/step-response.ts rename to packages/workflows-sdk/src/utils/composer/helpers/step-response.ts diff --git a/packages/workflows/src/utils/composer/helpers/symbol.ts b/packages/workflows-sdk/src/utils/composer/helpers/symbol.ts similarity index 100% rename from packages/workflows/src/utils/composer/helpers/symbol.ts rename to packages/workflows-sdk/src/utils/composer/helpers/symbol.ts diff --git a/packages/workflows/src/utils/composer/hook.ts b/packages/workflows-sdk/src/utils/composer/hook.ts similarity index 99% rename from packages/workflows/src/utils/composer/hook.ts rename to packages/workflows-sdk/src/utils/composer/hook.ts index 8fa91c8028a8c..8902d2011a6cb 100644 --- a/packages/workflows/src/utils/composer/hook.ts +++ b/packages/workflows-sdk/src/utils/composer/hook.ts @@ -28,7 +28,7 @@ import { * StepExecutionContext, * hook, * transform - * } from "@medusajs/workflows" + * } from "@medusajs/workflows-sdk" * import { * createProductStep, * getProductStep, diff --git a/packages/workflows/src/utils/composer/index.ts b/packages/workflows-sdk/src/utils/composer/index.ts similarity index 100% rename from packages/workflows/src/utils/composer/index.ts rename to packages/workflows-sdk/src/utils/composer/index.ts diff --git a/packages/workflows/src/utils/composer/parallelize.ts b/packages/workflows-sdk/src/utils/composer/parallelize.ts similarity index 98% rename from packages/workflows/src/utils/composer/parallelize.ts rename to packages/workflows-sdk/src/utils/composer/parallelize.ts index fdc8ed50b399a..dc864e0f1b170 100644 --- a/packages/workflows/src/utils/composer/parallelize.ts +++ b/packages/workflows-sdk/src/utils/composer/parallelize.ts @@ -13,7 +13,7 @@ import { SymbolMedusaWorkflowComposerContext } from "./helpers" * import { * createWorkflow, * parallelize - * } from "@medusajs/workflows" + * } from "@medusajs/workflows-sdk" * import { * createProductStep, * getProductStep, diff --git a/packages/workflows/src/utils/composer/transform.ts b/packages/workflows-sdk/src/utils/composer/transform.ts similarity index 99% rename from packages/workflows/src/utils/composer/transform.ts rename to packages/workflows-sdk/src/utils/composer/transform.ts index 03a97d3c6ab68..98f5d076cb734 100644 --- a/packages/workflows/src/utils/composer/transform.ts +++ b/packages/workflows-sdk/src/utils/composer/transform.ts @@ -30,7 +30,7 @@ type Func = (input: T, context: StepExecutionContext) => U | Promise * import { * createWorkflow, * transform - * } from "@medusajs/workflows" + * } from "@medusajs/workflows-sdk" * import { step1, step2 } from "./steps" * * type WorkflowInput = { diff --git a/packages/workflows/src/utils/composer/type.ts b/packages/workflows-sdk/src/utils/composer/type.ts similarity index 100% rename from packages/workflows/src/utils/composer/type.ts rename to packages/workflows-sdk/src/utils/composer/type.ts diff --git a/packages/workflows-sdk/tsconfig.json b/packages/workflows-sdk/tsconfig.json new file mode 100644 index 0000000000000..d27e01678bb73 --- /dev/null +++ b/packages/workflows-sdk/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "lib": ["es2020"], + "target": "es2020", + "outDir": "./dist", + "esModuleInterop": true, + "declaration": true, + "module": "commonjs", + "moduleResolution": "node", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "sourceMap": true, + "noImplicitReturns": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "noImplicitThis": true, + "allowJs": true, + "skipLibCheck": true, + "downlevelIteration": true + }, + "include": ["src"], + "exclude": [ + "dist", + "./src/**/__tests__", + "./src/**/__mocks__", + "./src/**/__fixtures__", + "node_modules" + ] +} diff --git a/packages/workflows-sdk/tsconfig.spec.json b/packages/workflows-sdk/tsconfig.spec.json new file mode 100644 index 0000000000000..b800dda7ee62d --- /dev/null +++ b/packages/workflows-sdk/tsconfig.spec.json @@ -0,0 +1,5 @@ +{ + "extends": "./tsconfig.json", + "include": ["src"], + "exclude": ["node_modules", "dist"] +} diff --git a/packages/workflows/CHANGELOG.md b/packages/workflows/CHANGELOG.md deleted file mode 100644 index f9771a3e5a94f..0000000000000 --- a/packages/workflows/CHANGELOG.md +++ /dev/null @@ -1,111 +0,0 @@ -# @medusajs/workflows - -## 0.3.0 - -### Minor Changes - -- [#5603](https://github.com/medusajs/medusa/pull/5603) [`cedab5833`](https://github.com/medusajs/medusa/commit/cedab583395275444001f0268e4b9ccab9b2b262) Thanks [@riqwan](https://github.com/riqwan)! - feat(workflows,medusa,utils): add medusa v2 feature flag - -### Patch Changes - -- Updated dependencies [[`cedab5833`](https://github.com/medusajs/medusa/commit/cedab583395275444001f0268e4b9ccab9b2b262)]: - - @medusajs/utils@1.11.0 - -## 0.2.5 - -### Patch Changes - -- [`c39bf69a5`](https://github.com/medusajs/medusa/commit/c39bf69a5e5cae75d7fa12aa6022b10903557a32) Thanks [@olivermrbl](https://github.com/olivermrbl)! - chore: Add missing version bumps - -- Updated dependencies [[`c39bf69a5`](https://github.com/medusajs/medusa/commit/c39bf69a5e5cae75d7fa12aa6022b10903557a32), [`154c9b43b`](https://github.com/medusajs/medusa/commit/154c9b43bde1fdff562aba9da8a79af2660b29b3)]: - - @medusajs/modules-sdk@1.12.3 - - @medusajs/orchestration@0.4.4 - - @medusajs/utils@1.10.5 - -## 0.2.4 - -### Patch Changes - -- [#5301](https://github.com/medusajs/medusa/pull/5301) [`66413d094`](https://github.com/medusajs/medusa/commit/66413d094e916debbdb74b68800c96ca2c9302c9) Thanks [@srindom](https://github.com/srindom)! - fix: move create inventory workflow to @medusajs/workflows - -- Updated dependencies [[`378ca1b36`](https://github.com/medusajs/medusa/commit/378ca1b36e909a67e39c69ea5ca94ec58a345878), [`b62af612c`](https://github.com/medusajs/medusa/commit/b62af612c7baa244075e546c949b89c4589bd2cf), [`e47461d95`](https://github.com/medusajs/medusa/commit/e47461d95caecf3a447ee9fa0b0950340b93f282), [`66413d094`](https://github.com/medusajs/medusa/commit/66413d094e916debbdb74b68800c96ca2c9302c9)]: - - @medusajs/utils@1.10.4 - - @medusajs/modules-sdk@1.12.1 - - @medusajs/orchestration@0.4.2 - -## 0.2.3 - -### Patch Changes - -- [#5081](https://github.com/medusajs/medusa/pull/5081) [`202049f8a`](https://github.com/medusajs/medusa/commit/202049f8aa3682df7e545b1c42ab0bdab1c52639) Thanks [@adrien2p](https://github.com/adrien2p)! - fix(medusa, workflows): Create product workflow with Isolated modules + module registration - -- Updated dependencies [[`cc4169a94`](https://github.com/medusajs/medusa/commit/cc4169a94c7c5f5bf4d04f7b6e815b409a0a8192), [`30233712c`](https://github.com/medusajs/medusa/commit/30233712cb93b38de50c266a9841cea413949611), [`dfa5d041c`](https://github.com/medusajs/medusa/commit/dfa5d041c90b849b288f8ae9f5a0a1aa3ee1b32e), [`1e7db5a5c`](https://github.com/medusajs/medusa/commit/1e7db5a5cb7c955e72c52e64df8a16b1607eef70)]: - - @medusajs/utils@1.10.2 - - @medusajs/orchestration@0.4.1 - - @medusajs/modules-sdk@1.11.3 - -## 0.2.2 - -### Patch Changes - -- Updated dependencies [[`d8649baca`](https://github.com/medusajs/medusa/commit/d8649bacaa2ed784b9e7b2b0e1f1194d3697bb92), [`4fa675ec2`](https://github.com/medusajs/medusa/commit/4fa675ec25b3d6fccd881c4f5a5b91f0e9e13e82), [`6273b4b16`](https://github.com/medusajs/medusa/commit/6273b4b160493463e1199e5db4e9cfa4cff6fbe4), [`30863fee5`](https://github.com/medusajs/medusa/commit/30863fee529ed035f161c749fda3cd64fa48efb1), [`3d68be2b6`](https://github.com/medusajs/medusa/commit/3d68be2b6b93ae928f5c955e102ebdf2c34fb364), [`107aaa371`](https://github.com/medusajs/medusa/commit/107aaa371c444843874d125bf8bd493ef89f5756)]: - - @medusajs/orchestration@0.4.0 - - @medusajs/modules-sdk@1.11.0 - - @medusajs/utils@1.10.1 - -## 0.2.1 - -### Patch Changes - -- Updated dependencies [[`c3dba0694`](https://github.com/medusajs/medusa/commit/c3dba069488952945150117a30b1306a2e0bb3ce), [`460161a69`](https://github.com/medusajs/medusa/commit/460161a69f22cf6d561952e92e7d9b56912113e6), [`fcb6b4f51`](https://github.com/medusajs/medusa/commit/fcb6b4f510dba2757570625acb5da9476b7544fd), [`4d16acf5f`](https://github.com/medusajs/medusa/commit/4d16acf5f096b5656b645f510f9c971e7c2dc9ef), [`4d16acf5f`](https://github.com/medusajs/medusa/commit/4d16acf5f096b5656b645f510f9c971e7c2dc9ef), [`87bade096`](https://github.com/medusajs/medusa/commit/87bade096e3d536f29ddc57dbc4c04e5d7a46e4b), [`4d16acf5f`](https://github.com/medusajs/medusa/commit/4d16acf5f096b5656b645f510f9c971e7c2dc9ef), [`a4906d0ac`](https://github.com/medusajs/medusa/commit/a4906d0ac0af36b1382d3befe64281b404387bd7)]: - - @medusajs/modules-sdk@1.10.0 - - @medusajs/orchestration@0.3.0 - - @medusajs/utils@1.10.0 - -## 0.2.0 - -### Minor Changes - -- [#4697](https://github.com/medusajs/medusa/pull/4697) [`c0ca00290`](https://github.com/medusajs/medusa/commit/c0ca00290106fbdc8e15077bc8d1c3eafbef59f2) Thanks [@carlos-r-l-rodrigues](https://github.com/carlos-r-l-rodrigues)! - Add pipe onComplete callback and preparation function to exportsWorkflow - -### Patch Changes - -- [#4703](https://github.com/medusajs/medusa/pull/4703) [`8ae31aff4`](https://github.com/medusajs/medusa/commit/8ae31aff4b23c980a2ecc8300a75798c263f0298) Thanks [@adrien2p](https://github.com/adrien2p)! - feat(workflows): list product should be reusable in different context - -- [#4716](https://github.com/medusajs/medusa/pull/4716) [`ac866ebb5`](https://github.com/medusajs/medusa/commit/ac866ebb5197ee694dda91824b501109012a3dd1) Thanks [@adrien2p](https://github.com/adrien2p)! - test(): Test the create product workflow compensation - fix(orchestration): Fix the transaction state after compensating with no compensation steps in the middle - chore(workflows): Export and naming - feat(types): Update product workflow input types - feat(medusa): Update product workflow usage and cleanup endpoint - -- [#4685](https://github.com/medusajs/medusa/pull/4685) [`281b0746c`](https://github.com/medusajs/medusa/commit/281b0746cfbe80b83c6a67d1ea120b47a0ea7121) Thanks [@riqwan](https://github.com/riqwan)! - feat(medusa,workflows,types) Create cart workflow - -- Updated dependencies [[`ac866ebb5`](https://github.com/medusajs/medusa/commit/ac866ebb5197ee694dda91824b501109012a3dd1), [`3f3a84262`](https://github.com/medusajs/medusa/commit/3f3a84262ce9cbd911923278a54e301fbe9a4634), [`30ce35b16`](https://github.com/medusajs/medusa/commit/30ce35b163afa25f4e1d8d1bd392f401a3b413df), [`c0ca00290`](https://github.com/medusajs/medusa/commit/c0ca00290106fbdc8e15077bc8d1c3eafbef59f2)]: - - @medusajs/orchestration@0.2.0 - - @medusajs/modules-sdk@1.9.2 - - @medusajs/utils@1.9.6 - -## 0.1.1 - -### Patch Changes - -- [#4673](https://github.com/medusajs/medusa/pull/4673) [`e78c47b66`](https://github.com/medusajs/medusa/commit/e78c47b66fe99f5d242ca119dea580804a31768c) Thanks [@adrien2p](https://github.com/adrien2p)! - Feat/workflow confusion elimination - -- [#4689](https://github.com/medusajs/medusa/pull/4689) [`43f34866c`](https://github.com/medusajs/medusa/commit/43f34866c817da43ca2b865fd58e5fc8c3dc891b) Thanks [@adrien2p](https://github.com/adrien2p)! - feat(workflows): Improve typings - -- Updated dependencies [[`4b80ba8a3`](https://github.com/medusajs/medusa/commit/4b80ba8a356806da3c92634e40e8946da25e35ee), [`8af55aed8`](https://github.com/medusajs/medusa/commit/8af55aed87da7252c7c261175bc98331466a0da8), [`5c60aad17`](https://github.com/medusajs/medusa/commit/5c60aad177a99574ffff5ebdc02ce9dc86ef9af9), [`4073b7313`](https://github.com/medusajs/medusa/commit/4073b73130c874dc7d2240726224a01b7b19b1a1)]: - - @medusajs/modules-sdk@1.9.1 - - @medusajs/utils@1.9.5 - -## 0.1.0 - -### Minor Changes - -- [#4553](https://github.com/medusajs/medusa/pull/4553) [`f12299deb`](https://github.com/medusajs/medusa/commit/f12299deb10baadab1505cd4ac353dd5d1c8fa7c) Thanks [@carlos-r-l-rodrigues](https://github.com/carlos-r-l-rodrigues)! - Medusa workflows package - -### Patch Changes - -- Updated dependencies [[`131477faf`](https://github.com/medusajs/medusa/commit/131477faf0409c49d4aacf26ea591e33b2fa22fd), [`379c83933`](https://github.com/medusajs/medusa/commit/379c83933ed12a4ec712e7f3c9b0252e4a4601dd), [`f174bb6fa`](https://github.com/medusajs/medusa/commit/f174bb6fa1b105b39065478a67b6be0b968f707a), [`f12299deb`](https://github.com/medusajs/medusa/commit/f12299deb10baadab1505cd4ac353dd5d1c8fa7c)]: - - @medusajs/utils@1.9.3 - - @medusajs/modules-sdk@1.9.0 - - @medusajs/orchestration@0.1.0 diff --git a/yarn.lock b/yarn.lock index c6b2d9364423c..c9d3e69731215 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7449,6 +7449,25 @@ __metadata: languageName: unknown linkType: soft +"@medusajs/core-flows@^0.0.1, @medusajs/core-flows@workspace:packages/core-flows": + version: 0.0.0-use.local + resolution: "@medusajs/core-flows@workspace:packages/core-flows" + dependencies: + "@medusajs/modules-sdk": ^1.12.3 + "@medusajs/orchestration": ^0.4.4 + "@medusajs/types": ^1.11.7 + "@medusajs/utils": ^1.11.0 + "@medusajs/workflows-sdk": ^0.1.0 + awilix: ^8.0.1 + cross-env: ^5.2.1 + jest: ^29.6.3 + rimraf: ^5.0.1 + ts-jest: ^29.1.1 + typescript: ^5.1.6 + ulid: ^2.3.0 + languageName: unknown + linkType: soft + "@medusajs/event-bus-local@workspace:*, @medusajs/event-bus-local@workspace:packages/event-bus-local": version: 0.0.0-use.local resolution: "@medusajs/event-bus-local@workspace:packages/event-bus-local" @@ -7666,13 +7685,14 @@ __metadata: version: 0.0.0-use.local resolution: "@medusajs/medusa@workspace:packages/medusa" 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/types": ^1.11.7 "@medusajs/utils": ^1.11.0 - "@medusajs/workflows": ^0.3.0 + "@medusajs/workflows-sdk": ^0.1.0 "@types/express": ^4.17.17 "@types/ioredis": ^4.28.10 "@types/jsonwebtoken": ^8.5.9 @@ -8051,9 +8071,9 @@ __metadata: languageName: unknown linkType: soft -"@medusajs/workflows@^0.3.0, @medusajs/workflows@workspace:packages/workflows": +"@medusajs/workflows-sdk@^0.1.0, @medusajs/workflows-sdk@workspace:packages/workflows-sdk": version: 0.0.0-use.local - resolution: "@medusajs/workflows@workspace:packages/workflows" + resolution: "@medusajs/workflows-sdk@workspace:packages/workflows-sdk" dependencies: "@medusajs/modules-sdk": ^1.12.3 "@medusajs/orchestration": ^0.4.4