{"_id":"@bimeo/directus-extension-update-data-based-on-relation-interface","name":"@bimeo/directus-extension-update-data-based-on-relation-interface","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.1":{"name":"@bimeo/directus-extension-update-data-based-on-relation-interface","description":"Update data based on data from a related record","icon":"extension","version":"1.0.1","keywords":["directus","directus-extension","directus-extension-interface"],"type":"module","directus:extension":{"type":"interface","path":"dist/index.js","source":"src/index.ts","host":"^10.10.0"},"scripts":{"build":"directus-extension build","dev":"directus-extension build -w --no-minify","link":"directus-extension link","validate":"directus-extension validate"},"devDependencies":{"@directus/extensions-sdk":"13.1.1","typescript":"^5.8.3","vue":"^3.5.17"},"_id":"@bimeo/directus-extension-update-data-based-on-relation-interface@1.0.1","gitHead":"fa17bdd05fd137ebe5ca3c8b77c0c0b258d87caf","_nodeVersion":"18.20.6","_npmVersion":"10.8.2","dist":{"integrity":"sha512-9f3erlexOVb00e2ykvP1mz10SnepxVbPnKyzMqz012fA9yBVyn931VSoNoiswliEQ6INKhrEADDnlwKGN+o27Q==","shasum":"cd5ce32c56149c1f81ec0f935224894d16a665ec","tarball":"https://registry.npmjs.org/@bimeo/directus-extension-update-data-based-on-relation-interface/-/directus-extension-update-data-based-on-relation-interface-1.0.1.tgz","fileCount":3,"unpackedSize":5567,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGpOQOU8+kF45BuNSFnl+BeLr8Dy2WcHmz5H0ZAh+ddSAiAPUo3aaJyprxmsKyxJOwcR3TnXeCf6O9Sgrqbvsu73Cg=="}]},"_npmUser":{"name":"cdillon","email":"cody@bimeodigital.com","actor":{"name":"cdillon","email":"cody@bimeodigital.com","type":"user"}},"directories":{},"maintainers":[{"name":"cdillon","email":"cody@bimeodigital.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/directus-extension-update-data-based-on-relation-interface_1.0.1_1751394991849_0.41659852715022394"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-01T18:36:31.713Z","1.0.1":"2025-07-01T18:36:32.047Z","modified":"2025-07-01T18:36:32.350Z"},"maintainers":[{"name":"cdillon","email":"cody@bimeodigital.com"}],"description":"Update data based on data from a related record","keywords":["directus","directus-extension","directus-extension-interface"],"readme":"# Update Data Based on Relation - Directus Interface Extension\n\nThis 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.\n\n## Features\n\n- Automatically fills target fields when a related record is selected\n- Configurable source lookup field, source field, and target field\n- Real-time updates when the lookup value changes\n\n## How it Works\n\n1. Configure a source lookup field (M2O relationship)\n2. Select which field from the related record to copy (source field)\n3. Choose which field in the current record to update (target field)\n4. When users select a value in the lookup field, the extension automatically fetches the related data and updates the target field\n\n## Use Cases\n\n- Auto-populate customer details when selecting a customer\n- Fill in product information when choosing a product\n- Set default values based on category selection\n- Copy reference data from master records\n\n## Development\n\nTo run the extension in development mode with hot reloading:\n\n```bash\nnpm run dev\n```\n\nThis will build the extension in watch mode without minification, allowing for faster development cycles with automatic rebuilds when files change.\n\n## Building\n\nTo build the extension for production:\n\n```bash\nnpm run build\n```\n\nThe built extension will be output to the `dist` directory and can be deployed to your Directus instance.\n\n## Installation\n\n1. Copy the `dist` folder to your Directus extensions directory (typically `extensions/`)\n2. Restart your Directus instance\n3. The \"Update data based on a relation\" interface will be available in your field configuration options\n\n## Configuration\n\nWhen adding this interface to a field in Directus:\n\n1. **Source lookup**: Select the M2O relationship field that triggers the update\n2. **Source field**: Choose which field from the related record to copy\n3. **Target field**: Select the field in the current record that will be updated\n\n### Configuration Example\n\nIf you have:\n\n- A `customers` collection with fields like `name`, `email`\n- An `orders` collection with a `customer_id` M2O field pointing to customers\n\nYou could configure:\n\n- **Source lookup**: `customer_id`\n- **Source field**: `email` (from customers)\n- **Target field**: `customer_email` (in orders)\n\nNow when someone selects a customer, the customer's email will automatically populate the `customer_email` field.\n\n## Development Scripts\n\n- `npm run build` - Build for production\n- `npm run dev` - Build in watch mode for development\n- `npm run link` - Link extension for local development\n- `npm run validate` - Validate extension structure\n","readmeFilename":"README.md","_rev":"1-00f8858dc9414d904a441c17132dce0c"}