chore: make module loaders DML aware and auto generate joiner config (#7781)
* chore: make module loaders DML aware and auto generate joiner config * fixes and cleanup * improve dml entity check * add unit tests on load resources * cleanup deps * cleanup deps * cleanup Modules * finalise * fix modules-sdk jest * fix modules-sdk jest * fix import * fix import
This commit is contained in:
1 parent
03924a4ff6
commit
937a632eb6
191 files changed
+822
-330
No files matched your search
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
+2
-2
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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 = [
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
+2
-3
@@ -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(
|
||||
|
||||
@@ -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[] }
|
||||
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
+6
-3
@@ -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"
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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[]
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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[] }
|
||||
|
||||
|
||||
@@ -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[] }
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
+2
-3
@@ -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: {
|
||||
|
||||
+1
-2
@@ -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 {
|
||||
|
||||
@@ -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: {
|
||||
|
||||
+2
-3
@@ -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: {
|
||||
|
||||
@@ -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[] }
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
+2
-3
@@ -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: {
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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`],
|
||||
}
|
||||
@@ -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",
|
||||
|
||||
@@ -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,8 +60,9 @@ export const MODULE_PACKAGE_NAMES = {
|
||||
[Modules.NOTIFICATION]: "@medusajs/notification",
|
||||
}
|
||||
|
||||
export const ModulesDefinition: { [key: string | Modules]: ModuleDefinition } =
|
||||
{
|
||||
export const ModulesDefinition: {
|
||||
[key: string]: ModuleDefinition
|
||||
} = {
|
||||
[Modules.EVENT_BUS]: {
|
||||
key: Modules.EVENT_BUS,
|
||||
registrationName: ModuleRegistrationName.EVENT_BUS,
|
||||
|
||||
@@ -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"
|
||||
+11
@@ -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
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import { model } from "@medusajs/utils"
|
||||
|
||||
export const dmlEntity = model.define("dmlEntity", {
|
||||
name: model.text(),
|
||||
})
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { Entity, Property } from "@mikro-orm/core"
|
||||
|
||||
@Entity()
|
||||
export class EntityModel {
|
||||
@Property({ columnType: "int" })
|
||||
id!: number
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export * from "./entity"
|
||||
export * from "./dml-entity"
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
import { IModuleService } from "@medusajs/types"
|
||||
|
||||
export class ModuleService implements IModuleService {}
|
||||
+11
@@ -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
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import { model } from "@medusajs/utils"
|
||||
|
||||
export const entityModel = model.define("entityModel", {
|
||||
name: model.text(),
|
||||
})
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import { model } from "@medusajs/utils"
|
||||
|
||||
export const dmlEntity = model.define("dmlEntity", {
|
||||
name: model.text(),
|
||||
})
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export * from "./dml-entity"
|
||||
export * from "./dml-entity-model"
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
import { IModuleService } from "@medusajs/types"
|
||||
|
||||
export class ModuleService implements IModuleService {}
|
||||
+11
@@ -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
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { Entity, Property } from "@mikro-orm/core"
|
||||
|
||||
@Entity()
|
||||
export class Entity2 {
|
||||
@Property({ columnType: "int" })
|
||||
id!: number
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { Entity, Property } from "@mikro-orm/core"
|
||||
|
||||
@Entity()
|
||||
export class EntityModel {
|
||||
@Property({ columnType: "int" })
|
||||
id!: number
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export * from "./entity"
|
||||
export * from "./entity-2"
|
||||
+17
@@ -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",
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
}
|
||||
}
|
||||
+11
@@ -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
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { Entity, Property } from "@mikro-orm/core"
|
||||
|
||||
@Entity()
|
||||
export class Entity2 {
|
||||
@Property({ columnType: "int" })
|
||||
id!: number
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { Entity, Property } from "@mikro-orm/core"
|
||||
|
||||
@Entity()
|
||||
export class EntityModel {
|
||||
@Property({ columnType: "int" })
|
||||
id!: number
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export * from "./entity"
|
||||
export * from "./entity-2"
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
import { IModuleService } from "@medusajs/types"
|
||||
|
||||
export class ModuleService implements IModuleService {}
|
||||
@@ -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",
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -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<ModuleResource> {
|
||||
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<any>)
|
||||
}
|
||||
)
|
||||
|
||||
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<IModuleService>
|
||||
models: Function[]
|
||||
}) {
|
||||
if (service.prototype.__joinerConfig) {
|
||||
return
|
||||
}
|
||||
|
||||
service.prototype.__joinerConfig = function () {
|
||||
return defineJoinerConfig(moduleResolution.definition.key, {
|
||||
entityQueryingConfig: models,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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", {
|
||||
|
||||
@@ -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<T>(entityBuilder, options || {})
|
||||
}
|
||||
}
|
||||
|
||||
export const model = new EntityBuilder()
|
||||
@@ -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<string, PropertyType<any> | RelationshipType<any>>
|
||||
> {
|
||||
[IsDmlEntity] = true
|
||||
|
||||
#cascades: EntityCascades<string[]> = {}
|
||||
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<any> {
|
||||
return (
|
||||
!!entity &&
|
||||
(entity instanceof DmlEntity ||
|
||||
(typeof entity === "object" && entity[IsDmlEntity] === true))
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse entity to get its underlying information
|
||||
*/
|
||||
|
||||
@@ -618,3 +618,5 @@ export function createMikrORMEntity() {
|
||||
) as Infer<T>
|
||||
}
|
||||
}
|
||||
|
||||
export const toMikroORMEntity = createMikrORMEntity()
|
||||
@@ -1,2 +1,3 @@
|
||||
export * from "./entity-builder"
|
||||
export * from "./entity"
|
||||
export * from "./helpers/create-mikro-orm-entity"
|
||||
@@ -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<T extends Record<any, any>, 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<T extends Record<any, any>, K = keyof T> = T[K] extends {
|
||||
type ExtractPluralName<T extends Record<any, any>, K = keyof T> = Capitalize<
|
||||
T[K] extends {
|
||||
plural?: string
|
||||
}
|
||||
? T[K]["plural"] & string
|
||||
: Pluralize<K & string>
|
||||
>
|
||||
|
||||
// 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<any> as well as this temporary object
|
||||
type TEntityEntries<Keys = string> = Record<
|
||||
Keys & string,
|
||||
Constructor<any> | { name?: string; singular?: string; plural?: string }
|
||||
| Constructor<any>
|
||||
| DmlEntity<any>
|
||||
| { name?: string; singular?: string; plural?: string }
|
||||
>
|
||||
|
||||
type ExtractKeysFromConfig<EntitiesConfig> = EntitiesConfig extends {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
+2
-2
@@ -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)
|
||||
|
||||
|
||||
@@ -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: [
|
||||
|
||||
@@ -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],
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@medusajs/modules-sdk": "^1.12.11",
|
||||
"@medusajs/utils": "^1.11.9",
|
||||
"awilix": "^8.0.0",
|
||||
"ioredis": "^5.3.1"
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
+2
-3
@@ -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<ICartModuleService>({
|
||||
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 () => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
import {
|
||||
buildEntitiesNameToLinkableKeysMap,
|
||||
defineJoinerConfig,
|
||||
MapToConfig,
|
||||
Modules,
|
||||
} from "@medusajs/utils"
|
||||
|
||||
export const joinerConfig = defineJoinerConfig(Modules.CART)
|
||||
|
||||
+1
-1
@@ -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)
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
import {
|
||||
buildEntitiesNameToLinkableKeysMap,
|
||||
defineJoinerConfig,
|
||||
MapToConfig,
|
||||
Modules,
|
||||
} from "@medusajs/utils"
|
||||
|
||||
export const joinerConfig = defineJoinerConfig(Modules.CURRENCY)
|
||||
|
||||
+1
-1
@@ -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)
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
import {
|
||||
buildEntitiesNameToLinkableKeysMap,
|
||||
defineJoinerConfig,
|
||||
MapToConfig,
|
||||
Modules,
|
||||
} from "@medusajs/utils"
|
||||
|
||||
export const joinerConfig = defineJoinerConfig(Modules.CUSTOMER, {
|
||||
|
||||
@@ -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<IEventBusService> => {
|
||||
const serviceKey = Modules.EVENT_BUS
|
||||
|
||||
Loaded 100 of 191 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user