diff --git a/integration-tests/api/medusa-config.js b/integration-tests/api/medusa-config.js index 1de336b775..738f8534a7 100644 --- a/integration-tests/api/medusa-config.js +++ b/integration-tests/api/medusa-config.js @@ -1,4 +1,4 @@ -const { Modules } = require("@medusajs/modules-sdk") +const { Modules } = require("@medusajs/utils") const DB_HOST = process.env.DB_HOST const DB_USERNAME = process.env.DB_USERNAME diff --git a/integration-tests/modules/__tests__/cart/store/add-promotions-to-cart.spec.ts b/integration-tests/modules/__tests__/cart/store/add-promotions-to-cart.spec.ts index 596e79e188..687c051baf 100644 --- a/integration-tests/modules/__tests__/cart/store/add-promotions-to-cart.spec.ts +++ b/integration-tests/modules/__tests__/cart/store/add-promotions-to-cart.spec.ts @@ -1,11 +1,10 @@ import { LinkModuleUtils, ModuleRegistrationName, - Modules, RemoteLink, } from "@medusajs/modules-sdk" import { ICartModuleService, IPromotionModuleService } from "@medusajs/types" -import { PromotionType } from "@medusajs/utils" +import { Modules, PromotionType } from "@medusajs/utils" import { medusaIntegrationTestRunner } from "medusa-test-utils" import { adminHeaders, diff --git a/integration-tests/modules/__tests__/cart/store/cart.workflows.spec.ts b/integration-tests/modules/__tests__/cart/store/cart.workflows.spec.ts index 7fe2072619..1c1bcbd8d2 100644 --- a/integration-tests/modules/__tests__/cart/store/cart.workflows.spec.ts +++ b/integration-tests/modules/__tests__/cart/store/cart.workflows.spec.ts @@ -13,7 +13,7 @@ import { updateLineItemsStepId, updatePaymentCollectionStepId, } from "@medusajs/core-flows" -import { ModuleRegistrationName, Modules } from "@medusajs/modules-sdk" +import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { ICartModuleService, ICustomerModuleService, @@ -26,7 +26,11 @@ import { ISalesChannelModuleService, IStockLocationService, } from "@medusajs/types" -import { ContainerRegistrationKeys, RuleOperator } from "@medusajs/utils" +import { + ContainerRegistrationKeys, + Modules, + RuleOperator, +} from "@medusajs/utils" import { medusaIntegrationTestRunner } from "medusa-test-utils" import { adminHeaders, diff --git a/integration-tests/modules/__tests__/cart/store/carts.spec.ts b/integration-tests/modules/__tests__/cart/store/carts.spec.ts index 3255933687..133a72a8c8 100644 --- a/integration-tests/modules/__tests__/cart/store/carts.spec.ts +++ b/integration-tests/modules/__tests__/cart/store/carts.spec.ts @@ -1,7 +1,6 @@ import { LinkModuleUtils, ModuleRegistrationName, - Modules, RemoteLink, } from "@medusajs/modules-sdk" import PaymentModuleService from "@medusajs/payment/dist/services/payment-module" @@ -22,6 +21,7 @@ import { import { ContainerRegistrationKeys, MedusaError, + Modules, ProductStatus, PromotionRuleOperator, PromotionType, diff --git a/integration-tests/modules/__tests__/cart/store/remove-promotions-from-cart.spec.ts b/integration-tests/modules/__tests__/cart/store/remove-promotions-from-cart.spec.ts index 3a5805d377..fdd25397f2 100644 --- a/integration-tests/modules/__tests__/cart/store/remove-promotions-from-cart.spec.ts +++ b/integration-tests/modules/__tests__/cart/store/remove-promotions-from-cart.spec.ts @@ -1,11 +1,10 @@ import { LinkModuleUtils, ModuleRegistrationName, - Modules, RemoteLink, } from "@medusajs/modules-sdk" import { ICartModuleService, IPromotionModuleService } from "@medusajs/types" -import { PromotionType } from "@medusajs/utils" +import { Modules, PromotionType } from "@medusajs/utils" import { medusaIntegrationTestRunner } from "medusa-test-utils" import { adminHeaders, diff --git a/integration-tests/modules/__tests__/link-modules/cart-links.spec.ts b/integration-tests/modules/__tests__/link-modules/cart-links.spec.ts index b32b1ba694..79399e9e95 100644 --- a/integration-tests/modules/__tests__/link-modules/cart-links.spec.ts +++ b/integration-tests/modules/__tests__/link-modules/cart-links.spec.ts @@ -1,4 +1,4 @@ -import { ModuleRegistrationName, Modules } from "@medusajs/modules-sdk" +import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { ICartModuleService, ICustomerModuleService, @@ -7,6 +7,7 @@ import { ISalesChannelModuleService, } from "@medusajs/types" import { medusaIntegrationTestRunner } from "medusa-test-utils" +import { Modules } from "@medusajs/utils" jest.setTimeout(50000) diff --git a/integration-tests/modules/__tests__/link-modules/fulfillment-set-location.spec.ts b/integration-tests/modules/__tests__/link-modules/fulfillment-set-location.spec.ts index 07569f7aea..ddf3b21d5d 100644 --- a/integration-tests/modules/__tests__/link-modules/fulfillment-set-location.spec.ts +++ b/integration-tests/modules/__tests__/link-modules/fulfillment-set-location.spec.ts @@ -1,10 +1,11 @@ -import { ModuleRegistrationName, Modules } from "@medusajs/modules-sdk" +import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { IFulfillmentModuleService, IStockLocationService, } from "@medusajs/types" import { ContainerRegistrationKeys, + Modules, remoteQueryObjectFromString, } from "@medusajs/utils" import { medusaIntegrationTestRunner } from "medusa-test-utils" diff --git a/integration-tests/modules/__tests__/link-modules/product-variant-price-set.spec.ts b/integration-tests/modules/__tests__/link-modules/product-variant-price-set.spec.ts index 327931d24a..31fbd8dfcc 100644 --- a/integration-tests/modules/__tests__/link-modules/product-variant-price-set.spec.ts +++ b/integration-tests/modules/__tests__/link-modules/product-variant-price-set.spec.ts @@ -1,7 +1,8 @@ -import { ModuleRegistrationName, Modules } from "@medusajs/modules-sdk" +import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { IPricingModuleService, IProductModuleService } from "@medusajs/types" import { ContainerRegistrationKeys, + Modules, remoteQueryObjectFromString, } from "@medusajs/utils" import { medusaIntegrationTestRunner } from "medusa-test-utils" diff --git a/integration-tests/modules/__tests__/link-modules/publishable-key-sales-channel.spec.ts b/integration-tests/modules/__tests__/link-modules/publishable-key-sales-channel.spec.ts index 1552d57c64..c776c818d7 100644 --- a/integration-tests/modules/__tests__/link-modules/publishable-key-sales-channel.spec.ts +++ b/integration-tests/modules/__tests__/link-modules/publishable-key-sales-channel.spec.ts @@ -1,9 +1,9 @@ -import { ModuleRegistrationName, Modules } from "@medusajs/modules-sdk" +import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { IApiKeyModuleService, ISalesChannelModuleService, } from "@medusajs/types" -import { remoteQueryObjectFromString } from "@medusajs/utils" +import { Modules, remoteQueryObjectFromString } from "@medusajs/utils" import { medusaIntegrationTestRunner } from "medusa-test-utils" jest.setTimeout(50000) diff --git a/integration-tests/modules/__tests__/link-modules/region-payment-provider.spec.ts b/integration-tests/modules/__tests__/link-modules/region-payment-provider.spec.ts index 6ded4d5f6a..070fa8583f 100644 --- a/integration-tests/modules/__tests__/link-modules/region-payment-provider.spec.ts +++ b/integration-tests/modules/__tests__/link-modules/region-payment-provider.spec.ts @@ -1,7 +1,7 @@ -import { ModuleRegistrationName, Modules } from "@medusajs/modules-sdk" +import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { IRegionModuleService } from "@medusajs/types" import { medusaIntegrationTestRunner } from "medusa-test-utils" -import { ContainerRegistrationKeys } from "@medusajs/utils" +import { ContainerRegistrationKeys, Modules } from "@medusajs/utils" jest.setTimeout(50000) diff --git a/integration-tests/modules/__tests__/link-modules/sales-channel-location.spec.ts b/integration-tests/modules/__tests__/link-modules/sales-channel-location.spec.ts index 4d6f16b71b..5055390fef 100644 --- a/integration-tests/modules/__tests__/link-modules/sales-channel-location.spec.ts +++ b/integration-tests/modules/__tests__/link-modules/sales-channel-location.spec.ts @@ -1,9 +1,9 @@ -import { ModuleRegistrationName, Modules } from "@medusajs/modules-sdk" +import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { ISalesChannelModuleService, IStockLocationService, } from "@medusajs/types" -import { remoteQueryObjectFromString } from "@medusajs/utils" +import { Modules, remoteQueryObjectFromString } from "@medusajs/utils" import { medusaIntegrationTestRunner } from "medusa-test-utils" jest.setTimeout(50000) diff --git a/integration-tests/modules/__tests__/link-modules/shipping-option-price-set.spec.ts b/integration-tests/modules/__tests__/link-modules/shipping-option-price-set.spec.ts index a08aab4876..29b93afed9 100644 --- a/integration-tests/modules/__tests__/link-modules/shipping-option-price-set.spec.ts +++ b/integration-tests/modules/__tests__/link-modules/shipping-option-price-set.spec.ts @@ -1,9 +1,9 @@ -import { ModuleRegistrationName, Modules } from "@medusajs/modules-sdk" +import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { IFulfillmentModuleService, IPricingModuleService, } from "@medusajs/types" -import { ContainerRegistrationKeys } from "@medusajs/utils" +import { ContainerRegistrationKeys, Modules } from "@medusajs/utils" import { medusaIntegrationTestRunner } from "medusa-test-utils" jest.setTimeout(50000) diff --git a/integration-tests/modules/__tests__/modules/load-standalone.ts b/integration-tests/modules/__tests__/modules/load-standalone.ts index dfaf8525bc..19ff640689 100644 --- a/integration-tests/modules/__tests__/modules/load-standalone.ts +++ b/integration-tests/modules/__tests__/modules/load-standalone.ts @@ -1,6 +1,7 @@ import { medusaIntegrationTestRunner } from "medusa-test-utils" -import { MedusaApp, Modules } from "@medusajs/modules-sdk" +import { MedusaApp } from "@medusajs/modules-sdk" import { IProductModuleService } from "@medusajs/types" +import { Modules } from "@medusajs/utils" jest.setTimeout(30000) diff --git a/integration-tests/modules/__tests__/modules/remote-query.spec.ts b/integration-tests/modules/__tests__/modules/remote-query.spec.ts index b870d43b4d..ac8a102c9f 100644 --- a/integration-tests/modules/__tests__/modules/remote-query.spec.ts +++ b/integration-tests/modules/__tests__/modules/remote-query.spec.ts @@ -1,6 +1,6 @@ -import { ModuleRegistrationName, Modules } from "@medusajs/modules-sdk" +import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { IRegionModuleService } from "@medusajs/types" -import { ContainerRegistrationKeys } from "@medusajs/utils" +import { ContainerRegistrationKeys, Modules } from "@medusajs/utils" import { medusaIntegrationTestRunner } from "medusa-test-utils" import { createAdminUser } from "../../..//helpers/create-admin-user" import { adminHeaders } from "../../../helpers/create-admin-user" diff --git a/integration-tests/modules/__tests__/order/draft-order.spec.ts b/integration-tests/modules/__tests__/order/draft-order.spec.ts index c0120ab3f9..d100da8f4a 100644 --- a/integration-tests/modules/__tests__/order/draft-order.spec.ts +++ b/integration-tests/modules/__tests__/order/draft-order.spec.ts @@ -1,4 +1,4 @@ -import { ModuleRegistrationName, Modules } from "@medusajs/modules-sdk" +import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { ICartModuleService, IFulfillmentModuleService, @@ -10,7 +10,7 @@ import { IStockLocationServiceNext, ITaxModuleService, } from "@medusajs/types" -import { ContainerRegistrationKeys } from "@medusajs/utils" +import { ContainerRegistrationKeys, Modules } from "@medusajs/utils" import { medusaIntegrationTestRunner } from "medusa-test-utils" import { adminHeaders, diff --git a/integration-tests/modules/__tests__/order/workflows/cancel-order.spec.ts b/integration-tests/modules/__tests__/order/workflows/cancel-order.spec.ts index 55b2f0d7d2..24822cf0a7 100644 --- a/integration-tests/modules/__tests__/order/workflows/cancel-order.spec.ts +++ b/integration-tests/modules/__tests__/order/workflows/cancel-order.spec.ts @@ -4,7 +4,7 @@ import { createOrderFulfillmentWorkflow, createShippingOptionsWorkflow, } from "@medusajs/core-flows" -import { ModuleRegistrationName, Modules } from "@medusajs/modules-sdk" +import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { FulfillmentWorkflow, IOrderModuleService, @@ -18,6 +18,7 @@ import { } from "@medusajs/types" import { ContainerRegistrationKeys, + Modules, remoteQueryObjectFromString, } from "@medusajs/utils" import { medusaIntegrationTestRunner } from "medusa-test-utils/dist" diff --git a/integration-tests/modules/__tests__/order/workflows/create-fulfillment.spec.ts b/integration-tests/modules/__tests__/order/workflows/create-fulfillment.spec.ts index 600d1bda35..bc8e13d7d0 100644 --- a/integration-tests/modules/__tests__/order/workflows/create-fulfillment.spec.ts +++ b/integration-tests/modules/__tests__/order/workflows/create-fulfillment.spec.ts @@ -3,7 +3,7 @@ import { createOrderFulfillmentWorkflow, createShippingOptionsWorkflow, } from "@medusajs/core-flows" -import { ModuleRegistrationName, Modules } from "@medusajs/modules-sdk" +import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { FulfillmentWorkflow, IOrderModuleService, @@ -17,6 +17,7 @@ import { } from "@medusajs/types" import { ContainerRegistrationKeys, + Modules, remoteQueryObjectFromString, } from "@medusajs/utils" import { medusaIntegrationTestRunner } from "medusa-test-utils/dist" diff --git a/integration-tests/modules/__tests__/order/workflows/create-return.spec.ts b/integration-tests/modules/__tests__/order/workflows/create-return.spec.ts index 45bf0ca3e2..b851a4b2b3 100644 --- a/integration-tests/modules/__tests__/order/workflows/create-return.spec.ts +++ b/integration-tests/modules/__tests__/order/workflows/create-return.spec.ts @@ -2,11 +2,7 @@ import { createReturnOrderWorkflow, createShippingOptionsWorkflow, } from "@medusajs/core-flows" -import { - ModuleRegistrationName, - Modules, - RemoteLink, -} from "@medusajs/modules-sdk" +import { ModuleRegistrationName, RemoteLink } from "@medusajs/modules-sdk" import { FulfillmentSetDTO, FulfillmentWorkflow, @@ -21,6 +17,7 @@ import { } from "@medusajs/types" import { ContainerRegistrationKeys, + Modules, remoteQueryObjectFromString, RuleOperator, } from "@medusajs/utils" diff --git a/integration-tests/modules/__tests__/order/workflows/create-shipment.spec.ts b/integration-tests/modules/__tests__/order/workflows/create-shipment.spec.ts index eb6651f878..200d784073 100644 --- a/integration-tests/modules/__tests__/order/workflows/create-shipment.spec.ts +++ b/integration-tests/modules/__tests__/order/workflows/create-shipment.spec.ts @@ -3,7 +3,7 @@ import { createOrderShipmentWorkflow, createShippingOptionsWorkflow, } from "@medusajs/core-flows" -import { ModuleRegistrationName, Modules } from "@medusajs/modules-sdk" +import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { FulfillmentWorkflow, IOrderModuleService, @@ -17,6 +17,7 @@ import { } from "@medusajs/types" import { ContainerRegistrationKeys, + Modules, remoteQueryObjectFromString, RuleOperator, } from "@medusajs/utils" diff --git a/integration-tests/modules/__tests__/payment/payments.spec.ts b/integration-tests/modules/__tests__/payment/payments.spec.ts index c92248ca3a..1a33f6aa2e 100644 --- a/integration-tests/modules/__tests__/payment/payments.spec.ts +++ b/integration-tests/modules/__tests__/payment/payments.spec.ts @@ -2,13 +2,10 @@ import { capturePaymentWorkflow, refundPaymentWorkflow, } from "@medusajs/core-flows" -import { - LinkModuleUtils, - ModuleRegistrationName, - Modules, -} from "@medusajs/modules-sdk" +import { LinkModuleUtils, ModuleRegistrationName } from "@medusajs/modules-sdk" import { IPaymentModuleService, IRegionModuleService } from "@medusajs/types" import { medusaIntegrationTestRunner } from "medusa-test-utils/dist" +import { Modules } from "@medusajs/utils" jest.setTimeout(50000) diff --git a/integration-tests/modules/__tests__/shipping-options/store/shipping-options.spec.ts b/integration-tests/modules/__tests__/shipping-options/store/shipping-options.spec.ts index d16c89548d..7244f3b165 100644 --- a/integration-tests/modules/__tests__/shipping-options/store/shipping-options.spec.ts +++ b/integration-tests/modules/__tests__/shipping-options/store/shipping-options.spec.ts @@ -1,9 +1,9 @@ -import { ModuleRegistrationName, Modules } from "@medusajs/modules-sdk" +import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { IFulfillmentModuleService, IRegionModuleService, } from "@medusajs/types" -import { ContainerRegistrationKeys } from "@medusajs/utils" +import { ContainerRegistrationKeys, Modules } from "@medusajs/utils" import { medusaIntegrationTestRunner } from "medusa-test-utils" import { createAdminUser } from "../../../../helpers/create-admin-user" diff --git a/integration-tests/modules/helpers/create-authenticated-customer.ts b/integration-tests/modules/helpers/create-authenticated-customer.ts index d092ad9ed7..5a6552013d 100644 --- a/integration-tests/modules/helpers/create-authenticated-customer.ts +++ b/integration-tests/modules/helpers/create-authenticated-customer.ts @@ -1,6 +1,6 @@ import { CreateCustomerDTO, MedusaContainer } from "@medusajs/types" -import { ModuleRegistrationName, Modules } from "@medusajs/modules-sdk" +import { ModuleRegistrationName } from "@medusajs/modules-sdk" import jwt from "jsonwebtoken" export const createAuthenticatedCustomer = async ( diff --git a/integration-tests/modules/helpers/create-variant-price-set.ts b/integration-tests/modules/helpers/create-variant-price-set.ts index 9eb13f6ec2..d78e896b32 100644 --- a/integration-tests/modules/helpers/create-variant-price-set.ts +++ b/integration-tests/modules/helpers/create-variant-price-set.ts @@ -1,9 +1,10 @@ -import { MedusaContainer, Modules } from "@medusajs/modules-sdk" +import { MedusaContainer } from "@medusajs/modules-sdk" import { CreatePriceSetDTO, IPricingModuleService, PriceSetDTO, } from "@medusajs/types" +import { Modules } from "@medusajs/utils" const defaultPrices = [ { diff --git a/integration-tests/modules/medusa-config.js b/integration-tests/modules/medusa-config.js index 36d0733ded..1227e1720b 100644 --- a/integration-tests/modules/medusa-config.js +++ b/integration-tests/modules/medusa-config.js @@ -1,4 +1,4 @@ -const { Modules } = require("@medusajs/modules-sdk") +const { Modules } = require("@medusajs/utils") const { FulfillmentModuleOptions } = require("@medusajs/fulfillment") const DB_HOST = process.env.DB_HOST const DB_USERNAME = process.env.DB_USERNAME diff --git a/packages/core/core-flows/src/api-key/steps/link-sales-channels-to-publishable-key.ts b/packages/core/core-flows/src/api-key/steps/link-sales-channels-to-publishable-key.ts index a11d2d774a..9e9151cc44 100644 --- a/packages/core/core-flows/src/api-key/steps/link-sales-channels-to-publishable-key.ts +++ b/packages/core/core-flows/src/api-key/steps/link-sales-channels-to-publishable-key.ts @@ -1,7 +1,6 @@ -import { Modules } from "@medusajs/modules-sdk" import { LinkWorkflowInput } from "@medusajs/types/src" -import { ContainerRegistrationKeys, promiseAll } from "@medusajs/utils" -import { StepResponse, createStep } from "@medusajs/workflows-sdk" +import { ContainerRegistrationKeys, Modules, promiseAll } from "@medusajs/utils" +import { createStep, StepResponse } from "@medusajs/workflows-sdk" export const linkSalesChannelsToApiKeyStepId = "link-sales-channels-to-api-key" export const linkSalesChannelsToApiKeyStep = createStep( diff --git a/packages/core/core-flows/src/api-key/workflows/delete-api-keys.ts b/packages/core/core-flows/src/api-key/workflows/delete-api-keys.ts index 1810445311..3e049c4913 100644 --- a/packages/core/core-flows/src/api-key/workflows/delete-api-keys.ts +++ b/packages/core/core-flows/src/api-key/workflows/delete-api-keys.ts @@ -1,7 +1,7 @@ -import { Modules } from "@medusajs/modules-sdk" -import { WorkflowData, createWorkflow } from "@medusajs/workflows-sdk" +import { createWorkflow, WorkflowData } from "@medusajs/workflows-sdk" import { removeRemoteLinkStep } from "../../common/steps/remove-remote-links" import { deleteApiKeysStep } from "../steps" +import { Modules } from "@medusajs/utils" type WorkflowInput = { ids: string[] } diff --git a/packages/core/core-flows/src/definition/cart/steps/link-cart-payment-collection.ts b/packages/core/core-flows/src/definition/cart/steps/link-cart-payment-collection.ts index 43cef3e67f..09130f214d 100644 --- a/packages/core/core-flows/src/definition/cart/steps/link-cart-payment-collection.ts +++ b/packages/core/core-flows/src/definition/cart/steps/link-cart-payment-collection.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" -import { ContainerRegistrationKeys } from "@medusajs/utils" -import { StepResponse, createStep } from "@medusajs/workflows-sdk" +import { ContainerRegistrationKeys, Modules } from "@medusajs/utils" +import { createStep, StepResponse } from "@medusajs/workflows-sdk" type StepInput = { links: { diff --git a/packages/core/core-flows/src/definition/cart/steps/retrieve-cart-with-links.ts b/packages/core/core-flows/src/definition/cart/steps/retrieve-cart-with-links.ts index 3a0453f029..3cf4748e75 100644 --- a/packages/core/core-flows/src/definition/cart/steps/retrieve-cart-with-links.ts +++ b/packages/core/core-flows/src/definition/cart/steps/retrieve-cart-with-links.ts @@ -1,7 +1,7 @@ -import { LinkModuleUtils, Modules } from "@medusajs/modules-sdk" +import { LinkModuleUtils } from "@medusajs/modules-sdk" import { CartWorkflowDTO } from "@medusajs/types" -import { isObject, remoteQueryObjectFromString } from "@medusajs/utils" -import { StepResponse, createStep } from "@medusajs/workflows-sdk" +import { isObject, Modules, remoteQueryObjectFromString } from "@medusajs/utils" +import { createStep, StepResponse } from "@medusajs/workflows-sdk" interface StepInput { cart_or_cart_id: string | CartWorkflowDTO diff --git a/packages/core/core-flows/src/definition/cart/steps/update-cart-promotions.ts b/packages/core/core-flows/src/definition/cart/steps/update-cart-promotions.ts index 9e21e5b407..d8a2de3327 100644 --- a/packages/core/core-flows/src/definition/cart/steps/update-cart-promotions.ts +++ b/packages/core/core-flows/src/definition/cart/steps/update-cart-promotions.ts @@ -1,11 +1,7 @@ -import { - LinkModuleUtils, - ModuleRegistrationName, - Modules, -} from "@medusajs/modules-sdk" +import { LinkModuleUtils, ModuleRegistrationName } from "@medusajs/modules-sdk" import { IPromotionModuleService } from "@medusajs/types" -import { PromotionActions } from "@medusajs/utils" -import { StepResponse, createStep } from "@medusajs/workflows-sdk" +import { Modules, PromotionActions } from "@medusajs/utils" +import { createStep, StepResponse } from "@medusajs/workflows-sdk" interface StepInput { id: string diff --git a/packages/core/core-flows/src/fulfillment/workflows/delete-fulfillment-sets.ts b/packages/core/core-flows/src/fulfillment/workflows/delete-fulfillment-sets.ts index e39f23cd8a..e6c6d39fbe 100644 --- a/packages/core/core-flows/src/fulfillment/workflows/delete-fulfillment-sets.ts +++ b/packages/core/core-flows/src/fulfillment/workflows/delete-fulfillment-sets.ts @@ -1,7 +1,7 @@ -import { WorkflowData, createWorkflow } from "@medusajs/workflows-sdk" +import { createWorkflow, WorkflowData } from "@medusajs/workflows-sdk" import { deleteFulfillmentSetsStep } from "../steps" import { removeRemoteLinkStep } from "../../common" -import { Modules } from "@medusajs/modules-sdk" +import { Modules } from "@medusajs/utils" export const deleteFulfillmentSetsWorkflowId = "delete-fulfillment-sets-workflow" diff --git a/packages/core/core-flows/src/inventory/steps/delete-levels-by-item-and-location.ts b/packages/core/core-flows/src/inventory/steps/delete-levels-by-item-and-location.ts index 685d863f40..ab22251994 100644 --- a/packages/core/core-flows/src/inventory/steps/delete-levels-by-item-and-location.ts +++ b/packages/core/core-flows/src/inventory/steps/delete-levels-by-item-and-location.ts @@ -1,9 +1,5 @@ -import { - DeleteEntityInput, - ModuleRegistrationName, - Modules, -} from "@medusajs/modules-sdk" -import { StepResponse, createStep } from "@medusajs/workflows-sdk" +import { ModuleRegistrationName } from "@medusajs/modules-sdk" +import { createStep, StepResponse } from "@medusajs/workflows-sdk" import { IInventoryService } from "@medusajs/types" import { MedusaError } from "@medusajs/utils" diff --git a/packages/core/core-flows/src/inventory/steps/validate-singular-inventory-items-for-tags.ts b/packages/core/core-flows/src/inventory/steps/validate-singular-inventory-items-for-tags.ts index 33224239a7..b6670e782e 100644 --- a/packages/core/core-flows/src/inventory/steps/validate-singular-inventory-items-for-tags.ts +++ b/packages/core/core-flows/src/inventory/steps/validate-singular-inventory-items-for-tags.ts @@ -1,6 +1,9 @@ -import { ContainerRegistrationKeys, MedusaError } from "@medusajs/utils" -import { StepResponse, createStep } from "@medusajs/workflows-sdk" -import { Modules } from "@medusajs/modules-sdk" +import { + ContainerRegistrationKeys, + MedusaError, + Modules, +} from "@medusajs/utils" +import { createStep, StepResponse } from "@medusajs/workflows-sdk" export const validateInventoryItemsForCreateStepId = "validate-inventory-items-for-create-step" diff --git a/packages/core/core-flows/src/inventory/workflows/delete-inventory-items.ts b/packages/core/core-flows/src/inventory/workflows/delete-inventory-items.ts index f89874ff97..11115a1f2f 100644 --- a/packages/core/core-flows/src/inventory/workflows/delete-inventory-items.ts +++ b/packages/core/core-flows/src/inventory/workflows/delete-inventory-items.ts @@ -1,8 +1,8 @@ -import { WorkflowData, createWorkflow } from "@medusajs/workflows-sdk" +import { createWorkflow, WorkflowData } from "@medusajs/workflows-sdk" -import { Modules } from "@medusajs/modules-sdk" import { deleteInventoryItemStep } from "../steps" import { removeRemoteLinkStep } from "../../common/steps/remove-remote-links" +import { Modules } from "@medusajs/utils" export const deleteInventoryItemWorkflowId = "delete-inventory-item-workflow" export const deleteInventoryItemWorkflow = createWorkflow( diff --git a/packages/core/core-flows/src/order/workflows/cancel-order-fulfillment.ts b/packages/core/core-flows/src/order/workflows/cancel-order-fulfillment.ts index a7e258ccdd..8178741166 100644 --- a/packages/core/core-flows/src/order/workflows/cancel-order-fulfillment.ts +++ b/packages/core/core-flows/src/order/workflows/cancel-order-fulfillment.ts @@ -1,12 +1,11 @@ -import { Modules } from "@medusajs/modules-sdk" import { FulfillmentDTO, OrderDTO, OrderWorkflow } from "@medusajs/types" -import { MedusaError } from "@medusajs/utils" +import { MedusaError, Modules } from "@medusajs/utils" import { - WorkflowData, createStep, createWorkflow, parallelize, transform, + WorkflowData, } from "@medusajs/workflows-sdk" import { useRemoteQueryStep } from "../../common" import { cancelFulfillmentWorkflow } from "../../fulfillment" diff --git a/packages/core/core-flows/src/order/workflows/create-fulfillment.ts b/packages/core/core-flows/src/order/workflows/create-fulfillment.ts index 488020827a..c5ce0d88fb 100644 --- a/packages/core/core-flows/src/order/workflows/create-fulfillment.ts +++ b/packages/core/core-flows/src/order/workflows/create-fulfillment.ts @@ -1,4 +1,3 @@ -import { Modules } from "@medusajs/modules-sdk" import { FulfillmentDTO, FulfillmentWorkflow, @@ -6,13 +5,13 @@ import { OrderWorkflow, ReservationItemDTO, } from "@medusajs/types" -import { MedusaError } from "@medusajs/utils" +import { MedusaError, Modules } from "@medusajs/utils" import { - WorkflowData, createStep, createWorkflow, parallelize, transform, + WorkflowData, } from "@medusajs/workflows-sdk" import { createRemoteLinkStep, useRemoteQueryStep } from "../../common" import { createFulfillmentWorkflow } from "../../fulfillment" diff --git a/packages/core/core-flows/src/order/workflows/create-return.ts b/packages/core/core-flows/src/order/workflows/create-return.ts index 7825b5a2d5..de9d91fab8 100644 --- a/packages/core/core-flows/src/order/workflows/create-return.ts +++ b/packages/core/core-flows/src/order/workflows/create-return.ts @@ -1,4 +1,3 @@ -import { Modules } from "@medusajs/modules-sdk" import { CreateOrderShippingMethodDTO, FulfillmentWorkflow, @@ -8,19 +7,20 @@ import { WithCalculatedPrice, } from "@medusajs/types" import { + arrayDifference, ContainerRegistrationKeys, + isDefined, MathBN, MedusaError, - arrayDifference, - isDefined, + Modules, remoteQueryObjectFromString, } from "@medusajs/utils" import { - WorkflowData, createStep, createWorkflow, parallelize, transform, + WorkflowData, } from "@medusajs/workflows-sdk" import { createRemoteLinkStep, useRemoteQueryStep } from "../../common" import { createReturnFulfillmentWorkflow } from "../../fulfillment" diff --git a/packages/core/core-flows/src/product/steps/create-variant-pricing-link.ts b/packages/core/core-flows/src/product/steps/create-variant-pricing-link.ts index d47e52f1ea..cde73f9e8c 100644 --- a/packages/core/core-flows/src/product/steps/create-variant-pricing-link.ts +++ b/packages/core/core-flows/src/product/steps/create-variant-pricing-link.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" -import { ContainerRegistrationKeys } from "@medusajs/utils" -import { StepResponse, createStep } from "@medusajs/workflows-sdk" +import { ContainerRegistrationKeys, Modules } from "@medusajs/utils" +import { createStep, StepResponse } from "@medusajs/workflows-sdk" type StepInput = { links: { diff --git a/packages/core/core-flows/src/product/steps/get-variant-pricing-link.ts b/packages/core/core-flows/src/product/steps/get-variant-pricing-link.ts index 6ed9073b2c..f3046c385e 100644 --- a/packages/core/core-flows/src/product/steps/get-variant-pricing-link.ts +++ b/packages/core/core-flows/src/product/steps/get-variant-pricing-link.ts @@ -1,11 +1,10 @@ -import { ModuleRegistrationName, Modules } from "@medusajs/modules-sdk" -import { IProductModuleService } from "@medusajs/types" import { + arrayDifference, ContainerRegistrationKeys, MedusaError, - arrayDifference, + Modules, } from "@medusajs/utils" -import { StepResponse, createStep } from "@medusajs/workflows-sdk" +import { createStep, StepResponse } from "@medusajs/workflows-sdk" type StepInput = { ids: string[] diff --git a/packages/core/core-flows/src/product/workflows/create-product-variants.ts b/packages/core/core-flows/src/product/workflows/create-product-variants.ts index 528f2b1769..8027e494fb 100644 --- a/packages/core/core-flows/src/product/workflows/create-product-variants.ts +++ b/packages/core/core-flows/src/product/workflows/create-product-variants.ts @@ -1,4 +1,4 @@ -import { LinkDefinition, Modules } from "@medusajs/modules-sdk" +import { LinkDefinition } from "@medusajs/modules-sdk" import { InventoryTypes, PricingTypes, ProductTypes } from "@medusajs/types" import { WorkflowData, @@ -11,6 +11,7 @@ import { createInventoryItemsWorkflow } from "../../inventory/workflows/create-i import { createPriceSetsStep } from "../../pricing" import { createProductVariantsStep } from "../steps/create-product-variants" import { createVariantPricingLinkStep } from "../steps/create-variant-pricing-link" +import { Modules } from "@medusajs/utils" // TODO: Create separate typings for the workflow input type WorkflowInput = { diff --git a/packages/core/core-flows/src/product/workflows/delete-product-variants.ts b/packages/core/core-flows/src/product/workflows/delete-product-variants.ts index 00aec64bdd..c61adc7dce 100644 --- a/packages/core/core-flows/src/product/workflows/delete-product-variants.ts +++ b/packages/core/core-flows/src/product/workflows/delete-product-variants.ts @@ -1,7 +1,7 @@ -import { WorkflowData, createWorkflow } from "@medusajs/workflows-sdk" -import { Modules } from "@medusajs/modules-sdk" +import { createWorkflow, WorkflowData } from "@medusajs/workflows-sdk" import { deleteProductVariantsStep } from "../steps" import { removeRemoteLinkStep } from "../../common" +import { Modules } from "@medusajs/utils" type WorkflowInput = { ids: string[] } diff --git a/packages/core/core-flows/src/product/workflows/delete-products.ts b/packages/core/core-flows/src/product/workflows/delete-products.ts index 68318c4550..f09a704a15 100644 --- a/packages/core/core-flows/src/product/workflows/delete-products.ts +++ b/packages/core/core-flows/src/product/workflows/delete-products.ts @@ -1,13 +1,13 @@ -import { Modules } from "@medusajs/modules-sdk" import { - WorkflowData, createWorkflow, parallelize, transform, + WorkflowData, } from "@medusajs/workflows-sdk" import { removeRemoteLinkStep } from "../../common" import { deleteProductsStep } from "../steps/delete-products" import { getProductsStep } from "../steps/get-products" +import { Modules } from "@medusajs/utils" type WorkflowInput = { ids: string[] } diff --git a/packages/core/core-flows/src/product/workflows/update-products.ts b/packages/core/core-flows/src/product/workflows/update-products.ts index 830deff8b5..0c8059fe07 100644 --- a/packages/core/core-flows/src/product/workflows/update-products.ts +++ b/packages/core/core-flows/src/product/workflows/update-products.ts @@ -1,8 +1,7 @@ import { updateProductsStep } from "../steps/update-products" -import { Modules } from "@medusajs/modules-sdk" import { ProductTypes } from "@medusajs/types" -import { arrayDifference } from "@medusajs/utils" +import { arrayDifference, Modules } from "@medusajs/utils" import { createWorkflow, transform, diff --git a/packages/core/core-flows/src/sales-channel/steps/associate-locations-with-channels.ts b/packages/core/core-flows/src/sales-channel/steps/associate-locations-with-channels.ts index bd5b2b4f7a..26d6fb47e3 100644 --- a/packages/core/core-flows/src/sales-channel/steps/associate-locations-with-channels.ts +++ b/packages/core/core-flows/src/sales-channel/steps/associate-locations-with-channels.ts @@ -1,7 +1,6 @@ -import { StepResponse, createStep } from "@medusajs/workflows-sdk" +import { createStep, StepResponse } from "@medusajs/workflows-sdk" -import { ContainerRegistrationKeys } from "@medusajs/utils" -import { Modules } from "@medusajs/modules-sdk" +import { ContainerRegistrationKeys, Modules } from "@medusajs/utils" interface StepInput { links: { diff --git a/packages/core/core-flows/src/sales-channel/steps/associate-products-with-channels.ts b/packages/core/core-flows/src/sales-channel/steps/associate-products-with-channels.ts index 8e400a9a9e..9792d05781 100644 --- a/packages/core/core-flows/src/sales-channel/steps/associate-products-with-channels.ts +++ b/packages/core/core-flows/src/sales-channel/steps/associate-products-with-channels.ts @@ -1,5 +1,4 @@ -import { Modules, RemoteLink } from "@medusajs/modules-sdk" -import { ContainerRegistrationKeys } from "@medusajs/utils" +import { ContainerRegistrationKeys, Modules } from "@medusajs/utils" import { createStep, StepResponse } from "@medusajs/workflows-sdk" interface StepInput { diff --git a/packages/core/core-flows/src/sales-channel/steps/detach-locations-from-channels.ts b/packages/core/core-flows/src/sales-channel/steps/detach-locations-from-channels.ts index d746c51eba..dbb06230a9 100644 --- a/packages/core/core-flows/src/sales-channel/steps/detach-locations-from-channels.ts +++ b/packages/core/core-flows/src/sales-channel/steps/detach-locations-from-channels.ts @@ -1,7 +1,7 @@ -import { Modules, RemoteLink } from "@medusajs/modules-sdk" -import { StepResponse, createStep } from "@medusajs/workflows-sdk" +import { RemoteLink } from "@medusajs/modules-sdk" +import { createStep, StepResponse } from "@medusajs/workflows-sdk" -import { ContainerRegistrationKeys } from "@medusajs/utils" +import { ContainerRegistrationKeys, Modules } from "@medusajs/utils" interface StepInput { links: { diff --git a/packages/core/core-flows/src/sales-channel/steps/detach-products-from-sales-channels.ts b/packages/core/core-flows/src/sales-channel/steps/detach-products-from-sales-channels.ts index b5e3844175..92971daed2 100644 --- a/packages/core/core-flows/src/sales-channel/steps/detach-products-from-sales-channels.ts +++ b/packages/core/core-flows/src/sales-channel/steps/detach-products-from-sales-channels.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" -import { ContainerRegistrationKeys } from "@medusajs/utils" -import { StepResponse, createStep } from "@medusajs/workflows-sdk" +import { ContainerRegistrationKeys, Modules } from "@medusajs/utils" +import { createStep, StepResponse } from "@medusajs/workflows-sdk" interface StepInput { links: { diff --git a/packages/core/core-flows/src/sales-channel/workflows/delete-sales-channels.ts b/packages/core/core-flows/src/sales-channel/workflows/delete-sales-channels.ts index f1d158d764..6a496ffa07 100644 --- a/packages/core/core-flows/src/sales-channel/workflows/delete-sales-channels.ts +++ b/packages/core/core-flows/src/sales-channel/workflows/delete-sales-channels.ts @@ -1,8 +1,8 @@ -import { WorkflowData, createWorkflow } from "@medusajs/workflows-sdk" +import { createWorkflow, WorkflowData } from "@medusajs/workflows-sdk" -import { Modules } from "@medusajs/modules-sdk" import { deleteSalesChannelsStep } from "../steps/delete-sales-channels" import { removeRemoteLinkStep } from "../../common/steps/remove-remote-links" +import { Modules } from "@medusajs/utils" type WorkflowInput = { ids: string[] } diff --git a/packages/core/core-flows/src/shipping-profile/workflows/delete-shipping-profile.ts b/packages/core/core-flows/src/shipping-profile/workflows/delete-shipping-profile.ts index 49e415c220..aee55fd6a9 100644 --- a/packages/core/core-flows/src/shipping-profile/workflows/delete-shipping-profile.ts +++ b/packages/core/core-flows/src/shipping-profile/workflows/delete-shipping-profile.ts @@ -1,8 +1,8 @@ -import { WorkflowData, createWorkflow } from "@medusajs/workflows-sdk" -import { Modules } from "@medusajs/modules-sdk" +import { createWorkflow, WorkflowData } from "@medusajs/workflows-sdk" import { deleteShippingProfilesStep } from "../steps" import { removeRemoteLinkStep } from "../../common" +import { Modules } from "@medusajs/utils" export const deleteShippingProfileWorkflowId = "delete-shipping-profile-workflow" diff --git a/packages/core/core-flows/src/stock-location/steps/associate-locations-with-fulfillment-sets.ts b/packages/core/core-flows/src/stock-location/steps/associate-locations-with-fulfillment-sets.ts index c2a8add7e1..9a141a2ce2 100644 --- a/packages/core/core-flows/src/stock-location/steps/associate-locations-with-fulfillment-sets.ts +++ b/packages/core/core-flows/src/stock-location/steps/associate-locations-with-fulfillment-sets.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" -import { ContainerRegistrationKeys } from "@medusajs/utils" -import { StepResponse, createStep } from "@medusajs/workflows-sdk" +import { ContainerRegistrationKeys, Modules } from "@medusajs/utils" +import { createStep, StepResponse } from "@medusajs/workflows-sdk" interface StepInput { input: { diff --git a/packages/core/core-flows/src/stock-location/steps/delete-stock-locations.ts b/packages/core/core-flows/src/stock-location/steps/delete-stock-locations.ts index 13105067b0..89f5b38d41 100644 --- a/packages/core/core-flows/src/stock-location/steps/delete-stock-locations.ts +++ b/packages/core/core-flows/src/stock-location/steps/delete-stock-locations.ts @@ -1,9 +1,9 @@ import { DeleteEntityInput, ModuleRegistrationName, - Modules, } from "@medusajs/modules-sdk" -import { StepResponse, createStep } from "@medusajs/workflows-sdk" +import { createStep, StepResponse } from "@medusajs/workflows-sdk" +import { Modules } from "@medusajs/utils" export const deleteStockLocationsStepId = "delete-stock-locations-step" export const deleteStockLocationsStep = createStep( diff --git a/packages/core/modules-sdk/jest.config.js b/packages/core/modules-sdk/jest.config.js index c7b7c431b7..3d35b60536 100644 --- a/packages/core/modules-sdk/jest.config.js +++ b/packages/core/modules-sdk/jest.config.js @@ -1,5 +1,15 @@ module.exports = { - transform: { "^.+\\.[jt]s?$": "@swc/jest" }, + transform: { + "^.+\\.[jt]s?$": [ + "@swc/jest", + { + jsc: { + parser: { syntax: "typescript", decorators: true }, + transform: { decoratorMetadata: true }, + }, + }, + ], + }, testEnvironment: `node`, moduleFileExtensions: [`js`, `ts`], } diff --git a/packages/core/modules-sdk/package.json b/packages/core/modules-sdk/package.json index 45cd774958..cf8ec8ac9c 100644 --- a/packages/core/modules-sdk/package.json +++ b/packages/core/modules-sdk/package.json @@ -21,6 +21,7 @@ "license": "MIT", "devDependencies": { "@medusajs/types": "^1.11.16", + "@mikro-orm/core": "5.9.7", "cross-env": "^5.2.1", "jest": "^29.7.0", "rimraf": "^5.0.1", diff --git a/packages/core/modules-sdk/src/definitions.ts b/packages/core/modules-sdk/src/definitions.ts index b10dcd2a9a..65c55edbd6 100644 --- a/packages/core/modules-sdk/src/definitions.ts +++ b/packages/core/modules-sdk/src/definitions.ts @@ -1,5 +1,5 @@ import { ModuleDefinition } from "@medusajs/types" -import { upperCaseFirst } from "@medusajs/utils" +import { Modules, upperCaseFirst } from "@medusajs/utils" import { MODULE_RESOURCE_TYPE, MODULE_SCOPE } from "./types" export enum LinkModuleUtils { @@ -7,34 +7,6 @@ export enum LinkModuleUtils { REMOTE_LINK = "remoteLink", } -// TODO: Remove this enum and use the one from @medusajs/utils -export enum Modules { - AUTH = "auth", - CACHE = "cacheService", - CART = "cart", - CUSTOMER = "customer", - EVENT_BUS = "eventBus", - INVENTORY = "inventoryService", - LINK = "linkModules", - PAYMENT = "payment", - PRICING = "pricingService", - PRODUCT = "productService", - PROMOTION = "promotion", - SALES_CHANNEL = "salesChannel", - TAX = "tax", - FULFILLMENT = "fulfillment", - STOCK_LOCATION = "stockLocationService", - USER = "user", - WORKFLOW_ENGINE = "workflows", - REGION = "region", - ORDER = "order", - API_KEY = "apiKey", - STORE = "store", - CURRENCY = "currency", - FILE = "file", - NOTIFICATION = "notification", -} - export enum ModuleRegistrationName { AUTH = "authModuleService", CACHE = "cacheService", @@ -88,305 +60,306 @@ export const MODULE_PACKAGE_NAMES = { [Modules.NOTIFICATION]: "@medusajs/notification", } -export const ModulesDefinition: { [key: string | Modules]: ModuleDefinition } = - { - [Modules.EVENT_BUS]: { - key: Modules.EVENT_BUS, - registrationName: ModuleRegistrationName.EVENT_BUS, - defaultPackage: MODULE_PACKAGE_NAMES[Modules.EVENT_BUS], - label: upperCaseFirst(ModuleRegistrationName.EVENT_BUS), - isRequired: true, - dependencies: ["logger"], - defaultModuleDeclaration: { - scope: MODULE_SCOPE.INTERNAL, - resources: MODULE_RESOURCE_TYPE.SHARED, - }, +export const ModulesDefinition: { + [key: string]: ModuleDefinition +} = { + [Modules.EVENT_BUS]: { + key: Modules.EVENT_BUS, + registrationName: ModuleRegistrationName.EVENT_BUS, + defaultPackage: MODULE_PACKAGE_NAMES[Modules.EVENT_BUS], + label: upperCaseFirst(ModuleRegistrationName.EVENT_BUS), + isRequired: true, + dependencies: ["logger"], + defaultModuleDeclaration: { + scope: MODULE_SCOPE.INTERNAL, + resources: MODULE_RESOURCE_TYPE.SHARED, }, - [Modules.STOCK_LOCATION]: { - key: Modules.STOCK_LOCATION, - registrationName: ModuleRegistrationName.STOCK_LOCATION, - defaultPackage: false, - label: upperCaseFirst(ModuleRegistrationName.STOCK_LOCATION), - isRequired: false, - isQueryable: true, - dependencies: [ModuleRegistrationName.EVENT_BUS], - defaultModuleDeclaration: { - scope: MODULE_SCOPE.INTERNAL, - resources: MODULE_RESOURCE_TYPE.SHARED, - }, + }, + [Modules.STOCK_LOCATION]: { + key: Modules.STOCK_LOCATION, + registrationName: ModuleRegistrationName.STOCK_LOCATION, + defaultPackage: false, + label: upperCaseFirst(ModuleRegistrationName.STOCK_LOCATION), + isRequired: false, + isQueryable: true, + dependencies: [ModuleRegistrationName.EVENT_BUS], + defaultModuleDeclaration: { + scope: MODULE_SCOPE.INTERNAL, + resources: MODULE_RESOURCE_TYPE.SHARED, }, - [Modules.INVENTORY]: { - key: Modules.INVENTORY, - registrationName: ModuleRegistrationName.INVENTORY, - defaultPackage: false, - label: upperCaseFirst(ModuleRegistrationName.INVENTORY), - isRequired: false, - isQueryable: true, - dependencies: [ModuleRegistrationName.EVENT_BUS], - defaultModuleDeclaration: { - scope: MODULE_SCOPE.INTERNAL, - resources: MODULE_RESOURCE_TYPE.SHARED, - }, + }, + [Modules.INVENTORY]: { + key: Modules.INVENTORY, + registrationName: ModuleRegistrationName.INVENTORY, + defaultPackage: false, + label: upperCaseFirst(ModuleRegistrationName.INVENTORY), + isRequired: false, + isQueryable: true, + dependencies: [ModuleRegistrationName.EVENT_BUS], + defaultModuleDeclaration: { + scope: MODULE_SCOPE.INTERNAL, + resources: MODULE_RESOURCE_TYPE.SHARED, }, - [Modules.CACHE]: { - key: Modules.CACHE, - registrationName: ModuleRegistrationName.CACHE, - defaultPackage: MODULE_PACKAGE_NAMES[Modules.CACHE], - label: upperCaseFirst(ModuleRegistrationName.CACHE), - isRequired: true, - defaultModuleDeclaration: { - scope: MODULE_SCOPE.INTERNAL, - resources: MODULE_RESOURCE_TYPE.SHARED, - }, + }, + [Modules.CACHE]: { + key: Modules.CACHE, + registrationName: ModuleRegistrationName.CACHE, + defaultPackage: MODULE_PACKAGE_NAMES[Modules.CACHE], + label: upperCaseFirst(ModuleRegistrationName.CACHE), + isRequired: true, + defaultModuleDeclaration: { + scope: MODULE_SCOPE.INTERNAL, + resources: MODULE_RESOURCE_TYPE.SHARED, }, - [Modules.PRODUCT]: { - key: Modules.PRODUCT, - registrationName: ModuleRegistrationName.PRODUCT, - defaultPackage: false, - label: upperCaseFirst(ModuleRegistrationName.PRODUCT), - isRequired: false, - isQueryable: true, - dependencies: [ModuleRegistrationName.EVENT_BUS, "logger"], - defaultModuleDeclaration: { - scope: MODULE_SCOPE.INTERNAL, - resources: MODULE_RESOURCE_TYPE.SHARED, - }, + }, + [Modules.PRODUCT]: { + key: Modules.PRODUCT, + registrationName: ModuleRegistrationName.PRODUCT, + defaultPackage: false, + label: upperCaseFirst(ModuleRegistrationName.PRODUCT), + isRequired: false, + isQueryable: true, + dependencies: [ModuleRegistrationName.EVENT_BUS, "logger"], + defaultModuleDeclaration: { + scope: MODULE_SCOPE.INTERNAL, + resources: MODULE_RESOURCE_TYPE.SHARED, }, - [Modules.PRICING]: { - key: Modules.PRICING, - registrationName: ModuleRegistrationName.PRICING, - defaultPackage: false, - label: upperCaseFirst(ModuleRegistrationName.PRICING), - isRequired: false, - isQueryable: true, - dependencies: [ModuleRegistrationName.EVENT_BUS, "logger"], - defaultModuleDeclaration: { - scope: MODULE_SCOPE.INTERNAL, - resources: MODULE_RESOURCE_TYPE.SHARED, - }, + }, + [Modules.PRICING]: { + key: Modules.PRICING, + registrationName: ModuleRegistrationName.PRICING, + defaultPackage: false, + label: upperCaseFirst(ModuleRegistrationName.PRICING), + isRequired: false, + isQueryable: true, + dependencies: [ModuleRegistrationName.EVENT_BUS, "logger"], + defaultModuleDeclaration: { + scope: MODULE_SCOPE.INTERNAL, + resources: MODULE_RESOURCE_TYPE.SHARED, }, - [Modules.PROMOTION]: { - key: Modules.PROMOTION, - registrationName: ModuleRegistrationName.PROMOTION, - defaultPackage: false, - label: upperCaseFirst(ModuleRegistrationName.PROMOTION), - isRequired: false, - isQueryable: true, - dependencies: ["logger"], - defaultModuleDeclaration: { - scope: MODULE_SCOPE.INTERNAL, - resources: MODULE_RESOURCE_TYPE.SHARED, - }, + }, + [Modules.PROMOTION]: { + key: Modules.PROMOTION, + registrationName: ModuleRegistrationName.PROMOTION, + defaultPackage: false, + label: upperCaseFirst(ModuleRegistrationName.PROMOTION), + isRequired: false, + isQueryable: true, + dependencies: ["logger"], + defaultModuleDeclaration: { + scope: MODULE_SCOPE.INTERNAL, + resources: MODULE_RESOURCE_TYPE.SHARED, }, - [Modules.AUTH]: { - key: Modules.AUTH, - registrationName: ModuleRegistrationName.AUTH, - defaultPackage: false, - label: upperCaseFirst(ModuleRegistrationName.AUTH), - isRequired: false, - isQueryable: true, - dependencies: ["logger"], - defaultModuleDeclaration: { - scope: MODULE_SCOPE.INTERNAL, - resources: MODULE_RESOURCE_TYPE.SHARED, - }, + }, + [Modules.AUTH]: { + key: Modules.AUTH, + registrationName: ModuleRegistrationName.AUTH, + defaultPackage: false, + label: upperCaseFirst(ModuleRegistrationName.AUTH), + isRequired: false, + isQueryable: true, + dependencies: ["logger"], + defaultModuleDeclaration: { + scope: MODULE_SCOPE.INTERNAL, + resources: MODULE_RESOURCE_TYPE.SHARED, }, - [Modules.WORKFLOW_ENGINE]: { - key: Modules.WORKFLOW_ENGINE, - registrationName: ModuleRegistrationName.WORKFLOW_ENGINE, - defaultPackage: false, - label: upperCaseFirst(ModuleRegistrationName.WORKFLOW_ENGINE), - isRequired: false, - isQueryable: true, - dependencies: ["logger"], - defaultModuleDeclaration: { - scope: MODULE_SCOPE.INTERNAL, - resources: MODULE_RESOURCE_TYPE.SHARED, - }, + }, + [Modules.WORKFLOW_ENGINE]: { + key: Modules.WORKFLOW_ENGINE, + registrationName: ModuleRegistrationName.WORKFLOW_ENGINE, + defaultPackage: false, + label: upperCaseFirst(ModuleRegistrationName.WORKFLOW_ENGINE), + isRequired: false, + isQueryable: true, + dependencies: ["logger"], + defaultModuleDeclaration: { + scope: MODULE_SCOPE.INTERNAL, + resources: MODULE_RESOURCE_TYPE.SHARED, }, - [Modules.SALES_CHANNEL]: { - key: Modules.SALES_CHANNEL, - registrationName: ModuleRegistrationName.SALES_CHANNEL, - defaultPackage: false, - label: upperCaseFirst(ModuleRegistrationName.SALES_CHANNEL), - isRequired: false, - isQueryable: true, - dependencies: ["logger"], - defaultModuleDeclaration: { - scope: MODULE_SCOPE.INTERNAL, - resources: MODULE_RESOURCE_TYPE.SHARED, - }, + }, + [Modules.SALES_CHANNEL]: { + key: Modules.SALES_CHANNEL, + registrationName: ModuleRegistrationName.SALES_CHANNEL, + defaultPackage: false, + label: upperCaseFirst(ModuleRegistrationName.SALES_CHANNEL), + isRequired: false, + isQueryable: true, + dependencies: ["logger"], + defaultModuleDeclaration: { + scope: MODULE_SCOPE.INTERNAL, + resources: MODULE_RESOURCE_TYPE.SHARED, }, - [Modules.FULFILLMENT]: { - key: Modules.FULFILLMENT, - registrationName: ModuleRegistrationName.FULFILLMENT, - defaultPackage: false, - label: upperCaseFirst(ModuleRegistrationName.FULFILLMENT), - isRequired: false, - isQueryable: true, - dependencies: ["logger", ModuleRegistrationName.EVENT_BUS], - defaultModuleDeclaration: { - scope: MODULE_SCOPE.INTERNAL, - resources: MODULE_RESOURCE_TYPE.SHARED, - }, + }, + [Modules.FULFILLMENT]: { + key: Modules.FULFILLMENT, + registrationName: ModuleRegistrationName.FULFILLMENT, + defaultPackage: false, + label: upperCaseFirst(ModuleRegistrationName.FULFILLMENT), + isRequired: false, + isQueryable: true, + dependencies: ["logger", ModuleRegistrationName.EVENT_BUS], + defaultModuleDeclaration: { + scope: MODULE_SCOPE.INTERNAL, + resources: MODULE_RESOURCE_TYPE.SHARED, }, - [Modules.CART]: { - key: Modules.CART, - registrationName: ModuleRegistrationName.CART, - defaultPackage: false, - label: upperCaseFirst(ModuleRegistrationName.CART), - isRequired: false, - isQueryable: true, - dependencies: ["logger"], - defaultModuleDeclaration: { - scope: MODULE_SCOPE.INTERNAL, - resources: MODULE_RESOURCE_TYPE.SHARED, - }, + }, + [Modules.CART]: { + key: Modules.CART, + registrationName: ModuleRegistrationName.CART, + defaultPackage: false, + label: upperCaseFirst(ModuleRegistrationName.CART), + isRequired: false, + isQueryable: true, + dependencies: ["logger"], + defaultModuleDeclaration: { + scope: MODULE_SCOPE.INTERNAL, + resources: MODULE_RESOURCE_TYPE.SHARED, }, - [Modules.CUSTOMER]: { - key: Modules.CUSTOMER, - registrationName: ModuleRegistrationName.CUSTOMER, - defaultPackage: false, - label: upperCaseFirst(ModuleRegistrationName.CUSTOMER), - isRequired: false, - isQueryable: true, - dependencies: ["logger"], - defaultModuleDeclaration: { - scope: MODULE_SCOPE.INTERNAL, - resources: MODULE_RESOURCE_TYPE.SHARED, - }, + }, + [Modules.CUSTOMER]: { + key: Modules.CUSTOMER, + registrationName: ModuleRegistrationName.CUSTOMER, + defaultPackage: false, + label: upperCaseFirst(ModuleRegistrationName.CUSTOMER), + isRequired: false, + isQueryable: true, + dependencies: ["logger"], + defaultModuleDeclaration: { + scope: MODULE_SCOPE.INTERNAL, + resources: MODULE_RESOURCE_TYPE.SHARED, }, - [Modules.PAYMENT]: { - key: Modules.PAYMENT, - registrationName: ModuleRegistrationName.PAYMENT, - defaultPackage: false, - label: upperCaseFirst(ModuleRegistrationName.PAYMENT), - isRequired: false, - isQueryable: true, - dependencies: ["logger"], - defaultModuleDeclaration: { - scope: MODULE_SCOPE.INTERNAL, - resources: MODULE_RESOURCE_TYPE.SHARED, - }, + }, + [Modules.PAYMENT]: { + key: Modules.PAYMENT, + registrationName: ModuleRegistrationName.PAYMENT, + defaultPackage: false, + label: upperCaseFirst(ModuleRegistrationName.PAYMENT), + isRequired: false, + isQueryable: true, + dependencies: ["logger"], + defaultModuleDeclaration: { + scope: MODULE_SCOPE.INTERNAL, + resources: MODULE_RESOURCE_TYPE.SHARED, }, - [Modules.USER]: { - key: Modules.USER, - registrationName: ModuleRegistrationName.USER, - defaultPackage: false, - label: upperCaseFirst(ModuleRegistrationName.USER), - isRequired: false, - isQueryable: true, - dependencies: [ModuleRegistrationName.EVENT_BUS, "logger"], - defaultModuleDeclaration: { - scope: MODULE_SCOPE.INTERNAL, - resources: MODULE_RESOURCE_TYPE.SHARED, - }, + }, + [Modules.USER]: { + key: Modules.USER, + registrationName: ModuleRegistrationName.USER, + defaultPackage: false, + label: upperCaseFirst(ModuleRegistrationName.USER), + isRequired: false, + isQueryable: true, + dependencies: [ModuleRegistrationName.EVENT_BUS, "logger"], + defaultModuleDeclaration: { + scope: MODULE_SCOPE.INTERNAL, + resources: MODULE_RESOURCE_TYPE.SHARED, }, - [Modules.REGION]: { - key: Modules.REGION, - registrationName: ModuleRegistrationName.REGION, - defaultPackage: false, - label: upperCaseFirst(ModuleRegistrationName.REGION), - isRequired: false, - isQueryable: true, - dependencies: ["logger"], - defaultModuleDeclaration: { - scope: MODULE_SCOPE.INTERNAL, - resources: MODULE_RESOURCE_TYPE.SHARED, - }, + }, + [Modules.REGION]: { + key: Modules.REGION, + registrationName: ModuleRegistrationName.REGION, + defaultPackage: false, + label: upperCaseFirst(ModuleRegistrationName.REGION), + isRequired: false, + isQueryable: true, + dependencies: ["logger"], + defaultModuleDeclaration: { + scope: MODULE_SCOPE.INTERNAL, + resources: MODULE_RESOURCE_TYPE.SHARED, }, - [Modules.ORDER]: { - key: Modules.ORDER, - registrationName: ModuleRegistrationName.ORDER, - defaultPackage: false, - label: upperCaseFirst(ModuleRegistrationName.ORDER), - isRequired: false, - isQueryable: true, - dependencies: ["logger", ModuleRegistrationName.EVENT_BUS], - defaultModuleDeclaration: { - scope: MODULE_SCOPE.INTERNAL, - resources: MODULE_RESOURCE_TYPE.SHARED, - }, + }, + [Modules.ORDER]: { + key: Modules.ORDER, + registrationName: ModuleRegistrationName.ORDER, + defaultPackage: false, + label: upperCaseFirst(ModuleRegistrationName.ORDER), + isRequired: false, + isQueryable: true, + dependencies: ["logger", ModuleRegistrationName.EVENT_BUS], + defaultModuleDeclaration: { + scope: MODULE_SCOPE.INTERNAL, + resources: MODULE_RESOURCE_TYPE.SHARED, }, - [Modules.TAX]: { - key: Modules.TAX, - registrationName: ModuleRegistrationName.TAX, - defaultPackage: false, - label: upperCaseFirst(ModuleRegistrationName.TAX), - isRequired: false, - isQueryable: true, - dependencies: ["logger", ModuleRegistrationName.EVENT_BUS], - defaultModuleDeclaration: { - scope: MODULE_SCOPE.INTERNAL, - resources: MODULE_RESOURCE_TYPE.SHARED, - }, + }, + [Modules.TAX]: { + key: Modules.TAX, + registrationName: ModuleRegistrationName.TAX, + defaultPackage: false, + label: upperCaseFirst(ModuleRegistrationName.TAX), + isRequired: false, + isQueryable: true, + dependencies: ["logger", ModuleRegistrationName.EVENT_BUS], + defaultModuleDeclaration: { + scope: MODULE_SCOPE.INTERNAL, + resources: MODULE_RESOURCE_TYPE.SHARED, }, - [Modules.API_KEY]: { - key: Modules.API_KEY, - registrationName: ModuleRegistrationName.API_KEY, - defaultPackage: false, - label: upperCaseFirst(ModuleRegistrationName.API_KEY), - isRequired: false, - isQueryable: true, - dependencies: ["logger"], - defaultModuleDeclaration: { - scope: MODULE_SCOPE.INTERNAL, - resources: MODULE_RESOURCE_TYPE.SHARED, - }, + }, + [Modules.API_KEY]: { + key: Modules.API_KEY, + registrationName: ModuleRegistrationName.API_KEY, + defaultPackage: false, + label: upperCaseFirst(ModuleRegistrationName.API_KEY), + isRequired: false, + isQueryable: true, + dependencies: ["logger"], + defaultModuleDeclaration: { + scope: MODULE_SCOPE.INTERNAL, + resources: MODULE_RESOURCE_TYPE.SHARED, }, - [Modules.STORE]: { - key: Modules.STORE, - registrationName: ModuleRegistrationName.STORE, - defaultPackage: false, - label: upperCaseFirst(ModuleRegistrationName.STORE), - isRequired: false, - isQueryable: true, - dependencies: ["logger"], - defaultModuleDeclaration: { - scope: MODULE_SCOPE.INTERNAL, - resources: MODULE_RESOURCE_TYPE.SHARED, - }, + }, + [Modules.STORE]: { + key: Modules.STORE, + registrationName: ModuleRegistrationName.STORE, + defaultPackage: false, + label: upperCaseFirst(ModuleRegistrationName.STORE), + isRequired: false, + isQueryable: true, + dependencies: ["logger"], + defaultModuleDeclaration: { + scope: MODULE_SCOPE.INTERNAL, + resources: MODULE_RESOURCE_TYPE.SHARED, }, - [Modules.CURRENCY]: { - key: Modules.CURRENCY, - registrationName: ModuleRegistrationName.CURRENCY, - defaultPackage: false, - label: upperCaseFirst(ModuleRegistrationName.CURRENCY), - isRequired: false, - isQueryable: true, - dependencies: ["logger"], - defaultModuleDeclaration: { - scope: MODULE_SCOPE.INTERNAL, - resources: MODULE_RESOURCE_TYPE.SHARED, - }, + }, + [Modules.CURRENCY]: { + key: Modules.CURRENCY, + registrationName: ModuleRegistrationName.CURRENCY, + defaultPackage: false, + label: upperCaseFirst(ModuleRegistrationName.CURRENCY), + isRequired: false, + isQueryable: true, + dependencies: ["logger"], + defaultModuleDeclaration: { + scope: MODULE_SCOPE.INTERNAL, + resources: MODULE_RESOURCE_TYPE.SHARED, }, - [Modules.FILE]: { - key: Modules.FILE, - registrationName: ModuleRegistrationName.FILE, - defaultPackage: false, - label: upperCaseFirst(ModuleRegistrationName.FILE), - isRequired: false, - isQueryable: true, - dependencies: ["logger"], - defaultModuleDeclaration: { - scope: MODULE_SCOPE.INTERNAL, - resources: MODULE_RESOURCE_TYPE.SHARED, - }, + }, + [Modules.FILE]: { + key: Modules.FILE, + registrationName: ModuleRegistrationName.FILE, + defaultPackage: false, + label: upperCaseFirst(ModuleRegistrationName.FILE), + isRequired: false, + isQueryable: true, + dependencies: ["logger"], + defaultModuleDeclaration: { + scope: MODULE_SCOPE.INTERNAL, + resources: MODULE_RESOURCE_TYPE.SHARED, }, - [Modules.NOTIFICATION]: { - key: Modules.NOTIFICATION, - registrationName: ModuleRegistrationName.NOTIFICATION, - defaultPackage: false, - label: upperCaseFirst(ModuleRegistrationName.NOTIFICATION), - isRequired: false, - isQueryable: true, - dependencies: ["logger"], - defaultModuleDeclaration: { - scope: MODULE_SCOPE.INTERNAL, - resources: MODULE_RESOURCE_TYPE.SHARED, - }, + }, + [Modules.NOTIFICATION]: { + key: Modules.NOTIFICATION, + registrationName: ModuleRegistrationName.NOTIFICATION, + defaultPackage: false, + label: upperCaseFirst(ModuleRegistrationName.NOTIFICATION), + isRequired: false, + isQueryable: true, + dependencies: ["logger"], + defaultModuleDeclaration: { + scope: MODULE_SCOPE.INTERNAL, + resources: MODULE_RESOURCE_TYPE.SHARED, }, - } + }, +} export const MODULE_DEFINITIONS: ModuleDefinition[] = Object.values(ModulesDefinition) diff --git a/packages/core/modules-sdk/src/loaders/utils/__fixtures__/index.ts b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/index.ts new file mode 100644 index 0000000000..ac3c19e58d --- /dev/null +++ b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/index.ts @@ -0,0 +1,4 @@ +export * as ModuleWithDmlMixedWithoutJoinerConfigFixtures from "./module-with-dml-mixed-without-joiner-config" +export * as ModuleWithDmlWithoutJoinerConfigFixtures from "./module-with-dml-without-joiner-config" +export * as ModuleWithoutJoinerConfigFixtures from "./module-without-joiner-config" +export * as ModuleWithJoinerConfigFixtures from "./module-with-joiner-config" diff --git a/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-mixed-without-joiner-config/index.ts b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-mixed-without-joiner-config/index.ts new file mode 100644 index 0000000000..c965430a94 --- /dev/null +++ b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-mixed-without-joiner-config/index.ts @@ -0,0 +1,11 @@ +import { ModuleExports } from "@medusajs/types" +import { ModuleService } from "./services/module-service" + +const moduleExports: ModuleExports = { + service: ModuleService, +} + +export * from "./models" +export * from "./services/module-service" + +export default moduleExports diff --git a/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-mixed-without-joiner-config/models/dml-entity.ts b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-mixed-without-joiner-config/models/dml-entity.ts new file mode 100644 index 0000000000..fe765f6e3d --- /dev/null +++ b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-mixed-without-joiner-config/models/dml-entity.ts @@ -0,0 +1,5 @@ +import { model } from "@medusajs/utils" + +export const dmlEntity = model.define("dmlEntity", { + name: model.text(), +}) diff --git a/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-mixed-without-joiner-config/models/entity.ts b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-mixed-without-joiner-config/models/entity.ts new file mode 100644 index 0000000000..6aaa9fb4a9 --- /dev/null +++ b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-mixed-without-joiner-config/models/entity.ts @@ -0,0 +1,7 @@ +import { Entity, Property } from "@mikro-orm/core" + +@Entity() +export class EntityModel { + @Property({ columnType: "int" }) + id!: number +} diff --git a/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-mixed-without-joiner-config/models/index.ts b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-mixed-without-joiner-config/models/index.ts new file mode 100644 index 0000000000..b0e2abc6e8 --- /dev/null +++ b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-mixed-without-joiner-config/models/index.ts @@ -0,0 +1,2 @@ +export * from "./entity" +export * from "./dml-entity" diff --git a/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-mixed-without-joiner-config/services/module-service.ts b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-mixed-without-joiner-config/services/module-service.ts new file mode 100644 index 0000000000..64f984323b --- /dev/null +++ b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-mixed-without-joiner-config/services/module-service.ts @@ -0,0 +1,3 @@ +import { IModuleService } from "@medusajs/types" + +export class ModuleService implements IModuleService {} diff --git a/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-without-joiner-config/index.ts b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-without-joiner-config/index.ts new file mode 100644 index 0000000000..c965430a94 --- /dev/null +++ b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-without-joiner-config/index.ts @@ -0,0 +1,11 @@ +import { ModuleExports } from "@medusajs/types" +import { ModuleService } from "./services/module-service" + +const moduleExports: ModuleExports = { + service: ModuleService, +} + +export * from "./models" +export * from "./services/module-service" + +export default moduleExports diff --git a/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-without-joiner-config/models/dml-entity-model.ts b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-without-joiner-config/models/dml-entity-model.ts new file mode 100644 index 0000000000..4bc3b2bd87 --- /dev/null +++ b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-without-joiner-config/models/dml-entity-model.ts @@ -0,0 +1,5 @@ +import { model } from "@medusajs/utils" + +export const entityModel = model.define("entityModel", { + name: model.text(), +}) diff --git a/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-without-joiner-config/models/dml-entity.ts b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-without-joiner-config/models/dml-entity.ts new file mode 100644 index 0000000000..fe765f6e3d --- /dev/null +++ b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-without-joiner-config/models/dml-entity.ts @@ -0,0 +1,5 @@ +import { model } from "@medusajs/utils" + +export const dmlEntity = model.define("dmlEntity", { + name: model.text(), +}) diff --git a/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-without-joiner-config/models/index.ts b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-without-joiner-config/models/index.ts new file mode 100644 index 0000000000..e25b59d5f4 --- /dev/null +++ b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-without-joiner-config/models/index.ts @@ -0,0 +1,2 @@ +export * from "./dml-entity" +export * from "./dml-entity-model" diff --git a/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-without-joiner-config/services/module-service.ts b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-without-joiner-config/services/module-service.ts new file mode 100644 index 0000000000..64f984323b --- /dev/null +++ b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-dml-without-joiner-config/services/module-service.ts @@ -0,0 +1,3 @@ +import { IModuleService } from "@medusajs/types" + +export class ModuleService implements IModuleService {} diff --git a/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-joiner-config/index.ts b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-joiner-config/index.ts new file mode 100644 index 0000000000..c965430a94 --- /dev/null +++ b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-joiner-config/index.ts @@ -0,0 +1,11 @@ +import { ModuleExports } from "@medusajs/types" +import { ModuleService } from "./services/module-service" + +const moduleExports: ModuleExports = { + service: ModuleService, +} + +export * from "./models" +export * from "./services/module-service" + +export default moduleExports diff --git a/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-joiner-config/models/entity-2.ts b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-joiner-config/models/entity-2.ts new file mode 100644 index 0000000000..9fb792adb7 --- /dev/null +++ b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-joiner-config/models/entity-2.ts @@ -0,0 +1,7 @@ +import { Entity, Property } from "@mikro-orm/core" + +@Entity() +export class Entity2 { + @Property({ columnType: "int" }) + id!: number +} diff --git a/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-joiner-config/models/entity.ts b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-joiner-config/models/entity.ts new file mode 100644 index 0000000000..6aaa9fb4a9 --- /dev/null +++ b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-joiner-config/models/entity.ts @@ -0,0 +1,7 @@ +import { Entity, Property } from "@mikro-orm/core" + +@Entity() +export class EntityModel { + @Property({ columnType: "int" }) + id!: number +} diff --git a/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-joiner-config/models/index.ts b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-joiner-config/models/index.ts new file mode 100644 index 0000000000..bcdc5ed229 --- /dev/null +++ b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-joiner-config/models/index.ts @@ -0,0 +1,2 @@ +export * from "./entity" +export * from "./entity-2" diff --git a/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-joiner-config/services/module-service.ts b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-joiner-config/services/module-service.ts new file mode 100644 index 0000000000..3cdc974588 --- /dev/null +++ b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-with-joiner-config/services/module-service.ts @@ -0,0 +1,17 @@ +import { IModuleService, ModuleJoinerConfig } from "@medusajs/types" +import { defineJoinerConfig } from "@medusajs/utils" + +export class ModuleService implements IModuleService { + __joinerConfig(): ModuleJoinerConfig { + return defineJoinerConfig("module-service", { + alias: [ + { + name: ["custom_name"], + args: { + entity: "Custom", + }, + }, + ], + }) + } +} diff --git a/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-without-joiner-config/index.ts b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-without-joiner-config/index.ts new file mode 100644 index 0000000000..c965430a94 --- /dev/null +++ b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-without-joiner-config/index.ts @@ -0,0 +1,11 @@ +import { ModuleExports } from "@medusajs/types" +import { ModuleService } from "./services/module-service" + +const moduleExports: ModuleExports = { + service: ModuleService, +} + +export * from "./models" +export * from "./services/module-service" + +export default moduleExports diff --git a/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-without-joiner-config/models/entity-2.ts b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-without-joiner-config/models/entity-2.ts new file mode 100644 index 0000000000..9fb792adb7 --- /dev/null +++ b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-without-joiner-config/models/entity-2.ts @@ -0,0 +1,7 @@ +import { Entity, Property } from "@mikro-orm/core" + +@Entity() +export class Entity2 { + @Property({ columnType: "int" }) + id!: number +} diff --git a/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-without-joiner-config/models/entity.ts b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-without-joiner-config/models/entity.ts new file mode 100644 index 0000000000..6aaa9fb4a9 --- /dev/null +++ b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-without-joiner-config/models/entity.ts @@ -0,0 +1,7 @@ +import { Entity, Property } from "@mikro-orm/core" + +@Entity() +export class EntityModel { + @Property({ columnType: "int" }) + id!: number +} diff --git a/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-without-joiner-config/models/index.ts b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-without-joiner-config/models/index.ts new file mode 100644 index 0000000000..bcdc5ed229 --- /dev/null +++ b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-without-joiner-config/models/index.ts @@ -0,0 +1,2 @@ +export * from "./entity" +export * from "./entity-2" diff --git a/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-without-joiner-config/services/module-service.ts b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-without-joiner-config/services/module-service.ts new file mode 100644 index 0000000000..64f984323b --- /dev/null +++ b/packages/core/modules-sdk/src/loaders/utils/__fixtures__/module-without-joiner-config/services/module-service.ts @@ -0,0 +1,3 @@ +import { IModuleService } from "@medusajs/types" + +export class ModuleService implements IModuleService {} diff --git a/packages/core/modules-sdk/src/loaders/utils/__tests__/load-internal.spec.ts b/packages/core/modules-sdk/src/loaders/utils/__tests__/load-internal.spec.ts new file mode 100644 index 0000000000..5034dc7463 --- /dev/null +++ b/packages/core/modules-sdk/src/loaders/utils/__tests__/load-internal.spec.ts @@ -0,0 +1,316 @@ +import { loadResources } from "../load-internal" +import { IModuleService, ModuleResolution } from "@medusajs/types" +import { join } from "path" +import { + ModuleWithDmlMixedWithoutJoinerConfigFixtures, + ModuleWithDmlWithoutJoinerConfigFixtures, + ModuleWithJoinerConfigFixtures, + ModuleWithoutJoinerConfigFixtures, +} from "../__fixtures__" +import { upperCaseFirst } from "@medusajs/utils" + +describe("load internal - load resources", () => { + describe("when loading the module resources from a path", () => { + test("should return the correct resources and generate the correct joiner config from a mix of DML entities and mikro orm entities", async () => { + const { ModuleService, EntityModel, dmlEntity } = + ModuleWithDmlMixedWithoutJoinerConfigFixtures + + const moduleResolution: ModuleResolution = { + resolutionPath: join( + __dirname, + "../__fixtures__/module-with-dml-mixed-without-joiner-config" + ), + definition: { + key: "module-with-dml-mixed-without-joiner-config", + registrationName: "service", + label: "Module with DML mixed without joiner config", + defaultPackage: false, + defaultModuleDeclaration: { + scope: "internal", + resources: "shared", + }, + }, + } + + expect( + (ModuleService.prototype as IModuleService).__joinerConfig + ).toBeUndefined() + + const resources = await loadResources(moduleResolution) + + expect(resources).toBeDefined() + expect(resources.services).toHaveLength(1) + expect(resources.services[0]).toEqual(ModuleService) + expect(resources.models).toHaveLength(2) + expect(resources.models).toEqual( + expect.arrayContaining([ + expect.objectContaining({ name: upperCaseFirst(dmlEntity.name) }), + expect.objectContaining({ name: upperCaseFirst(EntityModel.name) }), + ]) + ) + expect(resources.repositories).toHaveLength(0) + expect(resources.loaders).toHaveLength(2) + expect(resources.loaders).toEqual([ + expect.objectContaining({ name: "connectionLoader" }), + expect.objectContaining({ name: "containerLoader" }), + ]) + expect(resources.moduleService).toEqual(ModuleService) + + expect( + (resources.moduleService.prototype as IModuleService).__joinerConfig + ).toBeDefined() + + const generatedJoinerConfig = ( + resources.moduleService.prototype as IModuleService + ).__joinerConfig() + + expect(generatedJoinerConfig).toEqual({ + serviceName: "module-with-dml-mixed-without-joiner-config", + primaryKeys: ["id"], + linkableKeys: { + dml_entity_id: "DmlEntity", + entity_model_id: "EntityModel", + }, + alias: [ + { + name: ["dml_entity", "dml_entities"], + args: { + entity: "DmlEntity", + methodSuffix: "DmlEntities", + }, + }, + { + name: ["entity_model", "entity_models"], + args: { + entity: "EntityModel", + methodSuffix: "EntityModels", + }, + }, + ], + }) + }) + + test("should return the correct resources and generate the correct joiner config from DML entities", async () => { + const { ModuleService, entityModel, dmlEntity } = + ModuleWithDmlWithoutJoinerConfigFixtures + + const moduleResolution: ModuleResolution = { + resolutionPath: join( + __dirname, + "../__fixtures__/module-with-dml-without-joiner-config" + ), + definition: { + key: "module-with-dml-without-joiner-config", + registrationName: "service", + label: "Module with DML without joiner config", + defaultPackage: false, + defaultModuleDeclaration: { + scope: "internal", + resources: "shared", + }, + }, + } + + expect( + (ModuleService.prototype as IModuleService).__joinerConfig + ).toBeUndefined() + + const resources = await loadResources(moduleResolution) + + expect(resources).toBeDefined() + expect(resources.services).toHaveLength(1) + expect(resources.services[0]).toEqual(ModuleService) + expect(resources.models).toHaveLength(2) + expect(resources.models).toEqual( + expect.arrayContaining([ + expect.objectContaining({ name: upperCaseFirst(dmlEntity.name) }), + expect.objectContaining({ name: upperCaseFirst(entityModel.name) }), + ]) + ) + expect(resources.repositories).toHaveLength(0) + expect(resources.loaders).toHaveLength(2) + expect(resources.loaders).toEqual([ + expect.objectContaining({ name: "connectionLoader" }), + expect.objectContaining({ name: "containerLoader" }), + ]) + expect(resources.moduleService).toEqual(ModuleService) + + expect( + (resources.moduleService.prototype as IModuleService).__joinerConfig + ).toBeDefined() + + const generatedJoinerConfig = ( + resources.moduleService.prototype as IModuleService + ).__joinerConfig() + + expect(generatedJoinerConfig).toEqual({ + serviceName: "module-with-dml-without-joiner-config", + primaryKeys: ["id"], + linkableKeys: { + entity_model_id: "EntityModel", + dml_entity_id: "DmlEntity", + }, + alias: [ + { + name: ["entity_model", "entity_models"], + args: { + entity: "EntityModel", + methodSuffix: "EntityModels", + }, + }, + { + name: ["dml_entity", "dml_entities"], + args: { + entity: "DmlEntity", + methodSuffix: "DmlEntities", + }, + }, + ], + }) + }) + + test("should return the correct resources and generate the correct joiner config from mikro orm entities", async () => { + const { ModuleService, EntityModel, Entity2 } = + ModuleWithoutJoinerConfigFixtures + + const moduleResolution: ModuleResolution = { + resolutionPath: join( + __dirname, + "../__fixtures__/module-without-joiner-config" + ), + definition: { + key: "module-without-joiner-config", + registrationName: "service", + label: "Module without joiner config", + defaultPackage: false, + defaultModuleDeclaration: { + scope: "internal", + resources: "shared", + }, + }, + } + + expect( + (ModuleService.prototype as IModuleService).__joinerConfig + ).toBeUndefined() + + const resources = await loadResources(moduleResolution) + + expect(resources).toBeDefined() + expect(resources.services).toHaveLength(1) + expect(resources.services[0]).toEqual(ModuleService) + expect(resources.models).toHaveLength(2) + expect(resources.models).toEqual( + expect.arrayContaining([ + expect.objectContaining({ name: upperCaseFirst(EntityModel.name) }), + expect.objectContaining({ name: upperCaseFirst(Entity2.name) }), + ]) + ) + expect(resources.repositories).toHaveLength(0) + expect(resources.loaders).toHaveLength(2) + expect(resources.loaders).toEqual([ + expect.objectContaining({ name: "connectionLoader" }), + expect.objectContaining({ name: "containerLoader" }), + ]) + expect(resources.moduleService).toEqual(ModuleService) + + expect( + (resources.moduleService.prototype as IModuleService).__joinerConfig + ).toBeDefined() + + const generatedJoinerConfig = ( + resources.moduleService.prototype as IModuleService + ).__joinerConfig() + + expect(generatedJoinerConfig).toEqual({ + serviceName: "module-without-joiner-config", + primaryKeys: ["id"], + linkableKeys: { + entity2_id: "Entity2", + entity_model_id: "EntityModel", + }, + alias: [ + { + name: ["entity2", "entity2s"], + args: { + entity: "Entity2", + methodSuffix: "Entity2s", + }, + }, + { + name: ["entity_model", "entity_models"], + args: { + entity: "EntityModel", + methodSuffix: "EntityModels", + }, + }, + ], + }) + }) + + test("should return the correct resources and use the given joiner config", async () => { + const { ModuleService, EntityModel, Entity2 } = + ModuleWithJoinerConfigFixtures + + const moduleResolution: ModuleResolution = { + resolutionPath: join( + __dirname, + "../__fixtures__/module-with-joiner-config" + ), + definition: { + key: "module-without-joiner-config", + registrationName: "service", + label: "Module without joiner config", + defaultPackage: false, + defaultModuleDeclaration: { + scope: "internal", + resources: "shared", + }, + }, + } + + expect( + (ModuleService.prototype as IModuleService).__joinerConfig + ).toBeDefined() + + const resources = await loadResources(moduleResolution) + + expect(resources).toBeDefined() + expect(resources.services).toHaveLength(1) + expect(resources.services[0]).toEqual(ModuleService) + expect(resources.models).toHaveLength(2) + expect(resources.models).toEqual( + expect.arrayContaining([ + expect.objectContaining({ name: upperCaseFirst(EntityModel.name) }), + expect.objectContaining({ name: upperCaseFirst(Entity2.name) }), + ]) + ) + expect(resources.repositories).toHaveLength(0) + expect(resources.loaders).toHaveLength(2) + expect(resources.loaders).toEqual([ + expect.objectContaining({ name: "connectionLoader" }), + expect.objectContaining({ name: "containerLoader" }), + ]) + expect(resources.moduleService).toEqual(ModuleService) + + const generatedJoinerConfig = ( + resources.moduleService.prototype as IModuleService + ).__joinerConfig() + + expect(generatedJoinerConfig).toEqual({ + serviceName: "module-service", + primaryKeys: ["id"], + linkableKeys: {}, + alias: [ + { + name: ["custom_name"], + args: { + entity: "Custom", + methodSuffix: "Customs", + }, + }, + ], + }) + }) + }) +}) diff --git a/packages/core/modules-sdk/src/loaders/utils/load-internal.ts b/packages/core/modules-sdk/src/loaders/utils/load-internal.ts index 2e4fc89c30..5bf3fe9268 100644 --- a/packages/core/modules-sdk/src/loaders/utils/load-internal.ts +++ b/packages/core/modules-sdk/src/loaders/utils/load-internal.ts @@ -10,9 +10,12 @@ import { } from "@medusajs/types" import { ContainerRegistrationKeys, + createMedusaContainer, + createMikrORMEntity, + defineJoinerConfig, + DmlEntity, MedusaModuleType, ModulesSdkUtils, - createMedusaContainer, } from "@medusajs/utils" import { asFunction, asValue } from "awilix" import { statSync } from "fs" @@ -78,9 +81,9 @@ export async function loadInternalModule( if (resolution.resolutionPath) { moduleResources = await loadResources( - loadedModule?.loaders ?? [], resolution, - logger + logger, + loadedModule?.loaders ?? [] ) } @@ -180,9 +183,9 @@ export async function loadModuleMigrations( // Generate migration scripts if they are not present if (!runMigrations || !revertMigration) { const moduleResources = await loadResources( - loadedModule?.loaders ?? [], resolution, - console as unknown as Logger + console as unknown as Logger, + loadedModule?.loaders ?? [] ) const migrationScriptOptions = { @@ -240,10 +243,10 @@ async function importAllFromDir(path: string) { }) } -async function loadResources( - loadedModuleLoaders: ModuleLoaderFunction[], +export async function loadResources( moduleResolution: ModuleResolution, - logger: Logger + logger: Logger = console as unknown as Logger, + loadedModuleLoaders?: ModuleLoaderFunction[] ): Promise { let modulePath = moduleResolution.resolutionPath as string let normalizedPath = modulePath @@ -267,12 +270,21 @@ async function loadResources( ), ]) + const entityBuilder = createMikrORMEntity() const cleanupResources = (resources) => { - return Object.values(resources).filter( - (resource): resource is Function => { - return typeof resource === "function" - } - ) + return Object.values(resources) + .map((resource) => { + if (DmlEntity.isDmlEntity(resource)) { + return entityBuilder(resource as DmlEntity) + } + + if (typeof resource === "function") { + return resource + } + + return null + }) + .filter((v): v is Function => !!v) } const potentialServices = [...new Set(cleanupResources(services))] @@ -288,6 +300,12 @@ async function loadResources( migrationPath: normalizedPath + "/migrations", }) + generateJoinerConfigIfNecessary({ + moduleResolution, + service: moduleService, + models: potentialModels, + }) + return { services: potentialServices, models: potentialModels, @@ -342,7 +360,7 @@ async function runLoaders( } function prepareLoaders({ - loadedModuleLoaders, + loadedModuleLoaders = [] as ModuleLoaderFunction[], models, repositories, services, @@ -407,3 +425,23 @@ function prepareLoaders({ return finalLoaders } + +function generateJoinerConfigIfNecessary({ + moduleResolution, + service, + models, +}: { + moduleResolution: ModuleResolution + service: Constructor + models: Function[] +}) { + if (service.prototype.__joinerConfig) { + return + } + + service.prototype.__joinerConfig = function () { + return defineJoinerConfig(moduleResolution.definition.key, { + entityQueryingConfig: models, + }) + } +} diff --git a/packages/core/modules-sdk/src/medusa-app.ts b/packages/core/modules-sdk/src/medusa-app.ts index ccf614874d..04fee33aa2 100644 --- a/packages/core/modules-sdk/src/medusa-app.ts +++ b/packages/core/modules-sdk/src/medusa-app.ts @@ -18,19 +18,16 @@ import type { } from "@medusajs/types" import { ContainerRegistrationKeys, - ModulesSdkUtils, createMedusaContainer, isObject, isString, + Modules, + ModulesSdkUtils, promiseAll, } from "@medusajs/utils" import { asValue } from "awilix" import type { Knex } from "knex" -import { - MODULE_PACKAGE_NAMES, - ModuleRegistrationName, - Modules, -} from "./definitions" +import { MODULE_PACKAGE_NAMES, ModuleRegistrationName } from "./definitions" import { MedusaModule, RegisterModuleJoinerConfig } from "./medusa-module" import { RemoteLink } from "./remote-link" import { RemoteQuery } from "./remote-query" diff --git a/packages/core/modules-sdk/src/remote-link.ts b/packages/core/modules-sdk/src/remote-link.ts index 8fc0eb4e68..69f5bc7680 100644 --- a/packages/core/modules-sdk/src/remote-link.ts +++ b/packages/core/modules-sdk/src/remote-link.ts @@ -4,8 +4,7 @@ import { ModuleJoinerRelationship, } from "@medusajs/types" -import { isObject, promiseAll, toPascalCase } from "@medusajs/utils" -import { Modules } from "./definitions" +import { isObject, Modules, promiseAll, toPascalCase } from "@medusajs/utils" import { MedusaModule } from "./medusa-module" import { convertRecordsToLinkDefinition } from "./utils/convert-data-to-link-definition" import { linkingErrorMessage } from "./utils/linking-error" diff --git a/packages/core/utils/src/dml/__tests__/entity-builder.spec.ts b/packages/core/utils/src/dml/__tests__/entity-builder.spec.ts index 094a91218a..ed9628b7e8 100644 --- a/packages/core/utils/src/dml/__tests__/entity-builder.spec.ts +++ b/packages/core/utils/src/dml/__tests__/entity-builder.spec.ts @@ -3,6 +3,7 @@ import { MetadataStorage } from "@mikro-orm/core" import { EntityConstructor } from "../types" import { EntityBuilder } from "../entity-builder" import { createMikrORMEntity } from "../helpers/create-mikro-orm-entity" +import { DmlEntity } from "../entity" describe("Entity builder", () => { beforeEach(() => { @@ -10,6 +11,21 @@ describe("Entity builder", () => { }) describe("Entity builder | properties", () => { + test("should identify a DML entity correctly", () => { + const model = new EntityBuilder() + const user = model.define("user", { + id: model.number(), + username: model.text(), + email: model.text(), + }) + + expect(DmlEntity.isDmlEntity(user)).toBe(true) + + const nonDmlEntity = new Object() + + expect(DmlEntity.isDmlEntity(nonDmlEntity)).toBe(false) + }) + test("define an entity", () => { const model = new EntityBuilder() const user = model.define("user", { diff --git a/packages/core/utils/src/dml/entity-builder.ts b/packages/core/utils/src/dml/entity-builder.ts index 0495f422c2..1dd97850a3 100644 --- a/packages/core/utils/src/dml/entity-builder.ts +++ b/packages/core/utils/src/dml/entity-builder.ts @@ -10,9 +10,9 @@ import { BelongsTo } from "./relations/belongs-to" import { DateTimeProperty } from "./properties/date-time" import { ManyToMany } from "./relations/many-to-many" import type { + PropertyType, RelationshipOptions, RelationshipType, - PropertyType, } from "./types" import { NullableModifier } from "./properties/nullable" import { IdProperty } from "./properties/id" @@ -179,3 +179,5 @@ export class EntityBuilder { return new ManyToMany(entityBuilder, options || {}) } } + +export const model = new EntityBuilder() diff --git a/packages/core/utils/src/dml/entity.ts b/packages/core/utils/src/dml/entity.ts index 9bd8966b5f..c654608667 100644 --- a/packages/core/utils/src/dml/entity.ts +++ b/packages/core/utils/src/dml/entity.ts @@ -1,11 +1,13 @@ import { BelongsTo } from "./relations/belongs-to" import { - PropertyType, EntityCascades, - RelationshipType, ExtractEntityRelations, + PropertyType, + RelationshipType, } from "./types" +const IsDmlEntity = Symbol("isDmlEntity") + /** * Dml entity is a representation of a DML model with a unique * name, its schema and relationships. @@ -13,9 +15,26 @@ import { export class DmlEntity< Schema extends Record | RelationshipType> > { + [IsDmlEntity] = true + #cascades: EntityCascades = {} constructor(public name: string, public schema: Schema) {} + /** + * A static method to check if an entity is an instance of DmlEntity. + * It allows us to identify a specific object as being an instance of + * DmlEntity. + * + * @param entity + */ + static isDmlEntity(entity: unknown): entity is DmlEntity { + return ( + !!entity && + (entity instanceof DmlEntity || + (typeof entity === "object" && entity[IsDmlEntity] === true)) + ) + } + /** * Parse entity to get its underlying information */ diff --git a/packages/core/utils/src/dml/helpers/create-mikro-orm-entity.ts b/packages/core/utils/src/dml/helpers/create-mikro-orm-entity.ts index 47f5fdd986..dc026a9633 100644 --- a/packages/core/utils/src/dml/helpers/create-mikro-orm-entity.ts +++ b/packages/core/utils/src/dml/helpers/create-mikro-orm-entity.ts @@ -618,3 +618,5 @@ export function createMikrORMEntity() { ) as Infer } } + +export const toMikroORMEntity = createMikrORMEntity() diff --git a/packages/core/utils/src/dml/index.ts b/packages/core/utils/src/dml/index.ts index 73bd0fe2c3..e04b59b4da 100644 --- a/packages/core/utils/src/dml/index.ts +++ b/packages/core/utils/src/dml/index.ts @@ -1,2 +1,3 @@ export * from "./entity-builder" +export * from "./entity" export * from "./helpers/create-mikro-orm-entity" diff --git a/packages/core/utils/src/modules-sdk/medusa-service.ts b/packages/core/utils/src/modules-sdk/medusa-service.ts index fe389deffc..ad0018a400 100644 --- a/packages/core/utils/src/modules-sdk/medusa-service.ts +++ b/packages/core/utils/src/modules-sdk/medusa-service.ts @@ -22,6 +22,7 @@ import { } from "../common" import { InjectManager, MedusaContext } from "./decorators" import { ModuleRegistrationName } from "./definition" +import { DmlEntity } from "../dml" type BaseMethods = | "retrieve" @@ -83,16 +84,20 @@ type ExtractSingularName, K = keyof T> = Capitalize< * @deprecated should all notion of singular and plural be removed once all modules are aligned with the convention * The pluralize will move to where it should be used instead */ -type ExtractPluralName, K = keyof T> = T[K] extends { - plural?: string -} - ? T[K]["plural"] & string - : Pluralize +type ExtractPluralName, K = keyof T> = Capitalize< + T[K] extends { + plural?: string + } + ? T[K]["plural"] & string + : Pluralize +> // TODO: The future expected entry will be a DML object but in the meantime we have to maintain backward compatibility for ouw own modules and therefore we need to support Constructor as well as this temporary object type TEntityEntries = Record< Keys & string, - Constructor | { name?: string; singular?: string; plural?: string } + | Constructor + | DmlEntity + | { name?: string; singular?: string; plural?: string } > type ExtractKeysFromConfig = EntitiesConfig extends { diff --git a/packages/modules/api-key/integration-tests/__tests__/api-key-module-service.spec.ts b/packages/modules/api-key/integration-tests/__tests__/api-key-module-service.spec.ts index 64649a0797..81a434edb6 100644 --- a/packages/modules/api-key/integration-tests/__tests__/api-key-module-service.spec.ts +++ b/packages/modules/api-key/integration-tests/__tests__/api-key-module-service.spec.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { IApiKeyModuleService } from "@medusajs/types" -import { ApiKeyType } from "@medusajs/utils" +import { ApiKeyType, Modules } from "@medusajs/utils" import crypto from "crypto" import { moduleIntegrationTestRunner } from "medusa-test-utils" import { diff --git a/packages/modules/api-key/src/joiner-config.ts b/packages/modules/api-key/src/joiner-config.ts index f58891d8f3..7f7cb55a6c 100644 --- a/packages/modules/api-key/src/joiner-config.ts +++ b/packages/modules/api-key/src/joiner-config.ts @@ -1,8 +1,8 @@ -import { Modules } from "@medusajs/modules-sdk" import { buildEntitiesNameToLinkableKeysMap, defineJoinerConfig, MapToConfig, + Modules, } from "@medusajs/utils" export const joinerConfig = defineJoinerConfig(Modules.API_KEY) diff --git a/packages/modules/auth/integration-tests/__tests__/auth-module-service/auth-identity.spec.ts b/packages/modules/auth/integration-tests/__tests__/auth-module-service/auth-identity.spec.ts index 5815c6c0e4..3a1de6e87c 100644 --- a/packages/modules/auth/integration-tests/__tests__/auth-module-service/auth-identity.spec.ts +++ b/packages/modules/auth/integration-tests/__tests__/auth-module-service/auth-identity.spec.ts @@ -1,7 +1,7 @@ -import { Modules } from "@medusajs/modules-sdk" import { IAuthModuleService } from "@medusajs/types" -import { moduleIntegrationTestRunner, SuiteOptions } from "medusa-test-utils" import { createAuthIdentities } from "../../__fixtures__/auth-identity" +import { moduleIntegrationTestRunner } from "medusa-test-utils" +import { Modules } from "@medusajs/utils" jest.setTimeout(30000) diff --git a/packages/modules/auth/integration-tests/__tests__/auth-module-service/index.spec.ts b/packages/modules/auth/integration-tests/__tests__/auth-module-service/index.spec.ts index 489f54075f..1bcf63c531 100644 --- a/packages/modules/auth/integration-tests/__tests__/auth-module-service/index.spec.ts +++ b/packages/modules/auth/integration-tests/__tests__/auth-module-service/index.spec.ts @@ -1,7 +1,7 @@ -import { Modules } from "@medusajs/modules-sdk" import { IAuthModuleService } from "@medusajs/types" import { moduleIntegrationTestRunner, SuiteOptions } from "medusa-test-utils" import { resolve } from "path" +import { Modules } from "@medusajs/utils" let moduleOptions = { providers: [ diff --git a/packages/modules/auth/src/joiner-config.ts b/packages/modules/auth/src/joiner-config.ts index dd8c39a668..b0947b225f 100644 --- a/packages/modules/auth/src/joiner-config.ts +++ b/packages/modules/auth/src/joiner-config.ts @@ -3,8 +3,8 @@ import { buildEntitiesNameToLinkableKeysMap, defineJoinerConfig, MapToConfig, + Modules, } from "@medusajs/utils" -import { Modules } from "@medusajs/modules-sdk" export const joinerConfig = defineJoinerConfig(Modules.AUTH, { entityQueryingConfig: [AuthIdentity], diff --git a/packages/modules/cache-inmemory/package.json b/packages/modules/cache-inmemory/package.json index a5305701a2..2f6ab41b29 100644 --- a/packages/modules/cache-inmemory/package.json +++ b/packages/modules/cache-inmemory/package.json @@ -33,6 +33,7 @@ "test": "jest --passWithNoTests" }, "dependencies": { - "@medusajs/modules-sdk": "^1.12.3" + "@medusajs/modules-sdk": "^1.12.3", + "@medusajs/utils": "^1.11.9" } } diff --git a/packages/modules/cache-inmemory/src/initialize/index.ts b/packages/modules/cache-inmemory/src/initialize/index.ts index 80decde7af..5617a07159 100644 --- a/packages/modules/cache-inmemory/src/initialize/index.ts +++ b/packages/modules/cache-inmemory/src/initialize/index.ts @@ -2,10 +2,10 @@ import { ExternalModuleDeclaration, InternalModuleDeclaration, MedusaModule, - Modules, } from "@medusajs/modules-sdk" import { ICacheService } from "@medusajs/types" import { InMemoryCacheModuleOptions } from "../types" +import { Modules } from "@medusajs/utils" export const initialize = async ( options?: InMemoryCacheModuleOptions | ExternalModuleDeclaration diff --git a/packages/modules/cache-redis/package.json b/packages/modules/cache-redis/package.json index fc241280ff..c467c34d47 100644 --- a/packages/modules/cache-redis/package.json +++ b/packages/modules/cache-redis/package.json @@ -34,6 +34,7 @@ }, "dependencies": { "@medusajs/modules-sdk": "^1.12.11", + "@medusajs/utils": "^1.11.9", "awilix": "^8.0.0", "ioredis": "^5.3.1" } diff --git a/packages/modules/cache-redis/src/initialize/index.ts b/packages/modules/cache-redis/src/initialize/index.ts index 9d40e66558..94ae11212c 100644 --- a/packages/modules/cache-redis/src/initialize/index.ts +++ b/packages/modules/cache-redis/src/initialize/index.ts @@ -2,10 +2,10 @@ import { ExternalModuleDeclaration, InternalModuleDeclaration, MedusaModule, - Modules, } from "@medusajs/modules-sdk" import { ICacheService } from "@medusajs/types" import { RedisCacheModuleOptions } from "../types" +import { Modules } from "@medusajs/utils" export const initialize = async ( options?: RedisCacheModuleOptions | ExternalModuleDeclaration diff --git a/packages/modules/cart/integration-tests/__tests__/services/cart-module/index.spec.ts b/packages/modules/cart/integration-tests/__tests__/services/cart-module/index.spec.ts index d234ffbe0a..3161c9e9e6 100644 --- a/packages/modules/cart/integration-tests/__tests__/services/cart-module/index.spec.ts +++ b/packages/modules/cart/integration-tests/__tests__/services/cart-module/index.spec.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { ICartModuleService } from "@medusajs/types" -import { BigNumber } from "@medusajs/utils" +import { BigNumber, Modules } from "@medusajs/utils" import { CheckConstraintViolationException } from "@mikro-orm/core" import { moduleIntegrationTestRunner } from "medusa-test-utils" @@ -8,7 +7,7 @@ jest.setTimeout(50000) moduleIntegrationTestRunner({ moduleName: Modules.CART, - testSuite: ({ MikroOrmWrapper, service }) => { + testSuite: ({ service }) => { describe("Cart Module Service", () => { describe("create", () => { it("should throw an error when required params are not passed", async () => { diff --git a/packages/modules/cart/src/joiner-config.ts b/packages/modules/cart/src/joiner-config.ts index 1ce87ac804..b5c3118c6b 100644 --- a/packages/modules/cart/src/joiner-config.ts +++ b/packages/modules/cart/src/joiner-config.ts @@ -1,8 +1,8 @@ -import { Modules } from "@medusajs/modules-sdk" import { buildEntitiesNameToLinkableKeysMap, defineJoinerConfig, MapToConfig, + Modules, } from "@medusajs/utils" export const joinerConfig = defineJoinerConfig(Modules.CART) diff --git a/packages/modules/currency/integration-tests/__tests__/currency-module-service.spec.ts b/packages/modules/currency/integration-tests/__tests__/currency-module-service.spec.ts index 060ab2e2c9..113fa2b347 100644 --- a/packages/modules/currency/integration-tests/__tests__/currency-module-service.spec.ts +++ b/packages/modules/currency/integration-tests/__tests__/currency-module-service.spec.ts @@ -1,6 +1,6 @@ -import { Modules } from "@medusajs/modules-sdk" import { ICurrencyModuleService } from "@medusajs/types" import { moduleIntegrationTestRunner } from "medusa-test-utils" +import { Modules } from "@medusajs/utils" jest.setTimeout(100000) diff --git a/packages/modules/currency/src/joiner-config.ts b/packages/modules/currency/src/joiner-config.ts index a7c930d48a..06bdffed3d 100644 --- a/packages/modules/currency/src/joiner-config.ts +++ b/packages/modules/currency/src/joiner-config.ts @@ -1,8 +1,8 @@ -import { Modules } from "@medusajs/modules-sdk" import { buildEntitiesNameToLinkableKeysMap, defineJoinerConfig, MapToConfig, + Modules, } from "@medusajs/utils" export const joinerConfig = defineJoinerConfig(Modules.CURRENCY) diff --git a/packages/modules/customer/integration-tests/__tests__/services/customer-module/index.spec.ts b/packages/modules/customer/integration-tests/__tests__/services/customer-module/index.spec.ts index 2e0c2c6475..7654fb6026 100644 --- a/packages/modules/customer/integration-tests/__tests__/services/customer-module/index.spec.ts +++ b/packages/modules/customer/integration-tests/__tests__/services/customer-module/index.spec.ts @@ -1,6 +1,6 @@ import { ICustomerModuleService } from "@medusajs/types" import { moduleIntegrationTestRunner } from "medusa-test-utils" -import { Modules } from "@medusajs/modules-sdk" +import { Modules } from "@medusajs/utils" jest.setTimeout(30000) diff --git a/packages/modules/customer/src/joiner-config.ts b/packages/modules/customer/src/joiner-config.ts index a9ede100f2..4c4797584c 100644 --- a/packages/modules/customer/src/joiner-config.ts +++ b/packages/modules/customer/src/joiner-config.ts @@ -1,8 +1,8 @@ -import { Modules } from "@medusajs/modules-sdk" import { buildEntitiesNameToLinkableKeysMap, defineJoinerConfig, MapToConfig, + Modules, } from "@medusajs/utils" export const joinerConfig = defineJoinerConfig(Modules.CUSTOMER, { diff --git a/packages/modules/event-bus-local/src/initialize/index.ts b/packages/modules/event-bus-local/src/initialize/index.ts index 23ea34b9d0..a73eacd57a 100644 --- a/packages/modules/event-bus-local/src/initialize/index.ts +++ b/packages/modules/event-bus-local/src/initialize/index.ts @@ -1,5 +1,6 @@ -import { MedusaModule, Modules } from "@medusajs/modules-sdk" +import { MedusaModule } from "@medusajs/modules-sdk" import { IEventBusService } from "@medusajs/types" +import { Modules } from "@medusajs/utils" export const initialize = async (): Promise => { const serviceKey = Modules.EVENT_BUS diff --git a/packages/modules/event-bus-redis/src/initialize/index.ts b/packages/modules/event-bus-redis/src/initialize/index.ts index b091cb9414..59ce181814 100644 --- a/packages/modules/event-bus-redis/src/initialize/index.ts +++ b/packages/modules/event-bus-redis/src/initialize/index.ts @@ -2,10 +2,10 @@ import { ExternalModuleDeclaration, InternalModuleDeclaration, MedusaModule, - Modules, } from "@medusajs/modules-sdk" import { IEventBusService } from "@medusajs/types" import { EventBusRedisModuleOptions } from "../types" +import { Modules } from "@medusajs/utils" export const initialize = async ( options?: EventBusRedisModuleOptions | ExternalModuleDeclaration diff --git a/packages/modules/file/integration-tests/__tests__/module.spec.ts b/packages/modules/file/integration-tests/__tests__/module.spec.ts index df02a3a11e..401118a59e 100644 --- a/packages/modules/file/integration-tests/__tests__/module.spec.ts +++ b/packages/modules/file/integration-tests/__tests__/module.spec.ts @@ -1,8 +1,8 @@ import { resolve } from "path" -import { Modules } from "@medusajs/utils" import { moduleIntegrationTestRunner } from "medusa-test-utils" import { Entity, PrimaryKey } from "@mikro-orm/core" import { IFileModuleService } from "@medusajs/types" +import { Modules } from "@medusajs/utils" jest.setTimeout(100000) diff --git a/packages/modules/file/src/joiner-config.ts b/packages/modules/file/src/joiner-config.ts index e6caec270e..56558e8e82 100644 --- a/packages/modules/file/src/joiner-config.ts +++ b/packages/modules/file/src/joiner-config.ts @@ -1,8 +1,8 @@ -import { Modules } from "@medusajs/modules-sdk" import { buildEntitiesNameToLinkableKeysMap, defineJoinerConfig, MapToConfig, + Modules, } from "@medusajs/utils" export const joinerConfig = defineJoinerConfig(Modules.FILE, { diff --git a/packages/modules/fulfillment/integration-tests/__fixtures__/providers/default-provider.ts b/packages/modules/fulfillment/integration-tests/__fixtures__/providers/default-provider.ts index 00bda21149..caee5b3620 100644 --- a/packages/modules/fulfillment/integration-tests/__fixtures__/providers/default-provider.ts +++ b/packages/modules/fulfillment/integration-tests/__fixtures__/providers/default-provider.ts @@ -1,4 +1,4 @@ -import { AbstractFulfillmentProviderService } from "@medusajs/utils/src" +import { AbstractFulfillmentProviderService } from "@medusajs/utils" export class FulfillmentProviderServiceFixtures extends AbstractFulfillmentProviderService { static identifier = "fixtures-fulfillment-provider" diff --git a/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/fulfillment.spec.ts b/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/fulfillment.spec.ts index e0e553ed06..d76a7f4721 100644 --- a/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/fulfillment.spec.ts +++ b/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/fulfillment.spec.ts @@ -1,5 +1,4 @@ import { resolve } from "path" -import { Modules } from "@medusajs/modules-sdk" import { IFulfillmentModuleService, UpdateFulfillmentDTO, @@ -13,7 +12,7 @@ import { generateCreateFulfillmentData, generateCreateShippingOptionsData, } from "../../__fixtures__" -import { FulfillmentEvents } from "@medusajs/utils" +import { FulfillmentEvents, Modules } from "@medusajs/utils" jest.setTimeout(100000) diff --git a/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/geo-zone.spec.ts b/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/geo-zone.spec.ts index e582405cfe..a6eddf16b5 100644 --- a/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/geo-zone.spec.ts +++ b/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/geo-zone.spec.ts @@ -1,10 +1,9 @@ -import { Modules } from "@medusajs/modules-sdk" import { CreateGeoZoneDTO, IFulfillmentModuleService, UpdateGeoZoneDTO, } from "@medusajs/types" -import { FulfillmentEvents, GeoZoneType } from "@medusajs/utils" +import { FulfillmentEvents, GeoZoneType, Modules } from "@medusajs/utils" import { MockEventBusService, moduleIntegrationTestRunner, diff --git a/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/index.spec.ts b/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/index.spec.ts index 0660394199..6eec89dd32 100644 --- a/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/index.spec.ts +++ b/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/index.spec.ts @@ -1,4 +1,4 @@ -import { Modules, ModulesDefinition } from "@medusajs/modules-sdk" +import { ModulesDefinition } from "@medusajs/modules-sdk" import { FulfillmentSetDTO, IFulfillmentModuleService } from "@medusajs/types" import { initModules, @@ -9,6 +9,7 @@ import { resolve } from "path" import { createFullDataStructure } from "../../__fixtures__" import { FulfillmentProviderService } from "@services" import { FulfillmentProviderServiceFixtures } from "../../__fixtures__/providers" +import { Modules } from "@medusajs/utils" let moduleOptions = { providers: [ diff --git a/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/service-zone.spec.ts b/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/service-zone.spec.ts index 839e0a5cb3..3526cc1330 100644 --- a/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/service-zone.spec.ts +++ b/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/service-zone.spec.ts @@ -1,11 +1,10 @@ -import { Modules } from "@medusajs/modules-sdk" import { CreateServiceZoneDTO, GeoZoneDTO, IFulfillmentModuleService, UpdateServiceZoneDTO, } from "@medusajs/types" -import { FulfillmentEvents, GeoZoneType } from "@medusajs/utils" +import { FulfillmentEvents, GeoZoneType, Modules } from "@medusajs/utils" import { MockEventBusService, moduleIntegrationTestRunner, diff --git a/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/shipping-option.spec.ts b/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/shipping-option.spec.ts index 4972fba8ac..4000b30cb7 100644 --- a/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/shipping-option.spec.ts +++ b/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/shipping-option.spec.ts @@ -1,4 +1,3 @@ -import { Modules } from "@medusajs/modules-sdk" import { CreateShippingOptionDTO, IFulfillmentModuleService, @@ -14,7 +13,7 @@ import { import { resolve } from "path" import { FulfillmentProviderService } from "@services" import { FulfillmentProviderServiceFixtures } from "../../__fixtures__/providers" -import { FulfillmentEvents, GeoZoneType } from "@medusajs/utils" +import { FulfillmentEvents, GeoZoneType, Modules } from "@medusajs/utils" import { UpdateShippingOptionDTO } from "@medusajs/types/src" jest.setTimeout(100000) diff --git a/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/shipping-profile.spec.ts b/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/shipping-profile.spec.ts index e74b390396..21a42750b8 100644 --- a/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/shipping-profile.spec.ts +++ b/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/shipping-profile.spec.ts @@ -1,4 +1,3 @@ -import { Modules } from "@medusajs/modules-sdk" import { CreateShippingProfileDTO, IFulfillmentModuleService, @@ -8,7 +7,7 @@ import { moduleIntegrationTestRunner, } from "medusa-test-utils" import { buildExpectedEventMessageShape } from "../../__fixtures__" -import { FulfillmentEvents } from "@medusajs/utils" +import { FulfillmentEvents, Modules } from "@medusajs/utils" jest.setTimeout(100000) diff --git a/packages/modules/fulfillment/src/joiner-config.ts b/packages/modules/fulfillment/src/joiner-config.ts index d4b7358816..aeae17c335 100644 --- a/packages/modules/fulfillment/src/joiner-config.ts +++ b/packages/modules/fulfillment/src/joiner-config.ts @@ -1,8 +1,8 @@ -import { Modules } from "@medusajs/modules-sdk" import { buildEntitiesNameToLinkableKeysMap, defineJoinerConfig, MapToConfig, + Modules, } from "@medusajs/utils" import { Fulfillment, diff --git a/packages/modules/inventory-next/integration-tests/__tests__/inventory-module-service.spec.ts b/packages/modules/inventory-next/integration-tests/__tests__/inventory-module-service.spec.ts index f5644bc43d..ab8ccc694a 100644 --- a/packages/modules/inventory-next/integration-tests/__tests__/inventory-module-service.spec.ts +++ b/packages/modules/inventory-next/integration-tests/__tests__/inventory-module-service.spec.ts @@ -1,7 +1,6 @@ import { IInventoryService, InventoryItemDTO } from "@medusajs/types" import { moduleIntegrationTestRunner } from "medusa-test-utils" - -import { ModuleRegistrationName, Modules } from "@medusajs/modules-sdk" +import { Modules } from "@medusajs/utils" jest.setTimeout(100000) diff --git a/packages/modules/inventory-next/src/joiner-config.ts b/packages/modules/inventory-next/src/joiner-config.ts index fef4b81e5b..82ffa206db 100644 --- a/packages/modules/inventory-next/src/joiner-config.ts +++ b/packages/modules/inventory-next/src/joiner-config.ts @@ -2,8 +2,8 @@ import { buildEntitiesNameToLinkableKeysMap, defineJoinerConfig, MapToConfig, + Modules, } from "@medusajs/utils" -import { Modules } from "@medusajs/modules-sdk" export const joinerConfig = defineJoinerConfig(Modules.INVENTORY, { alias: [ diff --git a/packages/modules/link-modules/src/definitions/cart-payment-collection.ts b/packages/modules/link-modules/src/definitions/cart-payment-collection.ts index acd2fabbc9..99e4a27337 100644 --- a/packages/modules/link-modules/src/definitions/cart-payment-collection.ts +++ b/packages/modules/link-modules/src/definitions/cart-payment-collection.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { ModuleJoinerConfig } from "@medusajs/types" -import { LINKS } from "@medusajs/utils" +import { LINKS, Modules } from "@medusajs/utils" export const CartPaymentCollection: ModuleJoinerConfig = { serviceName: LINKS.CartPaymentCollection, diff --git a/packages/modules/link-modules/src/definitions/cart-promotion.ts b/packages/modules/link-modules/src/definitions/cart-promotion.ts index c8322d4467..11e04c9ec9 100644 --- a/packages/modules/link-modules/src/definitions/cart-promotion.ts +++ b/packages/modules/link-modules/src/definitions/cart-promotion.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { ModuleJoinerConfig } from "@medusajs/types" -import { LINKS } from "@medusajs/utils" +import { LINKS, Modules } from "@medusajs/utils" export const CartPromotion: ModuleJoinerConfig = { serviceName: LINKS.CartPromotion, diff --git a/packages/modules/link-modules/src/definitions/fulfillment-set-location.ts b/packages/modules/link-modules/src/definitions/fulfillment-set-location.ts index 9f23d73b62..448587feed 100644 --- a/packages/modules/link-modules/src/definitions/fulfillment-set-location.ts +++ b/packages/modules/link-modules/src/definitions/fulfillment-set-location.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { ModuleJoinerConfig } from "@medusajs/types" -import { LINKS } from "@medusajs/utils" +import { LINKS, Modules } from "@medusajs/utils" export const LocationFulfillmentSet: ModuleJoinerConfig = { serviceName: LINKS.LocationFulfillmentSet, diff --git a/packages/modules/link-modules/src/definitions/order-cart.ts b/packages/modules/link-modules/src/definitions/order-cart.ts index 9621fbfd61..2a017ec9dd 100644 --- a/packages/modules/link-modules/src/definitions/order-cart.ts +++ b/packages/modules/link-modules/src/definitions/order-cart.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { ModuleJoinerConfig } from "@medusajs/types" -import { LINKS } from "@medusajs/utils" +import { LINKS, Modules } from "@medusajs/utils" export const OrderCart: ModuleJoinerConfig = { serviceName: LINKS.OrderCart, diff --git a/packages/modules/link-modules/src/definitions/order-fulfillment.ts b/packages/modules/link-modules/src/definitions/order-fulfillment.ts index 3542e1577e..aa1d33b6ca 100644 --- a/packages/modules/link-modules/src/definitions/order-fulfillment.ts +++ b/packages/modules/link-modules/src/definitions/order-fulfillment.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { ModuleJoinerConfig } from "@medusajs/types" -import { LINKS } from "@medusajs/utils" +import { LINKS, Modules } from "@medusajs/utils" export const OrderFulfillment: ModuleJoinerConfig = { serviceName: LINKS.OrderFulfillment, diff --git a/packages/modules/link-modules/src/definitions/order-payment-collection.ts b/packages/modules/link-modules/src/definitions/order-payment-collection.ts index 5327afbe3c..59ba12e75a 100644 --- a/packages/modules/link-modules/src/definitions/order-payment-collection.ts +++ b/packages/modules/link-modules/src/definitions/order-payment-collection.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { ModuleJoinerConfig } from "@medusajs/types" -import { LINKS } from "@medusajs/utils" +import { LINKS, Modules } from "@medusajs/utils" export const OrderPaymentCollection: ModuleJoinerConfig = { serviceName: LINKS.OrderPaymentCollection, diff --git a/packages/modules/link-modules/src/definitions/order-promotion.ts b/packages/modules/link-modules/src/definitions/order-promotion.ts index e701ca71a1..3d66d6caea 100644 --- a/packages/modules/link-modules/src/definitions/order-promotion.ts +++ b/packages/modules/link-modules/src/definitions/order-promotion.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { ModuleJoinerConfig } from "@medusajs/types" -import { LINKS } from "@medusajs/utils" +import { LINKS, Modules } from "@medusajs/utils" export const OrderPromotion: ModuleJoinerConfig = { serviceName: LINKS.OrderPromotion, diff --git a/packages/modules/link-modules/src/definitions/product-sales-channel.ts b/packages/modules/link-modules/src/definitions/product-sales-channel.ts index f3a7efac99..f331b34375 100644 --- a/packages/modules/link-modules/src/definitions/product-sales-channel.ts +++ b/packages/modules/link-modules/src/definitions/product-sales-channel.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { ModuleJoinerConfig } from "@medusajs/types" -import { LINKS } from "@medusajs/utils" +import { LINKS, Modules } from "@medusajs/utils" export const ProductSalesChannel: ModuleJoinerConfig = { serviceName: LINKS.ProductSalesChannel, diff --git a/packages/modules/link-modules/src/definitions/product-variant-inventory-item.ts b/packages/modules/link-modules/src/definitions/product-variant-inventory-item.ts index d75ef5f261..e164162ed4 100644 --- a/packages/modules/link-modules/src/definitions/product-variant-inventory-item.ts +++ b/packages/modules/link-modules/src/definitions/product-variant-inventory-item.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { ModuleJoinerConfig } from "@medusajs/types" -import { LINKS } from "@medusajs/utils" +import { LINKS, Modules } from "@medusajs/utils" export const ProductVariantInventoryItem: ModuleJoinerConfig = { serviceName: LINKS.ProductVariantInventoryItem, diff --git a/packages/modules/link-modules/src/definitions/product-variant-price-set.ts b/packages/modules/link-modules/src/definitions/product-variant-price-set.ts index e2f80a678a..b712724b4a 100644 --- a/packages/modules/link-modules/src/definitions/product-variant-price-set.ts +++ b/packages/modules/link-modules/src/definitions/product-variant-price-set.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { ModuleJoinerConfig } from "@medusajs/types" -import { LINKS } from "@medusajs/utils" +import { LINKS, Modules } from "@medusajs/utils" export const ProductVariantPriceSet: ModuleJoinerConfig = { serviceName: LINKS.ProductVariantPriceSet, diff --git a/packages/modules/link-modules/src/definitions/publishable-api-key-sales-channel.ts b/packages/modules/link-modules/src/definitions/publishable-api-key-sales-channel.ts index 9da3cb1133..65403be53d 100644 --- a/packages/modules/link-modules/src/definitions/publishable-api-key-sales-channel.ts +++ b/packages/modules/link-modules/src/definitions/publishable-api-key-sales-channel.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { ModuleJoinerConfig } from "@medusajs/types" -import { LINKS } from "@medusajs/utils" +import { LINKS, Modules } from "@medusajs/utils" export const PublishableApiKeySalesChannel: ModuleJoinerConfig = { serviceName: LINKS.PublishableApiKeySalesChannel, diff --git a/packages/modules/link-modules/src/definitions/readonly/cart-customer.ts b/packages/modules/link-modules/src/definitions/readonly/cart-customer.ts index 30b8437803..eb93ab73d2 100644 --- a/packages/modules/link-modules/src/definitions/readonly/cart-customer.ts +++ b/packages/modules/link-modules/src/definitions/readonly/cart-customer.ts @@ -1,5 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { ModuleJoinerConfig } from "@medusajs/types" +import { Modules } from "@medusajs/utils" export const CartCustomer: ModuleJoinerConfig = { isLink: true, diff --git a/packages/modules/link-modules/src/definitions/readonly/cart-product.ts b/packages/modules/link-modules/src/definitions/readonly/cart-product.ts index a494d9d584..af0fc8e710 100644 --- a/packages/modules/link-modules/src/definitions/readonly/cart-product.ts +++ b/packages/modules/link-modules/src/definitions/readonly/cart-product.ts @@ -1,5 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { ModuleJoinerConfig } from "@medusajs/types" +import { Modules } from "@medusajs/utils" export const CartProduct: ModuleJoinerConfig = { isLink: true, diff --git a/packages/modules/link-modules/src/definitions/readonly/cart-region.ts b/packages/modules/link-modules/src/definitions/readonly/cart-region.ts index f7428fc02d..5041b2f0a4 100644 --- a/packages/modules/link-modules/src/definitions/readonly/cart-region.ts +++ b/packages/modules/link-modules/src/definitions/readonly/cart-region.ts @@ -1,5 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { ModuleJoinerConfig } from "@medusajs/types" +import { Modules } from "@medusajs/utils" export const CartRegion: ModuleJoinerConfig = { isLink: true, diff --git a/packages/modules/link-modules/src/definitions/readonly/cart-sales-channel.ts b/packages/modules/link-modules/src/definitions/readonly/cart-sales-channel.ts index 5e1cc94510..7d7347efce 100644 --- a/packages/modules/link-modules/src/definitions/readonly/cart-sales-channel.ts +++ b/packages/modules/link-modules/src/definitions/readonly/cart-sales-channel.ts @@ -1,5 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { ModuleJoinerConfig } from "@medusajs/types" +import { Modules } from "@medusajs/utils" export const CartSalesChannel: ModuleJoinerConfig = { isLink: true, diff --git a/packages/modules/link-modules/src/definitions/readonly/inventory-level-stock-location.ts b/packages/modules/link-modules/src/definitions/readonly/inventory-level-stock-location.ts index 212f6c7df6..a47056d5c7 100644 --- a/packages/modules/link-modules/src/definitions/readonly/inventory-level-stock-location.ts +++ b/packages/modules/link-modules/src/definitions/readonly/inventory-level-stock-location.ts @@ -1,5 +1,5 @@ import { ModuleJoinerConfig } from "@medusajs/types" -import { Modules } from "@medusajs/modules-sdk" +import { Modules } from "@medusajs/utils" export const InventoryLevelStockLocation: ModuleJoinerConfig = { isLink: true, diff --git a/packages/modules/link-modules/src/definitions/readonly/line-item-adjustment-promotion.ts b/packages/modules/link-modules/src/definitions/readonly/line-item-adjustment-promotion.ts index 57a35b87c6..f01166d28f 100644 --- a/packages/modules/link-modules/src/definitions/readonly/line-item-adjustment-promotion.ts +++ b/packages/modules/link-modules/src/definitions/readonly/line-item-adjustment-promotion.ts @@ -1,5 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { ModuleJoinerConfig } from "@medusajs/types" +import { Modules } from "@medusajs/utils" export const LineItemAdjustmentPromotion: ModuleJoinerConfig = { isLink: true, diff --git a/packages/modules/link-modules/src/definitions/readonly/order-customer.ts b/packages/modules/link-modules/src/definitions/readonly/order-customer.ts index aea2ee7612..81a77c99c7 100644 --- a/packages/modules/link-modules/src/definitions/readonly/order-customer.ts +++ b/packages/modules/link-modules/src/definitions/readonly/order-customer.ts @@ -1,5 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { ModuleJoinerConfig } from "@medusajs/types" +import { Modules } from "@medusajs/utils" export const OrderCustomer: ModuleJoinerConfig = { isLink: true, diff --git a/packages/modules/link-modules/src/definitions/readonly/order-product.ts b/packages/modules/link-modules/src/definitions/readonly/order-product.ts index 0a7562aeb4..776eac8f00 100644 --- a/packages/modules/link-modules/src/definitions/readonly/order-product.ts +++ b/packages/modules/link-modules/src/definitions/readonly/order-product.ts @@ -1,5 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { ModuleJoinerConfig } from "@medusajs/types" +import { Modules } from "@medusajs/utils" export const OrderProduct: ModuleJoinerConfig = { isLink: true, diff --git a/packages/modules/link-modules/src/definitions/readonly/order-region.ts b/packages/modules/link-modules/src/definitions/readonly/order-region.ts index a09bdb2b6d..0682b2e272 100644 --- a/packages/modules/link-modules/src/definitions/readonly/order-region.ts +++ b/packages/modules/link-modules/src/definitions/readonly/order-region.ts @@ -1,5 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { ModuleJoinerConfig } from "@medusajs/types" +import { Modules } from "@medusajs/utils" export const OrderRegion: ModuleJoinerConfig = { isLink: true, diff --git a/packages/modules/link-modules/src/definitions/readonly/order-sales-channel.ts b/packages/modules/link-modules/src/definitions/readonly/order-sales-channel.ts index 0b37eb8841..b5d6cc3c5c 100644 --- a/packages/modules/link-modules/src/definitions/readonly/order-sales-channel.ts +++ b/packages/modules/link-modules/src/definitions/readonly/order-sales-channel.ts @@ -1,6 +1,5 @@ import { ModuleJoinerConfig } from "@medusajs/types" - -import { Modules } from "@medusajs/modules-sdk" +import { Modules } from "@medusajs/utils" export const OrderSalesChannel: ModuleJoinerConfig = { isLink: true, diff --git a/packages/modules/link-modules/src/definitions/readonly/store-default-currency.ts b/packages/modules/link-modules/src/definitions/readonly/store-default-currency.ts index 9f0e82402c..d0018ef68b 100644 --- a/packages/modules/link-modules/src/definitions/readonly/store-default-currency.ts +++ b/packages/modules/link-modules/src/definitions/readonly/store-default-currency.ts @@ -1,5 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { ModuleJoinerConfig } from "@medusajs/types" +import { Modules } from "@medusajs/utils" export const StoreDefaultCurrency: ModuleJoinerConfig = { isLink: true, diff --git a/packages/modules/link-modules/src/definitions/region-payment-provider.ts b/packages/modules/link-modules/src/definitions/region-payment-provider.ts index 71d02ca56e..fcf41ae41d 100644 --- a/packages/modules/link-modules/src/definitions/region-payment-provider.ts +++ b/packages/modules/link-modules/src/definitions/region-payment-provider.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { ModuleJoinerConfig } from "@medusajs/types" -import { LINKS } from "@medusajs/utils" +import { LINKS, Modules } from "@medusajs/utils" export const RegionPaymentProvider: ModuleJoinerConfig = { serviceName: LINKS.RegionPaymentProvider, diff --git a/packages/modules/link-modules/src/definitions/sales-channel-location.ts b/packages/modules/link-modules/src/definitions/sales-channel-location.ts index 20c4f6cfb2..a5242cbb16 100644 --- a/packages/modules/link-modules/src/definitions/sales-channel-location.ts +++ b/packages/modules/link-modules/src/definitions/sales-channel-location.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { ModuleJoinerConfig } from "@medusajs/types" -import { LINKS } from "@medusajs/utils" +import { LINKS, Modules } from "@medusajs/utils" export const SalesChannelLocation: ModuleJoinerConfig = { serviceName: LINKS.SalesChannelLocation, diff --git a/packages/modules/link-modules/src/definitions/shipping-option-price-set.ts b/packages/modules/link-modules/src/definitions/shipping-option-price-set.ts index bbac11e125..cba1ec08f5 100644 --- a/packages/modules/link-modules/src/definitions/shipping-option-price-set.ts +++ b/packages/modules/link-modules/src/definitions/shipping-option-price-set.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { ModuleJoinerConfig } from "@medusajs/types" -import { LINKS } from "@medusajs/utils" +import { LINKS, Modules } from "@medusajs/utils" export const ShippingOptionPriceSet: ModuleJoinerConfig = { serviceName: LINKS.ShippingOptionPriceSet, diff --git a/packages/modules/notification/integration-tests/__fixtures__/providers/default-provider.ts b/packages/modules/notification/integration-tests/__fixtures__/providers/default-provider.ts index f9540a6920..829bb20357 100644 --- a/packages/modules/notification/integration-tests/__fixtures__/providers/default-provider.ts +++ b/packages/modules/notification/integration-tests/__fixtures__/providers/default-provider.ts @@ -1,5 +1,5 @@ import { NotificationTypes } from "@medusajs/types" -import { AbstractNotificationProviderService } from "@medusajs/utils/src" +import { AbstractNotificationProviderService } from "@medusajs/utils" export class NotificationProviderServiceFixtures extends AbstractNotificationProviderService { static identifier = "fixtures-notification-provider" diff --git a/packages/modules/notification/integration-tests/__tests__/notification-module-service/index.spec.ts b/packages/modules/notification/integration-tests/__tests__/notification-module-service/index.spec.ts index 93657addf7..f747165192 100644 --- a/packages/modules/notification/integration-tests/__tests__/notification-module-service/index.spec.ts +++ b/packages/modules/notification/integration-tests/__tests__/notification-module-service/index.spec.ts @@ -1,10 +1,10 @@ -import { Modules } from "@medusajs/modules-sdk" import { INotificationModuleService } from "@medusajs/types" import { moduleIntegrationTestRunner, SuiteOptions, } from "medusa-test-utils/dist" import { resolve } from "path" +import { Modules } from "@medusajs/utils" let moduleOptions = { providers: [ diff --git a/packages/modules/notification/src/joiner-config.ts b/packages/modules/notification/src/joiner-config.ts index f4d265f557..709cd9fc05 100644 --- a/packages/modules/notification/src/joiner-config.ts +++ b/packages/modules/notification/src/joiner-config.ts @@ -1,8 +1,8 @@ -import { Modules } from "@medusajs/modules-sdk" import { buildEntitiesNameToLinkableKeysMap, defineJoinerConfig, MapToConfig, + Modules, } from "@medusajs/utils" export const joinerConfig = defineJoinerConfig(Modules.NOTIFICATION, { diff --git a/packages/modules/order/integration-tests/__tests__/create-order.ts b/packages/modules/order/integration-tests/__tests__/create-order.ts index c353622c4b..f2731a78d4 100644 --- a/packages/modules/order/integration-tests/__tests__/create-order.ts +++ b/packages/modules/order/integration-tests/__tests__/create-order.ts @@ -1,6 +1,6 @@ -import { Modules } from "@medusajs/modules-sdk" import { CreateOrderDTO, IOrderModuleService } from "@medusajs/types" import { moduleIntegrationTestRunner } from "medusa-test-utils" +import { Modules } from "@medusajs/utils" jest.setTimeout(100000) diff --git a/packages/modules/order/integration-tests/__tests__/order-claim.ts b/packages/modules/order/integration-tests/__tests__/order-claim.ts index c06f7a61b0..6e36f2e172 100644 --- a/packages/modules/order/integration-tests/__tests__/order-claim.ts +++ b/packages/modules/order/integration-tests/__tests__/order-claim.ts @@ -1,7 +1,6 @@ -import {Modules} from "@medusajs/modules-sdk" -import {CreateOrderDTO, IOrderModuleService} from "@medusajs/types" -import {ClaimType} from "@medusajs/utils" -import {moduleIntegrationTestRunner, SuiteOptions} from "medusa-test-utils" +import { CreateOrderDTO, IOrderModuleService } from "@medusajs/types" +import { ClaimType, Modules } from "@medusajs/utils" +import { moduleIntegrationTestRunner, SuiteOptions } from "medusa-test-utils" jest.setTimeout(100000) diff --git a/packages/modules/order/integration-tests/__tests__/order-edit.ts b/packages/modules/order/integration-tests/__tests__/order-edit.ts index 320725ae71..c62e727a73 100644 --- a/packages/modules/order/integration-tests/__tests__/order-edit.ts +++ b/packages/modules/order/integration-tests/__tests__/order-edit.ts @@ -1,11 +1,10 @@ -import { Modules } from "@medusajs/modules-sdk" import { CreateOrderChangeActionDTO, CreateOrderChangeDTO, CreateOrderDTO, IOrderModuleService, } from "@medusajs/types" -import { BigNumber } from "@medusajs/utils" +import { BigNumber, Modules } from "@medusajs/utils" import { moduleIntegrationTestRunner } from "medusa-test-utils" import { ChangeActionType } from "../../src/utils" diff --git a/packages/modules/order/integration-tests/__tests__/order-exchange.ts b/packages/modules/order/integration-tests/__tests__/order-exchange.ts index e058f31e12..bd7b4086bf 100644 --- a/packages/modules/order/integration-tests/__tests__/order-exchange.ts +++ b/packages/modules/order/integration-tests/__tests__/order-exchange.ts @@ -1,6 +1,6 @@ -import {Modules} from "@medusajs/modules-sdk" -import {CreateOrderDTO, IOrderModuleService} from "@medusajs/types" -import {moduleIntegrationTestRunner, SuiteOptions} from "medusa-test-utils" +import { CreateOrderDTO, IOrderModuleService } from "@medusajs/types" +import { moduleIntegrationTestRunner, SuiteOptions } from "medusa-test-utils" +import { Modules } from "@medusajs/utils" jest.setTimeout(100000) diff --git a/packages/modules/order/integration-tests/__tests__/order-items-shipping.spec.ts b/packages/modules/order/integration-tests/__tests__/order-items-shipping.spec.ts index 2bb32369af..5de94ee091 100644 --- a/packages/modules/order/integration-tests/__tests__/order-items-shipping.spec.ts +++ b/packages/modules/order/integration-tests/__tests__/order-items-shipping.spec.ts @@ -1,9 +1,8 @@ -import { Modules } from "@medusajs/modules-sdk" import { CreateOrderLineItemTaxLineDTO, IOrderModuleService, } from "@medusajs/types" -import { OrderStatus } from "@medusajs/utils" +import { Modules, OrderStatus } from "@medusajs/utils" import { moduleIntegrationTestRunner } from "medusa-test-utils" jest.setTimeout(100000) @@ -1203,7 +1202,10 @@ moduleIntegrationTestRunner({ const [checkOrderOne, checkOrderTwo] = JSON.parse( JSON.stringify( - await service.listOrders({}, { relations: ["items.item.adjustments"] }) + await service.listOrders( + {}, + { relations: ["items.item.adjustments"] } + ) ) ) @@ -1718,12 +1720,16 @@ moduleIntegrationTestRunner({ }, ]) - const orderOneMethods = await (service as any).listOrderShippingMethods( + const orderOneMethods = await ( + service as any + ).listOrderShippingMethods( { order_id: orderOne.id }, { relations: ["shipping_method.adjustments"] } ) - const orderTwoMethods = await (service as any).listOrderShippingMethods( + const orderTwoMethods = await ( + service as any + ).listOrderShippingMethods( { order_id: orderTwo.id }, { relations: ["shipping_method.adjustments"] } ) @@ -2346,7 +2352,10 @@ moduleIntegrationTestRunner({ const [checkOrderOne, checkOrderTwo] = JSON.parse( JSON.stringify( - await service.listOrders({}, { relations: ["items.item.tax_lines"] }) + await service.listOrders( + {}, + { relations: ["items.item.tax_lines"] } + ) ) ) diff --git a/packages/modules/order/integration-tests/__tests__/order-return.ts b/packages/modules/order/integration-tests/__tests__/order-return.ts index 86b516dce2..e4cfc132bc 100644 --- a/packages/modules/order/integration-tests/__tests__/order-return.ts +++ b/packages/modules/order/integration-tests/__tests__/order-return.ts @@ -1,6 +1,6 @@ -import { Modules } from "@medusajs/modules-sdk" import { CreateOrderDTO, IOrderModuleService } from "@medusajs/types" import { moduleIntegrationTestRunner } from "medusa-test-utils" +import { Modules } from "@medusajs/utils" jest.setTimeout(1000000) diff --git a/packages/modules/order/integration-tests/__tests__/returns.ts b/packages/modules/order/integration-tests/__tests__/returns.ts index 74b5b558bc..8f07b2c973 100644 --- a/packages/modules/order/integration-tests/__tests__/returns.ts +++ b/packages/modules/order/integration-tests/__tests__/returns.ts @@ -1,6 +1,6 @@ -import { Modules } from "@medusajs/modules-sdk" import { IOrderModuleService } from "@medusajs/types" import { moduleIntegrationTestRunner } from "medusa-test-utils" +import { Modules } from "@medusajs/utils" jest.setTimeout(100000) diff --git a/packages/modules/order/src/joiner-config.ts b/packages/modules/order/src/joiner-config.ts index 4d045bf1e6..5717f1d452 100644 --- a/packages/modules/order/src/joiner-config.ts +++ b/packages/modules/order/src/joiner-config.ts @@ -1,8 +1,8 @@ -import { Modules } from "@medusajs/modules-sdk" import { buildEntitiesNameToLinkableKeysMap, defineJoinerConfig, MapToConfig, + Modules, } from "@medusajs/utils" // TODO: review configuration diff --git a/packages/modules/payment/integration-tests/__tests__/loaders/providers.spec.ts b/packages/modules/payment/integration-tests/__tests__/loaders/providers.spec.ts index d5a6bd6b32..df72ee2fb2 100644 --- a/packages/modules/payment/integration-tests/__tests__/loaders/providers.spec.ts +++ b/packages/modules/payment/integration-tests/__tests__/loaders/providers.spec.ts @@ -1,7 +1,7 @@ import { IPaymentModuleService } from "@medusajs/types" -import { Modules } from "@medusajs/modules-sdk" import { moduleIntegrationTestRunner } from "medusa-test-utils" +import { Modules } from "@medusajs/utils" jest.setTimeout(30000) diff --git a/packages/modules/payment/integration-tests/__tests__/services/payment-module/index.spec.ts b/packages/modules/payment/integration-tests/__tests__/services/payment-module/index.spec.ts index 99b630020d..278004554f 100644 --- a/packages/modules/payment/integration-tests/__tests__/services/payment-module/index.spec.ts +++ b/packages/modules/payment/integration-tests/__tests__/services/payment-module/index.spec.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { IPaymentModuleService } from "@medusajs/types" -import { promiseAll } from "@medusajs/utils" +import { Modules, promiseAll } from "@medusajs/utils" import { moduleIntegrationTestRunner } from "medusa-test-utils/dist" import { createPaymentCollections, diff --git a/packages/modules/payment/src/joiner-config.ts b/packages/modules/payment/src/joiner-config.ts index 045046193f..0be93aec88 100644 --- a/packages/modules/payment/src/joiner-config.ts +++ b/packages/modules/payment/src/joiner-config.ts @@ -1,8 +1,8 @@ -import { Modules } from "@medusajs/modules-sdk" import { buildEntitiesNameToLinkableKeysMap, defineJoinerConfig, MapToConfig, + Modules, } from "@medusajs/utils" import { Payment, diff --git a/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/calculate-price.spec.ts b/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/calculate-price.spec.ts index e891208536..11a5a5f3f2 100644 --- a/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/calculate-price.spec.ts +++ b/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/calculate-price.spec.ts @@ -1,11 +1,10 @@ -import { Modules } from "@medusajs/modules-sdk" import { CreatePriceRuleDTO, CreatePriceSetDTO, IPricingModuleService, PricingTypes, } from "@medusajs/types" -import { PriceListStatus, PriceListType } from "@medusajs/utils" +import { Modules, PriceListStatus, PriceListType } from "@medusajs/utils" import { moduleIntegrationTestRunner } from "medusa-test-utils" import { seedPriceData } from "../../../__fixtures__/seed-price-data" diff --git a/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/price-list-rule.spec.ts b/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/price-list-rule.spec.ts index c82864b993..5f7163aa20 100644 --- a/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/price-list-rule.spec.ts +++ b/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/price-list-rule.spec.ts @@ -1,10 +1,10 @@ -import { Modules } from "@medusajs/modules-sdk" import { IPricingModuleService } from "@medusajs/types" import { SqlEntityManager } from "@mikro-orm/postgresql" import { moduleIntegrationTestRunner } from "medusa-test-utils" import { createPriceLists } from "../../../__fixtures__/price-list" import { createPriceListRules } from "../../../__fixtures__/price-list-rules" import { createRuleTypes } from "../../../__fixtures__/rule-type" +import { Modules } from "@medusajs/utils" jest.setTimeout(30000) diff --git a/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/price-list.spec.ts b/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/price-list.spec.ts index f07c9c1718..9889a69bf7 100644 --- a/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/price-list.spec.ts +++ b/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/price-list.spec.ts @@ -1,4 +1,3 @@ -import { Modules } from "@medusajs/modules-sdk" import { IPricingModuleService } from "@medusajs/types" import { MockEventBusService, @@ -6,7 +5,12 @@ import { } from "medusa-test-utils" import { createPriceLists } from "../../../__fixtures__/price-list" import { createPriceSets } from "../../../__fixtures__/price-set" -import { CommonEvents, composeMessage, PricingEvents } from "@medusajs/utils" +import { + CommonEvents, + composeMessage, + Modules, + PricingEvents, +} from "@medusajs/utils" jest.setTimeout(30000) diff --git a/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/price-rule.spec.ts b/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/price-rule.spec.ts index a5ab2dba6e..4117bc74b1 100644 --- a/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/price-rule.spec.ts +++ b/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/price-rule.spec.ts @@ -1,4 +1,3 @@ -import { Modules } from "@medusajs/modules-sdk" import { IPricingModuleService } from "@medusajs/types" import { SqlEntityManager } from "@mikro-orm/postgresql" import { moduleIntegrationTestRunner } from "medusa-test-utils" @@ -7,6 +6,7 @@ import { createPrices } from "../../../__fixtures__/price" import { createPriceRules } from "../../../__fixtures__/price-rule" import { createPriceSets } from "../../../__fixtures__/price-set" import { createRuleTypes } from "../../../__fixtures__/rule-type" +import { Modules } from "@medusajs/utils" jest.setTimeout(30000) diff --git a/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/price-set.spec.ts b/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/price-set.spec.ts index efa05d3700..05ec0bc2d7 100644 --- a/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/price-set.spec.ts +++ b/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/price-set.spec.ts @@ -1,4 +1,3 @@ -import { Modules } from "@medusajs/modules-sdk" import { CreatePriceSetDTO, CreatePriceSetRuleTypeDTO, @@ -11,7 +10,12 @@ import { } from "medusa-test-utils" import { PriceSetRuleType } from "../../../../src/models" import { seedPriceData } from "../../../__fixtures__/seed-price-data" -import { CommonEvents, composeMessage, PricingEvents } from "@medusajs/utils" +import { + CommonEvents, + composeMessage, + Modules, + PricingEvents, +} from "@medusajs/utils" jest.setTimeout(30000) diff --git a/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/rule-type.spec.ts b/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/rule-type.spec.ts index 82efd6ba6f..99b84c3430 100644 --- a/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/rule-type.spec.ts +++ b/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/rule-type.spec.ts @@ -1,7 +1,7 @@ import { createRuleTypes } from "../../../__fixtures__/rule-type" import { moduleIntegrationTestRunner } from "medusa-test-utils" -import { Modules } from "@medusajs/modules-sdk" import { IPricingModuleService } from "@medusajs/types" +import { Modules } from "@medusajs/utils" jest.setTimeout(30000) diff --git a/packages/modules/pricing/src/joiner-config.ts b/packages/modules/pricing/src/joiner-config.ts index ce7c3cd2cb..5ff9fb071c 100644 --- a/packages/modules/pricing/src/joiner-config.ts +++ b/packages/modules/pricing/src/joiner-config.ts @@ -1,8 +1,8 @@ -import { Modules } from "@medusajs/modules-sdk" import { buildEntitiesNameToLinkableKeysMap, defineJoinerConfig, MapToConfig, + Modules, } from "@medusajs/utils" import { Price, PriceList, PriceSet, RuleType } from "@models" diff --git a/packages/modules/product/integration-tests/__tests__/product-category.ts b/packages/modules/product/integration-tests/__tests__/product-category.ts index d75285d105..795a555434 100644 --- a/packages/modules/product/integration-tests/__tests__/product-category.ts +++ b/packages/modules/product/integration-tests/__tests__/product-category.ts @@ -1,6 +1,5 @@ import { ProductCategoryService } from "@services" -import { Modules } from "@medusajs/modules-sdk" import { moduleIntegrationTestRunner } from "medusa-test-utils" import { eletronicsCategoriesData, @@ -8,6 +7,7 @@ import { productCategoriesRankData, } from "../__fixtures__/product-category/data" import { IProductModuleService } from "@medusajs/types" +import { Modules } from "@medusajs/utils" jest.setTimeout(30000) diff --git a/packages/modules/product/integration-tests/__tests__/product-module-service/product-categories.spec.ts b/packages/modules/product/integration-tests/__tests__/product-module-service/product-categories.spec.ts index f0b0db9fa9..e317d43c9f 100644 --- a/packages/modules/product/integration-tests/__tests__/product-module-service/product-categories.spec.ts +++ b/packages/modules/product/integration-tests/__tests__/product-module-service/product-categories.spec.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { IProductModuleService } from "@medusajs/types" -import { ProductStatus } from "@medusajs/utils" +import { Modules, ProductStatus } from "@medusajs/utils" import { Product, ProductCategory } from "@models" import { MockEventBusService, diff --git a/packages/modules/product/integration-tests/__tests__/product-module-service/product-collections.spec.ts b/packages/modules/product/integration-tests/__tests__/product-module-service/product-collections.spec.ts index a0761949c8..35a7aaa8de 100644 --- a/packages/modules/product/integration-tests/__tests__/product-module-service/product-collections.spec.ts +++ b/packages/modules/product/integration-tests/__tests__/product-module-service/product-collections.spec.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { IProductModuleService } from "@medusajs/types" -import { ProductStatus } from "@medusajs/utils" +import { Modules, ProductStatus } from "@medusajs/utils" import { Product, ProductCollection } from "@models" import { MockEventBusService, diff --git a/packages/modules/product/integration-tests/__tests__/product-module-service/product-options.spec.ts b/packages/modules/product/integration-tests/__tests__/product-module-service/product-options.spec.ts index 4208c190cf..4c05be17a1 100644 --- a/packages/modules/product/integration-tests/__tests__/product-module-service/product-options.spec.ts +++ b/packages/modules/product/integration-tests/__tests__/product-module-service/product-options.spec.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { IProductModuleService } from "@medusajs/types" -import { ProductStatus } from "@medusajs/utils" +import { Modules, ProductStatus } from "@medusajs/utils" import { Product, ProductOption } from "@models" import { moduleIntegrationTestRunner } from "medusa-test-utils" diff --git a/packages/modules/product/integration-tests/__tests__/product-module-service/product-tags.spec.ts b/packages/modules/product/integration-tests/__tests__/product-module-service/product-tags.spec.ts index 49e7d49018..5c3d2b5898 100644 --- a/packages/modules/product/integration-tests/__tests__/product-module-service/product-tags.spec.ts +++ b/packages/modules/product/integration-tests/__tests__/product-module-service/product-tags.spec.ts @@ -1,8 +1,8 @@ -import { Modules } from "@medusajs/modules-sdk" import { IProductModuleService } from "@medusajs/types" import { CommonEvents, composeMessage, + Modules, ProductEvents, ProductStatus, } from "@medusajs/utils" diff --git a/packages/modules/product/integration-tests/__tests__/product-module-service/product-types.spec.ts b/packages/modules/product/integration-tests/__tests__/product-module-service/product-types.spec.ts index c6d9ff6034..b938f141c0 100644 --- a/packages/modules/product/integration-tests/__tests__/product-module-service/product-types.spec.ts +++ b/packages/modules/product/integration-tests/__tests__/product-module-service/product-types.spec.ts @@ -1,7 +1,7 @@ -import { Modules } from "@medusajs/modules-sdk" import { IProductModuleService } from "@medusajs/types" import { ProductType } from "@models" import { moduleIntegrationTestRunner } from "medusa-test-utils" +import { Modules } from "@medusajs/utils" jest.setTimeout(30000) diff --git a/packages/modules/product/integration-tests/__tests__/product-module-service/product-variants.spec.ts b/packages/modules/product/integration-tests/__tests__/product-module-service/product-variants.spec.ts index 2dc8caaefe..70c4a7a72f 100644 --- a/packages/modules/product/integration-tests/__tests__/product-module-service/product-variants.spec.ts +++ b/packages/modules/product/integration-tests/__tests__/product-module-service/product-variants.spec.ts @@ -1,4 +1,3 @@ -import { Modules } from "@medusajs/modules-sdk" import { CreateProductDTO, CreateProductVariantDTO, @@ -9,6 +8,7 @@ import { import { CommonEvents, composeMessage, + Modules, ProductEvents, ProductStatus, } from "@medusajs/utils" diff --git a/packages/modules/product/integration-tests/__tests__/product-module-service/products.spec.ts b/packages/modules/product/integration-tests/__tests__/product-module-service/products.spec.ts index 82a90f7e47..7c7d198834 100644 --- a/packages/modules/product/integration-tests/__tests__/product-module-service/products.spec.ts +++ b/packages/modules/product/integration-tests/__tests__/product-module-service/products.spec.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { IProductModuleService, ProductCategoryDTO } from "@medusajs/types" -import { kebabCase, ProductStatus } from "@medusajs/utils" +import { kebabCase, Modules, ProductStatus } from "@medusajs/utils" import { Product, ProductCategory, diff --git a/packages/modules/product/integration-tests/__tests__/product.ts b/packages/modules/product/integration-tests/__tests__/product.ts index a16e80bad0..55269592dd 100644 --- a/packages/modules/product/integration-tests/__tests__/product.ts +++ b/packages/modules/product/integration-tests/__tests__/product.ts @@ -8,11 +8,10 @@ import { createProductVariants, } from "../__fixtures__/product" -import { Modules } from "@medusajs/modules-sdk" import { IProductModuleService, ProductDTO } from "@medusajs/types" -import { kebabCase, ProductStatus } from "@medusajs/utils" +import { kebabCase, Modules, ProductStatus } from "@medusajs/utils" import { SqlEntityManager } from "@mikro-orm/postgresql" -import { ProductService, ProductCategoryService } from "@services" +import { ProductCategoryService, ProductService } from "@services" import { moduleIntegrationTestRunner } from "medusa-test-utils" import { categoriesData, diff --git a/packages/modules/product/src/joiner-config.ts b/packages/modules/product/src/joiner-config.ts index 176497a006..551439b74a 100644 --- a/packages/modules/product/src/joiner-config.ts +++ b/packages/modules/product/src/joiner-config.ts @@ -1,8 +1,8 @@ -import { Modules } from "@medusajs/modules-sdk" import { buildEntitiesNameToLinkableKeysMap, defineJoinerConfig, MapToConfig, + Modules, } from "@medusajs/utils" export const joinerConfig = defineJoinerConfig(Modules.PRODUCT, { diff --git a/packages/modules/promotion/integration-tests/__tests__/services/promotion-module/campaign.spec.ts b/packages/modules/promotion/integration-tests/__tests__/services/promotion-module/campaign.spec.ts index 890d319d68..1c5ad7457b 100644 --- a/packages/modules/promotion/integration-tests/__tests__/services/promotion-module/campaign.spec.ts +++ b/packages/modules/promotion/integration-tests/__tests__/services/promotion-module/campaign.spec.ts @@ -1,9 +1,9 @@ -import { Modules } from "@medusajs/modules-sdk" import { IPromotionModuleService } from "@medusajs/types" import { moduleIntegrationTestRunner } from "medusa-test-utils" import { CampaignBudgetType } from "../../../../../../core/utils/src/promotion/index" import { createCampaigns } from "../../../__fixtures__/campaigns" import { createPromotions } from "../../../__fixtures__/promotion" +import { Modules } from "@medusajs/utils" jest.setTimeout(30000) diff --git a/packages/modules/promotion/integration-tests/__tests__/services/promotion-module/compute-actions.spec.ts b/packages/modules/promotion/integration-tests/__tests__/services/promotion-module/compute-actions.spec.ts index 19ccd55d10..95ef4af993 100644 --- a/packages/modules/promotion/integration-tests/__tests__/services/promotion-module/compute-actions.spec.ts +++ b/packages/modules/promotion/integration-tests/__tests__/services/promotion-module/compute-actions.spec.ts @@ -1,7 +1,6 @@ -import { Modules } from "@medusajs/modules-sdk" import { IPromotionModuleService } from "@medusajs/types" -import { ApplicationMethodType, PromotionType } from "@medusajs/utils" -import { SuiteOptions, moduleIntegrationTestRunner } from "medusa-test-utils" +import { ApplicationMethodType, Modules, PromotionType } from "@medusajs/utils" +import { moduleIntegrationTestRunner, SuiteOptions } from "medusa-test-utils" import { createCampaigns } from "../../../__fixtures__/campaigns" import { createDefaultPromotion } from "../../../__fixtures__/promotion" diff --git a/packages/modules/promotion/integration-tests/__tests__/services/promotion-module/promotion.spec.ts b/packages/modules/promotion/integration-tests/__tests__/services/promotion-module/promotion.spec.ts index 695314d3bf..72fe589fbf 100644 --- a/packages/modules/promotion/integration-tests/__tests__/services/promotion-module/promotion.spec.ts +++ b/packages/modules/promotion/integration-tests/__tests__/services/promotion-module/promotion.spec.ts @@ -1,8 +1,8 @@ -import { Modules } from "@medusajs/modules-sdk" import { IPromotionModuleService } from "@medusajs/types" import { ApplicationMethodType, CampaignBudgetType, + Modules, PromotionType, } from "@medusajs/utils" import { moduleIntegrationTestRunner, SuiteOptions } from "medusa-test-utils" diff --git a/packages/modules/promotion/integration-tests/__tests__/services/promotion-module/register-usage.spec.ts b/packages/modules/promotion/integration-tests/__tests__/services/promotion-module/register-usage.spec.ts index 0476ce5777..7eed12992b 100644 --- a/packages/modules/promotion/integration-tests/__tests__/services/promotion-module/register-usage.spec.ts +++ b/packages/modules/promotion/integration-tests/__tests__/services/promotion-module/register-usage.spec.ts @@ -1,8 +1,8 @@ -import { Modules } from "@medusajs/modules-sdk" import { IPromotionModuleService } from "@medusajs/types" import { moduleIntegrationTestRunner, SuiteOptions } from "medusa-test-utils" import { createCampaigns } from "../../../__fixtures__/campaigns" import { createDefaultPromotion } from "../../../__fixtures__/promotion" +import { Modules } from "@medusajs/utils" jest.setTimeout(30000) diff --git a/packages/modules/promotion/src/joiner-config.ts b/packages/modules/promotion/src/joiner-config.ts index a3cefbb16f..c3373592d4 100644 --- a/packages/modules/promotion/src/joiner-config.ts +++ b/packages/modules/promotion/src/joiner-config.ts @@ -1,8 +1,8 @@ -import { Modules } from "@medusajs/modules-sdk" import { buildEntitiesNameToLinkableKeysMap, defineJoinerConfig, MapToConfig, + Modules, } from "@medusajs/utils" import { Campaign, Promotion, PromotionRule } from "@models" diff --git a/packages/modules/region/integration-tests/__tests__/region-module.spec.ts b/packages/modules/region/integration-tests/__tests__/region-module.spec.ts index 6dc99b29fe..f0d9a3b9b9 100644 --- a/packages/modules/region/integration-tests/__tests__/region-module.spec.ts +++ b/packages/modules/region/integration-tests/__tests__/region-module.spec.ts @@ -1,6 +1,6 @@ -import { Modules } from "@medusajs/modules-sdk" import { IRegionModuleService } from "@medusajs/types" import { moduleIntegrationTestRunner } from "medusa-test-utils" +import { Modules } from "@medusajs/utils" jest.setTimeout(30000) diff --git a/packages/modules/region/src/joiner-config.ts b/packages/modules/region/src/joiner-config.ts index 780be956c6..4291e972c0 100644 --- a/packages/modules/region/src/joiner-config.ts +++ b/packages/modules/region/src/joiner-config.ts @@ -1,8 +1,8 @@ -import { Modules } from "@medusajs/modules-sdk" import { buildEntitiesNameToLinkableKeysMap, defineJoinerConfig, MapToConfig, + Modules, } from "@medusajs/utils" export const joinerConfig = defineJoinerConfig(Modules.REGION) diff --git a/packages/modules/sales-channel/integration-tests/__tests__/services/sales-channel-module.spec.ts b/packages/modules/sales-channel/integration-tests/__tests__/services/sales-channel-module.spec.ts index 94610fb43f..953409feb3 100644 --- a/packages/modules/sales-channel/integration-tests/__tests__/services/sales-channel-module.spec.ts +++ b/packages/modules/sales-channel/integration-tests/__tests__/services/sales-channel-module.spec.ts @@ -1,6 +1,6 @@ import { ISalesChannelModuleService } from "@medusajs/types" -import { moduleIntegrationTestRunner, SuiteOptions } from "medusa-test-utils" -import { Modules } from "@medusajs/modules-sdk" +import { moduleIntegrationTestRunner } from "medusa-test-utils" +import { Modules } from "@medusajs/utils" jest.setTimeout(30000) diff --git a/packages/modules/sales-channel/src/joiner-config.ts b/packages/modules/sales-channel/src/joiner-config.ts index d16648cb2b..26250f9174 100644 --- a/packages/modules/sales-channel/src/joiner-config.ts +++ b/packages/modules/sales-channel/src/joiner-config.ts @@ -1,8 +1,8 @@ -import { Modules } from "@medusajs/modules-sdk" import { buildEntitiesNameToLinkableKeysMap, defineJoinerConfig, MapToConfig, + Modules, } from "@medusajs/utils" export const joinerConfig = defineJoinerConfig(Modules.SALES_CHANNEL) diff --git a/packages/modules/stock-location-next/integration-tests/__tests__/stock-location-module-service.spec.ts b/packages/modules/stock-location-next/integration-tests/__tests__/stock-location-module-service.spec.ts index 31d0eba5f0..104de16c60 100644 --- a/packages/modules/stock-location-next/integration-tests/__tests__/stock-location-module-service.spec.ts +++ b/packages/modules/stock-location-next/integration-tests/__tests__/stock-location-module-service.spec.ts @@ -1,7 +1,7 @@ import { moduleIntegrationTestRunner } from "medusa-test-utils" import { IStockLocationService } from "@medusajs/types" -import { Modules } from "@medusajs/modules-sdk" +import { Modules } from "@medusajs/utils" jest.setTimeout(100000) diff --git a/packages/modules/stock-location-next/src/joiner-config.ts b/packages/modules/stock-location-next/src/joiner-config.ts index 07eaef92f6..b073aecfe2 100644 --- a/packages/modules/stock-location-next/src/joiner-config.ts +++ b/packages/modules/stock-location-next/src/joiner-config.ts @@ -1,8 +1,8 @@ -import { Modules } from "@medusajs/modules-sdk" import { buildEntitiesNameToLinkableKeysMap, defineJoinerConfig, MapToConfig, + Modules, } from "@medusajs/utils" import { StockLocation } from "./models" diff --git a/packages/modules/store/integration-tests/__tests__/store-module-service.spec.ts b/packages/modules/store/integration-tests/__tests__/store-module-service.spec.ts index 2a8e05c7eb..a7f05d2f0e 100644 --- a/packages/modules/store/integration-tests/__tests__/store-module-service.spec.ts +++ b/packages/modules/store/integration-tests/__tests__/store-module-service.spec.ts @@ -1,7 +1,7 @@ -import { Modules } from "@medusajs/modules-sdk" import { IStoreModuleService } from "@medusajs/types" import { moduleIntegrationTestRunner } from "medusa-test-utils" import { createStoreFixture } from "../__fixtures__" +import { Modules } from "@medusajs/utils" jest.setTimeout(100000) diff --git a/packages/modules/store/src/joiner-config.ts b/packages/modules/store/src/joiner-config.ts index 9e370a9f41..4f99f9f39f 100644 --- a/packages/modules/store/src/joiner-config.ts +++ b/packages/modules/store/src/joiner-config.ts @@ -1,8 +1,8 @@ -import { Modules } from "@medusajs/modules-sdk" import { buildEntitiesNameToLinkableKeysMap, defineJoinerConfig, MapToConfig, + Modules, } from "@medusajs/utils" export const joinerConfig = defineJoinerConfig(Modules.STORE) diff --git a/packages/modules/tax/integration-tests/__tests__/index.spec.ts b/packages/modules/tax/integration-tests/__tests__/index.spec.ts index 1e90c3e5c9..c5df98eded 100644 --- a/packages/modules/tax/integration-tests/__tests__/index.spec.ts +++ b/packages/modules/tax/integration-tests/__tests__/index.spec.ts @@ -1,7 +1,7 @@ import { moduleIntegrationTestRunner } from "medusa-test-utils" import { ITaxModuleService } from "@medusajs/types" -import { Modules } from "@medusajs/modules-sdk" import { setupTaxStructure } from "../utils/setup-tax-structure" +import { Modules } from "@medusajs/utils" jest.setTimeout(30000) diff --git a/packages/modules/tax/src/joiner-config.ts b/packages/modules/tax/src/joiner-config.ts index ad1d349c1e..8b885e986b 100644 --- a/packages/modules/tax/src/joiner-config.ts +++ b/packages/modules/tax/src/joiner-config.ts @@ -1,8 +1,8 @@ -import { Modules } from "@medusajs/modules-sdk" import { buildEntitiesNameToLinkableKeysMap, defineJoinerConfig, MapToConfig, + Modules, } from "@medusajs/utils" export const joinerConfig = defineJoinerConfig(Modules.TAX) diff --git a/packages/modules/user/integration-tests/__tests__/invite.spec.ts b/packages/modules/user/integration-tests/__tests__/invite.spec.ts index ce42e09e2f..32424c94aa 100644 --- a/packages/modules/user/integration-tests/__tests__/invite.spec.ts +++ b/packages/modules/user/integration-tests/__tests__/invite.spec.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" import { IUserModuleService } from "@medusajs/types/dist/user" -import { UserEvents } from "@medusajs/utils" +import { Modules, UserEvents } from "@medusajs/utils" import { MockEventBusService, moduleIntegrationTestRunner, diff --git a/packages/modules/user/integration-tests/__tests__/user.spec.ts b/packages/modules/user/integration-tests/__tests__/user.spec.ts index 2ffa00ac76..04ab162ea4 100644 --- a/packages/modules/user/integration-tests/__tests__/user.spec.ts +++ b/packages/modules/user/integration-tests/__tests__/user.spec.ts @@ -1,6 +1,5 @@ -import { Modules } from "@medusajs/modules-sdk" -import { IUserModuleService } from "@medusajs/types/dist/user" -import { UserEvents } from "@medusajs/utils" +import { IUserModuleService } from "@medusajs/types" +import { Modules, UserEvents } from "@medusajs/utils" import { MockEventBusService, moduleIntegrationTestRunner, diff --git a/packages/modules/user/src/joiner-config.ts b/packages/modules/user/src/joiner-config.ts index b1bbe5718c..6d4f655656 100644 --- a/packages/modules/user/src/joiner-config.ts +++ b/packages/modules/user/src/joiner-config.ts @@ -2,8 +2,8 @@ import { buildEntitiesNameToLinkableKeysMap, defineJoinerConfig, MapToConfig, + Modules, } from "@medusajs/utils" -import { Modules } from "@medusajs/modules-sdk" export const joinerConfig = defineJoinerConfig(Modules.USER) diff --git a/packages/modules/workflow-engine-inmemory/integration-tests/__tests__/index.spec.ts b/packages/modules/workflow-engine-inmemory/integration-tests/__tests__/index.spec.ts index 51f9d8d9bd..fff797151f 100644 --- a/packages/modules/workflow-engine-inmemory/integration-tests/__tests__/index.spec.ts +++ b/packages/modules/workflow-engine-inmemory/integration-tests/__tests__/index.spec.ts @@ -1,7 +1,10 @@ -import { Modules, RemoteQueryFunction } from "@medusajs/modules-sdk" import { WorkflowManager } from "@medusajs/orchestration" -import { Context, IWorkflowEngineService } from "@medusajs/types" -import { TransactionHandlerType } from "@medusajs/utils" +import { + Context, + IWorkflowEngineService, + RemoteQueryFunction, +} from "@medusajs/types" +import { Modules, TransactionHandlerType } from "@medusajs/utils" import { setTimeout as setTimeoutPromise } from "timers/promises" import "../__fixtures__" import { workflow2Step2Invoke, workflow2Step3Invoke } from "../__fixtures__" diff --git a/packages/modules/workflow-engine-inmemory/src/joiner-config.ts b/packages/modules/workflow-engine-inmemory/src/joiner-config.ts index 6c66786707..585b9fa4f0 100644 --- a/packages/modules/workflow-engine-inmemory/src/joiner-config.ts +++ b/packages/modules/workflow-engine-inmemory/src/joiner-config.ts @@ -1,8 +1,8 @@ -import { Modules } from "@medusajs/modules-sdk" import { buildEntitiesNameToLinkableKeysMap, defineJoinerConfig, MapToConfig, + Modules, } from "@medusajs/utils" export const joinerConfig = defineJoinerConfig(Modules.WORKFLOW_ENGINE) diff --git a/packages/modules/workflow-engine-redis/src/joiner-config.ts b/packages/modules/workflow-engine-redis/src/joiner-config.ts index 6c66786707..585b9fa4f0 100644 --- a/packages/modules/workflow-engine-redis/src/joiner-config.ts +++ b/packages/modules/workflow-engine-redis/src/joiner-config.ts @@ -1,8 +1,8 @@ -import { Modules } from "@medusajs/modules-sdk" import { buildEntitiesNameToLinkableKeysMap, defineJoinerConfig, MapToConfig, + Modules, } from "@medusajs/utils" export const joinerConfig = defineJoinerConfig(Modules.WORKFLOW_ENGINE) diff --git a/yarn.lock b/yarn.lock index df783b8e40..b90818d683 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4308,6 +4308,7 @@ __metadata: dependencies: "@medusajs/modules-sdk": ^1.12.3 "@medusajs/types": ^1.11.6 + "@medusajs/utils": ^1.11.9 cross-env: ^5.2.1 jest: ^29.7.0 rimraf: ^5.0.1 @@ -4321,6 +4322,7 @@ __metadata: dependencies: "@medusajs/modules-sdk": ^1.12.11 "@medusajs/types": ^1.11.16 + "@medusajs/utils": ^1.11.9 awilix: ^8.0.0 cross-env: ^5.2.1 ioredis: ^5.3.1 @@ -4850,6 +4852,7 @@ __metadata: "@medusajs/orchestration": ^0.5.7 "@medusajs/types": ^1.11.16 "@medusajs/utils": ^1.11.9 + "@mikro-orm/core": 5.9.7 awilix: ^8.0.0 cross-env: ^5.2.1 graphql: ^16.6.0