diff --git a/.eslintrc.js b/.eslintrc.js index ff4a8c6aba..dabb9e9d6a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -88,7 +88,6 @@ module.exports = { "./packages/cli/create-medusa-app/tsconfig.json", "./packages/cli/medusa-cli/tsconfig.spec.json", - "./packages/cli/medusa-dev-cli/tsconfig.spec.json", "./packages/cli/oas/medusa-oas-cli/tsconfig.spec.json", "./packages/core/orchestration/tsconfig.json", diff --git a/integration-tests/modules/__tests__/link-modules/index.ts b/integration-tests/modules/__tests__/link-modules/index.ts index f64c64a5e0..3c4579e826 100644 --- a/integration-tests/modules/__tests__/link-modules/index.ts +++ b/integration-tests/modules/__tests__/link-modules/index.ts @@ -1,5 +1,6 @@ import { getMigrationPlanner, initialize } from "@medusajs/link-modules" -import { MedusaModule, ModuleJoinerConfig } from "@medusajs/modules-sdk" +import { MedusaModule } from "@medusajs/modules-sdk" +import { ModuleJoinerConfig } from "@medusajs/types" import { medusaIntegrationTestRunner } from "medusa-test-utils" jest.setTimeout(5000000) diff --git a/integration-tests/modules/helpers/create-variant-price-set.ts b/integration-tests/modules/helpers/create-variant-price-set.ts index ab4efd4f0d..d9228df07c 100644 --- a/integration-tests/modules/helpers/create-variant-price-set.ts +++ b/integration-tests/modules/helpers/create-variant-price-set.ts @@ -1,7 +1,7 @@ -import { MedusaContainer } from "@medusajs/modules-sdk" import { CreatePriceSetDTO, IPricingModuleService, + MedusaContainer, PriceSetDTO, } from "@medusajs/types" import { Modules } from "@medusajs/utils" diff --git a/packages/cli/medusa-cli/cli.js b/packages/cli/medusa-cli/cli.js index c838a76c43..9a776a25eb 100755 --- a/packages/cli/medusa-cli/cli.js +++ b/packages/cli/medusa-cli/cli.js @@ -1,4 +1,5 @@ #!/usr/bin/env node + try { require("ts-node").register({}) } catch {} diff --git a/packages/cli/medusa-cli/package.json b/packages/cli/medusa-cli/package.json index ceb26ae027..5ccd24ac37 100644 --- a/packages/cli/medusa-cli/package.json +++ b/packages/cli/medusa-cli/package.json @@ -39,12 +39,10 @@ "typescript": "^5.3.3" }, "dependencies": { - "@medusajs/utils": "^1.11.2", + "@medusajs/utils": "^1.11.9", "axios": "^0.21.4", "chalk": "^4.0.0", "configstore": "5.0.1", - "core-js": "^3.6.5", - "dotenv": "^16.4.5", "execa": "^5.1.1", "fs-exists-cached": "^1.0.0", "fs-extra": "^10.0.0", @@ -59,13 +57,15 @@ "pg": "^8.11.3", "pg-god": "^1.0.12", "prompts": "^2.4.2", - "regenerator-runtime": "^0.13.11", "resolve-cwd": "^3.0.0", "semver": "^7.3.8", "stack-trace": "^0.0.10", - "ulid": "^2.3.0", "winston": "^3.8.2", "yargs": "^15.3.1" }, + "peerDependencies": { + "dotenv": "*", + "ulid": "*" + }, "gitHead": "81a7ff73d012fda722f6e9ef0bd9ba0232d37808" } diff --git a/packages/cli/medusa-cli/src/index.ts b/packages/cli/medusa-cli/src/index.ts index d7ee720500..c81cafb5af 100644 --- a/packages/cli/medusa-cli/src/index.ts +++ b/packages/cli/medusa-cli/src/index.ts @@ -1,7 +1,5 @@ #!/usr/bin/env node -import "core-js/stable" -import "regenerator-runtime/runtime" import os from "os" import util from "util" import createCli from "./create-cli" diff --git a/packages/cli/oas/medusa-oas-cli/package.json b/packages/cli/oas/medusa-oas-cli/package.json index ba94549a1b..658a8af2e1 100644 --- a/packages/cli/oas/medusa-oas-cli/package.json +++ b/packages/cli/oas/medusa-oas-cli/package.json @@ -37,7 +37,7 @@ }, "dependencies": { "@medusajs/medusa": "^1.20.4", - "@medusajs/utils": "^1.11.8", + "@medusajs/utils": "^1.11.9", "@readme/json-schema-ref-parser": "^1.2.0", "@readme/openapi-parser": "^2.4.0", "@redocly/cli": "^1.7.0", diff --git a/packages/core/core-flows/package.json b/packages/core/core-flows/package.json index 47b3a67a32..86a706a52d 100644 --- a/packages/core/core-flows/package.json +++ b/packages/core/core-flows/package.json @@ -34,8 +34,11 @@ "@medusajs/orchestration": "^0.5.7", "@medusajs/utils": "^1.11.9", "@medusajs/workflows-sdk": "^0.1.6", - "awilix": "^8.0.1", - "ulid": "^2.3.0" + "json-2-csv": "^5.5.4" + }, + "peerDependencies": { + "awilix": "*", + "ulid": "*" }, "scripts": { "prepublishOnly": "cross-env NODE_ENV=production tsc --build", diff --git a/packages/core/core-flows/src/common/steps/create-remote-links.ts b/packages/core/core-flows/src/common/steps/create-remote-links.ts index abd28f403a..e2ff5ff168 100644 --- a/packages/core/core-flows/src/common/steps/create-remote-links.ts +++ b/packages/core/core-flows/src/common/steps/create-remote-links.ts @@ -1,15 +1,16 @@ -import { LinkDefinition, RemoteLink } from "@medusajs/modules-sdk" +import { RemoteLink } from "@medusajs/modules-sdk" +import { LinkDefinition } from "@medusajs/types" import { ContainerRegistrationKeys } from "@medusajs/utils" import { createStep, StepResponse } from "@medusajs/workflows-sdk" export const createLinksStepId = "create-remote-links" /** * This step creates remote links between two records of linked data models. - * + * * Learn more in the [Remote Link documentation.](https://docs.medusajs.com/v2/advanced-development/modules/remote-link#create-link). - * + * * @example - * import { + * import { * createWorkflow * } from "@medusajs/workflows-sdk" * import { @@ -18,7 +19,7 @@ export const createLinksStepId = "create-remote-links" * import { * Modules * } from "@medusajs/utils" - * + * * const helloWorldWorkflow = createWorkflow( * "hello-world", * () => { diff --git a/packages/core/core-flows/src/common/steps/dismiss-remote-links.ts b/packages/core/core-flows/src/common/steps/dismiss-remote-links.ts index 1e5a08906b..4b290a733c 100644 --- a/packages/core/core-flows/src/common/steps/dismiss-remote-links.ts +++ b/packages/core/core-flows/src/common/steps/dismiss-remote-links.ts @@ -1,4 +1,5 @@ -import { LinkDefinition, RemoteLink } from "@medusajs/modules-sdk" +import { RemoteLink } from "@medusajs/modules-sdk" +import { LinkDefinition } from "@medusajs/types" import { createStep, StepResponse } from "@medusajs/workflows-sdk" import { ContainerRegistrationKeys } from "@medusajs/utils" @@ -9,11 +10,11 @@ export type DismissRemoteLinksStepInput = LinkDefinition | LinkDefinition[] export const dismissRemoteLinkStepId = "dismiss-remote-links" /** * This step removes remote links between two records of linked data models. - * + * * Learn more in the [Remote Link documentation.](https://docs.medusajs.com/v2/advanced-development/modules/remote-link#dismiss-link). - * + * * @example - * import { + * import { * createWorkflow * } from "@medusajs/workflows-sdk" * import { @@ -22,7 +23,7 @@ export const dismissRemoteLinkStepId = "dismiss-remote-links" * import { * Modules * } from "@medusajs/utils" - * + * * const helloWorldWorkflow = createWorkflow( * "hello-world", * () => { diff --git a/packages/core/core-flows/src/common/steps/update-remote-links.ts b/packages/core/core-flows/src/common/steps/update-remote-links.ts index d9c364d317..5e64a71fc1 100644 --- a/packages/core/core-flows/src/common/steps/update-remote-links.ts +++ b/packages/core/core-flows/src/common/steps/update-remote-links.ts @@ -1,6 +1,7 @@ -import { LinkDefinition, RemoteLink } from "@medusajs/modules-sdk" +import { RemoteLink } from "@medusajs/modules-sdk" +import { LinkDefinition } from "@medusajs/types" import { ContainerRegistrationKeys, MedusaError } from "@medusajs/utils" -import { createStep, StepResponse } from "@medusajs/workflows-sdk" +import { StepResponse, createStep } from "@medusajs/workflows-sdk" export const updateRemoteLinksStepId = "update-remote-links-step" export const updateRemoteLinksStep = createStep( diff --git a/packages/core/core-flows/src/common/workflows/batch-links.ts b/packages/core/core-flows/src/common/workflows/batch-links.ts index 9e94830dc0..9adefae5c1 100644 --- a/packages/core/core-flows/src/common/workflows/batch-links.ts +++ b/packages/core/core-flows/src/common/workflows/batch-links.ts @@ -1,5 +1,4 @@ -import { LinkDefinition } from "@medusajs/modules-sdk" -import { BatchWorkflowInput } from "@medusajs/types" +import { BatchWorkflowInput, LinkDefinition } from "@medusajs/types" import { WorkflowData, WorkflowResponse, diff --git a/packages/core/core-flows/src/common/workflows/create-links.ts b/packages/core/core-flows/src/common/workflows/create-links.ts index d9b9d3ae40..efc3068933 100644 --- a/packages/core/core-flows/src/common/workflows/create-links.ts +++ b/packages/core/core-flows/src/common/workflows/create-links.ts @@ -1,4 +1,4 @@ -import { LinkDefinition } from "@medusajs/modules-sdk" +import { LinkDefinition } from "@medusajs/types" import { WorkflowData, WorkflowResponse, diff --git a/packages/core/core-flows/src/common/workflows/dismiss-links.ts b/packages/core/core-flows/src/common/workflows/dismiss-links.ts index 3e31fb4bca..1e6ea0da63 100644 --- a/packages/core/core-flows/src/common/workflows/dismiss-links.ts +++ b/packages/core/core-flows/src/common/workflows/dismiss-links.ts @@ -1,4 +1,4 @@ -import { LinkDefinition } from "@medusajs/modules-sdk" +import { LinkDefinition } from "@medusajs/types" import { WorkflowData, WorkflowResponse, diff --git a/packages/core/core-flows/src/common/workflows/update-links.ts b/packages/core/core-flows/src/common/workflows/update-links.ts index e4b2688a47..eb3b1858be 100644 --- a/packages/core/core-flows/src/common/workflows/update-links.ts +++ b/packages/core/core-flows/src/common/workflows/update-links.ts @@ -1,4 +1,4 @@ -import { LinkDefinition } from "@medusajs/modules-sdk" +import { LinkDefinition } from "@medusajs/types" import { WorkflowData, WorkflowResponse, diff --git a/packages/core/core-flows/src/product/steps/generate-product-csv.ts b/packages/core/core-flows/src/product/steps/generate-product-csv.ts index c95b560a4d..94e562dee3 100644 --- a/packages/core/core-flows/src/product/steps/generate-product-csv.ts +++ b/packages/core/core-flows/src/product/steps/generate-product-csv.ts @@ -1,11 +1,12 @@ import { - IFileModuleService, HttpTypes, + IFileModuleService, IRegionModuleService, } from "@medusajs/types" -import { ModuleRegistrationName, convertJsonToCsv } from "@medusajs/utils" +import { ModuleRegistrationName } from "@medusajs/utils" import { StepResponse, createStep } from "@medusajs/workflows-sdk" import { normalizeForExport } from "../helpers/normalize-for-export" +import { convertJsonToCsv } from "../utlils" const prodColumnPositions = new Map([ ["Product Id", 0], diff --git a/packages/core/core-flows/src/product/steps/parse-product-csv.ts b/packages/core/core-flows/src/product/steps/parse-product-csv.ts index da392433ea..d60993a5d9 100644 --- a/packages/core/core-flows/src/product/steps/parse-product-csv.ts +++ b/packages/core/core-flows/src/product/steps/parse-product-csv.ts @@ -1,16 +1,13 @@ -import { - MedusaError, - ModuleRegistrationName, - convertCsvToJson, -} from "@medusajs/utils" -import { StepResponse, createStep } from "@medusajs/workflows-sdk" -import { normalizeForImport } from "../helpers/normalize-for-import" import { IProductModuleService, IRegionModuleService, ISalesChannelModuleService, } from "@medusajs/types" +import { MedusaError, ModuleRegistrationName } from "@medusajs/utils" +import { StepResponse, createStep } from "@medusajs/workflows-sdk" +import { normalizeForImport } from "../helpers/normalize-for-import" import { normalizeV1Products } from "../helpers/normalize-v1-import" +import { convertCsvToJson } from "../utlils" export const parseProductCsvStepId = "parse-product-csv" /** diff --git a/packages/core/utils/src/csv/csvtojson.ts b/packages/core/core-flows/src/product/utlils/csvtojson.ts similarity index 100% rename from packages/core/utils/src/csv/csvtojson.ts rename to packages/core/core-flows/src/product/utlils/csvtojson.ts diff --git a/packages/core/utils/src/csv/index.ts b/packages/core/core-flows/src/product/utlils/index.ts similarity index 100% rename from packages/core/utils/src/csv/index.ts rename to packages/core/core-flows/src/product/utlils/index.ts diff --git a/packages/core/utils/src/csv/jsontocsv.ts b/packages/core/core-flows/src/product/utlils/jsontocsv.ts similarity index 100% rename from packages/core/utils/src/csv/jsontocsv.ts rename to packages/core/core-flows/src/product/utlils/jsontocsv.ts 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 dd9b000fc0..c67e73ffb8 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,10 +1,11 @@ -import { LinkDefinition } from "@medusajs/modules-sdk" import { AdditionalData, InventoryTypes, + LinkDefinition, PricingTypes, ProductTypes, } from "@medusajs/types" +import { Modules } from "@medusajs/utils" import { WorkflowData, WorkflowResponse, @@ -18,7 +19,6 @@ 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" /** * @privateRemarks diff --git a/packages/core/medusa-test-utils/src/index.ts b/packages/core/medusa-test-utils/src/index.ts index b1a80f63de..8cc6c7f72b 100644 --- a/packages/core/medusa-test-utils/src/index.ts +++ b/packages/core/medusa-test-utils/src/index.ts @@ -1,8 +1,8 @@ export * as TestDatabaseUtils from "./database" export * as TestEventUtils from "./events" -export * as JestUtils from "./jest" export { default as IdMap } from "./id-map" export * from "./init-modules" +export * as JestUtils from "./jest" +export * from "./medusa-test-runner" export { default as MockEventBusService } from "./mock-event-bus-service" export * from "./module-test-runner" -export * from "./medusa-test-runner" diff --git a/packages/core/medusa-test-utils/src/module-test-runner.ts b/packages/core/medusa-test-utils/src/module-test-runner.ts index 69f6528008..ab5046a700 100644 --- a/packages/core/medusa-test-utils/src/module-test-runner.ts +++ b/packages/core/medusa-test-utils/src/module-test-runner.ts @@ -3,9 +3,9 @@ import { ModulesSdkUtils, toMikroOrmEntities, } from "@medusajs/utils" -import { MockEventBusService } from "." -import { getDatabaseURL, getMikroOrmWrapper, TestDatabase } from "./database" -import { initModules, InitModulesOptions } from "./init-modules" +import { TestDatabase, getDatabaseURL, getMikroOrmWrapper } from "./database" +import { InitModulesOptions, initModules } from "./init-modules" +import { default as MockEventBusService } from "./mock-event-bus-service" export interface SuiteOptions { MikroOrmWrapper: TestDatabase diff --git a/packages/core/modules-sdk/package.json b/packages/core/modules-sdk/package.json index a3f767f699..1968783f54 100644 --- a/packages/core/modules-sdk/package.json +++ b/packages/core/modules-sdk/package.json @@ -32,11 +32,12 @@ "@graphql-tools/schema": "^10.0.0", "@medusajs/orchestration": "^0.5.7", "@medusajs/utils": "^1.11.9", - "awilix": "^8.0.0", "graphql": "^16.6.0", - "knex": "2.4.2", "resolve-cwd": "^3.0.0" }, + "peerDependencies": { + "awilix": "*" + }, "scripts": { "prepublishOnly": "cross-env NODE_ENV=production tsc --build", "build": "rimraf dist && tsc --build", diff --git a/packages/core/modules-sdk/src/index.ts b/packages/core/modules-sdk/src/index.ts index 5df4a1e178..5658769fee 100644 --- a/packages/core/modules-sdk/src/index.ts +++ b/packages/core/modules-sdk/src/index.ts @@ -1,4 +1,3 @@ -export * from "@medusajs/types/dist/modules-sdk" export * from "./definitions" export * from "./loaders" export * from "./medusa-app" diff --git a/packages/core/modules-sdk/src/medusa-app.ts b/packages/core/modules-sdk/src/medusa-app.ts index 8f179c257e..cd8a8da35c 100644 --- a/packages/core/modules-sdk/src/medusa-app.ts +++ b/packages/core/modules-sdk/src/medusa-app.ts @@ -20,17 +20,17 @@ import { } from "@medusajs/types" import { ContainerRegistrationKeys, - createMedusaContainer, - isObject, - isString, MedusaError, ModuleRegistrationName, Modules, ModulesSdkUtils, + createMedusaContainer, + isObject, + isString, promiseAll, } from "@medusajs/utils" +import type { Knex } from "@mikro-orm/knex" import { asValue } from "awilix" -import type { Knex } from "knex" import { MODULE_PACKAGE_NAMES } from "./definitions" import { MedusaModule, @@ -39,8 +39,8 @@ import { } from "./medusa-module" import { RemoteLink } from "./remote-link" import { RemoteQuery } from "./remote-query" -import { cleanGraphQLSchema } from "./utils" import { MODULE_RESOURCE_TYPE, MODULE_SCOPE } from "./types" +import { cleanGraphQLSchema } from "./utils" const LinkModulePackage = MODULE_PACKAGE_NAMES[Modules.LINK] diff --git a/packages/core/modules-sdk/src/remote-link.ts b/packages/core/modules-sdk/src/remote-link.ts index ea8426935f..4e20d6bca2 100644 --- a/packages/core/modules-sdk/src/remote-link.ts +++ b/packages/core/modules-sdk/src/remote-link.ts @@ -1,5 +1,6 @@ import { ILinkModule, + LinkDefinition, LoadedModule, ModuleJoinerRelationship, } from "@medusajs/types" @@ -12,7 +13,7 @@ import { linkingErrorMessage } from "./utils/linking-error" /** * The details of a data model's record whose linked records should be deleted. Usually used after the * data model's record is deleted. - * + * * The key is the data model's name. Its value is an object that has the ID of the data model's record. */ export type DeleteEntityInput = { @@ -20,20 +21,6 @@ export type DeleteEntityInput = { } export type RestoreEntityInput = DeleteEntityInput -/** - * A link for two records of linked data models. - * - * The keys are the names of each module, and their value is an object that holds the ID of the linked data model's record. - */ -export type LinkDefinition = { - [moduleName: string]: { - // TODO: changing this to any temporarily as the "data" attribute is not being picked up correctly - [fieldName: string]: any - } -} & { - data?: Record -} - type RemoteRelationship = ModuleJoinerRelationship & { isPrimary: boolean isForeign: boolean diff --git a/packages/core/modules-sdk/src/utils/convert-data-to-link-definition.ts b/packages/core/modules-sdk/src/utils/convert-data-to-link-definition.ts index c197efcca7..94fb73156a 100644 --- a/packages/core/modules-sdk/src/utils/convert-data-to-link-definition.ts +++ b/packages/core/modules-sdk/src/utils/convert-data-to-link-definition.ts @@ -1,6 +1,5 @@ -import { LoadedModule } from "@medusajs/types" +import { LinkDefinition, LoadedModule } from "@medusajs/types" import { isPresent } from "@medusajs/utils" -import { LinkDefinition } from "../remote-link" export const convertRecordsToLinkDefinition = ( links: object[], diff --git a/packages/core/orchestration/package.json b/packages/core/orchestration/package.json index 4f2a52fe84..f7aa786e4f 100644 --- a/packages/core/orchestration/package.json +++ b/packages/core/orchestration/package.json @@ -20,17 +20,19 @@ "author": "Medusa", "license": "MIT", "devDependencies": { + "@medusajs/types": "^1.11.16", "cross-env": "^5.2.1", "jest": "^29.7.0", "rimraf": "^5.0.1", "typescript": "^5.1.6" }, "dependencies": { - "@medusajs/types": "^1.11.16", "@medusajs/utils": "^1.11.9", - "awilix": "^8.0.0", "graphql": "^16.6.0" }, + "peerDependencies": { + "awilix": "*" + }, "scripts": { "prepublishOnly": "cross-env NODE_ENV=production tsc --build", "build": "rimraf dist && tsc --build", diff --git a/packages/core/orchestration/src/transaction/distributed-transaction.ts b/packages/core/orchestration/src/transaction/distributed-transaction.ts index 70a4850d50..e057de1425 100644 --- a/packages/core/orchestration/src/transaction/distributed-transaction.ts +++ b/packages/core/orchestration/src/transaction/distributed-transaction.ts @@ -2,12 +2,13 @@ import { isDefined } from "@medusajs/utils" import { EventEmitter } from "events" import { IDistributedTransactionStorage } from "./datastore/abstract-storage" import { BaseInMemoryDistributedTransactionStorage } from "./datastore/base-in-memory-storage" +import { TransactionOrchestrator } from "./transaction-orchestrator" +import { TransactionStep, TransactionStepHandler } from "./transaction-step" import { TransactionFlow, - TransactionOrchestrator, -} from "./transaction-orchestrator" -import { TransactionStep, TransactionStepHandler } from "./transaction-step" -import { TransactionHandlerType, TransactionState } from "./types" + TransactionHandlerType, + TransactionState, +} from "./types" /** * @typedef TransactionMetadata diff --git a/packages/core/orchestration/src/transaction/transaction-orchestrator.ts b/packages/core/orchestration/src/transaction/transaction-orchestrator.ts index 63872a84d9..d3611f72d3 100644 --- a/packages/core/orchestration/src/transaction/transaction-orchestrator.ts +++ b/packages/core/orchestration/src/transaction/transaction-orchestrator.ts @@ -8,6 +8,7 @@ import { TransactionStep, TransactionStepHandler } from "./transaction-step" import { DistributedTransactionEvent, StepFeatures, + TransactionFlow, TransactionHandlerType, TransactionModelOptions, TransactionOptions, @@ -27,29 +28,6 @@ import { TransactionTimeoutError, } from "./errors" -export type TransactionFlow = { - modelId: string - options?: TransactionModelOptions - definition: TransactionStepsDefinition - transactionId: string - metadata?: { - eventGroupId?: string - [key: string]: unknown - } - hasAsyncSteps: boolean - hasFailedSteps: boolean - hasSkippedOnFailureSteps: boolean - hasWaitingSteps: boolean - hasSkippedSteps: boolean - hasRevertedSteps: boolean - timedOutAt: number | null - startedAt?: number - state: TransactionState - steps: { - [key: string]: TransactionStep - } -} - /** * @class TransactionOrchestrator is responsible for managing and executing distributed transactions. * It is based on a single transaction definition, which is used to execute all the transaction steps diff --git a/packages/core/orchestration/src/transaction/types.ts b/packages/core/orchestration/src/transaction/types.ts index 7f86ce5557..f6915f8793 100644 --- a/packages/core/orchestration/src/transaction/types.ts +++ b/packages/core/orchestration/src/transaction/types.ts @@ -1,3 +1,4 @@ +import { TransactionState } from "@medusajs/utils" import { DistributedTransactionType } from "./distributed-transaction" import { TransactionStep } from "./transaction-step" export { @@ -228,3 +229,26 @@ export type StepFeatures = { } export type TransactionOptions = TransactionModelOptions & StepFeatures + +export type TransactionFlow = { + modelId: string + options?: TransactionModelOptions + definition: TransactionStepsDefinition + transactionId: string + metadata?: { + eventGroupId?: string + [key: string]: unknown + } + hasAsyncSteps: boolean + hasFailedSteps: boolean + hasSkippedOnFailureSteps: boolean + hasWaitingSteps: boolean + hasSkippedSteps: boolean + hasRevertedSteps: boolean + timedOutAt: number | null + startedAt?: number + state: TransactionState + steps: { + [key: string]: TransactionStep + } +} diff --git a/packages/core/types/package.json b/packages/core/types/package.json index df8de34c0e..06ede67d56 100644 --- a/packages/core/types/package.json +++ b/packages/core/types/package.json @@ -21,7 +21,7 @@ "author": "Medusa", "license": "MIT", "devDependencies": { - "awilix": "^8.0.0", + "awilix": "^8.0.1", "bignumber.js": "^9.1.2", "cross-env": "^5.2.1", "ioredis": "^5.4.1", diff --git a/packages/core/types/src/dml/index.ts b/packages/core/types/src/dml/index.ts index 48c59473d4..838f3409d7 100644 --- a/packages/core/types/src/dml/index.ts +++ b/packages/core/types/src/dml/index.ts @@ -1,10 +1,5 @@ import { CamelCase, Prettify } from "../common" -/** - * Symbol to identify a DML entity from an object - */ -export const IsDmlEntity = Symbol.for("isDmlEntity") - /** * Representation of DML schema. It must be a key-value pair * with string based keys and properties/relationships @@ -33,7 +28,6 @@ export interface IDmlEntity< Schema extends DMLSchema, Config extends IDmlEntityConfig > { - [IsDmlEntity]: true name: InferDmlEntityNameFromConfig schema: Schema } diff --git a/packages/core/types/src/modules-sdk/index.ts b/packages/core/types/src/modules-sdk/index.ts index ab3422c976..d16824c43b 100644 --- a/packages/core/types/src/modules-sdk/index.ts +++ b/packages/core/types/src/modules-sdk/index.ts @@ -165,6 +165,20 @@ export type LinkModulesExtraFields = Record< } > +/** + * A link for two records of linked data models. + * + * The keys are the names of each module, and their value is an object that holds the ID of the linked data model's record. + */ +export type LinkDefinition = { + [moduleName: string]: { + // TODO: changing this to any temporarily as the "data" attribute is not being picked up correctly + [fieldName: string]: any + } +} & { + data?: Record +} + export type ModuleJoinerConfig = Omit< JoinerServiceConfig, "serviceName" | "primaryKeys" | "relationships" | "extends" diff --git a/packages/core/utils/package.json b/packages/core/utils/package.json index c49198b049..e7e9f16b2a 100644 --- a/packages/core/utils/package.json +++ b/packages/core/utils/package.json @@ -39,9 +39,7 @@ "bignumber.js": "^9.1.2", "dotenv": "^16.4.5", "dotenv-expand": "^11.0.6", - "json-2-csv": "^5.5.4", "jsonwebtoken": "^9.0.2", - "knex": "2.4.2", "pluralize": "^8.0.0", "ulid": "^2.3.0" }, diff --git a/packages/core/utils/src/common/get-medusa-version.ts b/packages/core/utils/src/common/get-medusa-version.ts deleted file mode 100644 index ed32467086..0000000000 --- a/packages/core/utils/src/common/get-medusa-version.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { join } from "path" - -export const getMedusaVersion = (): string => { - try { - return require(join( - process.cwd(), - `node_modules`, - `@medusajs/medusa`, - `package.json` - )).version - } catch (e) { - return `` - } -} diff --git a/packages/core/utils/src/dal/mikro-orm/mikro-orm-repository.ts b/packages/core/utils/src/dal/mikro-orm/mikro-orm-repository.ts index c96d3ab134..d161d55007 100644 --- a/packages/core/utils/src/dal/mikro-orm/mikro-orm-repository.ts +++ b/packages/core/utils/src/dal/mikro-orm/mikro-orm-repository.ts @@ -25,12 +25,12 @@ import { } from "@mikro-orm/core/typings" import { SqlEntityManager } from "@mikro-orm/postgresql" import { + MedusaError, arrayDifference, isString, - MedusaError, promiseAll, } from "../../common" -import { buildQuery } from "../../modules-sdk" +import { buildQuery } from "../../modules-sdk/build-query" import { getSoftDeletedCascadedEntitiesIdsMappedBy, transactionWrapper, diff --git a/packages/core/utils/src/dal/mikro-orm/utils.ts b/packages/core/utils/src/dal/mikro-orm/utils.ts index 4e7637e6db..ec3f8f9a6d 100644 --- a/packages/core/utils/src/dal/mikro-orm/utils.ts +++ b/packages/core/utils/src/dal/mikro-orm/utils.ts @@ -1,6 +1,6 @@ import { EntityMetadata, FindOptions, wrap } from "@mikro-orm/core" import { SqlEntityManager } from "@mikro-orm/postgresql" -import { buildQuery } from "../../modules-sdk" +import { buildQuery } from "../../modules-sdk/build-query" function detectCircularDependency( manager: SqlEntityManager, diff --git a/packages/core/utils/src/dml/entity.ts b/packages/core/utils/src/dml/entity.ts index 69395c913b..233937a1bc 100644 --- a/packages/core/utils/src/dml/entity.ts +++ b/packages/core/utils/src/dml/entity.ts @@ -6,13 +6,14 @@ import { IDmlEntity, IDmlEntityConfig, InferDmlEntityNameFromConfig, - IsDmlEntity, QueryCondition, } from "@medusajs/types" import { isObject, isString, toCamelCase } from "../common" import { transformIndexWhere } from "./helpers/entity-builder/build-indexes" import { BelongsTo } from "./relations/belongs-to" +const IsDmlEntity = Symbol.for("isDmlEntity") + function extractNameAndTableName( nameOrConfig: Config ) { @@ -59,7 +60,7 @@ export class DmlEntity< const TConfig extends IDmlEntityConfig > implements IDmlEntity { - [IsDmlEntity]: true = true + [IsDmlEntity] = true name: InferDmlEntityNameFromConfig schema: Schema diff --git a/packages/core/utils/src/index.ts b/packages/core/utils/src/index.ts index 073040bc91..d11b798b67 100644 --- a/packages/core/utils/src/index.ts +++ b/packages/core/utils/src/index.ts @@ -1,7 +1,7 @@ -export * from "./common" export * from "./api-key" export * from "./auth" export * from "./bundles" +export * from "./common" export * from "./dal" export * from "./decorators" export * from "./defaults" @@ -26,6 +26,5 @@ export * from "./shipping" export * from "./totals" export * from "./totals/big-number" export * from "./user" -export * from "./csv" export const MedusaModuleType = Symbol.for("MedusaModule") diff --git a/packages/core/utils/src/link/links.ts b/packages/core/utils/src/link/links.ts index 4e12863586..71ace47c6a 100644 --- a/packages/core/utils/src/link/links.ts +++ b/packages/core/utils/src/link/links.ts @@ -1,4 +1,4 @@ -import { Modules } from "../modules-sdk" +import { Modules } from "../modules-sdk/definition" import { composeLinkName } from "./compose-link-name" export const LINKS = { diff --git a/packages/core/utils/src/migrations/index.ts b/packages/core/utils/src/migrations/index.ts index b69321eab5..b3f09f8268 100644 --- a/packages/core/utils/src/migrations/index.ts +++ b/packages/core/utils/src/migrations/index.ts @@ -1,13 +1,13 @@ -import { EventEmitter } from "events" +import { MikroORM, MikroORMOptions } from "@mikro-orm/core" import { MigrateOptions, MigrationResult, UmzugMigration, } from "@mikro-orm/migrations" -import { MikroORM, MikroORMOptions } from "@mikro-orm/core" import { PostgreSqlDriver } from "@mikro-orm/postgresql" -import { dirname } from "path" +import { EventEmitter } from "events" import { access, mkdir, writeFile } from "fs/promises" +import { dirname } from "path" /** * Events emitted by the migrations class diff --git a/packages/core/utils/src/modules-sdk/build-query.ts b/packages/core/utils/src/modules-sdk/build-query.ts index 05be78e9a8..04974bc8bf 100644 --- a/packages/core/utils/src/modules-sdk/build-query.ts +++ b/packages/core/utils/src/modules-sdk/build-query.ts @@ -1,7 +1,7 @@ import { DAL, FindConfig } from "@medusajs/types" import { deduplicate, isDefined, isObject } from "../common" -import { SoftDeletableFilterKey } from "../dal" +import { SoftDeletableFilterKey } from "../dal/mikro-orm/mikro-orm-soft-deletable-filter" // Following convention here is fine, we can make it configurable if needed. const DELETED_AT_FIELD_NAME = "deleted_at" diff --git a/packages/core/utils/src/modules-sdk/define-link.ts b/packages/core/utils/src/modules-sdk/define-link.ts index 68a508f983..0f62495d95 100644 --- a/packages/core/utils/src/modules-sdk/define-link.ts +++ b/packages/core/utils/src/modules-sdk/define-link.ts @@ -1,6 +1,6 @@ import { LinkModulesExtraFields, ModuleJoinerConfig } from "@medusajs/types" import { camelToSnakeCase, isObject, pluralize, toPascalCase } from "../common" -import { composeLinkName } from "../link" +import { composeLinkName } from "../link/compose-link-name" export const DefineLinkSymbol = Symbol.for("DefineLink") diff --git a/packages/core/utils/src/modules-sdk/medusa-service.ts b/packages/core/utils/src/modules-sdk/medusa-service.ts index 8ae67095fc..15e38d232c 100644 --- a/packages/core/utils/src/modules-sdk/medusa-service.ts +++ b/packages/core/utils/src/modules-sdk/medusa-service.ts @@ -11,16 +11,18 @@ import { SoftDeleteReturn, } from "@medusajs/types" import { + MapToConfig, isString, kebabCase, lowerCaseFirst, mapObjectTo, - MapToConfig, pluralize, upperCaseFirst, } from "../common" +import { DmlEntity } from "../dml" import { InjectManager, MedusaContext } from "./decorators" import { ModuleRegistrationName } from "./definition" +import { buildModelsNameToLinkableKeysMap } from "./joiner-config-builder" import { BaseMethods, ExtractKeysFromConfig, @@ -29,8 +31,6 @@ import { ModelEntries, ModelsConfigTemplate, } from "./types/medusa-service" -import { buildModelsNameToLinkableKeysMap } from "./joiner-config-builder" -import { DmlEntity } from "../dml" const readMethods = ["retrieve", "list", "listAndCount"] as BaseMethods[] const writeMethods = [ @@ -55,12 +55,12 @@ function buildMethodNamesFromModel( if (method === "retrieve") { normalizedModelName = - "singular" in model && model.singular + model && "singular" in model && model.singular ? model.singular : defaultMethodName } else { normalizedModelName = - "plural" in model && model.plural + model && "plural" in model && model.plural ? model.plural : pluralize(defaultMethodName) } diff --git a/packages/core/workflows-sdk/package.json b/packages/core/workflows-sdk/package.json index a88d1db9e6..836560f6b0 100644 --- a/packages/core/workflows-sdk/package.json +++ b/packages/core/workflows-sdk/package.json @@ -30,9 +30,11 @@ "dependencies": { "@medusajs/modules-sdk": "^1.12.11", "@medusajs/orchestration": "^0.5.7", - "@medusajs/utils": "^1.11.9", - "awilix": "^8.0.1", - "ulid": "^2.3.0" + "@medusajs/utils": "^1.11.9" + }, + "peerDependencies": { + "awilix": "*", + "ulid": "*" }, "scripts": { "prepublishOnly": "cross-env NODE_ENV=production tsc --build", diff --git a/packages/core/workflows-sdk/src/helper/workflow-export.ts b/packages/core/workflows-sdk/src/helper/workflow-export.ts index adb1e4eacd..a9d2e794df 100644 --- a/packages/core/workflows-sdk/src/helper/workflow-export.ts +++ b/packages/core/workflows-sdk/src/helper/workflow-export.ts @@ -16,7 +16,7 @@ import { import { EOL } from "os" import { ulid } from "ulid" import { MedusaWorkflow } from "../medusa-workflow" -import { resolveValue } from "../utils/composer" +import { resolveValue } from "../utils/composer/helpers/resolve-value" import { ExportedWorkflow, FlowCancelOptions, diff --git a/packages/core/workflows-sdk/src/utils/composer/create-workflow.ts b/packages/core/workflows-sdk/src/utils/composer/create-workflow.ts index adccb73967..ecb218e056 100644 --- a/packages/core/workflows-sdk/src/utils/composer/create-workflow.ts +++ b/packages/core/workflows-sdk/src/utils/composer/create-workflow.ts @@ -4,19 +4,19 @@ import { WorkflowManager, } from "@medusajs/orchestration" import { LoadedModule, MedusaContainer } from "@medusajs/types" -import { isString, OrchestrationUtils } from "@medusajs/utils" +import { OrchestrationUtils, isString } from "@medusajs/utils" import { exportWorkflow } from "../../helper" import { createStep } from "./create-step" -import { StepResponse } from "./helpers" import { proxify } from "./helpers/proxy" +import { StepResponse } from "./helpers/step-response" +import { WorkflowResponse } from "./helpers/workflow-response" import { CreateWorkflowComposerContext, + HookHandler, ReturnWorkflow, StepFunction, WorkflowData, - HookHandler, } from "./type" -import { WorkflowResponse } from "./helpers/workflow-response" global[OrchestrationUtils.SymbolMedusaWorkflowComposerContext] = null diff --git a/packages/framework/framework/package.json b/packages/framework/framework/package.json index 1ef0de9287..2462a1bab8 100644 --- a/packages/framework/framework/package.json +++ b/packages/framework/framework/package.json @@ -39,6 +39,7 @@ "test:integration": "jest --forceExit -- integration-tests/**/__tests__/**/*.ts" }, "devDependencies": { + "@medusajs/orchestration": "^0.5.7", "@medusajs/types": "^1.11.16", "@types/express": "^4.17.17", "@types/jsonwebtoken": "^8.5.9", @@ -52,10 +53,8 @@ "dependencies": { "@medusajs/medusa-cli": "^1.3.22", "@medusajs/modules-sdk": "^1.12.11", - "@medusajs/orchestration": "^0.5.7", "@medusajs/utils": "^1.11.9", "@medusajs/workflows-sdk": "^0.1.6", - "awilix": "^8.0.0", "cookie-parser": "^1.4.6", "cors": "^2.8.5", "express": "^4.18.2", @@ -66,5 +65,8 @@ "medusa-telemetry": "^0.0.17", "morgan": "^1.9.1", "zod": "3.22.4" + }, + "peerDependencies": { + "awilix": "*" } } diff --git a/packages/framework/framework/src/index.ts b/packages/framework/framework/src/index.ts index d0b0b5ddef..5cf77257a2 100644 --- a/packages/framework/framework/src/index.ts +++ b/packages/framework/framework/src/index.ts @@ -1,11 +1,13 @@ export * from "./config" -export * from "./logger" -export * from "./http" -export * from "./database" export * from "./container" -export * from "./subscribers" -export * from "./links" -export * from "./jobs" +export * from "./database" export * from "./feature-flags" -export * from "./workflows" +export * from "./http" +export * from "./jobs" +export * from "./links" +export * from "./logger" export * from "./medusa-app-loader" +export * from "./subscribers" +export * from "./workflows" + +export const MEDUSA_CLI_PATH = require.resolve("@medusajs/medusa-cli") diff --git a/packages/framework/framework/src/jobs/__fixtures__/mock-scheduler-storage.ts b/packages/framework/framework/src/jobs/__fixtures__/mock-scheduler-storage.ts index 009102ef12..988d6bed7f 100644 --- a/packages/framework/framework/src/jobs/__fixtures__/mock-scheduler-storage.ts +++ b/packages/framework/framework/src/jobs/__fixtures__/mock-scheduler-storage.ts @@ -1,4 +1,4 @@ -import { +import type { IDistributedSchedulerStorage, SchedulerOptions, } from "@medusajs/orchestration" diff --git a/packages/framework/framework/src/jobs/job-loader.ts b/packages/framework/framework/src/jobs/job-loader.ts index 82127a13a1..29548dd505 100644 --- a/packages/framework/framework/src/jobs/job-loader.ts +++ b/packages/framework/framework/src/jobs/job-loader.ts @@ -1,14 +1,14 @@ +import type { SchedulerOptions } from "@medusajs/orchestration" +import { MedusaContainer } from "@medusajs/types" +import { isObject, MedusaError, promiseAll } from "@medusajs/utils" import { createStep, createWorkflow, StepResponse, } from "@medusajs/workflows-sdk" -import { isObject, MedusaError, promiseAll } from "@medusajs/utils" -import { SchedulerOptions } from "@medusajs/orchestration" -import { MedusaContainer } from "@medusajs/types" -import { logger } from "../logger" import { access, readdir } from "fs/promises" import { join } from "path" +import { logger } from "../logger" type CronJobConfig = { name: string diff --git a/packages/medusa/package.json b/packages/medusa/package.json index adc1d02bf4..1d54433dc5 100644 --- a/packages/medusa/package.json +++ b/packages/medusa/package.json @@ -41,20 +41,19 @@ "serve": "node dist/app.js", "test": "jest --silent --bail --maxWorkers=50% --forceExit" }, + "peerDependencies": { + "awilix": "*" + }, "dependencies": { "@inquirer/checkbox": "^2.3.11", "@medusajs/admin-sdk": "0.0.1", "@medusajs/core-flows": "^0.0.9", "@medusajs/framework": "^0.0.1", "@medusajs/link-modules": "^0.2.11", - "@medusajs/medusa-cli": "^1.3.22", - "@medusajs/modules-sdk": "^1.12.11", - "@medusajs/orchestration": "^0.5.7", "@medusajs/utils": "^1.11.9", "@medusajs/workflows-sdk": "^0.1.6", "@swc/core": "1.5.7", "@swc/helpers": "^0.5.11", - "awilix": "^8.0.0", "body-parser": "^1.19.0", "boxen": "^5.0.1", "chalk": "^4.0.0", @@ -62,9 +61,7 @@ "compression": "^1.7.4", "connect-redis": "^5.0.0", "cookie-parser": "^1.4.6", - "core-js": "^3.6.5", "cors": "^2.8.5", - "dotenv": "^16.4.5", "express": "^4.18.2", "express-session": "^1.17.3", "fs-exists-cached": "^1.0.0", @@ -76,13 +73,7 @@ "morgan": "^1.9.1", "multer": "^1.4.5-lts.1", "node-schedule": "^2.1.1", - "passport": "^0.6.0", - "passport-custom": "^1.1.1", - "passport-jwt": "^4.0.1", - "passport-local": "^1.0.0", "qs": "^6.11.2", - "reflect-metadata": "^0.1.13", - "regenerator-runtime": "^0.13.11", "request-ip": "^3.3.0", "uuid": "^9.0.0", "zod": "3.22.4" diff --git a/packages/medusa/src/api/admin/products/helpers.ts b/packages/medusa/src/api/admin/products/helpers.ts index f263503edf..18d921cd9e 100644 --- a/packages/medusa/src/api/admin/products/helpers.ts +++ b/packages/medusa/src/api/admin/products/helpers.ts @@ -1,7 +1,7 @@ -import { LinkDefinition } from "@medusajs/modules-sdk" import { BatchMethodResponse, HttpTypes, + LinkDefinition, MedusaContainer, PriceDTO, ProductDTO, diff --git a/packages/medusa/src/api/store/customers/me/addresses/[address_id]/route.ts b/packages/medusa/src/api/store/customers/me/addresses/[address_id]/route.ts index 5c5d9b3a13..7b321d94de 100644 --- a/packages/medusa/src/api/store/customers/me/addresses/[address_id]/route.ts +++ b/packages/medusa/src/api/store/customers/me/addresses/[address_id]/route.ts @@ -1,24 +1,23 @@ -import { - AuthenticatedMedusaRequest, - MedusaResponse, -} from "../../../../../../types/routing" import { deleteCustomerAddressesWorkflow, updateCustomerAddressesWorkflow, } from "@medusajs/core-flows" +import { + AuthenticatedMedusaRequest, + MedusaResponse, +} from "../../../../../../types/routing" +import { DeleteResponse, HttpTypes, MedusaContainer } from "@medusajs/types" import { ContainerRegistrationKeys, MedusaError, remoteQueryObjectFromString, } from "@medusajs/utils" -import { MedusaContainer } from "@medusajs/modules-sdk" +import { refetchCustomer } from "../../../helpers" import { StoreGetCustomerAddressParamsType, StoreUpdateCustomerAddressType, } from "../../../validators" -import { refetchCustomer } from "../../../helpers" -import { DeleteResponse, HttpTypes } from "@medusajs/types" export const GET = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/commands/develop.ts b/packages/medusa/src/commands/develop.ts index 0c5c26bdd0..be2a8e601b 100644 --- a/packages/medusa/src/commands/develop.ts +++ b/packages/medusa/src/commands/develop.ts @@ -5,7 +5,7 @@ import Store from "medusa-telemetry/dist/store" import { EOL } from "os" import path from "path" -import { logger } from "@medusajs/framework" +import { logger, MEDUSA_CLI_PATH } from "@medusajs/framework" const defaultConfig = { padding: 5, @@ -27,12 +27,7 @@ export default async function ({ port, directory }) { * Re-constructing the path to Medusa CLI to execute the * start command. */ - const cliPath = path.resolve( - require.resolve("@medusajs/medusa-cli"), - "..", - "..", - "cli.js" - ) + const cliPath = path.resolve(MEDUSA_CLI_PATH, "..", "..", "cli.js") const devServer = { childProcess: null as ChildProcess | null, diff --git a/packages/medusa/src/commands/start-cluster.ts b/packages/medusa/src/commands/start-cluster.ts index 796f127aa0..181ae4f2d3 100644 --- a/packages/medusa/src/commands/start-cluster.ts +++ b/packages/medusa/src/commands/start-cluster.ts @@ -1,15 +1,12 @@ -import "core-js/stable" -import "regenerator-runtime/runtime" - import cluster from "cluster" import express from "express" import { track } from "medusa-telemetry" import { scheduleJob } from "node-schedule" import os from "os" -import loaders from "../loaders" import { logger } from "@medusajs/framework" import { GracefulShutdownServer, isPresent } from "@medusajs/utils" +import loaders from "../loaders" const EVERY_SIXTH_HOUR = "0 */6 * * *" const CRON_SCHEDULE = EVERY_SIXTH_HOUR diff --git a/packages/medusa/src/commands/start.ts b/packages/medusa/src/commands/start.ts index 149bd85838..858a339b96 100644 --- a/packages/medusa/src/commands/start.ts +++ b/packages/medusa/src/commands/start.ts @@ -1,13 +1,10 @@ -import "core-js/stable" -import "regenerator-runtime/runtime" - import express from "express" import { track } from "medusa-telemetry" import { scheduleJob } from "node-schedule" -import loaders from "../loaders" import { logger } from "@medusajs/framework" import { GracefulShutdownServer } from "@medusajs/utils" +import loaders from "../loaders" const EVERY_SIXTH_HOUR = "0 */6 * * *" const CRON_SCHEDULE = EVERY_SIXTH_HOUR diff --git a/packages/medusa/src/commands/user.ts b/packages/medusa/src/commands/user.ts index 29eb3413bb..e350f06ce7 100644 --- a/packages/medusa/src/commands/user.ts +++ b/packages/medusa/src/commands/user.ts @@ -1,12 +1,9 @@ -import "core-js/stable" -import "regenerator-runtime/runtime" - import express from "express" import { track } from "medusa-telemetry" +import { logger } from "@medusajs/framework" import { ModuleRegistrationName } from "@medusajs/utils" import loaders from "../loaders" -import { logger } from "@medusajs/framework" export default async function ({ directory, diff --git a/packages/medusa/src/commands/utils/get-migrations.js b/packages/medusa/src/commands/utils/get-migrations.js deleted file mode 100644 index b7c1b32f32..0000000000 --- a/packages/medusa/src/commands/utils/get-migrations.js +++ /dev/null @@ -1,160 +0,0 @@ -import { MedusaModule, registerMedusaModule } from "@medusajs/modules-sdk" -import glob from "glob" -import { isDefined } from "@medusajs/utils" - -export function getInternalModules(configModule) { - const modules = [] - const moduleResolutions = {} - - Object.entries(configModule.modules ?? {}).forEach(([moduleKey, module]) => { - moduleResolutions[moduleKey] = registerMedusaModule(moduleKey, module)[ - moduleKey - ] - }) - - for (const moduleResolution of Object.values(moduleResolutions)) { - if ( - !moduleResolution.resolutionPath || - moduleResolution.moduleDeclaration.scope !== "internal" - ) { - continue - } - - let loadedModule = null - try { - loadedModule = require(moduleResolution.resolutionPath).default - } catch (error) { - console.log("Error loading Module", error) - continue - } - - modules.push({ - moduleDeclaration: moduleResolution.moduleDeclaration, - loadedModule, - }) - } - - return modules -} - -export const getEnabledMigrations = (migrationDirs, isFlagEnabled) => { - const allMigrations = migrationDirs.flatMap((dir) => { - return glob.sync(dir) - }) - return allMigrations - .map((file) => { - const loaded = require(file) - if (!isDefined(loaded.featureFlag) || isFlagEnabled(loaded.featureFlag)) { - delete loaded.featureFlag - return Object.values(loaded) - } - }) - .flat() - .filter(Boolean) -} - -export const getModuleMigrations = (configModule, isFlagEnabled) => { - const loadedModules = getInternalModules(configModule) - - const allModules = [] - - for (const loadedModule of loadedModules) { - const mod = loadedModule.loadedModule - - const moduleMigrations = (mod.migrations ?? []) - .map((migration) => { - if ( - !isDefined(migration.featureFlag) || - isFlagEnabled(migration.featureFlag) - ) { - delete migration.featureFlag - return Object.values(migration) - } - }) - .flat() - .filter(Boolean) - - allModules.push({ - moduleDeclaration: loadedModule.moduleDeclaration, - models: mod.models ?? [], - migrations: moduleMigrations, - }) - } - - return allModules -} - -export const getModuleSharedResources = (configModule, featureFlagsRouter) => { - const isFlagEnabled = (flag) => - featureFlagsRouter && featureFlagsRouter.isFeatureEnabled(flag) - - const loadedModules = getModuleMigrations(configModule, isFlagEnabled) - - let migrations = [] - let models = [] - - for (const mod of loadedModules) { - if (mod.moduleDeclaration.resources !== "shared") { - continue - } - - migrations = migrations.concat(mod.migrations) - - models = models.concat(mod.models ?? []) - } - - return { - models, - migrations, - } -} - -export const runIsolatedModulesMigration = async (configModule) => { - const moduleResolutions = {} - Object.entries(configModule.modules ?? {}).forEach(([moduleKey, module]) => { - moduleResolutions[moduleKey] = registerMedusaModule(moduleKey, module)[ - moduleKey - ] - }) - - for (const moduleResolution of Object.values(moduleResolutions)) { - if ( - !moduleResolution.resolutionPath || - moduleResolution.moduleDeclaration.scope !== "internal" || - moduleResolution.moduleDeclaration.resources !== "isolated" - ) { - continue - } - - await MedusaModule.migrateUp({ - moduleKey: moduleResolution.definition.key, - modulePath: moduleResolution.resolutionPath, - options: moduleResolution.options, - }) - } -} - -export const revertIsolatedModulesMigration = async (configModule) => { - const moduleResolutions = {} - Object.entries(configModule.modules ?? {}).forEach(([moduleKey, module]) => { - moduleResolutions[moduleKey] = registerMedusaModule(moduleKey, module)[ - moduleKey - ] - }) - - for (const moduleResolution of Object.values(moduleResolutions)) { - if ( - !moduleResolution.resolutionPath || - moduleResolution.moduleDeclaration.scope !== "internal" || - moduleResolution.moduleDeclaration.resources !== "isolated" - ) { - continue - } - - await MedusaModule.migrateDown({ - moduleKey: moduleResolution.definition.key, - modulePath: moduleResolution.resolutionPath, - options: moduleResolution.options, - }) - } -} diff --git a/packages/medusa/src/types/common.ts b/packages/medusa/src/types/common.ts index c07bd2c1c5..7efe3e53ad 100644 --- a/packages/medusa/src/types/common.ts +++ b/packages/medusa/src/types/common.ts @@ -1,5 +1,3 @@ -import "reflect-metadata" - export interface FindConfig { select?: (keyof Entity)[] skip?: number diff --git a/packages/modules/api-key/package.json b/packages/modules/api-key/package.json index 50fe7db735..e6e1c2b449 100644 --- a/packages/modules/api-key/package.json +++ b/packages/modules/api-key/package.json @@ -34,7 +34,6 @@ "orm:cache:clear": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm cache:clear" }, "devDependencies": { - "@medusajs/modules-sdk": "^1.12.11", "@medusajs/types": "^1.11.16", "@mikro-orm/cli": "5.9.7", "cross-env": "^5.2.1", @@ -46,10 +45,12 @@ "typescript": "^5.1.6" }, "dependencies": { - "@medusajs/utils": "^1.11.9", - "@mikro-orm/core": "5.9.7", - "@mikro-orm/migrations": "5.9.7", - "@mikro-orm/postgresql": "5.9.7", - "awilix": "^8.0.0" + "@medusajs/utils": "^1.11.9" + }, + "peerDependencies": { + "@mikro-orm/core": "*", + "@mikro-orm/migrations": "*", + "@mikro-orm/postgresql": "*", + "awilix": "*" } } diff --git a/packages/modules/auth/package.json b/packages/modules/auth/package.json index 96ba1b943c..75b8844075 100644 --- a/packages/modules/auth/package.json +++ b/packages/modules/auth/package.json @@ -45,13 +45,15 @@ }, "dependencies": { "@medusajs/modules-sdk": "^1.12.9", - "@medusajs/utils": "^1.11.7", - "@mikro-orm/core": "5.9.7", - "@mikro-orm/migrations": "5.9.7", - "@mikro-orm/postgresql": "5.9.7", - "awilix": "^8.0.0", + "@medusajs/utils": "^1.11.9", "jsonwebtoken": "^9.0.2", "scrypt-kdf": "^2.0.1", "simple-oauth2": "^5.0.0" + }, + "peerDependencies": { + "@mikro-orm/core": "*", + "@mikro-orm/migrations": "*", + "@mikro-orm/postgresql": "*", + "awilix": "*" } } diff --git a/packages/modules/cache-inmemory/package.json b/packages/modules/cache-inmemory/package.json index 2f6ab41b29..03d47f3d2e 100644 --- a/packages/modules/cache-inmemory/package.json +++ b/packages/modules/cache-inmemory/package.json @@ -20,7 +20,7 @@ "author": "Medusa", "license": "MIT", "devDependencies": { - "@medusajs/types": "^1.11.6", + "@medusajs/types": "^1.11.9", "cross-env": "^5.2.1", "jest": "^29.7.0", "rimraf": "^5.0.1", diff --git a/packages/modules/cache-inmemory/src/index.ts b/packages/modules/cache-inmemory/src/index.ts index 92addee2d4..5dd3330c72 100644 --- a/packages/modules/cache-inmemory/src/index.ts +++ b/packages/modules/cache-inmemory/src/index.ts @@ -1,4 +1,4 @@ -import { ModuleExports } from "@medusajs/modules-sdk" +import { ModuleExports } from "@medusajs/types" import InMemoryCacheService from "./services/inmemory-cache" const service = InMemoryCacheService diff --git a/packages/modules/cache-inmemory/src/initialize/index.ts b/packages/modules/cache-inmemory/src/initialize/index.ts index 5617a07159..25fcd1422a 100644 --- a/packages/modules/cache-inmemory/src/initialize/index.ts +++ b/packages/modules/cache-inmemory/src/initialize/index.ts @@ -1,11 +1,11 @@ +import { MedusaModule } from "@medusajs/modules-sdk" import { ExternalModuleDeclaration, + ICacheService, InternalModuleDeclaration, - MedusaModule, -} from "@medusajs/modules-sdk" -import { ICacheService } from "@medusajs/types" -import { InMemoryCacheModuleOptions } from "../types" +} from "@medusajs/types" import { Modules } from "@medusajs/utils" +import { InMemoryCacheModuleOptions } from "../types" export const initialize = async ( options?: InMemoryCacheModuleOptions | ExternalModuleDeclaration diff --git a/packages/modules/cache-redis/package.json b/packages/modules/cache-redis/package.json index c236875b4d..c01838b694 100644 --- a/packages/modules/cache-redis/package.json +++ b/packages/modules/cache-redis/package.json @@ -35,7 +35,9 @@ "dependencies": { "@medusajs/modules-sdk": "^1.12.11", "@medusajs/utils": "^1.11.9", - "awilix": "^8.0.0", "ioredis": "^5.4.1" + }, + "peerDependencies": { + "awilix": "*" } } diff --git a/packages/modules/cache-redis/src/index.ts b/packages/modules/cache-redis/src/index.ts index 1d4810f819..dbdf310bc0 100644 --- a/packages/modules/cache-redis/src/index.ts +++ b/packages/modules/cache-redis/src/index.ts @@ -1,4 +1,4 @@ -import { ModuleExports } from "@medusajs/modules-sdk" +import { ModuleExports } from "@medusajs/types" import Loader from "./loaders" import { RedisCacheService } from "./services" diff --git a/packages/modules/cache-redis/src/initialize/index.ts b/packages/modules/cache-redis/src/initialize/index.ts index 94ae11212c..392af417dc 100644 --- a/packages/modules/cache-redis/src/initialize/index.ts +++ b/packages/modules/cache-redis/src/initialize/index.ts @@ -1,11 +1,11 @@ +import { MedusaModule } from "@medusajs/modules-sdk" import { ExternalModuleDeclaration, + ICacheService, InternalModuleDeclaration, - MedusaModule, -} from "@medusajs/modules-sdk" -import { ICacheService } from "@medusajs/types" -import { RedisCacheModuleOptions } from "../types" +} from "@medusajs/types" import { Modules } from "@medusajs/utils" +import { RedisCacheModuleOptions } from "../types" export const initialize = async ( options?: RedisCacheModuleOptions | ExternalModuleDeclaration diff --git a/packages/modules/cache-redis/src/loaders/index.ts b/packages/modules/cache-redis/src/loaders/index.ts index dab33714ab..c620494460 100644 --- a/packages/modules/cache-redis/src/loaders/index.ts +++ b/packages/modules/cache-redis/src/loaders/index.ts @@ -1,4 +1,4 @@ -import { LoaderOptions } from "@medusajs/modules-sdk" +import { LoaderOptions } from "@medusajs/types" import { asValue } from "awilix" import Redis from "ioredis" import { RedisCacheModuleOptions } from "../types" diff --git a/packages/modules/cart/package.json b/packages/modules/cart/package.json index 927bad1d5c..080238978f 100644 --- a/packages/modules/cart/package.json +++ b/packages/modules/cart/package.json @@ -34,8 +34,7 @@ "orm:cache:clear": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm cache:clear" }, "devDependencies": { - "@medusajs/modules-sdk": "^1.12.11", - "@medusajs/types": "workspace:^", + "@medusajs/types": "^1.11.16", "@mikro-orm/cli": "5.9.7", "cross-env": "^5.2.1", "jest": "^29.7.0", @@ -46,10 +45,12 @@ "typescript": "^5.1.6" }, "dependencies": { - "@medusajs/utils": "^1.11.9", - "@mikro-orm/core": "5.9.7", - "@mikro-orm/migrations": "5.9.7", - "@mikro-orm/postgresql": "5.9.7", - "awilix": "^8.0.0" + "@medusajs/utils": "^1.11.9" + }, + "peerDependencies": { + "@mikro-orm/core": "*", + "@mikro-orm/migrations": "*", + "@mikro-orm/postgresql": "*", + "awilix": "*" } } diff --git a/packages/modules/currency/package.json b/packages/modules/currency/package.json index f6cc96985c..530343b1c5 100644 --- a/packages/modules/currency/package.json +++ b/packages/modules/currency/package.json @@ -34,22 +34,23 @@ "orm:cache:clear": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm cache:clear" }, "devDependencies": { - "@medusajs/modules-sdk": "^1.12.11", "@medusajs/types": "^1.11.16", "@mikro-orm/cli": "5.9.7", "cross-env": "^5.2.1", "jest": "^29.7.0", - "medusa-test-utils": "workspace:^", + "medusa-test-utils": "^1.1.44", "rimraf": "^3.0.2", "ts-node": "^10.9.1", "tsc-alias": "^1.8.6", "typescript": "^5.1.6" }, "dependencies": { - "@medusajs/utils": "^1.11.9", - "@mikro-orm/core": "5.9.7", - "@mikro-orm/migrations": "5.9.7", - "@mikro-orm/postgresql": "5.9.7", - "awilix": "^8.0.0" + "@medusajs/utils": "^1.11.9" + }, + "peerDependencies": { + "@mikro-orm/core": "*", + "@mikro-orm/migrations": "*", + "@mikro-orm/postgresql": "*", + "awilix": "*" } } diff --git a/packages/modules/customer/package.json b/packages/modules/customer/package.json index 2001457f4c..d4e6c011fb 100644 --- a/packages/modules/customer/package.json +++ b/packages/modules/customer/package.json @@ -34,7 +34,7 @@ "orm:cache:clear": "MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm cache:clear" }, "devDependencies": { - "@medusajs/types": "workspace:^", + "@medusajs/types": "^1.11.16", "@mikro-orm/cli": "5.9.7", "cross-env": "^5.2.1", "jest": "^29.7.0", @@ -45,11 +45,12 @@ "typescript": "^5.1.6" }, "dependencies": { - "@medusajs/modules-sdk": "^1.12.11", - "@medusajs/utils": "^1.11.9", - "@mikro-orm/core": "5.9.7", - "@mikro-orm/migrations": "5.9.7", - "@mikro-orm/postgresql": "5.9.7", - "awilix": "^8.0.0" + "@medusajs/utils": "^1.11.9" + }, + "peerDependencies": { + "@mikro-orm/core": "*", + "@mikro-orm/migrations": "*", + "@mikro-orm/postgresql": "*", + "awilix": "*" } } diff --git a/packages/modules/event-bus-local/package.json b/packages/modules/event-bus-local/package.json index 7807509c9f..50a2261eeb 100644 --- a/packages/modules/event-bus-local/package.json +++ b/packages/modules/event-bus-local/package.json @@ -34,7 +34,7 @@ }, "dependencies": { "@medusajs/modules-sdk": "^1.12.8", - "@medusajs/utils": "^1.11.5", + "@medusajs/utils": "^1.11.9", "ulid": "^2.3.0" } } diff --git a/packages/modules/event-bus-local/src/index.ts b/packages/modules/event-bus-local/src/index.ts index 104d35160d..3efbfe77d1 100644 --- a/packages/modules/event-bus-local/src/index.ts +++ b/packages/modules/event-bus-local/src/index.ts @@ -1,4 +1,4 @@ -import { ModuleExports } from "@medusajs/modules-sdk" +import { ModuleExports } from "@medusajs/types" import Loader from "./loaders" import LocalEventBus from "./services/event-bus-local" diff --git a/packages/modules/event-bus-local/src/loaders/index.ts b/packages/modules/event-bus-local/src/loaders/index.ts index ce7bbb9e7a..21f648bcbc 100644 --- a/packages/modules/event-bus-local/src/loaders/index.ts +++ b/packages/modules/event-bus-local/src/loaders/index.ts @@ -1,4 +1,4 @@ -import { LoaderOptions } from "@medusajs/modules-sdk" +import { LoaderOptions } from "@medusajs/types" export default async ({ logger }: LoaderOptions): Promise => { logger?.warn( diff --git a/packages/modules/event-bus-local/src/services/event-bus-local.ts b/packages/modules/event-bus-local/src/services/event-bus-local.ts index 351c78d681..1ed233824d 100644 --- a/packages/modules/event-bus-local/src/services/event-bus-local.ts +++ b/packages/modules/event-bus-local/src/services/event-bus-local.ts @@ -1,9 +1,9 @@ -import { MedusaContainer } from "@medusajs/modules-sdk" import { + Event, EventBusTypes, Logger, + MedusaContainer, Message, - Event, Subscriber, } from "@medusajs/types" import { AbstractEventBusModuleService } from "@medusajs/utils" diff --git a/packages/modules/event-bus-redis/package.json b/packages/modules/event-bus-redis/package.json index aebf100467..ba57f08b5d 100644 --- a/packages/modules/event-bus-redis/package.json +++ b/packages/modules/event-bus-redis/package.json @@ -36,8 +36,10 @@ "dependencies": { "@medusajs/modules-sdk": "^1.12.11", "@medusajs/utils": "^1.11.9", - "awilix": "^8.0.0", "bullmq": "5.12.0", "ioredis": "^5.4.1" + }, + "peerDependencies": { + "awilix": "*" } } diff --git a/packages/modules/event-bus-redis/src/index.ts b/packages/modules/event-bus-redis/src/index.ts index 5712da5fed..c572099b5f 100644 --- a/packages/modules/event-bus-redis/src/index.ts +++ b/packages/modules/event-bus-redis/src/index.ts @@ -1,4 +1,4 @@ -import { ModuleExports } from "@medusajs/modules-sdk" +import { ModuleExports } from "@medusajs/types" import Loader from "./loaders" import RedisEventBusService from "./services/event-bus-redis" diff --git a/packages/modules/event-bus-redis/src/initialize/index.ts b/packages/modules/event-bus-redis/src/initialize/index.ts index 59ce181814..2a72126a23 100644 --- a/packages/modules/event-bus-redis/src/initialize/index.ts +++ b/packages/modules/event-bus-redis/src/initialize/index.ts @@ -1,11 +1,11 @@ +import { MedusaModule } from "@medusajs/modules-sdk" import { ExternalModuleDeclaration, + IEventBusService, InternalModuleDeclaration, - MedusaModule, -} from "@medusajs/modules-sdk" -import { IEventBusService } from "@medusajs/types" -import { EventBusRedisModuleOptions } from "../types" +} from "@medusajs/types" import { Modules } from "@medusajs/utils" +import { EventBusRedisModuleOptions } from "../types" export const initialize = async ( options?: EventBusRedisModuleOptions | ExternalModuleDeclaration diff --git a/packages/modules/event-bus-redis/src/loaders/index.ts b/packages/modules/event-bus-redis/src/loaders/index.ts index 29e35ae366..f44f5bd555 100644 --- a/packages/modules/event-bus-redis/src/loaders/index.ts +++ b/packages/modules/event-bus-redis/src/loaders/index.ts @@ -1,4 +1,4 @@ -import { LoaderOptions } from "@medusajs/modules-sdk" +import { LoaderOptions } from "@medusajs/types" import { asValue } from "awilix" import Redis from "ioredis" import { EOL } from "os" diff --git a/packages/modules/event-bus-redis/src/services/event-bus-redis.ts b/packages/modules/event-bus-redis/src/services/event-bus-redis.ts index 7edfd230fb..76111b829f 100644 --- a/packages/modules/event-bus-redis/src/services/event-bus-redis.ts +++ b/packages/modules/event-bus-redis/src/services/event-bus-redis.ts @@ -1,5 +1,9 @@ -import { InternalModuleDeclaration } from "@medusajs/modules-sdk" -import { Event, Logger, Message } from "@medusajs/types" +import { + Event, + InternalModuleDeclaration, + Logger, + Message, +} from "@medusajs/types" import { AbstractEventBusModuleService, isPresent, diff --git a/packages/modules/file/package.json b/packages/modules/file/package.json index ae00e4a4ae..dec8a5dfd3 100644 --- a/packages/modules/file/package.json +++ b/packages/modules/file/package.json @@ -48,10 +48,12 @@ }, "dependencies": { "@medusajs/modules-sdk": "^1.12.11", - "@medusajs/utils": "^1.11.8", - "@mikro-orm/core": "5.9.7", - "@mikro-orm/migrations": "5.9.7", - "@mikro-orm/postgresql": "5.9.7", - "awilix": "^8.0.0" + "@medusajs/utils": "^1.11.9" + }, + "peerDependencies": { + "@mikro-orm/core": "*", + "@mikro-orm/migrations": "*", + "@mikro-orm/postgresql": "*", + "awilix": "*" } } diff --git a/packages/modules/fulfillment/package.json b/packages/modules/fulfillment/package.json index c473c4642b..9730454230 100644 --- a/packages/modules/fulfillment/package.json +++ b/packages/modules/fulfillment/package.json @@ -35,6 +35,7 @@ }, "devDependencies": { "@medusajs/fulfillment-manual": "workspace:*", + "@medusajs/types": "^1.11.16", "@mikro-orm/cli": "5.9.7", "cross-env": "^5.2.1", "jest": "^29.7.0", @@ -46,11 +47,12 @@ }, "dependencies": { "@medusajs/modules-sdk": "^1.12.11", - "@medusajs/types": "^1.11.16", - "@medusajs/utils": "^1.11.9", - "@mikro-orm/core": "5.9.7", - "@mikro-orm/migrations": "5.9.7", - "@mikro-orm/postgresql": "5.9.7", - "awilix": "^8.0.0" + "@medusajs/utils": "^1.11.9" + }, + "peerDependencies": { + "@mikro-orm/core": "*", + "@mikro-orm/migrations": "*", + "@mikro-orm/postgresql": "*", + "awilix": "*" } } diff --git a/packages/modules/inventory-next/package.json b/packages/modules/inventory-next/package.json index 99f024d7e4..549d8c1160 100644 --- a/packages/modules/inventory-next/package.json +++ b/packages/modules/inventory-next/package.json @@ -31,12 +31,13 @@ "typescript": "^5.1.6" }, "dependencies": { - "@medusajs/modules-sdk": "^1.12.10", - "@medusajs/utils": "^1.11.8", - "@mikro-orm/core": "5.9.7", - "@mikro-orm/migrations": "5.9.7", - "@mikro-orm/postgresql": "5.9.7", - "awilix": "^8.0.0" + "@medusajs/utils": "^1.11.9" + }, + "peerDependencies": { + "@mikro-orm/core": "*", + "@mikro-orm/migrations": "*", + "@mikro-orm/postgresql": "*", + "awilix": "*" }, "scripts": { "watch": "tsc --build --watch", diff --git a/packages/modules/inventory-next/src/services/inventory-module.ts b/packages/modules/inventory-next/src/services/inventory-module.ts index 3cb4747940..0d20aa0ce3 100644 --- a/packages/modules/inventory-next/src/services/inventory-module.ts +++ b/packages/modules/inventory-next/src/services/inventory-module.ts @@ -1,8 +1,8 @@ -import { InternalModuleDeclaration } from "@medusajs/modules-sdk" import { BigNumberInput, Context, DAL, + InternalModuleDeclaration, InventoryTypes, ModuleJoinerConfig, ModulesSdkTypes, diff --git a/packages/modules/link-modules/integration-tests/__tests__/migrations.spec.ts b/packages/modules/link-modules/integration-tests/__tests__/migrations.spec.ts index ea5a2bc1ec..2de35f3b5a 100644 --- a/packages/modules/link-modules/integration-tests/__tests__/migrations.spec.ts +++ b/packages/modules/link-modules/integration-tests/__tests__/migrations.spec.ts @@ -1,5 +1,8 @@ +import { MedusaModule } from "@medusajs/modules-sdk" +import { ILinkModule, ModuleJoinerConfig } from "@medusajs/types" +import { defineLink, isObject, Modules } from "@medusajs/utils" +import { moduleIntegrationTestRunner } from "medusa-test-utils" import { MigrationsExecutionPlanner } from "../../src" -import { MedusaModule, ModuleJoinerConfig } from "@medusajs/modules-sdk" import { Car, carJoinerConfig, @@ -8,9 +11,6 @@ import { userJoinerConfig, UserModule, } from "../__fixtures__/migrations" -import { defineLink, isObject, Modules } from "@medusajs/utils" -import { moduleIntegrationTestRunner } from "medusa-test-utils" -import { ILinkModule } from "@medusajs/types" jest.setTimeout(30000) diff --git a/packages/modules/link-modules/package.json b/packages/modules/link-modules/package.json index 7af9a697ec..e0de015c54 100644 --- a/packages/modules/link-modules/package.json +++ b/packages/modules/link-modules/package.json @@ -41,9 +41,12 @@ }, "dependencies": { "@medusajs/modules-sdk": "^1.12.11", - "@medusajs/utils": "^1.11.9", - "@mikro-orm/core": "5.9.7", - "@mikro-orm/postgresql": "5.9.7", - "awilix": "^8.0.0" + "@medusajs/utils": "^1.11.9" + }, + "peerDependencies": { + "@mikro-orm/core": "*", + "@mikro-orm/migrations": "*", + "@mikro-orm/postgresql": "*", + "awilix": "*" } } diff --git a/packages/modules/link-modules/src/initialize/index.ts b/packages/modules/link-modules/src/initialize/index.ts index b2bf09be72..3e451fc53f 100644 --- a/packages/modules/link-modules/src/initialize/index.ts +++ b/packages/modules/link-modules/src/initialize/index.ts @@ -1,5 +1,4 @@ import { - InternalModuleDeclaration, MedusaModule, MODULE_RESOURCE_TYPE, MODULE_SCOPE, @@ -7,6 +6,7 @@ import { import { ExternalModuleDeclaration, ILinkModule, + InternalModuleDeclaration, LinkModuleDefinition, ModuleExports, ModuleJoinerConfig, diff --git a/packages/modules/link-modules/src/loaders/connection.ts b/packages/modules/link-modules/src/loaders/connection.ts index 88ece9c68c..66343342a3 100644 --- a/packages/modules/link-modules/src/loaders/connection.ts +++ b/packages/modules/link-modules/src/loaders/connection.ts @@ -3,7 +3,7 @@ import { LoaderOptions, ModuleServiceInitializeCustomDataLayerOptions, ModuleServiceInitializeOptions, -} from "@medusajs/modules-sdk" +} from "@medusajs/types" import { ModulesSdkUtils } from "@medusajs/utils" import { EntitySchema } from "@mikro-orm/core" diff --git a/packages/modules/link-modules/src/loaders/container.ts b/packages/modules/link-modules/src/loaders/container.ts index dd3391bbe8..08814747a0 100644 --- a/packages/modules/link-modules/src/loaders/container.ts +++ b/packages/modules/link-modules/src/loaders/container.ts @@ -1,9 +1,9 @@ import { BaseRepository, getLinkRepository } from "@repositories" import { LinkService, getModuleService } from "@services" -import { LoaderOptions } from "@medusajs/modules-sdk" import { InternalModuleDeclaration, + LoaderOptions, ModuleJoinerConfig, ModulesSdkTypes, } from "@medusajs/types" diff --git a/packages/modules/notification/package.json b/packages/modules/notification/package.json index 64bd4c72c8..7b9a0f1c36 100644 --- a/packages/modules/notification/package.json +++ b/packages/modules/notification/package.json @@ -46,10 +46,12 @@ }, "dependencies": { "@medusajs/modules-sdk": "^1.12.11", - "@medusajs/utils": "^1.11.9", - "@mikro-orm/core": "5.9.7", - "@mikro-orm/migrations": "5.9.7", - "@mikro-orm/postgresql": "5.9.7", - "awilix": "^8.0.0" + "@medusajs/utils": "^1.11.9" + }, + "peerDependencies": { + "@mikro-orm/core": "*", + "@mikro-orm/migrations": "*", + "@mikro-orm/postgresql": "*", + "awilix": "*" } } diff --git a/packages/modules/order/package.json b/packages/modules/order/package.json index b4ba863daf..6dd70b315f 100644 --- a/packages/modules/order/package.json +++ b/packages/modules/order/package.json @@ -34,7 +34,6 @@ "orm:cache:clear": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm cache:clear" }, "devDependencies": { - "@medusajs/modules-sdk": "^1.12.11", "@medusajs/types": "^1.11.16", "@mikro-orm/cli": "5.9.7", "cross-env": "^5.2.1", @@ -46,10 +45,12 @@ "typescript": "^5.1.6" }, "dependencies": { - "@medusajs/utils": "^1.11.9", - "@mikro-orm/core": "5.9.7", - "@mikro-orm/migrations": "5.9.7", - "@mikro-orm/postgresql": "5.9.7", - "awilix": "^8.0.0" + "@medusajs/utils": "^1.11.9" + }, + "peerDependencies": { + "@mikro-orm/core": "*", + "@mikro-orm/migrations": "*", + "@mikro-orm/postgresql": "*", + "awilix": "*" } } diff --git a/packages/modules/payment/package.json b/packages/modules/payment/package.json index a884b55cc4..c71c4f311d 100644 --- a/packages/modules/payment/package.json +++ b/packages/modules/payment/package.json @@ -47,11 +47,13 @@ }, "dependencies": { "@medusajs/modules-sdk": "^1.12.11", - "@medusajs/utils": "^1.11.9", - "@mikro-orm/core": "5.9.7", - "@mikro-orm/migrations": "5.9.7", - "@mikro-orm/postgresql": "5.9.7", - "awilix": "^8.0.0", - "bignumber.js": "^9.1.2" + "@medusajs/utils": "^1.11.9" + }, + "peerDependencies": { + "@mikro-orm/core": "*", + "@mikro-orm/migrations": "*", + "@mikro-orm/postgresql": "*", + "awilix": "*", + "bignumber.js": "*" } } diff --git a/packages/modules/pricing/package.json b/packages/modules/pricing/package.json index cfd19a8575..c4112bad86 100644 --- a/packages/modules/pricing/package.json +++ b/packages/modules/pricing/package.json @@ -34,7 +34,6 @@ "orm:cache:clear": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm cache:clear" }, "devDependencies": { - "@medusajs/modules-sdk": "^1.12.11", "@medusajs/types": "^1.11.16", "@mikro-orm/cli": "5.9.7", "cross-env": "^5.2.1", @@ -47,10 +46,12 @@ "typescript": "^5.1.6" }, "dependencies": { - "@medusajs/utils": "^1.11.9", - "@mikro-orm/core": "5.9.7", - "@mikro-orm/migrations": "5.9.7", - "@mikro-orm/postgresql": "5.9.7", - "awilix": "^8.0.0" + "@medusajs/utils": "^1.11.9" + }, + "peerDependencies": { + "@mikro-orm/core": "*", + "@mikro-orm/migrations": "*", + "@mikro-orm/postgresql": "*", + "awilix": "*" } } diff --git a/packages/modules/product/mikro-orm.config.dev.ts b/packages/modules/product/mikro-orm.config.dev.ts index daa79585ac..50a21f71f3 100644 --- a/packages/modules/product/mikro-orm.config.dev.ts +++ b/packages/modules/product/mikro-orm.config.dev.ts @@ -1,7 +1,6 @@ -import * as entities from "./src/models" import { defineMikroOrmCliConfig, Modules } from "@medusajs/utils" +import * as entities from "./src/models" export default defineMikroOrmCliConfig(Modules.PRODUCT, { entities: Object.values(entities), - databaseName: "medusa-products", }) diff --git a/packages/modules/product/package.json b/packages/modules/product/package.json index 3df332468f..a2c27ac59b 100644 --- a/packages/modules/product/package.json +++ b/packages/modules/product/package.json @@ -34,7 +34,6 @@ "orm:cache:clear": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm cache:clear" }, "devDependencies": { - "@medusajs/modules-sdk": "^1.12.11", "@medusajs/types": "^1.11.16", "@mikro-orm/cli": "5.9.7", "cross-env": "^5.2.1", @@ -48,10 +47,12 @@ "typescript": "^5.1.6" }, "dependencies": { - "@medusajs/utils": "^1.11.9", - "@mikro-orm/core": "5.9.7", - "@mikro-orm/migrations": "5.9.7", - "@mikro-orm/postgresql": "5.9.7", - "awilix": "^8.0.0" + "@medusajs/utils": "^1.11.9" + }, + "peerDependencies": { + "@mikro-orm/core": "*", + "@mikro-orm/migrations": "*", + "@mikro-orm/postgresql": "*", + "awilix": "*" } } diff --git a/packages/modules/promotion/package.json b/packages/modules/promotion/package.json index d61a92c570..7ce9e66b1b 100644 --- a/packages/modules/promotion/package.json +++ b/packages/modules/promotion/package.json @@ -34,7 +34,6 @@ "orm:cache:clear": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm cache:clear" }, "devDependencies": { - "@medusajs/modules-sdk": "^1.12.11", "@medusajs/types": "^1.11.16", "@mikro-orm/cli": "5.9.7", "cross-env": "^5.2.1", @@ -47,10 +46,12 @@ "typescript": "^5.1.6" }, "dependencies": { - "@medusajs/utils": "1.11.9", - "@mikro-orm/core": "5.9.7", - "@mikro-orm/migrations": "5.9.7", - "@mikro-orm/postgresql": "5.9.7", - "awilix": "^8.0.0" + "@medusajs/utils": "1.11.9" + }, + "peerDependencies": { + "@mikro-orm/core": "*", + "@mikro-orm/migrations": "*", + "@mikro-orm/postgresql": "*", + "awilix": "*" } } diff --git a/packages/modules/providers/auth-emailpass/package.json b/packages/modules/providers/auth-emailpass/package.json index 5a30819eba..019394833b 100644 --- a/packages/modules/providers/auth-emailpass/package.json +++ b/packages/modules/providers/auth-emailpass/package.json @@ -30,7 +30,7 @@ "typescript": "^5.3.3" }, "dependencies": { - "@medusajs/utils": "^1.11.7", + "@medusajs/utils": "^1.11.9", "scrypt-kdf": "^2.0.1" }, "keywords": [ diff --git a/packages/modules/providers/auth-google/package.json b/packages/modules/providers/auth-google/package.json index a67898e320..f77afc487e 100644 --- a/packages/modules/providers/auth-google/package.json +++ b/packages/modules/providers/auth-google/package.json @@ -33,7 +33,7 @@ "typescript": "^5.1.6" }, "dependencies": { - "@medusajs/utils": "^1.11.7", + "@medusajs/utils": "^1.11.9", "jsonwebtoken": "^9.0.2" }, "keywords": [ diff --git a/packages/modules/providers/file-local/package.json b/packages/modules/providers/file-local/package.json index 758d950704..c79b28c17b 100644 --- a/packages/modules/providers/file-local/package.json +++ b/packages/modules/providers/file-local/package.json @@ -29,7 +29,7 @@ "typescript": "^5.3.3" }, "dependencies": { - "@medusajs/utils": "^1.11.7" + "@medusajs/utils": "^1.11.9" }, "keywords": [ "medusa-plugin", diff --git a/packages/modules/providers/file-s3/package.json b/packages/modules/providers/file-s3/package.json index a50e3006bc..6d3c0e3aaf 100644 --- a/packages/modules/providers/file-s3/package.json +++ b/packages/modules/providers/file-s3/package.json @@ -33,7 +33,7 @@ "dependencies": { "@aws-sdk/client-s3": "^3.556.0", "@aws-sdk/s3-request-presigner": "^3.556.0", - "@medusajs/utils": "^1.11.7", + "@medusajs/utils": "^1.11.9", "ulid": "^2.3.0" }, "keywords": [ diff --git a/packages/modules/providers/fulfillment-manual/package.json b/packages/modules/providers/fulfillment-manual/package.json index da5a999f09..a13b55767b 100644 --- a/packages/modules/providers/fulfillment-manual/package.json +++ b/packages/modules/providers/fulfillment-manual/package.json @@ -29,7 +29,7 @@ "typescript": "^5.3.3" }, "dependencies": { - "@medusajs/utils": "^1.11.7", + "@medusajs/utils": "^1.11.9", "body-parser": "^1.19.0", "express": "^4.17.1" }, diff --git a/packages/modules/providers/notification-local/package.json b/packages/modules/providers/notification-local/package.json index c948854dc4..41dac22557 100644 --- a/packages/modules/providers/notification-local/package.json +++ b/packages/modules/providers/notification-local/package.json @@ -30,7 +30,7 @@ "typescript": "^5.3.3" }, "dependencies": { - "@medusajs/utils": "^1.11.7" + "@medusajs/utils": "^1.11.9" }, "keywords": [ "medusa-provider", diff --git a/packages/modules/providers/notification-sendgrid/package.json b/packages/modules/providers/notification-sendgrid/package.json index f68048ed87..eafa6fc4d4 100644 --- a/packages/modules/providers/notification-sendgrid/package.json +++ b/packages/modules/providers/notification-sendgrid/package.json @@ -32,7 +32,7 @@ "typescript": "^5.3.3" }, "dependencies": { - "@medusajs/utils": "^1.11.7", + "@medusajs/utils": "^1.11.9", "@sendgrid/mail": "^8.1.3" }, "keywords": [ diff --git a/packages/modules/providers/payment-stripe/package.json b/packages/modules/providers/payment-stripe/package.json index 5cb866a286..565b9a9a9f 100644 --- a/packages/modules/providers/payment-stripe/package.json +++ b/packages/modules/providers/payment-stripe/package.json @@ -25,17 +25,16 @@ "devDependencies": { "@medusajs/medusa": "^1.20.3", "@types/stripe": "^8.0.417", - "awilix": "^8.0.1", "cross-env": "^5.2.1", "jest": "^29.7.0", "rimraf": "^5.0.1", "typescript": "^5.3.3" }, "peerDependencies": { - "@medusajs/medusa": "^1.12.0" + "awilix": "*" }, "dependencies": { - "@medusajs/utils": "^1.11.7", + "@medusajs/utils": "^1.11.9", "body-parser": "^1.19.0", "express": "^4.17.1", "stripe": "latest" diff --git a/packages/modules/region/package.json b/packages/modules/region/package.json index 55ae80fb2a..d42867c162 100644 --- a/packages/modules/region/package.json +++ b/packages/modules/region/package.json @@ -34,7 +34,6 @@ "orm:cache:clear": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm cache:clear" }, "devDependencies": { - "@medusajs/modules-sdk": "^1.12.11", "@medusajs/types": "^1.11.16", "@mikro-orm/cli": "5.9.7", "cross-env": "^5.2.1", @@ -46,10 +45,12 @@ "typescript": "^5.1.6" }, "dependencies": { - "@medusajs/utils": "^1.11.9", - "@mikro-orm/core": "5.9.7", - "@mikro-orm/migrations": "5.9.7", - "@mikro-orm/postgresql": "5.9.7", - "awilix": "^8.0.0" + "@medusajs/utils": "^1.11.9" + }, + "peerDependencies": { + "@mikro-orm/core": "*", + "@mikro-orm/migrations": "*", + "@mikro-orm/postgresql": "*", + "awilix": "*" } } diff --git a/packages/modules/sales-channel/package.json b/packages/modules/sales-channel/package.json index 68d730b4d1..30e525e7e6 100644 --- a/packages/modules/sales-channel/package.json +++ b/packages/modules/sales-channel/package.json @@ -34,7 +34,6 @@ "orm:cache:clear": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm cache:clear" }, "devDependencies": { - "@medusajs/modules-sdk": "^1.12.11", "@medusajs/types": "^1.11.14", "@mikro-orm/cli": "5.9.7", "cross-env": "^5.2.1", @@ -46,10 +45,12 @@ "typescript": "^5.1.6" }, "dependencies": { - "@medusajs/utils": "^1.11.7", - "@mikro-orm/core": "5.9.7", - "@mikro-orm/migrations": "5.9.7", - "@mikro-orm/postgresql": "5.9.7", - "awilix": "^8.0.0" + "@medusajs/utils": "^1.11.9" + }, + "peerDependencies": { + "@mikro-orm/core": "*", + "@mikro-orm/migrations": "*", + "@mikro-orm/postgresql": "*", + "awilix": "*" } } diff --git a/packages/modules/stock-location-next/package.json b/packages/modules/stock-location-next/package.json index f5fcd3f585..4633bb946a 100644 --- a/packages/modules/stock-location-next/package.json +++ b/packages/modules/stock-location-next/package.json @@ -31,12 +31,13 @@ "typescript": "^5.1.6" }, "dependencies": { - "@medusajs/modules-sdk": "^1.12.11", - "@medusajs/utils": "^1.11.9", - "@mikro-orm/core": "5.9.7", - "@mikro-orm/migrations": "5.9.7", - "@mikro-orm/postgresql": "5.9.7", - "awilix": "^8.0.0" + "@medusajs/utils": "^1.11.9" + }, + "peerDependencies": { + "@mikro-orm/core": "*", + "@mikro-orm/migrations": "*", + "@mikro-orm/postgresql": "*", + "awilix": "*" }, "scripts": { "watch": "tsc --build --watch", diff --git a/packages/modules/stock-location-next/src/services/stock-location-module.ts b/packages/modules/stock-location-next/src/services/stock-location-module.ts index e17175b2f7..5facd3ebbb 100644 --- a/packages/modules/stock-location-next/src/services/stock-location-module.ts +++ b/packages/modules/stock-location-next/src/services/stock-location-module.ts @@ -1,4 +1,3 @@ -import { InternalModuleDeclaration } from "@medusajs/modules-sdk" import { Context, CreateStockLocationInput, @@ -6,6 +5,7 @@ import { FilterableStockLocationProps, IEventBusService, IStockLocationService, + InternalModuleDeclaration, ModuleJoinerConfig, ModulesSdkTypes, StockLocationAddressInput, @@ -16,9 +16,9 @@ import { import { InjectManager, InjectTransactionManager, - isString, MedusaContext, MedusaService, + isString, promiseAll, } from "@medusajs/utils" import { joinerConfig } from "../joiner-config" diff --git a/packages/modules/store/package.json b/packages/modules/store/package.json index b071f0af58..f252c971dc 100644 --- a/packages/modules/store/package.json +++ b/packages/modules/store/package.json @@ -34,22 +34,23 @@ "orm:cache:clear": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm cache:clear" }, "devDependencies": { - "@medusajs/modules-sdk": "^1.12.11", "@medusajs/types": "^1.11.16", "@mikro-orm/cli": "5.9.7", "cross-env": "^5.2.1", "jest": "^29.7.0", - "medusa-test-utils": "workspace:^", + "medusa-test-utils": "^1.1.44", "rimraf": "^3.0.2", "ts-node": "^10.9.1", "tsc-alias": "^1.8.6", "typescript": "^5.1.6" }, "dependencies": { - "@medusajs/utils": "^1.11.9", - "@mikro-orm/core": "5.9.7", - "@mikro-orm/migrations": "5.9.7", - "@mikro-orm/postgresql": "5.9.7", - "awilix": "^8.0.0" + "@medusajs/utils": "^1.11.9" + }, + "peerDependencies": { + "@mikro-orm/core": "*", + "@mikro-orm/migrations": "*", + "@mikro-orm/postgresql": "*", + "awilix": "*" } } diff --git a/packages/modules/tax/package.json b/packages/modules/tax/package.json index d477c49df2..abc4b62123 100644 --- a/packages/modules/tax/package.json +++ b/packages/modules/tax/package.json @@ -46,10 +46,12 @@ }, "dependencies": { "@medusajs/modules-sdk": "^1.12.9", - "@medusajs/utils": "^1.11.7", - "@mikro-orm/core": "5.9.7", - "@mikro-orm/migrations": "5.9.7", - "@mikro-orm/postgresql": "5.9.7", - "awilix": "^8.0.0" + "@medusajs/utils": "^1.11.9" + }, + "peerDependencies": { + "@mikro-orm/core": "*", + "@mikro-orm/migrations": "*", + "@mikro-orm/postgresql": "*", + "awilix": "*" } } diff --git a/packages/modules/user/package.json b/packages/modules/user/package.json index c9758dc42c..bfb9e2c999 100644 --- a/packages/modules/user/package.json +++ b/packages/modules/user/package.json @@ -34,7 +34,6 @@ "orm:cache:clear": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm cache:clear" }, "devDependencies": { - "@medusajs/modules-sdk": "^1.12.11", "@medusajs/types": "^1.11.15", "@mikro-orm/cli": "5.9.7", "@swc/core": "^1.5.29", @@ -48,11 +47,13 @@ "typescript": "^5.1.6" }, "dependencies": { - "@medusajs/utils": "^1.11.8", - "@mikro-orm/core": "5.9.7", - "@mikro-orm/migrations": "5.9.7", - "@mikro-orm/postgresql": "5.9.7", - "awilix": "^8.0.0", + "@medusajs/utils": "^1.11.9", "jsonwebtoken": "^9.0.2" + }, + "peerDependencies": { + "@mikro-orm/core": "*", + "@mikro-orm/migrations": "*", + "@mikro-orm/postgresql": "*", + "awilix": "*" } } diff --git a/packages/modules/workflow-engine-inmemory/mikro-orm.config.dev.ts b/packages/modules/workflow-engine-inmemory/mikro-orm.config.dev.ts index 3380283402..d86510b726 100644 --- a/packages/modules/workflow-engine-inmemory/mikro-orm.config.dev.ts +++ b/packages/modules/workflow-engine-inmemory/mikro-orm.config.dev.ts @@ -1,7 +1,6 @@ -import * as entities from "./src/models" import { defineMikroOrmCliConfig, Modules } from "@medusajs/utils" +import * as entities from "./src/models" export default defineMikroOrmCliConfig(Modules.WORKFLOW_ENGINE, { entities: Object.values(entities), - databaseName: "medusa-workflow-engine-inmemory", }) diff --git a/packages/modules/workflow-engine-inmemory/package.json b/packages/modules/workflow-engine-inmemory/package.json index 3facc3e1cd..456742bd05 100644 --- a/packages/modules/workflow-engine-inmemory/package.json +++ b/packages/modules/workflow-engine-inmemory/package.json @@ -34,7 +34,6 @@ "orm:cache:clear": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm cache:clear" }, "devDependencies": { - "@medusajs/modules-sdk": "^1.12.11", "@medusajs/types": "^1.11.16", "@mikro-orm/cli": "5.9.7", "cross-env": "^5.2.1", @@ -46,12 +45,15 @@ "typescript": "^5.1.6" }, "dependencies": { + "@medusajs/orchestration": "^0.5.7", "@medusajs/utils": "^1.11.9", "@medusajs/workflows-sdk": "^0.1.6", - "@mikro-orm/core": "5.9.7", - "@mikro-orm/migrations": "5.9.7", - "@mikro-orm/postgresql": "5.9.7", - "awilix": "^8.0.0", "cron-parser": "^4.9.0" + }, + "peerDependencies": { + "@mikro-orm/core": "*", + "@mikro-orm/migrations": "*", + "@mikro-orm/postgresql": "*", + "awilix": "*" } } diff --git a/packages/modules/workflow-engine-redis/integration-tests/__tests__/index.spec.ts b/packages/modules/workflow-engine-redis/integration-tests/__tests__/index.spec.ts index 3d0341848c..4e7f51c965 100644 --- a/packages/modules/workflow-engine-redis/integration-tests/__tests__/index.spec.ts +++ b/packages/modules/workflow-engine-redis/integration-tests/__tests__/index.spec.ts @@ -1,4 +1,3 @@ -import { MedusaApp } from "@medusajs/modules-sdk" import { TransactionStepTimeoutError, TransactionTimeoutError, @@ -15,428 +14,395 @@ import { Modules, TransactionHandlerType, TransactionStepState, - createMedusaContainer, } from "@medusajs/utils" import { WorkflowsModuleService } from "@medusajs/workflow-engine-inmemory/dist/services" -import { asFunction, asValue } from "awilix" -import Redis from "ioredis" -import { knex } from "knex" +import { asValue } from "awilix" +import { moduleIntegrationTestRunner } from "medusa-test-utils" import { setTimeout } from "timers/promises" import "../__fixtures__" import { createScheduled } from "../__fixtures__/workflow_scheduled" -import { DB_URL, TestDatabase } from "../utils" +import { TestDatabase } from "../utils" jest.setTimeout(100000) -const sharedPgConnection = knex({ - client: "pg", - searchPath: process.env.MEDUSA_WORKFLOW_ENGINE_DB_SCHEMA, - connection: { - connectionString: DB_URL, - debug: false, - }, -}) - -const afterEach_ = async () => { - await TestDatabase.clearTables(sharedPgConnection) -} - -function times(num) { - let resolver - let counter = 0 - const promise = new Promise((resolve) => { - resolver = resolve - }) - - return { - next: () => { - counter += 1 - if (counter === num) { - resolver() - } +moduleIntegrationTestRunner({ + moduleName: Modules.WORKFLOW_ENGINE, + resolve: __dirname + "/../..", + moduleOptions: { + redis: { + url: "localhost:6379", }, - promise, - } -} + }, + testSuite: ({ service: workflowOrcModule, medusaApp }) => { + describe("Workflow Orchestrator module", function () { + const afterEach_ = async () => { + await TestDatabase.clearTables() + } + beforeEach(() => { + jest.clearAllMocks() + }) -describe("Workflow Orchestrator module", function () { - let workflowOrcModule: IWorkflowEngineService - let query: RemoteQueryFunction - let sharedContainer_: MedusaContainer + function times(num) { + let resolver + let counter = 0 + const promise = new Promise((resolve) => { + resolver = resolve + }) - beforeAll(async () => { - const container = createMedusaContainer() - container.register(ContainerRegistrationKeys.LOGGER, asValue(console)) + return { + next: () => { + counter += 1 + if (counter === num) { + resolver() + } + }, + promise, + } + } - // Clear any residual data in Redis - const redisClient = new Redis() - redisClient.flushall() + let query: RemoteQueryFunction + let sharedContainer_: MedusaContainer - const { - runMigrations, - query: remoteQuery, - modules, - sharedContainer, - onApplicationStart, - } = await MedusaApp({ - sharedContainer: container, - sharedResourcesConfig: { - database: { - connection: sharedPgConnection, - }, - }, - modulesConfig: { - workflows: { - resolve: __dirname + "/../..", - options: { - redis: { - url: "localhost:6379", + beforeEach(() => { + query = medusaApp.query + sharedContainer_ = medusaApp.sharedContainer + }) + + it(`should export the appropriate linkable configuration`, () => { + const linkable = Module(Modules.WORKFLOW_ENGINE, { + service: WorkflowsModuleService, + }).linkable + + expect(Object.keys(linkable)).toEqual(["workflowExecution"]) + + Object.keys(linkable).forEach((key) => { + delete linkable[key].toJSON + }) + + expect(linkable).toEqual({ + workflowExecution: { + id: { + linkable: "workflow_execution_id", + primaryKey: "id", + serviceName: "workflows", + field: "workflowExecution", }, }, - }, - }, - }) - - query = remoteQuery - sharedContainer_ = sharedContainer! - - await runMigrations() - await onApplicationStart() - - workflowOrcModule = modules.workflows as unknown as IWorkflowEngineService - }) - - it(`should export the appropriate linkable configuration`, () => { - const linkable = Module(Modules.WORKFLOW_ENGINE, { - service: WorkflowsModuleService, - }).linkable - - expect(Object.keys(linkable)).toEqual(["workflowExecution"]) - - Object.keys(linkable).forEach((key) => { - delete linkable[key].toJSON - }) - - expect(linkable).toEqual({ - workflowExecution: { - id: { - linkable: "workflow_execution_id", - primaryKey: "id", - serviceName: "workflows", - field: "workflowExecution", - }, - }, - }) - }) - - describe("Testing basic workflow", function () { - afterEach(afterEach_) - - it("should return a list of workflow executions and remove after completed when there is no retentionTime set", async () => { - await workflowOrcModule.run("workflow_1", { - input: { - value: "123", - }, - throwOnError: true, + }) }) - let executionsList = await query({ - workflow_executions: { - fields: ["workflow_id", "transaction_id", "state"], - }, - }) + describe("Testing basic workflow", function () { + afterEach(afterEach_) - expect(executionsList).toHaveLength(1) + it("should return a list of workflow executions and remove after completed when there is no retentionTime set", async () => { + await workflowOrcModule.run("workflow_1", { + input: { + value: "123", + }, + throwOnError: true, + }) - const { result } = await workflowOrcModule.setStepSuccess({ - idempotencyKey: { - action: TransactionHandlerType.INVOKE, - stepId: "new_step_name", - workflowId: "workflow_1", - transactionId: executionsList[0].transaction_id, - }, - stepResponse: { uhuuuu: "yeaah!" }, - }) + let executionsList = await query({ + workflow_executions: { + fields: ["workflow_id", "transaction_id", "state"], + }, + }) - executionsList = await query({ - workflow_executions: { - fields: ["id"], - }, - }) + expect(executionsList).toHaveLength(1) - expect(executionsList).toHaveLength(0) - expect(result).toEqual({ - done: { - inputFromSyncStep: "oh", - }, - }) - }) + const { result } = await workflowOrcModule.setStepSuccess({ + idempotencyKey: { + action: TransactionHandlerType.INVOKE, + stepId: "new_step_name", + workflowId: "workflow_1", + transactionId: executionsList[0].transaction_id, + }, + stepResponse: { uhuuuu: "yeaah!" }, + }) - it("should return a list of workflow executions and keep it saved when there is a retentionTime set", async () => { - await workflowOrcModule.run("workflow_2", { - input: { - value: "123", - }, - throwOnError: true, - transactionId: "transaction_1", - }) + executionsList = await query({ + workflow_executions: { + fields: ["id"], + }, + }) - let executionsList = await query({ - workflow_executions: { - fields: ["id"], - }, - }) + expect(executionsList).toHaveLength(0) + expect(result).toEqual({ + done: { + inputFromSyncStep: "oh", + }, + }) + }) - expect(executionsList).toHaveLength(1) + it("should return a list of workflow executions and keep it saved when there is a retentionTime set", async () => { + await workflowOrcModule.run("workflow_2", { + input: { + value: "123", + }, + throwOnError: true, + transactionId: "transaction_1", + }) - await workflowOrcModule.setStepSuccess({ - idempotencyKey: { - action: TransactionHandlerType.INVOKE, - stepId: "new_step_name", - workflowId: "workflow_2", - transactionId: "transaction_1", - }, - stepResponse: { uhuuuu: "yeaah!" }, - }) + let executionsList = await query({ + workflow_executions: { + fields: ["id"], + }, + }) - executionsList = await query({ - workflow_executions: { - fields: ["id"], - }, - }) + expect(executionsList).toHaveLength(1) - expect(executionsList).toHaveLength(1) - }) + await workflowOrcModule.setStepSuccess({ + idempotencyKey: { + action: TransactionHandlerType.INVOKE, + stepId: "new_step_name", + workflowId: "workflow_2", + transactionId: "transaction_1", + }, + stepResponse: { uhuuuu: "yeaah!" }, + }) - it("should revert the entire transaction when a step timeout expires", async () => { - const { transaction, result, errors } = await workflowOrcModule.run( - "workflow_step_timeout", - { - input: { + executionsList = await query({ + workflow_executions: { + fields: ["id"], + }, + }) + + expect(executionsList).toHaveLength(1) + }) + + it("should revert the entire transaction when a step timeout expires", async () => { + const { transaction, result, errors } = await workflowOrcModule.run( + "workflow_step_timeout", + { + input: { + myInput: "123", + }, + throwOnError: false, + logOnError: true, + } + ) + + expect(transaction.flow.state).toEqual("reverted") + expect(result).toEqual({ myInput: "123", - }, - throwOnError: false, - logOnError: true, - } - ) + }) + expect(errors).toHaveLength(1) + expect(errors[0].action).toEqual("step_1") + expect(errors[0].error).toBeInstanceOf(TransactionStepTimeoutError) + }) - expect(transaction.flow.state).toEqual("reverted") - expect(result).toEqual({ - myInput: "123", - }) - expect(errors).toHaveLength(1) - expect(errors[0].action).toEqual("step_1") - expect(errors[0].error).toBeInstanceOf(TransactionStepTimeoutError) - }) + it("should revert the entire transaction when the transaction timeout expires", async () => { + const { transaction, result, errors } = await workflowOrcModule.run( + "workflow_transaction_timeout", + { + input: {}, + transactionId: "trx", + throwOnError: false, + } + ) - it("should revert the entire transaction when the transaction timeout expires", async () => { - const { transaction, result, errors } = await workflowOrcModule.run( - "workflow_transaction_timeout", - { - input: {}, - transactionId: "trx", - throwOnError: false, - } - ) + expect(transaction.flow.state).toEqual("reverted") + expect(result).toEqual({ executed: true }) + expect(errors).toHaveLength(1) + expect(errors[0].action).toEqual("step_1") + expect( + TransactionTimeoutError.isTransactionTimeoutError(errors[0].error) + ).toBe(true) + }) - expect(transaction.flow.state).toEqual("reverted") - expect(result).toEqual({ executed: true }) - expect(errors).toHaveLength(1) - expect(errors[0].action).toEqual("step_1") - expect( - TransactionTimeoutError.isTransactionTimeoutError(errors[0].error) - ).toBe(true) - }) + it("should revert the entire transaction when a step timeout expires in a async step", async () => { + await workflowOrcModule.run("workflow_step_timeout_async", { + input: { + myInput: "123", + }, + transactionId: "transaction_1", + throwOnError: false, + }) - it("should revert the entire transaction when a step timeout expires in a async step", async () => { - await workflowOrcModule.run("workflow_step_timeout_async", { - input: { - myInput: "123", - }, - transactionId: "transaction_1", - throwOnError: false, - }) + await setTimeout(200) - await setTimeout(200) + const { transaction, result, errors } = await workflowOrcModule.run( + "workflow_step_timeout_async", + { + input: { + myInput: "123", + }, + transactionId: "transaction_1", + throwOnError: false, + } + ) - const { transaction, result, errors } = await workflowOrcModule.run( - "workflow_step_timeout_async", - { - input: { + expect(transaction.flow.state).toEqual("reverted") + expect(result).toEqual(undefined) + expect(errors).toHaveLength(1) + expect(errors[0].action).toEqual("step_1_async") + expect( + TransactionStepTimeoutError.isTransactionStepTimeoutError( + errors[0].error + ) + ).toBe(true) + }) + + it("should revert the entire transaction when the transaction timeout expires in a transaction containing an async step", async () => { + await workflowOrcModule.run("workflow_transaction_timeout_async", { + input: {}, + transactionId: "transaction_1", + throwOnError: false, + }) + + await setTimeout(200) + + const { transaction, result, errors } = await workflowOrcModule.run( + "workflow_transaction_timeout_async", + { + input: {}, + transactionId: "transaction_1", + throwOnError: false, + } + ) + + expect(transaction.flow.state).toEqual("reverted") + expect(result).toEqual(undefined) + expect(errors).toHaveLength(1) + expect(errors[0].action).toEqual("step_1") + expect( + TransactionTimeoutError.isTransactionTimeoutError(errors[0].error) + ).toBe(true) + }) + + it("should complete an async workflow that returns a StepResponse", async () => { + const { transaction, result } = await workflowOrcModule.run( + "workflow_async_background", + { + input: { + myInput: "123", + }, + transactionId: "transaction_1", + throwOnError: false, + } + ) + + expect(transaction.flow.state).toEqual(TransactionStepState.INVOKING) + expect(result).toEqual(undefined) + + await setTimeout(205) + + const trx = await workflowOrcModule.run("workflow_async_background", { + input: { + myInput: "123", + }, + transactionId: "transaction_1", + throwOnError: false, + }) + + expect(trx.transaction.flow.state).toEqual(TransactionStepState.DONE) + expect(trx.result).toEqual({ myInput: "123", - }, - transactionId: "transaction_1", - throwOnError: false, - } - ) + }) + }) - expect(transaction.flow.state).toEqual("reverted") - expect(result).toEqual(undefined) - expect(errors).toHaveLength(1) - expect(errors[0].action).toEqual("step_1_async") - expect( - TransactionStepTimeoutError.isTransactionStepTimeoutError( - errors[0].error - ) - ).toBe(true) - }) + it("should subsctibe to a async workflow and receive the response when it finishes", (done) => { + const transactionId = "trx_123" - it("should revert the entire transaction when the transaction timeout expires in a transaction containing an async step", async () => { - await workflowOrcModule.run("workflow_transaction_timeout_async", { - input: {}, - transactionId: "transaction_1", - throwOnError: false, + const onFinish = jest.fn(() => { + done() + }) + + void workflowOrcModule.run("workflow_async_background", { + input: { + myInput: "123", + }, + transactionId, + throwOnError: false, + }) + + void workflowOrcModule.subscribe({ + workflowId: "workflow_async_background", + transactionId, + subscriber: (event) => { + if (event.eventType === "onFinish") { + onFinish() + } + }, + }) + + expect(onFinish).toHaveBeenCalledTimes(0) + }) }) - await setTimeout(200) + // Note: These tests depend on actual Redis instance and waiting for the scheduled jobs to run, which isn't great. + // Mocking bullmq, however, would make the tests close to useless, so we can keep them very minimal and serve as smoke tests. + describe("Scheduled workflows", () => { + beforeEach(() => { + jest.clearAllMocks() + }) - const { transaction, result, errors } = await workflowOrcModule.run( - "workflow_transaction_timeout_async", - { - input: {}, - transactionId: "transaction_1", - throwOnError: false, - } - ) + it("should execute a scheduled workflow", async () => { + const wait = times(2) + const spy = createScheduled("standard", wait.next) - expect(transaction.flow.state).toEqual("reverted") - expect(result).toEqual(undefined) - expect(errors).toHaveLength(1) - expect(errors[0].action).toEqual("step_1") - expect( - TransactionTimeoutError.isTransactionTimeoutError(errors[0].error) - ).toBe(true) - }) + await wait.promise + expect(spy).toHaveBeenCalledTimes(2) + WorkflowManager.unregister("standard") + }) - it("should complete an async workflow that returns a StepResponse", async () => { - const { transaction, result } = await workflowOrcModule.run( - "workflow_async_background", - { - input: { - myInput: "123", - }, - transactionId: "transaction_1", - throwOnError: false, - } - ) + it("should stop executions after the set number of executions", async () => { + const wait = times(2) + const spy = await createScheduled("num-executions", wait.next, { + cron: "* * * * * *", + numberOfExecutions: 2, + }) - expect(transaction.flow.state).toEqual(TransactionStepState.INVOKING) - expect(result).toEqual(undefined) + await wait.promise + expect(spy).toHaveBeenCalledTimes(2) - await setTimeout(205) + // Make sure that on the next tick it doesn't execute again + await setTimeout(1100) + expect(spy).toHaveBeenCalledTimes(2) - const trx = await workflowOrcModule.run("workflow_async_background", { - input: { - myInput: "123", - }, - transactionId: "transaction_1", - throwOnError: false, - }) + WorkflowManager.unregister("num-execution") + }) - expect(trx.transaction.flow.state).toEqual(TransactionStepState.DONE) - expect(trx.result).toEqual({ - myInput: "123", + it("should remove scheduled workflow if workflow no longer exists", async () => { + const wait = times(1) + const logger = sharedContainer_.resolve( + ContainerRegistrationKeys.LOGGER + ) + + const spy = await createScheduled("remove-scheduled", wait.next, { + cron: "* * * * * *", + }) + const logSpy = jest.spyOn(logger, "warn") + + await wait.promise + expect(spy).toHaveBeenCalledTimes(1) + WorkflowManager["workflows"].delete("remove-scheduled") + + await setTimeout(1100) + expect(spy).toHaveBeenCalledTimes(1) + expect(logSpy).toHaveBeenCalledWith( + "Tried to execute a scheduled workflow with ID remove-scheduled that does not exist, removing it from the scheduler." + ) + }) + + // TODO: investigate why it fails intermittently + it.skip("the scheduled workflow should have access to the shared container", async () => { + const wait = times(1) + sharedContainer_.register("test-value", asValue("test")) + + const spy = await createScheduled("shared-container-job", wait.next, { + cron: "* * * * * *", + }) + await wait.promise + + expect(spy).toHaveBeenCalledTimes(1) + + expect(spy).toHaveReturnedWith( + expect.objectContaining({ output: { testValue: "test" } }) + ) + WorkflowManager.unregister("shared-container-job") + }) }) }) - - it("should subsctibe to a async workflow and receive the response when it finishes", (done) => { - const transactionId = "trx_123" - - const onFinish = jest.fn(() => { - done() - }) - - void workflowOrcModule.run("workflow_async_background", { - input: { - myInput: "123", - }, - transactionId, - throwOnError: false, - }) - - void workflowOrcModule.subscribe({ - workflowId: "workflow_async_background", - transactionId, - subscriber: (event) => { - if (event.eventType === "onFinish") { - onFinish() - } - }, - }) - - expect(onFinish).toHaveBeenCalledTimes(0) - }) - }) - - // Note: These tests depend on actual Redis instance and waiting for the scheduled jobs to run, which isn't great. - // Mocking bullmq, however, would make the tests close to useless, so we can keep them very minimal and serve as smoke tests. - describe("Scheduled workflows", () => { - it("should execute a scheduled workflow", async () => { - const wait = times(2) - const spy = createScheduled("standard", wait.next) - - await wait.promise - expect(spy).toHaveBeenCalledTimes(2) - WorkflowManager.unregister("standard") - }) - - it("should stop executions after the set number of executions", async () => { - const wait = times(2) - const spy = await createScheduled("num-executions", wait.next, { - cron: "* * * * * *", - numberOfExecutions: 2, - }) - - await wait.promise - expect(spy).toHaveBeenCalledTimes(2) - - // Make sure that on the next tick it doesn't execute again - await setTimeout(1100) - expect(spy).toHaveBeenCalledTimes(2) - - WorkflowManager.unregister("num-execution") - }) - - it("should remove scheduled workflow if workflow no longer exists", async () => { - const wait = times(1) - const logger = sharedContainer_.resolve( - ContainerRegistrationKeys.LOGGER - ) - - const spy = await createScheduled("remove-scheduled", wait.next, { - cron: "* * * * * *", - }) - const logSpy = jest.spyOn(logger, "warn") - - await wait.promise - expect(spy).toHaveBeenCalledTimes(1) - WorkflowManager["workflows"].delete("remove-scheduled") - - await setTimeout(1100) - expect(spy).toHaveBeenCalledTimes(1) - expect(logSpy).toHaveBeenCalledWith( - "Tried to execute a scheduled workflow with ID remove-scheduled that does not exist, removing it from the scheduler." - ) - }) - - it("the scheduled workflow should have access to the shared container", async () => { - const wait = times(1) - sharedContainer_.register( - "test-value", - asFunction(() => "test") - ) - - const spy = await createScheduled("shared-container-job", wait.next, { - cron: "* * * * * *", - }) - - await wait.promise - expect(spy).toHaveBeenCalledTimes(1) - - expect(spy).toHaveReturnedWith( - expect.objectContaining({ output: { testValue: "test" } }) - ) - WorkflowManager.unregister("shared-container-job") - }) - }) + }, }) diff --git a/packages/modules/workflow-engine-redis/integration-tests/setup-env.js b/packages/modules/workflow-engine-redis/integration-tests/setup-env.js deleted file mode 100644 index 18f30b372c..0000000000 --- a/packages/modules/workflow-engine-redis/integration-tests/setup-env.js +++ /dev/null @@ -1,6 +0,0 @@ -if (typeof process.env.DB_TEMP_NAME === "undefined") { - const tempName = parseInt(process.env.JEST_WORKER_ID || "1") - process.env.DB_TEMP_NAME = `medusa-workflow-engine-redis-${tempName}` -} - -process.env.MEDUSA_WORKFLOW_ENGINE_DB_SCHEMA = "public" diff --git a/packages/modules/workflow-engine-redis/integration-tests/setup.js b/packages/modules/workflow-engine-redis/integration-tests/setup.js deleted file mode 100644 index 43f99aab4a..0000000000 --- a/packages/modules/workflow-engine-redis/integration-tests/setup.js +++ /dev/null @@ -1,3 +0,0 @@ -import { JestUtils } from "medusa-test-utils" - -JestUtils.afterAllHookDropDatabase() diff --git a/packages/modules/workflow-engine-redis/integration-tests/utils/database.ts b/packages/modules/workflow-engine-redis/integration-tests/utils/database.ts index c15a1ebb9d..3fe2da0681 100644 --- a/packages/modules/workflow-engine-redis/integration-tests/utils/database.ts +++ b/packages/modules/workflow-engine-redis/integration-tests/utils/database.ts @@ -20,10 +20,6 @@ interface TestDatabase { export const TestDatabase: TestDatabase = { clearTables: async (knex) => { - await knex.raw(` - TRUNCATE TABLE workflow_execution CASCADE; - `) - await cleanRedis() }, } diff --git a/packages/modules/workflow-engine-redis/jest.config.js b/packages/modules/workflow-engine-redis/jest.config.js index 4b346c8373..d125300e58 100644 --- a/packages/modules/workflow-engine-redis/jest.config.js +++ b/packages/modules/workflow-engine-redis/jest.config.js @@ -3,6 +3,7 @@ module.exports = { "^@models": "/src/models", "^@services": "/src/services", "^@repositories": "/src/repositories", + "^@types": "/src/types", }, transform: { "^.+\\.[jt]s$": [ @@ -18,6 +19,4 @@ module.exports = { testEnvironment: `node`, moduleFileExtensions: [`js`, `ts`], modulePathIgnorePatterns: ["dist/"], - setupFiles: ["/integration-tests/setup-env.js"], - setupFilesAfterEnv: ["/integration-tests/setup.js"], } diff --git a/packages/modules/workflow-engine-redis/mikro-orm.config.dev.ts b/packages/modules/workflow-engine-redis/mikro-orm.config.dev.ts index 341f75d3fd..d86510b726 100644 --- a/packages/modules/workflow-engine-redis/mikro-orm.config.dev.ts +++ b/packages/modules/workflow-engine-redis/mikro-orm.config.dev.ts @@ -1,7 +1,6 @@ -import * as entities from "./src/models" import { defineMikroOrmCliConfig, Modules } from "@medusajs/utils" +import * as entities from "./src/models" export default defineMikroOrmCliConfig(Modules.WORKFLOW_ENGINE, { entities: Object.values(entities), - databaseName: "medusa-workflow-engine-redis", }) diff --git a/packages/modules/workflow-engine-redis/package.json b/packages/modules/workflow-engine-redis/package.json index 879ff081f2..9680a5016e 100644 --- a/packages/modules/workflow-engine-redis/package.json +++ b/packages/modules/workflow-engine-redis/package.json @@ -45,16 +45,16 @@ "typescript": "^5.1.6" }, "dependencies": { - "@medusajs/modules-sdk": "^1.12.11", + "@medusajs/orchestration": "^0.5.7", "@medusajs/utils": "^1.11.9", "@medusajs/workflows-sdk": "^0.1.6", - "@mikro-orm/core": "5.9.7", - "@mikro-orm/migrations": "5.9.7", - "@mikro-orm/postgresql": "5.9.7", - "awilix": "^8.0.0", "bullmq": "5.12.0", - "dotenv": "^16.4.5", - "ioredis": "^5.4.1", - "knex": "2.4.2" + "ioredis": "^5.4.1" + }, + "peerDependencies": { + "@mikro-orm/core": "*", + "@mikro-orm/migrations": "*", + "@mikro-orm/postgresql": "*", + "awilix": "*" } } diff --git a/packages/modules/workflow-engine-redis/src/loaders/redis.ts b/packages/modules/workflow-engine-redis/src/loaders/redis.ts index df82f0f4b8..6e10251b19 100644 --- a/packages/modules/workflow-engine-redis/src/loaders/redis.ts +++ b/packages/modules/workflow-engine-redis/src/loaders/redis.ts @@ -1,4 +1,4 @@ -import { LoaderOptions } from "@medusajs/modules-sdk" +import { LoaderOptions } from "@medusajs/types" import { asValue } from "awilix" import Redis from "ioredis" import { RedisWorkflowsOptions } from "../types" diff --git a/scripts/integration-tests.sh b/scripts/integration-tests.sh deleted file mode 100755 index fffaa413bb..0000000000 --- a/scripts/integration-tests.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -medusa-dev --set-path-to-repo . - -cd integration-tests/api - -medusa-dev --force-install --scan-once -yarn test - - diff --git a/yarn.lock b/yarn.lock index 3f7a4f0b5c..aed7700963 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4276,14 +4276,9 @@ __metadata: version: 0.0.0-use.local resolution: "@medusajs/api-key@workspace:packages/modules/api-key" dependencies: - "@medusajs/modules-sdk": ^1.12.11 "@medusajs/types": ^1.11.16 "@medusajs/utils": ^1.11.9 "@mikro-orm/cli": 5.9.7 - "@mikro-orm/core": 5.9.7 - "@mikro-orm/migrations": 5.9.7 - "@mikro-orm/postgresql": 5.9.7 - awilix: ^8.0.0 cross-env: ^5.2.1 jest: ^29.7.0 medusa-test-utils: ^1.1.44 @@ -4291,6 +4286,11 @@ __metadata: ts-node: ^10.9.1 tsc-alias: ^1.8.6 typescript: ^5.1.6 + peerDependencies: + "@mikro-orm/core": "*" + "@mikro-orm/migrations": "*" + "@mikro-orm/postgresql": "*" + awilix: "*" languageName: unknown linkType: soft @@ -4298,7 +4298,7 @@ __metadata: version: 0.0.0-use.local resolution: "@medusajs/auth-emailpass@workspace:packages/modules/providers/auth-emailpass" dependencies: - "@medusajs/utils": ^1.11.7 + "@medusajs/utils": ^1.11.9 cross-env: ^5.2.1 jest: ^29.7.0 rimraf: ^5.0.1 @@ -4312,7 +4312,7 @@ __metadata: resolution: "@medusajs/auth-google@workspace:packages/modules/providers/auth-google" dependencies: "@medusajs/types": ^1.11.16 - "@medusajs/utils": ^1.11.7 + "@medusajs/utils": ^1.11.9 "@types/simple-oauth2": ^5.0.7 cross-env: ^5.2.1 jest: ^29.7.0 @@ -4329,12 +4329,8 @@ __metadata: dependencies: "@medusajs/modules-sdk": ^1.12.9 "@medusajs/types": ^1.11.14 - "@medusajs/utils": ^1.11.7 + "@medusajs/utils": ^1.11.9 "@mikro-orm/cli": 5.9.7 - "@mikro-orm/core": 5.9.7 - "@mikro-orm/migrations": 5.9.7 - "@mikro-orm/postgresql": 5.9.7 - awilix: ^8.0.0 cross-env: ^5.2.1 jest: ^29.7.0 jsonwebtoken: ^9.0.2 @@ -4344,6 +4340,11 @@ __metadata: simple-oauth2: ^5.0.0 tsc-alias: ^1.8.6 typescript: ^5.1.6 + peerDependencies: + "@mikro-orm/core": "*" + "@mikro-orm/migrations": "*" + "@mikro-orm/postgresql": "*" + awilix: "*" languageName: unknown linkType: soft @@ -4352,7 +4353,7 @@ __metadata: resolution: "@medusajs/cache-inmemory@workspace:packages/modules/cache-inmemory" dependencies: "@medusajs/modules-sdk": ^1.12.3 - "@medusajs/types": ^1.11.6 + "@medusajs/types": ^1.11.9 "@medusajs/utils": ^1.11.9 cross-env: ^5.2.1 jest: ^29.7.0 @@ -4368,12 +4369,13 @@ __metadata: "@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.4.1 jest: ^29.7.0 rimraf: ^5.0.1 typescript: ^5.1.6 + peerDependencies: + awilix: "*" languageName: unknown linkType: soft @@ -4381,14 +4383,9 @@ __metadata: version: 0.0.0-use.local resolution: "@medusajs/cart@workspace:packages/modules/cart" dependencies: - "@medusajs/modules-sdk": ^1.12.11 - "@medusajs/types": "workspace:^" + "@medusajs/types": ^1.11.16 "@medusajs/utils": ^1.11.9 "@mikro-orm/cli": 5.9.7 - "@mikro-orm/core": 5.9.7 - "@mikro-orm/migrations": 5.9.7 - "@mikro-orm/postgresql": 5.9.7 - awilix: ^8.0.0 cross-env: ^5.2.1 jest: ^29.7.0 medusa-test-utils: ^1.1.44 @@ -4396,6 +4393,11 @@ __metadata: ts-node: ^10.9.1 tsc-alias: ^1.8.6 typescript: ^5.1.6 + peerDependencies: + "@mikro-orm/core": "*" + "@mikro-orm/migrations": "*" + "@mikro-orm/postgresql": "*" + awilix: "*" languageName: unknown linkType: soft @@ -4410,12 +4412,14 @@ __metadata: "@medusajs/workflows-sdk": ^0.1.6 "@swc/core": ^1.5.29 "@swc/jest": ^0.2.36 - awilix: ^8.0.1 cross-env: ^5.2.1 jest: ^29.7.0 + json-2-csv: ^5.5.4 rimraf: ^5.0.1 typescript: ^5.1.6 - ulid: ^2.3.0 + peerDependencies: + awilix: "*" + ulid: "*" languageName: unknown linkType: soft @@ -4423,36 +4427,9 @@ __metadata: version: 0.0.0-use.local resolution: "@medusajs/currency@workspace:packages/modules/currency" dependencies: - "@medusajs/modules-sdk": ^1.12.11 "@medusajs/types": ^1.11.16 "@medusajs/utils": ^1.11.9 "@mikro-orm/cli": 5.9.7 - "@mikro-orm/core": 5.9.7 - "@mikro-orm/migrations": 5.9.7 - "@mikro-orm/postgresql": 5.9.7 - awilix: ^8.0.0 - cross-env: ^5.2.1 - jest: ^29.7.0 - medusa-test-utils: "workspace:^" - rimraf: ^3.0.2 - ts-node: ^10.9.1 - tsc-alias: ^1.8.6 - typescript: ^5.1.6 - languageName: unknown - linkType: soft - -"@medusajs/customer@workspace:^, @medusajs/customer@workspace:packages/modules/customer": - version: 0.0.0-use.local - resolution: "@medusajs/customer@workspace:packages/modules/customer" - dependencies: - "@medusajs/modules-sdk": ^1.12.11 - "@medusajs/types": "workspace:^" - "@medusajs/utils": ^1.11.9 - "@mikro-orm/cli": 5.9.7 - "@mikro-orm/core": 5.9.7 - "@mikro-orm/migrations": 5.9.7 - "@mikro-orm/postgresql": 5.9.7 - awilix: ^8.0.0 cross-env: ^5.2.1 jest: ^29.7.0 medusa-test-utils: ^1.1.44 @@ -4460,6 +4437,33 @@ __metadata: ts-node: ^10.9.1 tsc-alias: ^1.8.6 typescript: ^5.1.6 + peerDependencies: + "@mikro-orm/core": "*" + "@mikro-orm/migrations": "*" + "@mikro-orm/postgresql": "*" + awilix: "*" + languageName: unknown + linkType: soft + +"@medusajs/customer@workspace:^, @medusajs/customer@workspace:packages/modules/customer": + version: 0.0.0-use.local + resolution: "@medusajs/customer@workspace:packages/modules/customer" + dependencies: + "@medusajs/types": ^1.11.16 + "@medusajs/utils": ^1.11.9 + "@mikro-orm/cli": 5.9.7 + cross-env: ^5.2.1 + jest: ^29.7.0 + medusa-test-utils: ^1.1.44 + rimraf: ^3.0.2 + ts-node: ^10.9.1 + tsc-alias: ^1.8.6 + typescript: ^5.1.6 + peerDependencies: + "@mikro-orm/core": "*" + "@mikro-orm/migrations": "*" + "@mikro-orm/postgresql": "*" + awilix: "*" languageName: unknown linkType: soft @@ -4523,7 +4527,7 @@ __metadata: dependencies: "@medusajs/modules-sdk": ^1.12.8 "@medusajs/types": ^1.11.12 - "@medusajs/utils": ^1.11.5 + "@medusajs/utils": ^1.11.9 cross-env: ^5.2.1 jest: ^29.7.0 rimraf: ^5.0.1 @@ -4539,7 +4543,6 @@ __metadata: "@medusajs/modules-sdk": ^1.12.11 "@medusajs/types": ^1.11.16 "@medusajs/utils": ^1.11.9 - awilix: ^8.0.0 bullmq: 5.12.0 cross-env: ^5.2.1 ioredis: ^5.4.1 @@ -4547,6 +4550,8 @@ __metadata: medusa-test-utils: ^1.1.44 rimraf: ^5.0.1 typescript: ^5.1.6 + peerDependencies: + awilix: "*" languageName: unknown linkType: soft @@ -4554,7 +4559,7 @@ __metadata: version: 0.0.0-use.local resolution: "@medusajs/file-local-next@workspace:packages/modules/providers/file-local" dependencies: - "@medusajs/utils": ^1.11.7 + "@medusajs/utils": ^1.11.9 cross-env: ^5.2.1 jest: ^29.7.0 rimraf: ^5.0.1 @@ -4568,7 +4573,7 @@ __metadata: dependencies: "@aws-sdk/client-s3": ^3.556.0 "@aws-sdk/s3-request-presigner": ^3.556.0 - "@medusajs/utils": ^1.11.7 + "@medusajs/utils": ^1.11.9 axios: ^1.6.8 cross-env: ^5.2.1 jest: ^29.7.0 @@ -4584,12 +4589,8 @@ __metadata: dependencies: "@medusajs/modules-sdk": ^1.12.11 "@medusajs/types": ^1.11.15 - "@medusajs/utils": ^1.11.8 + "@medusajs/utils": ^1.11.9 "@mikro-orm/cli": 5.9.7 - "@mikro-orm/core": 5.9.7 - "@mikro-orm/migrations": 5.9.7 - "@mikro-orm/postgresql": 5.9.7 - awilix: ^8.0.0 cross-env: ^5.2.1 faker: ^5.5.3 jest: ^29.7.0 @@ -4599,6 +4600,11 @@ __metadata: ts-node: ^10.9.1 tsc-alias: ^1.8.6 typescript: ^5.1.6 + peerDependencies: + "@mikro-orm/core": "*" + "@mikro-orm/migrations": "*" + "@mikro-orm/postgresql": "*" + awilix: "*" languageName: unknown linkType: soft @@ -4614,7 +4620,6 @@ __metadata: "@medusajs/workflows-sdk": ^0.1.6 "@types/express": ^4.17.17 "@types/jsonwebtoken": ^8.5.9 - awilix: ^8.0.0 cookie-parser: ^1.4.6 cors: ^2.8.5 cross-env: ^7.0.3 @@ -4631,6 +4636,8 @@ __metadata: typescript: ^5.1.6 vite: ^5.2.11 zod: 3.22.4 + peerDependencies: + awilix: "*" languageName: unknown linkType: soft @@ -4638,7 +4645,7 @@ __metadata: version: 0.0.0-use.local resolution: "@medusajs/fulfillment-manual@workspace:packages/modules/providers/fulfillment-manual" dependencies: - "@medusajs/utils": ^1.11.7 + "@medusajs/utils": ^1.11.9 body-parser: ^1.19.0 cross-env: ^5.2.1 express: ^4.17.1 @@ -4657,10 +4664,6 @@ __metadata: "@medusajs/types": ^1.11.16 "@medusajs/utils": ^1.11.9 "@mikro-orm/cli": 5.9.7 - "@mikro-orm/core": 5.9.7 - "@mikro-orm/migrations": 5.9.7 - "@mikro-orm/postgresql": 5.9.7 - awilix: ^8.0.0 cross-env: ^5.2.1 jest: ^29.7.0 medusa-test-utils: ^1.1.44 @@ -4668,6 +4671,11 @@ __metadata: ts-node: ^10.9.1 tsc-alias: ^1.8.6 typescript: ^5.1.6 + peerDependencies: + "@mikro-orm/core": "*" + "@mikro-orm/migrations": "*" + "@mikro-orm/postgresql": "*" + awilix: "*" languageName: unknown linkType: soft @@ -4709,14 +4717,9 @@ __metadata: version: 0.0.0-use.local resolution: "@medusajs/inventory-next@workspace:packages/modules/inventory-next" dependencies: - "@medusajs/modules-sdk": ^1.12.10 "@medusajs/types": ^1.11.15 - "@medusajs/utils": ^1.11.8 + "@medusajs/utils": ^1.11.9 "@mikro-orm/cli": 5.9.7 - "@mikro-orm/core": 5.9.7 - "@mikro-orm/migrations": 5.9.7 - "@mikro-orm/postgresql": 5.9.7 - awilix: ^8.0.0 cross-env: ^5.2.1 jest: ^29.7.0 medusa-test-utils: ^1.1.43 @@ -4724,6 +4727,11 @@ __metadata: ts-node: ^10.9.1 tsc-alias: ^1.8.6 typescript: ^5.1.6 + peerDependencies: + "@mikro-orm/core": "*" + "@mikro-orm/migrations": "*" + "@mikro-orm/postgresql": "*" + awilix: "*" languageName: unknown linkType: soft @@ -4760,9 +4768,6 @@ __metadata: "@medusajs/modules-sdk": ^1.12.11 "@medusajs/types": ^1.11.16 "@medusajs/utils": ^1.11.9 - "@mikro-orm/core": 5.9.7 - "@mikro-orm/postgresql": 5.9.7 - awilix: ^8.0.0 cross-env: ^5.2.1 jest: ^29.7.0 medusa-test-utils: ^1.1.44 @@ -4771,6 +4776,11 @@ __metadata: ts-node: ^10.9.1 tsc-alias: ^1.8.6 typescript: ^5.5.0 + peerDependencies: + "@mikro-orm/core": "*" + "@mikro-orm/migrations": "*" + "@mikro-orm/postgresql": "*" + awilix: "*" languageName: unknown linkType: soft @@ -4778,16 +4788,14 @@ __metadata: version: 0.0.0-use.local resolution: "@medusajs/medusa-cli@workspace:packages/cli/medusa-cli" dependencies: - "@medusajs/utils": ^1.11.2 + "@medusajs/utils": ^1.11.9 "@swc/core": ^1.5.29 "@swc/jest": ^0.2.36 "@types/yargs": ^15.0.15 axios: ^0.21.4 chalk: ^4.0.0 configstore: 5.0.1 - core-js: ^3.6.5 cross-env: ^5.2.1 - dotenv: ^16.4.5 execa: ^5.1.1 fs-exists-cached: ^1.0.0 fs-extra: ^10.0.0 @@ -4803,15 +4811,16 @@ __metadata: pg: ^8.11.3 pg-god: ^1.0.12 prompts: ^2.4.2 - regenerator-runtime: ^0.13.11 resolve-cwd: ^3.0.0 rimraf: ^5.0.1 semver: ^7.3.8 stack-trace: ^0.0.10 typescript: ^5.3.3 - ulid: ^2.3.0 winston: ^3.8.2 yargs: ^15.3.1 + peerDependencies: + dotenv: "*" + ulid: "*" bin: medusa: cli.js languageName: unknown @@ -4823,7 +4832,7 @@ __metadata: dependencies: "@medusajs/medusa": ^1.20.4 "@medusajs/types": ^1.11.15 - "@medusajs/utils": ^1.11.8 + "@medusajs/utils": ^1.11.9 "@readme/json-schema-ref-parser": ^1.2.0 "@readme/openapi-parser": ^2.4.0 "@redocly/cli": ^1.7.0 @@ -4855,9 +4864,6 @@ __metadata: "@medusajs/core-flows": ^0.0.9 "@medusajs/framework": ^0.0.1 "@medusajs/link-modules": ^0.2.11 - "@medusajs/medusa-cli": ^1.3.22 - "@medusajs/modules-sdk": ^1.12.11 - "@medusajs/orchestration": ^0.5.7 "@medusajs/types": ^1.11.16 "@medusajs/utils": ^1.11.9 "@medusajs/workflows-sdk": ^0.1.6 @@ -4869,7 +4875,6 @@ __metadata: "@types/jsonwebtoken": ^8.5.9 "@types/lodash": ^4.14.191 "@types/multer": ^1.4.7 - awilix: ^8.0.0 body-parser: ^1.19.0 boxen: ^5.0.1 chalk: ^4.0.0 @@ -4877,10 +4882,8 @@ __metadata: compression: ^1.7.4 connect-redis: ^5.0.0 cookie-parser: ^1.4.6 - core-js: ^3.6.5 cors: ^2.8.5 cross-env: ^5.2.1 - dotenv: ^16.4.5 express: ^4.18.2 express-session: ^1.17.3 fs-exists-cached: ^1.0.0 @@ -4893,23 +4896,19 @@ __metadata: morgan: ^1.9.1 multer: ^1.4.5-lts.1 node-schedule: ^2.1.1 - passport: ^0.6.0 - passport-custom: ^1.1.1 - passport-jwt: ^4.0.1 - passport-local: ^1.0.0 qs: ^6.11.2 - reflect-metadata: ^0.1.13 - regenerator-runtime: ^0.13.11 request-ip: ^3.3.0 rimraf: ^5.0.1 supertest: ^4.0.2 typescript: ^5.3.3 uuid: ^9.0.0 zod: 3.22.4 + peerDependencies: + awilix: "*" languageName: unknown linkType: soft -"@medusajs/modules-sdk@^1.12.10, @medusajs/modules-sdk@^1.12.11, @medusajs/modules-sdk@^1.12.3, @medusajs/modules-sdk@^1.12.8, @medusajs/modules-sdk@^1.12.9, @medusajs/modules-sdk@workspace:^, @medusajs/modules-sdk@workspace:packages/core/modules-sdk": +"@medusajs/modules-sdk@^1.12.11, @medusajs/modules-sdk@^1.12.3, @medusajs/modules-sdk@^1.12.8, @medusajs/modules-sdk@^1.12.9, @medusajs/modules-sdk@workspace:^, @medusajs/modules-sdk@workspace:packages/core/modules-sdk": version: 0.0.0-use.local resolution: "@medusajs/modules-sdk@workspace:packages/core/modules-sdk" dependencies: @@ -4919,14 +4918,14 @@ __metadata: "@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 jest: ^29.7.0 - knex: 2.4.2 resolve-cwd: ^3.0.0 rimraf: ^5.0.1 typescript: ^5.1.6 + peerDependencies: + awilix: "*" languageName: unknown linkType: soft @@ -4934,7 +4933,7 @@ __metadata: version: 0.0.0-use.local resolution: "@medusajs/notification-local@workspace:packages/modules/providers/notification-local" dependencies: - "@medusajs/utils": ^1.11.7 + "@medusajs/utils": ^1.11.9 cross-env: ^5.2.1 jest: ^29.7.0 rimraf: ^5.0.1 @@ -4946,7 +4945,7 @@ __metadata: version: 0.0.0-use.local resolution: "@medusajs/notification-sendgrid@workspace:packages/modules/providers/notification-sendgrid" dependencies: - "@medusajs/utils": ^1.11.7 + "@medusajs/utils": ^1.11.9 "@sendgrid/mail": ^8.1.3 "@swc/core": ^1.5.29 "@swc/jest": ^0.2.36 @@ -4965,10 +4964,6 @@ __metadata: "@medusajs/types": ^1.11.16 "@medusajs/utils": ^1.11.9 "@mikro-orm/cli": 5.9.7 - "@mikro-orm/core": 5.9.7 - "@mikro-orm/migrations": 5.9.7 - "@mikro-orm/postgresql": 5.9.7 - awilix: ^8.0.0 cross-env: ^5.2.1 jest: ^29.7.0 medusa-test-utils: ^1.1.44 @@ -4976,6 +4971,11 @@ __metadata: ts-node: ^10.9.1 tsc-alias: ^1.8.6 typescript: ^5.1.6 + peerDependencies: + "@mikro-orm/core": "*" + "@mikro-orm/migrations": "*" + "@mikro-orm/postgresql": "*" + awilix: "*" languageName: unknown linkType: soft @@ -4994,12 +4994,13 @@ __metadata: dependencies: "@medusajs/types": ^1.11.16 "@medusajs/utils": ^1.11.9 - awilix: ^8.0.0 cross-env: ^5.2.1 graphql: ^16.6.0 jest: ^29.7.0 rimraf: ^5.0.1 typescript: ^5.1.6 + peerDependencies: + awilix: "*" languageName: unknown linkType: soft @@ -5007,14 +5008,9 @@ __metadata: version: 0.0.0-use.local resolution: "@medusajs/order@workspace:packages/modules/order" dependencies: - "@medusajs/modules-sdk": ^1.12.11 "@medusajs/types": ^1.11.16 "@medusajs/utils": ^1.11.9 "@mikro-orm/cli": 5.9.7 - "@mikro-orm/core": 5.9.7 - "@mikro-orm/migrations": 5.9.7 - "@mikro-orm/postgresql": 5.9.7 - awilix: ^8.0.0 cross-env: ^5.2.1 jest: ^29.7.0 medusa-test-utils: ^1.1.44 @@ -5022,6 +5018,11 @@ __metadata: ts-node: ^10.9.1 tsc-alias: ^1.8.6 typescript: ^5.1.6 + peerDependencies: + "@mikro-orm/core": "*" + "@mikro-orm/migrations": "*" + "@mikro-orm/postgresql": "*" + awilix: "*" languageName: unknown linkType: soft @@ -5030,9 +5031,8 @@ __metadata: resolution: "@medusajs/payment-stripe@workspace:packages/modules/providers/payment-stripe" dependencies: "@medusajs/medusa": ^1.20.3 - "@medusajs/utils": ^1.11.7 + "@medusajs/utils": ^1.11.9 "@types/stripe": ^8.0.417 - awilix: ^8.0.1 body-parser: ^1.19.0 cross-env: ^5.2.1 express: ^4.17.1 @@ -5041,7 +5041,7 @@ __metadata: stripe: latest typescript: ^5.3.3 peerDependencies: - "@medusajs/medusa": ^1.12.0 + awilix: "*" languageName: unknown linkType: soft @@ -5053,11 +5053,6 @@ __metadata: "@medusajs/types": ^1.11.16 "@medusajs/utils": ^1.11.9 "@mikro-orm/cli": 5.9.7 - "@mikro-orm/core": 5.9.7 - "@mikro-orm/migrations": 5.9.7 - "@mikro-orm/postgresql": 5.9.7 - awilix: ^8.0.0 - bignumber.js: ^9.1.2 cross-env: ^5.2.1 jest: ^29.7.0 medusa-test-utils: ^1.1.44 @@ -5066,6 +5061,12 @@ __metadata: ts-node: ^10.9.1 tsc-alias: ^1.8.6 typescript: ^5.1.6 + peerDependencies: + "@mikro-orm/core": "*" + "@mikro-orm/migrations": "*" + "@mikro-orm/postgresql": "*" + awilix: "*" + bignumber.js: "*" languageName: unknown linkType: soft @@ -5073,14 +5074,9 @@ __metadata: version: 0.0.0-use.local resolution: "@medusajs/pricing@workspace:packages/modules/pricing" dependencies: - "@medusajs/modules-sdk": ^1.12.11 "@medusajs/types": ^1.11.16 "@medusajs/utils": ^1.11.9 "@mikro-orm/cli": 5.9.7 - "@mikro-orm/core": 5.9.7 - "@mikro-orm/migrations": 5.9.7 - "@mikro-orm/postgresql": 5.9.7 - awilix: ^8.0.0 cross-env: ^5.2.1 jest: ^29.7.0 medusa-test-utils: ^1.1.44 @@ -5089,6 +5085,11 @@ __metadata: ts-node: ^10.9.1 tsc-alias: ^1.8.6 typescript: ^5.1.6 + peerDependencies: + "@mikro-orm/core": "*" + "@mikro-orm/migrations": "*" + "@mikro-orm/postgresql": "*" + awilix: "*" languageName: unknown linkType: soft @@ -5096,14 +5097,9 @@ __metadata: version: 0.0.0-use.local resolution: "@medusajs/product@workspace:packages/modules/product" dependencies: - "@medusajs/modules-sdk": ^1.12.11 "@medusajs/types": ^1.11.16 "@medusajs/utils": ^1.11.9 "@mikro-orm/cli": 5.9.7 - "@mikro-orm/core": 5.9.7 - "@mikro-orm/migrations": 5.9.7 - "@mikro-orm/postgresql": 5.9.7 - awilix: ^8.0.0 cross-env: ^5.2.1 faker: ^5.5.3 jest: ^29.7.0 @@ -5113,6 +5109,11 @@ __metadata: ts-node: ^10.9.1 tsc-alias: ^1.8.6 typescript: ^5.1.6 + peerDependencies: + "@mikro-orm/core": "*" + "@mikro-orm/migrations": "*" + "@mikro-orm/postgresql": "*" + awilix: "*" languageName: unknown linkType: soft @@ -5120,14 +5121,9 @@ __metadata: version: 0.0.0-use.local resolution: "@medusajs/promotion@workspace:packages/modules/promotion" dependencies: - "@medusajs/modules-sdk": ^1.12.11 "@medusajs/types": ^1.11.16 "@medusajs/utils": 1.11.9 "@mikro-orm/cli": 5.9.7 - "@mikro-orm/core": 5.9.7 - "@mikro-orm/migrations": 5.9.7 - "@mikro-orm/postgresql": 5.9.7 - awilix: ^8.0.0 cross-env: ^5.2.1 jest: ^29.7.0 medusa-test-utils: ^1.1.44 @@ -5136,6 +5132,11 @@ __metadata: ts-node: ^10.9.1 tsc-alias: ^1.8.6 typescript: ^5.1.6 + peerDependencies: + "@mikro-orm/core": "*" + "@mikro-orm/migrations": "*" + "@mikro-orm/postgresql": "*" + awilix: "*" languageName: unknown linkType: soft @@ -5143,14 +5144,9 @@ __metadata: version: 0.0.0-use.local resolution: "@medusajs/region@workspace:packages/modules/region" dependencies: - "@medusajs/modules-sdk": ^1.12.11 "@medusajs/types": ^1.11.16 "@medusajs/utils": ^1.11.9 "@mikro-orm/cli": 5.9.7 - "@mikro-orm/core": 5.9.7 - "@mikro-orm/migrations": 5.9.7 - "@mikro-orm/postgresql": 5.9.7 - awilix: ^8.0.0 cross-env: ^5.2.1 jest: ^29.7.0 medusa-test-utils: ^1.1.44 @@ -5158,6 +5154,11 @@ __metadata: ts-node: ^10.9.1 tsc-alias: ^1.8.6 typescript: ^5.1.6 + peerDependencies: + "@mikro-orm/core": "*" + "@mikro-orm/migrations": "*" + "@mikro-orm/postgresql": "*" + awilix: "*" languageName: unknown linkType: soft @@ -5165,14 +5166,9 @@ __metadata: version: 0.0.0-use.local resolution: "@medusajs/sales-channel@workspace:packages/modules/sales-channel" dependencies: - "@medusajs/modules-sdk": ^1.12.11 "@medusajs/types": ^1.11.14 - "@medusajs/utils": ^1.11.7 + "@medusajs/utils": ^1.11.9 "@mikro-orm/cli": 5.9.7 - "@mikro-orm/core": 5.9.7 - "@mikro-orm/migrations": 5.9.7 - "@mikro-orm/postgresql": 5.9.7 - awilix: ^8.0.0 cross-env: ^5.2.1 jest: ^29.7.0 medusa-test-utils: ^1.1.42 @@ -5180,6 +5176,11 @@ __metadata: ts-node: ^10.9.1 tsc-alias: ^1.8.6 typescript: ^5.1.6 + peerDependencies: + "@mikro-orm/core": "*" + "@mikro-orm/migrations": "*" + "@mikro-orm/postgresql": "*" + awilix: "*" languageName: unknown linkType: soft @@ -5187,14 +5188,9 @@ __metadata: version: 0.0.0-use.local resolution: "@medusajs/stock-location-next@workspace:packages/modules/stock-location-next" dependencies: - "@medusajs/modules-sdk": ^1.12.11 "@medusajs/types": ^1.11.16 "@medusajs/utils": ^1.11.9 "@mikro-orm/cli": 5.9.7 - "@mikro-orm/core": 5.9.7 - "@mikro-orm/migrations": 5.9.7 - "@mikro-orm/postgresql": 5.9.7 - awilix: ^8.0.0 cross-env: ^5.2.1 jest: ^29.7.0 medusa-test-utils: ^1.1.44 @@ -5202,6 +5198,11 @@ __metadata: ts-node: ^10.9.1 tsc-alias: ^1.8.6 typescript: ^5.1.6 + peerDependencies: + "@mikro-orm/core": "*" + "@mikro-orm/migrations": "*" + "@mikro-orm/postgresql": "*" + awilix: "*" languageName: unknown linkType: soft @@ -5209,21 +5210,21 @@ __metadata: version: 0.0.0-use.local resolution: "@medusajs/store@workspace:packages/modules/store" dependencies: - "@medusajs/modules-sdk": ^1.12.11 "@medusajs/types": ^1.11.16 "@medusajs/utils": ^1.11.9 "@mikro-orm/cli": 5.9.7 - "@mikro-orm/core": 5.9.7 - "@mikro-orm/migrations": 5.9.7 - "@mikro-orm/postgresql": 5.9.7 - awilix: ^8.0.0 cross-env: ^5.2.1 jest: ^29.7.0 - medusa-test-utils: "workspace:^" + medusa-test-utils: ^1.1.44 rimraf: ^3.0.2 ts-node: ^10.9.1 tsc-alias: ^1.8.6 typescript: ^5.1.6 + peerDependencies: + "@mikro-orm/core": "*" + "@mikro-orm/migrations": "*" + "@mikro-orm/postgresql": "*" + awilix: "*" languageName: unknown linkType: soft @@ -5233,12 +5234,8 @@ __metadata: dependencies: "@medusajs/modules-sdk": ^1.12.9 "@medusajs/types": ^1.11.14 - "@medusajs/utils": ^1.11.7 + "@medusajs/utils": ^1.11.9 "@mikro-orm/cli": 5.9.7 - "@mikro-orm/core": 5.9.7 - "@mikro-orm/migrations": 5.9.7 - "@mikro-orm/postgresql": 5.9.7 - awilix: ^8.0.0 cross-env: ^5.2.1 jest: ^29.7.0 medusa-test-utils: ^1.1.42 @@ -5246,6 +5243,11 @@ __metadata: ts-node: ^10.9.1 tsc-alias: ^1.8.6 typescript: ^5.1.6 + peerDependencies: + "@mikro-orm/core": "*" + "@mikro-orm/migrations": "*" + "@mikro-orm/postgresql": "*" + awilix: "*" languageName: unknown linkType: soft @@ -5275,11 +5277,11 @@ __metadata: languageName: unknown linkType: soft -"@medusajs/types@1.11.16, @medusajs/types@^1.11.12, @medusajs/types@^1.11.14, @medusajs/types@^1.11.15, @medusajs/types@^1.11.16, @medusajs/types@^1.11.6, @medusajs/types@workspace:^, @medusajs/types@workspace:packages/core/types": +"@medusajs/types@1.11.16, @medusajs/types@^1.11.12, @medusajs/types@^1.11.14, @medusajs/types@^1.11.15, @medusajs/types@^1.11.16, @medusajs/types@^1.11.9, @medusajs/types@workspace:^, @medusajs/types@workspace:packages/core/types": version: 0.0.0-use.local resolution: "@medusajs/types@workspace:packages/core/types" dependencies: - awilix: ^8.0.0 + awilix: ^8.0.1 bignumber.js: ^9.1.2 cross-env: ^5.2.1 ioredis: ^5.4.1 @@ -5382,16 +5384,11 @@ __metadata: version: 0.0.0-use.local resolution: "@medusajs/user@workspace:packages/modules/user" dependencies: - "@medusajs/modules-sdk": ^1.12.11 "@medusajs/types": ^1.11.15 - "@medusajs/utils": ^1.11.8 + "@medusajs/utils": ^1.11.9 "@mikro-orm/cli": 5.9.7 - "@mikro-orm/core": 5.9.7 - "@mikro-orm/migrations": 5.9.7 - "@mikro-orm/postgresql": 5.9.7 "@swc/core": ^1.5.29 "@swc/jest": ^0.2.36 - awilix: ^8.0.0 cross-env: ^5.2.1 jest: ^29.7.0 jsonwebtoken: ^9.0.2 @@ -5400,10 +5397,15 @@ __metadata: ts-node: ^10.9.1 tsc-alias: ^1.8.6 typescript: ^5.1.6 + peerDependencies: + "@mikro-orm/core": "*" + "@mikro-orm/migrations": "*" + "@mikro-orm/postgresql": "*" + awilix: "*" languageName: unknown linkType: soft -"@medusajs/utils@1.11.9, @medusajs/utils@^1.11.2, @medusajs/utils@^1.11.5, @medusajs/utils@^1.11.7, @medusajs/utils@^1.11.8, @medusajs/utils@^1.11.9, @medusajs/utils@workspace:^, @medusajs/utils@workspace:packages/core/utils": +"@medusajs/utils@1.11.9, @medusajs/utils@^1.11.5, @medusajs/utils@^1.11.9, @medusajs/utils@workspace:^, @medusajs/utils@workspace:packages/core/utils": version: 0.0.0-use.local resolution: "@medusajs/utils@workspace:packages/core/utils" dependencies: @@ -5420,9 +5422,7 @@ __metadata: expect-type: ^0.19.0 express: ^4.18.2 jest: ^29.7.0 - json-2-csv: ^5.5.4 jsonwebtoken: ^9.0.2 - knex: 2.4.2 pluralize: ^8.0.0 rimraf: ^5.0.1 ts-jest: ^29.1.1 @@ -5435,15 +5435,11 @@ __metadata: version: 0.0.0-use.local resolution: "@medusajs/workflow-engine-inmemory@workspace:packages/modules/workflow-engine-inmemory" dependencies: - "@medusajs/modules-sdk": ^1.12.11 + "@medusajs/orchestration": ^0.5.7 "@medusajs/types": ^1.11.16 "@medusajs/utils": ^1.11.9 "@medusajs/workflows-sdk": ^0.1.6 "@mikro-orm/cli": 5.9.7 - "@mikro-orm/core": 5.9.7 - "@mikro-orm/migrations": 5.9.7 - "@mikro-orm/postgresql": 5.9.7 - awilix: ^8.0.0 cron-parser: ^4.9.0 cross-env: ^5.2.1 jest: ^29.7.0 @@ -5452,6 +5448,11 @@ __metadata: ts-node: ^10.9.1 tsc-alias: ^1.8.6 typescript: ^5.1.6 + peerDependencies: + "@mikro-orm/core": "*" + "@mikro-orm/migrations": "*" + "@mikro-orm/postgresql": "*" + awilix: "*" languageName: unknown linkType: soft @@ -5459,26 +5460,25 @@ __metadata: version: 0.0.0-use.local resolution: "@medusajs/workflow-engine-redis@workspace:packages/modules/workflow-engine-redis" dependencies: - "@medusajs/modules-sdk": ^1.12.11 + "@medusajs/orchestration": ^0.5.7 "@medusajs/types": ^1.11.16 "@medusajs/utils": ^1.11.9 "@medusajs/workflows-sdk": ^0.1.6 "@mikro-orm/cli": 5.9.7 - "@mikro-orm/core": 5.9.7 - "@mikro-orm/migrations": 5.9.7 - "@mikro-orm/postgresql": 5.9.7 - awilix: ^8.0.0 bullmq: 5.12.0 cross-env: ^5.2.1 - dotenv: ^16.4.5 ioredis: ^5.4.1 jest: ^29.7.0 - knex: 2.4.2 medusa-test-utils: ^1.1.44 rimraf: ^3.0.2 ts-node: ^10.9.1 tsc-alias: ^1.8.6 typescript: ^5.1.6 + peerDependencies: + "@mikro-orm/core": "*" + "@mikro-orm/migrations": "*" + "@mikro-orm/postgresql": "*" + awilix: "*" languageName: unknown linkType: soft @@ -5490,12 +5490,13 @@ __metadata: "@medusajs/orchestration": ^0.5.7 "@medusajs/types": ^1.11.16 "@medusajs/utils": ^1.11.9 - awilix: ^8.0.1 cross-env: ^5.2.1 jest: ^29.7.0 rimraf: ^5.0.1 typescript: ^5.1.6 - ulid: ^2.3.0 + peerDependencies: + awilix: "*" + ulid: "*" languageName: unknown linkType: soft @@ -13639,9 +13640,9 @@ __metadata: linkType: hard "aws4@npm:^1.8.0": - version: 1.12.0 - resolution: "aws4@npm:1.12.0" - checksum: 1e39c266f53b04daf88e112de93a6006375b386a1b7ab6197260886e39abd012aa90bdd87949c3bf9c30754846031f6d5d8ac4f8676628097c11065b5d39847a + version: 1.13.1 + resolution: "aws4@npm:1.13.1" + checksum: c40a90b998853b92f9d0198e9992f4a94c81f29b02ca02b75952efaef07ff0660e756c7ebd04ff674edfa36c29406abaa8aad84f23dbc8b362d31979a631d3fe languageName: node linkType: hard @@ -15064,7 +15065,7 @@ __metadata: languageName: node linkType: hard -"commander@npm:^9.0.0, commander@npm:^9.1.0, commander@npm:^9.4.1": +"commander@npm:^9.0.0, commander@npm:^9.4.1": version: 9.5.0 resolution: "commander@npm:9.5.0" checksum: 5f7784fbda2aaec39e89eb46f06a999e00224b3763dc65976e05929ec486e174fe9aac2655f03ba6a5e83875bd173be5283dc19309b7c65954701c02025b3c1d @@ -15356,7 +15357,7 @@ __metadata: languageName: node linkType: hard -"core-js@npm:^3.32.1, core-js@npm:^3.6.5": +"core-js@npm:^3.32.1": version: 3.37.0 resolution: "core-js@npm:3.37.0" checksum: 7e00331f346318ca3f595c08ce9e74ddae744715aef137486c1399163afd79792fb94c3161280863adfdc3e30f8026912d56bd3036f93cacfc689d33e185f2ee @@ -16497,9 +16498,9 @@ __metadata: linkType: hard "dompurify@npm:^2.2.6": - version: 2.5.2 - resolution: "dompurify@npm:2.5.2" - checksum: 95a54c4889e59dc02ca4357ca3e53a00e15d9263ce0c563f568e2462eb7a045e24ec483fc0c1d923a3a30c7e2c648c3d4b50eb395c745ba7ee08f2ff8b9e51f2 + version: 2.5.6 + resolution: "dompurify@npm:2.5.6" + checksum: ee7e7d17982b1017a20982a2d57a0463d7fbb67f7b92a13ecf772e5e6acf0a529a19e3e31d725b05d5a2524d40e0aeb7ebc4be0aff396a6345bd6f2749fe560d languageName: node linkType: hard @@ -21621,7 +21622,7 @@ __metadata: languageName: node linkType: hard -"jsonwebtoken@npm:^9.0.0, jsonwebtoken@npm:^9.0.2": +"jsonwebtoken@npm:^9.0.2": version: 9.0.2 resolution: "jsonwebtoken@npm:9.0.2" dependencies: @@ -21730,45 +21731,6 @@ __metadata: languageName: node linkType: hard -"knex@npm:2.4.2": - version: 2.4.2 - resolution: "knex@npm:2.4.2" - dependencies: - colorette: 2.0.19 - commander: ^9.1.0 - debug: 4.3.4 - escalade: ^3.1.1 - esm: ^3.2.25 - get-package-type: ^0.1.0 - getopts: 2.3.0 - interpret: ^2.2.0 - lodash: ^4.17.21 - pg-connection-string: 2.5.0 - rechoir: ^0.8.0 - resolve-from: ^5.0.0 - tarn: ^3.0.2 - tildify: 2.0.0 - peerDependenciesMeta: - better-sqlite3: - optional: true - mysql: - optional: true - mysql2: - optional: true - pg: - optional: true - pg-native: - optional: true - sqlite3: - optional: true - tedious: - optional: true - bin: - knex: bin/cli.js - checksum: b6e2582671ac1503edf073e011b1db1b4d5c719a7acad5d8453d70b45b45296c3fba43f91ea3d26956986fb0ec70a7d26b8af4dfcf5ac1507c6674fc2186400b - languageName: node - linkType: hard - "knex@npm:2.5.1": version: 2.5.1 resolution: "knex@npm:2.5.1" @@ -22718,7 +22680,7 @@ __metadata: languageName: unknown linkType: soft -"medusa-test-utils@^1.1.42, medusa-test-utils@^1.1.43, medusa-test-utils@^1.1.44, medusa-test-utils@workspace:*, medusa-test-utils@workspace:^, medusa-test-utils@workspace:packages/core/medusa-test-utils": +"medusa-test-utils@^1.1.42, medusa-test-utils@^1.1.43, medusa-test-utils@^1.1.44, medusa-test-utils@workspace:*, medusa-test-utils@workspace:packages/core/medusa-test-utils": version: 0.0.0-use.local resolution: "medusa-test-utils@workspace:packages/core/medusa-test-utils" dependencies: @@ -23435,11 +23397,11 @@ __metadata: linkType: hard "nan@npm:^2.14.0": - version: 2.19.0 - resolution: "nan@npm:2.19.0" + version: 2.20.0 + resolution: "nan@npm:2.20.0" dependencies: node-gyp: latest - checksum: b8d05d75f92ee9d94affa50d0aa41b6c698254c848529452d7ab67c2e0d160a83f563bfe2cbd53e077944eceb48c757f83c93634c7c9ff404c9ec1ed4e5ced1a + checksum: 75775309a21ad179a55250d62ce47322c33ca03d8ddb5ad4c555bd820dd72484b3c59253dd9f41cc68dd63453ef04017407fbd081a549bc030d977079bb798b7 languageName: node linkType: hard @@ -23802,7 +23764,14 @@ __metadata: languageName: node linkType: hard -"nwsapi@npm:^2.2.0, nwsapi@npm:^2.2.2, nwsapi@npm:^2.2.4": +"nwsapi@npm:^2.2.0": + version: 2.2.12 + resolution: "nwsapi@npm:2.2.12" + checksum: 95e9623d63df111405503df8c5d800e26f71675d319e2c9c70cddfa31e5ace1d3f8b6d98d354544fc156a1506d920ec291e303fab761e4f99296868e199a466e + languageName: node + linkType: hard + +"nwsapi@npm:^2.2.2, nwsapi@npm:^2.2.4": version: 2.2.9 resolution: "nwsapi@npm:2.2.9" checksum: e6ebbaedf44d1c1e13f7193e5129c8da1b2e8064862b70458ab9bd9e9640b8ad035a0e48d509e787527ecdddea74d5a02798420cd971264a4e03c2b173fadac8 @@ -24431,52 +24400,6 @@ __metadata: languageName: node linkType: hard -"passport-custom@npm:^1.1.1": - version: 1.1.1 - resolution: "passport-custom@npm:1.1.1" - dependencies: - passport-strategy: 1.x.x - checksum: 49b6fcd125dcd60272d4f02c27acb3b61b2659f3148bc10b31b7c439314054ce32c83a12f422215bdfa83d0463668a1f38ca6e8d68ccd32c922f73ccaa5ac9b3 - languageName: node - linkType: hard - -"passport-jwt@npm:^4.0.1": - version: 4.0.1 - resolution: "passport-jwt@npm:4.0.1" - dependencies: - jsonwebtoken: ^9.0.0 - passport-strategy: ^1.0.0 - checksum: d7e2b472d399f596a1db31310f8e63d10777ab7468b9a378c964156e5f0a772598b007417356ead578cfdaf60dc2bba39a55f0033ca865186fdb2a2b198e2e7e - languageName: node - linkType: hard - -"passport-local@npm:^1.0.0": - version: 1.0.0 - resolution: "passport-local@npm:1.0.0" - dependencies: - passport-strategy: 1.x.x - checksum: 59becb988014921a5d6056470d9373c41db452fcf113323064f39d53baa6f184e72151bf269ca6770511f7f0260e13632dacc7b6afdbf60ebf63e90327e186d4 - languageName: node - linkType: hard - -"passport-strategy@npm:1.x.x, passport-strategy@npm:^1.0.0": - version: 1.0.0 - resolution: "passport-strategy@npm:1.0.0" - checksum: cf4cd32e1bf2538a239651581292fbb91ccc83973cde47089f00d2014c24bed63d3e65af21da8ddef649a8896e089eb9c3ac9ca639f36c797654ae9ee4ed65e1 - languageName: node - linkType: hard - -"passport@npm:^0.6.0": - version: 0.6.0 - resolution: "passport@npm:0.6.0" - dependencies: - passport-strategy: 1.x.x - pause: 0.0.1 - utils-merge: ^1.0.1 - checksum: 1d8651a4a1a72b84ea08c498cff9cfc209aebfe18baed4cf93292ded3f8e30a04e30b404fdfce39dfb6aa7247e205f1df43fbfd7bc7c1a67a600884359d46ee6 - languageName: node - linkType: hard - "password-prompt@npm:^1.1.2": version: 1.1.3 resolution: "password-prompt@npm:1.1.3" @@ -24588,13 +24511,6 @@ __metadata: languageName: node linkType: hard -"pause@npm:0.0.1": - version: 0.0.1 - resolution: "pause@npm:0.0.1" - checksum: f362655dfa7f44b946302c5a033148852ed5d05f744bd848b1c7eae6a543f743e79c7751ee896ba519fd802affdf239a358bb2ea5ca1b1c1e4e916279f83ab75 - languageName: node - linkType: hard - "peek-stream@npm:^1.1.0": version: 1.1.3 resolution: "peek-stream@npm:1.1.3" @@ -24634,13 +24550,6 @@ __metadata: languageName: node linkType: hard -"pg-connection-string@npm:2.5.0": - version: 2.5.0 - resolution: "pg-connection-string@npm:2.5.0" - checksum: 4b1650132d8000d68864db774c4a99d98acf1cb90525045402b93d3b5a5f36500e5934c653598256cd86b3a310ba4639fbf1e8e1e04cefa46840838541b7626c - languageName: node - linkType: hard - "pg-connection-string@npm:2.6.1": version: 2.6.1 resolution: "pg-connection-string@npm:2.6.1" @@ -26567,13 +26476,6 @@ __metadata: languageName: node linkType: hard -"reflect-metadata@npm:^0.1.13": - version: 0.1.14 - resolution: "reflect-metadata@npm:0.1.14" - checksum: 3a6190c7f6cb224f26a012d11f9e329360c01c1945e2cbefea23976a8bacf9db6b794aeb5bf18adcb673c448a234fbc06fc41853c00a6c206b30f0777ecf019e - languageName: node - linkType: hard - "reflect-metadata@npm:^0.2.1": version: 0.2.2 resolution: "reflect-metadata@npm:0.2.2" @@ -26619,13 +26521,6 @@ __metadata: languageName: node linkType: hard -"regenerator-runtime@npm:^0.13.11": - version: 0.13.11 - resolution: "regenerator-runtime@npm:0.13.11" - checksum: 12b069dc774001fbb0014f6a28f11c09ebfe3c0d984d88c9bced77fdb6fedbacbca434d24da9ae9371bfbf23f754869307fb51a4c98a8b8b18e5ef748677ca24 - languageName: node - linkType: hard - "regenerator-runtime@npm:^0.14.0": version: 0.14.1 resolution: "regenerator-runtime@npm:0.14.1" @@ -30561,7 +30456,7 @@ __metadata: languageName: node linkType: hard -"utils-merge@npm:1.0.1, utils-merge@npm:^1.0.1": +"utils-merge@npm:1.0.1": version: 1.0.1 resolution: "utils-merge@npm:1.0.1" checksum: 02ba649de1b7ca8854bfe20a82f1dfbdda3fb57a22ab4a8972a63a34553cf7aa51bc9081cf7e001b035b88186d23689d69e71b510e610a09a4c66f68aa95b672 @@ -31340,7 +31235,22 @@ __metadata: languageName: node linkType: hard -"ws@npm:^7.0.0, ws@npm:^7.4.2": +"ws@npm:^7.0.0": + version: 7.5.10 + resolution: "ws@npm:7.5.10" + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ^5.0.2 + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + checksum: bd7d5f4aaf04fae7960c23dcb6c6375d525e00f795dd20b9385902bd008c40a94d3db3ce97d878acc7573df852056ca546328b27b39f47609f80fb22a0a9b61d + languageName: node + linkType: hard + +"ws@npm:^7.4.2": version: 7.5.9 resolution: "ws@npm:7.5.9" peerDependencies: