feat: deprecate remote link (#10768)
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
@@ -4,7 +4,7 @@ import { ProductInventoryLinkModule } from "../__mocks__/product-inventory-link"
|
||||
import { ProductModule } from "../__mocks__/product-module"
|
||||
import { StockLocationModule } from "../__mocks__/stock-location-module"
|
||||
|
||||
import { RemoteLink } from "../remote-link"
|
||||
import { Link } from "../link"
|
||||
|
||||
const allModules = [
|
||||
// modules
|
||||
@@ -17,7 +17,7 @@ const allModules = [
|
||||
]
|
||||
describe("Remote Link", function () {
|
||||
it("Should get all loaded modules and compose their relationships", async function () {
|
||||
const remoteLink = new RemoteLink(allModules as any)
|
||||
const remoteLink = new Link(allModules as any)
|
||||
|
||||
const relations = remoteLink.getRelationships()
|
||||
|
||||
@@ -84,7 +84,7 @@ describe("Remote Link", function () {
|
||||
})
|
||||
|
||||
it("Should call the correct link module to create relation between 2 keys", async function () {
|
||||
const remoteLink = new RemoteLink(allModules as any)
|
||||
const remoteLink = new Link(allModules as any)
|
||||
|
||||
await remoteLink.create([
|
||||
{
|
||||
@@ -123,7 +123,7 @@ describe("Remote Link", function () {
|
||||
})
|
||||
|
||||
it("Should call delete in cascade all the modules involved in the link", async function () {
|
||||
const remoteLink = new RemoteLink(allModules as any)
|
||||
const remoteLink = new Link(allModules as any)
|
||||
|
||||
ProductInventoryLinkModule.softDelete.mockImplementation(() => {
|
||||
return {
|
||||
|
||||
@@ -2,7 +2,7 @@ export * from "./definitions"
|
||||
export * from "./loaders"
|
||||
export * from "./medusa-app"
|
||||
export * from "./medusa-module"
|
||||
export * from "./remote-link"
|
||||
export * from "./link"
|
||||
export * from "./remote-query"
|
||||
export * from "./types"
|
||||
export * from "./utils"
|
||||
|
||||
@@ -48,7 +48,7 @@ type LinkDataConfig = {
|
||||
moduleBKey: string
|
||||
}
|
||||
|
||||
export class RemoteLink {
|
||||
export class Link {
|
||||
private modulesMap: Map<string, LoadedLinkModule> = new Map()
|
||||
private relationsPairs: Map<string, LoadedLinkModule> = new Map()
|
||||
private relations: Map<string, Map<string, RemoteRelationship[]>> = new Map()
|
||||
@@ -33,7 +33,7 @@ import {
|
||||
ModuleBootstrapOptions,
|
||||
RegisterModuleJoinerConfig,
|
||||
} from "./medusa-module"
|
||||
import { RemoteLink } from "./remote-link"
|
||||
import { Link } from "./link"
|
||||
import { createQuery, RemoteQuery } from "./remote-query"
|
||||
import { MODULE_SCOPE } from "./types"
|
||||
|
||||
@@ -210,7 +210,7 @@ async function initializeLinks({
|
||||
)
|
||||
|
||||
return {
|
||||
remoteLink: new RemoteLink(),
|
||||
remoteLink: new Link(),
|
||||
linkResolution,
|
||||
getMigrationPlanner,
|
||||
}
|
||||
@@ -261,7 +261,7 @@ function registerCustomJoinerConfigs(servicesConfig: ModuleJoinerConfig[]) {
|
||||
|
||||
export type MedusaAppOutput = {
|
||||
modules: Record<string, LoadedModule | LoadedModule[]>
|
||||
link: RemoteLink | undefined
|
||||
link: Link | undefined
|
||||
query: RemoteQueryFunction
|
||||
entitiesMap?: Record<string, any>
|
||||
gqlSchema?: GraphQLUtils.GraphQLSchema
|
||||
|
||||
Reference in New Issue
Block a user