npm.io
2.22.7 • Published 4d ago

@medusajs/link-modules

Licence
SEE LICENSE IN LICENSE
Version
2.22.7
Deps
0
Size
282 kB
Vulns
0
Weekly
121.3K
Stars
36.8K

Medusa logo

@medusajs/link-modules

Documentation | Website

Building blocks for digital commerce

Medusa is released under the MIT license. PRs welcome! Discord Chat Follow @medusajs

Link Modules for Medusa: creates and manages the tables that store module links, the relationships between data models of different modules (for example, a product and its sales channels). It contains Medusa's built-in link definitions and also loads the links you define with defineLink. Medusa loads it automatically; apps don't install, register, or call this package directly, and instead manage links with the Link tool (ContainerRegistrationKeys.LINK) and retrieve linked data with Query.

At a glance

Package @medusajs/link-modules
Type Infrastructure Module
Module key Modules.LINK ("link_modules")
Registered by default Yes (always loaded by the Medusa application)

Installation

No installation needed. The package ships with @medusajs/medusa.

Usage

Define a link in your application, then run npx medusa db:migrate to create its table:

import BrandModule from "../modules/brand"
import ProductModule from "@medusajs/medusa/product"
import { defineLink } from "@medusajs/framework/utils"

export default defineLink(
  ProductModule.linkable.product,
  BrandModule.linkable.brand
)

Resources