npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@bimeo/directus-extension-update-data-based-on-relation-interface

v1.0.1

Published

Update data based on data from a related record

Readme

Update Data Based on Relation - Directus Interface Extension

This is a Directus interface extension that automatically updates a field in the current record based on data from a related record. When a user selects a value in a many-to-one (M2O) relationship field, this extension can automatically populate another field with data from the selected related record.

Features

  • Automatically fills target fields when a related record is selected
  • Configurable source lookup field, source field, and target field
  • Real-time updates when the lookup value changes

How it Works

  1. Configure a source lookup field (M2O relationship)
  2. Select which field from the related record to copy (source field)
  3. Choose which field in the current record to update (target field)
  4. When users select a value in the lookup field, the extension automatically fetches the related data and updates the target field

Use Cases

  • Auto-populate customer details when selecting a customer
  • Fill in product information when choosing a product
  • Set default values based on category selection
  • Copy reference data from master records

Development

To run the extension in development mode with hot reloading:

npm run dev

This will build the extension in watch mode without minification, allowing for faster development cycles with automatic rebuilds when files change.

Building

To build the extension for production:

npm run build

The built extension will be output to the dist directory and can be deployed to your Directus instance.

Installation

  1. Copy the dist folder to your Directus extensions directory (typically extensions/)
  2. Restart your Directus instance
  3. The "Update data based on a relation" interface will be available in your field configuration options

Configuration

When adding this interface to a field in Directus:

  1. Source lookup: Select the M2O relationship field that triggers the update
  2. Source field: Choose which field from the related record to copy
  3. Target field: Select the field in the current record that will be updated

Configuration Example

If you have:

  • A customers collection with fields like name, email
  • An orders collection with a customer_id M2O field pointing to customers

You could configure:

  • Source lookup: customer_id
  • Source field: email (from customers)
  • Target field: customer_email (in orders)

Now when someone selects a customer, the customer's email will automatically populate the customer_email field.

Development Scripts

  • npm run build - Build for production
  • npm run dev - Build in watch mode for development
  • npm run link - Link extension for local development
  • npm run validate - Validate extension structure