Skip to content

Commit

Permalink
chore: dependecies reorg (medusajs#8535)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlos-r-l-rodrigues authored Aug 23, 2024
1 parent 59599ac commit 0583789
Show file tree
Hide file tree
Showing 126 changed files with 949 additions and 1,257 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion integration-tests/modules/__tests__/link-modules/index.ts
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MedusaContainer } from "@medusajs/modules-sdk"
import {
CreatePriceSetDTO,
IPricingModuleService,
MedusaContainer,
PriceSetDTO,
} from "@medusajs/types"
import { Modules } from "@medusajs/utils"
Expand Down
1 change: 1 addition & 0 deletions packages/cli/medusa-cli/cli.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env node

try {
require("ts-node").register({})
} catch {}
Expand Down
10 changes: 5 additions & 5 deletions packages/cli/medusa-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
}
2 changes: 0 additions & 2 deletions packages/cli/medusa-cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/oas/medusa-oas-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 5 additions & 2 deletions packages/core/core-flows/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 6 additions & 5 deletions packages/core/core-flows/src/common/steps/create-remote-links.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -18,7 +19,7 @@ export const createLinksStepId = "create-remote-links"
* import {
* Modules
* } from "@medusajs/utils"
*
*
* const helloWorldWorkflow = createWorkflow(
* "hello-world",
* () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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 {
Expand All @@ -22,7 +23,7 @@ export const dismissRemoteLinkStepId = "dismiss-remote-links"
* import {
* Modules
* } from "@medusajs/utils"
*
*
* const helloWorldWorkflow = createWorkflow(
* "hello-world",
* () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
3 changes: 1 addition & 2 deletions packages/core/core-flows/src/common/workflows/batch-links.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { LinkDefinition } from "@medusajs/modules-sdk"
import { BatchWorkflowInput } from "@medusajs/types"
import { BatchWorkflowInput, LinkDefinition } from "@medusajs/types"
import {
WorkflowData,
WorkflowResponse,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LinkDefinition } from "@medusajs/modules-sdk"
import { LinkDefinition } from "@medusajs/types"
import {
WorkflowData,
WorkflowResponse,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LinkDefinition } from "@medusajs/modules-sdk"
import { LinkDefinition } from "@medusajs/types"
import {
WorkflowData,
WorkflowResponse,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LinkDefinition } from "@medusajs/modules-sdk"
import { LinkDefinition } from "@medusajs/types"
import {
WorkflowData,
WorkflowResponse,
Expand Down
Original file line number Diff line number Diff line change
@@ -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],
Expand Down
11 changes: 4 additions & 7 deletions packages/core/core-flows/src/product/steps/parse-product-csv.ts
Original file line number Diff line number Diff line change
@@ -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"
/**
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions packages/core/medusa-test-utils/src/index.ts
Original file line number Diff line number Diff line change
@@ -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"
6 changes: 3 additions & 3 deletions packages/core/medusa-test-utils/src/module-test-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<TService = unknown> {
MikroOrmWrapper: TestDatabase
Expand Down
5 changes: 3 additions & 2 deletions packages/core/modules-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion packages/core/modules-sdk/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from "@medusajs/types/dist/modules-sdk"
export * from "./definitions"
export * from "./loaders"
export * from "./medusa-app"
Expand Down
10 changes: 5 additions & 5 deletions packages/core/modules-sdk/src/medusa-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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]

Expand Down
17 changes: 2 additions & 15 deletions packages/core/modules-sdk/src/remote-link.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
ILinkModule,
LinkDefinition,
LoadedModule,
ModuleJoinerRelationship,
} from "@medusajs/types"
Expand All @@ -12,28 +13,14 @@ 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 = {
[moduleName: string | Modules]: Record<string, string | string[]>
}
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<string, unknown>
}

type RemoteRelationship = ModuleJoinerRelationship & {
isPrimary: boolean
isForeign: boolean
Expand Down
Original file line number Diff line number Diff line change
@@ -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[],
Expand Down
6 changes: 4 additions & 2 deletions packages/core/orchestration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading

0 comments on commit 0583789

Please sign in to comment.