Rebuild the connector catalog with gendered Male/Female port types
Replaces the old ungendered catalog (plain XLR, TS/TRS 1/4", Speakon NL2/4/8, etc.) with a full Male/Female-aware set covering audio, video, network/data, USB (with Host/Device role split for USB-C), power, RF coax, and fiber connectors, plus real-world bridging/adapter cables — enough to model gender benders and specify exact cable types in the BOM instead of just a connector family. The catalog now lives entirely in the DB (seeded via supabase/seed.sql, captured with the new export-seed.mjs) rather than partly hardcoded in domain/library.ts, which is now unused. Existing seeded diagrams/devices were intentionally not migrated to the new port types — there was nothing important in them yet. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017DUU6CnxECCDeqDNYJgr5x
This commit is contained in:
@@ -1,257 +0,0 @@
|
||||
import type { CableType, DeviceCategoryDef, DeviceTemplate, PortType } from './types'
|
||||
|
||||
/**
|
||||
* Built-in connector/cable/device libraries — the source of truth for the
|
||||
* public catalog's seed data. Not imported by the app itself anymore (the
|
||||
* catalog is fetched from Supabase at runtime, see state/catalogStore.ts);
|
||||
* this file is read only by scripts/generate-seed.mjs, which turns it into
|
||||
* supabase/seed.sql. Re-run that script after editing anything here.
|
||||
*/
|
||||
|
||||
export const BUILT_IN_DEVICE_CATEGORIES: DeviceCategoryDef[] = [
|
||||
{ id: 'display', name: 'Display' },
|
||||
{ id: 'video-source', name: 'Video Source' },
|
||||
{ id: 'audio-source', name: 'Audio Source' },
|
||||
{ id: 'synth', name: 'Synthesizer / Sound Module' },
|
||||
{ id: 'mixer', name: 'Mixer' },
|
||||
{ id: 'amplifier', name: 'Amplifier / Receiver' },
|
||||
{ id: 'speaker', name: 'Speaker' },
|
||||
{ id: 'network', name: 'Network' },
|
||||
{ id: 'computer', name: 'Computer' },
|
||||
{ id: 'camera', name: 'Camera' },
|
||||
{ id: 'control', name: 'Control' },
|
||||
{ id: 'power', name: 'Power' },
|
||||
{ id: 'adapter', name: 'Adapter / Converter' },
|
||||
{ id: 'other', name: 'Other' },
|
||||
]
|
||||
|
||||
export const BUILT_IN_PORT_TYPES: PortType[] = [
|
||||
{ id: 'pt-hdmi', name: 'HDMI', category: 'video', family: 'hdmi' },
|
||||
{ id: 'pt-displayport', name: 'DisplayPort', category: 'video', family: 'displayport' },
|
||||
{ id: 'pt-sdi', name: 'SDI (BNC)', category: 'video', family: 'sdi' },
|
||||
{ id: 'pt-vga', name: 'VGA', category: 'video', family: 'vga' },
|
||||
{ id: 'pt-composite', name: 'Composite Video (RCA)', category: 'video', family: 'rca-composite' },
|
||||
{ id: 'pt-xlr', name: 'XLR (Balanced Audio)', category: 'audio', family: 'xlr' },
|
||||
{ id: 'pt-trs-quarter', name: '1/4" TRS (Balanced Audio)', category: 'audio', family: 'trs-quarter' },
|
||||
{ id: 'pt-ts-quarter', name: '1/4" TS (Unbalanced Audio)', category: 'audio', family: 'ts-quarter' },
|
||||
{ id: 'pt-trs-mini', name: '3.5mm TRS (Balanced Audio)', category: 'audio', family: 'trs-mini' },
|
||||
{ id: 'pt-ts-mini', name: '3.5mm (Unbalanced Audio)', category: 'audio', family: 'ts-mini' },
|
||||
{
|
||||
id: 'pt-trs-quarter-combo',
|
||||
name: '1/4" TRS/TS (Balanced or Unbalanced)',
|
||||
category: 'audio',
|
||||
family: 'trs-quarter-combo',
|
||||
compatibleFamilyIds: ['trs-quarter', 'ts-quarter'],
|
||||
},
|
||||
{
|
||||
id: 'pt-trs-mini-combo',
|
||||
name: '3.5mm TRS/TS (Balanced or Unbalanced)',
|
||||
category: 'audio',
|
||||
family: 'trs-mini-combo',
|
||||
compatibleFamilyIds: ['trs-mini', 'ts-mini'],
|
||||
},
|
||||
{ id: 'pt-rca-audio', name: 'RCA (Stereo Audio)', category: 'audio', family: 'rca-audio' },
|
||||
{ id: 'pt-speakon', name: 'Speakon', category: 'audio', family: 'speakon' },
|
||||
{ id: 'pt-speaker-wire', name: 'Speaker Wire (Bare/Terminal)', category: 'audio', family: 'speaker-wire', maxConnections: 1 },
|
||||
{ id: 'pt-toslink', name: 'TOSLINK (Optical)', category: 'audio', family: 'toslink' },
|
||||
{
|
||||
id: 'pt-cat-rj45',
|
||||
name: 'Cat5e/6 (RJ45)',
|
||||
category: 'network',
|
||||
family: 'cat-rj45',
|
||||
compatibleFamilyIds: ['cat-rj45'],
|
||||
},
|
||||
{ id: 'pt-fiber-lc', name: 'Fiber (LC)', category: 'network', family: 'fiber-lc' },
|
||||
{ id: 'pt-usb-a', name: 'USB-A (Unspecified)', category: 'usb', family: 'usb-a' },
|
||||
{ id: 'pt-usb-c', name: 'USB-C (Unspecified)', category: 'usb', family: 'usb-c' },
|
||||
{
|
||||
id: 'pt-usb-a-host',
|
||||
name: 'USB-A (Host)',
|
||||
category: 'usb',
|
||||
family: 'usb-a-host',
|
||||
// 'usb-a-to-b' lets this pair with a USB-B device port via an A-to-B
|
||||
// cable, distinct from the plain A-to-A cable used with usb-a-device.
|
||||
compatibleFamilyIds: ['usb-a-device', 'usb-a-to-b'],
|
||||
},
|
||||
{
|
||||
id: 'pt-usb-a-device',
|
||||
name: 'USB-A (Device)',
|
||||
category: 'usb',
|
||||
family: 'usb-a-device',
|
||||
compatibleFamilyIds: ['usb-a-host'],
|
||||
},
|
||||
{
|
||||
id: 'pt-usb-c-host',
|
||||
name: 'USB-C (Host)',
|
||||
category: 'usb',
|
||||
family: 'usb-c-host',
|
||||
compatibleFamilyIds: ['usb-c-device', 'usb-c-to-b'],
|
||||
},
|
||||
{
|
||||
id: 'pt-usb-c-device',
|
||||
name: 'USB-C (Device)',
|
||||
category: 'usb',
|
||||
family: 'usb-c-device',
|
||||
compatibleFamilyIds: ['usb-c-host'],
|
||||
},
|
||||
{
|
||||
id: 'pt-usb-b-device',
|
||||
name: 'USB-B (Device)',
|
||||
category: 'usb',
|
||||
family: 'usb-b-device',
|
||||
// The classic "printer" connector — pairs with a host's USB-A or USB-C
|
||||
// port via the corresponding shaped cable, not with another USB-B port.
|
||||
compatibleFamilyIds: ['usb-a-to-b', 'usb-c-to-b'],
|
||||
},
|
||||
{ id: 'pt-iec-power', name: 'IEC C13/C14 Power', category: 'power', family: 'iec-power' },
|
||||
{ id: 'pt-nema-power', name: 'NEMA 5-15 Power', category: 'power', family: 'nema-power' },
|
||||
{ id: 'pt-rs232', name: 'RS-232 (Serial)', category: 'control', family: 'rs232' },
|
||||
{ id: 'pt-ir', name: 'IR (3.5mm Emitter/Receiver)', category: 'control', family: 'ir' },
|
||||
{ id: 'pt-midi-din', name: 'MIDI (5-Pin DIN)', category: 'control', family: 'midi-din' },
|
||||
{
|
||||
id: 'pt-midi-trs-a',
|
||||
name: '3.5mm MIDI (Type A)',
|
||||
category: 'control',
|
||||
family: 'midi-trs-a',
|
||||
// Deliberately NOT cross-compatible with Type B — the two standards
|
||||
// swap tip/ring polarity, so a straight cable between them doesn't work.
|
||||
},
|
||||
{ id: 'pt-midi-trs-b', name: '3.5mm MIDI (Type B)', category: 'control', family: 'midi-trs-b' },
|
||||
]
|
||||
|
||||
export const BUILT_IN_CABLE_TYPES: CableType[] = [
|
||||
{ id: 'ct-hdmi', name: 'HDMI Cable', family: 'hdmi', unit: 'ft' },
|
||||
{ id: 'ct-displayport', name: 'DisplayPort Cable', family: 'displayport', unit: 'ft' },
|
||||
{ id: 'ct-sdi', name: 'SDI Coax (BNC)', family: 'sdi', unit: 'ft' },
|
||||
{ id: 'ct-vga', name: 'VGA Cable', family: 'vga', unit: 'ft' },
|
||||
{ id: 'ct-composite', name: 'Composite Video Cable (RCA)', family: 'rca-composite', unit: 'ft' },
|
||||
{ id: 'ct-xlr', name: 'XLR Cable', family: 'xlr', unit: 'ft' },
|
||||
{
|
||||
id: 'ct-xlr-to-trs-quarter',
|
||||
name: 'XLR to 1/4" TRS Adapter Cable',
|
||||
family: 'xlr',
|
||||
family2: 'trs-quarter',
|
||||
unit: 'ft',
|
||||
},
|
||||
{ id: 'ct-trs-quarter', name: '1/4" TRS Cable (Balanced)', family: 'trs-quarter', unit: 'ft' },
|
||||
{ id: 'ct-ts-quarter', name: '1/4" TS Cable (Instrument/Unbalanced)', family: 'ts-quarter', unit: 'ft' },
|
||||
{ id: 'ct-trs-mini', name: '3.5mm TRS Cable (Balanced)', family: 'trs-mini', unit: 'ft' },
|
||||
{ id: 'ct-ts-mini', name: '3.5mm Cable (Unbalanced)', family: 'ts-mini', unit: 'ft' },
|
||||
{ id: 'ct-rca-audio', name: 'RCA Stereo Audio Cable', family: 'rca-audio', unit: 'ft' },
|
||||
{ id: 'ct-speakon', name: 'Speakon Cable', family: 'speakon', unit: 'ft' },
|
||||
{ id: 'ct-speaker-wire', name: 'Speaker Wire (14/2)', family: 'speaker-wire', unit: 'ft' },
|
||||
{ id: 'ct-toslink', name: 'TOSLINK Optical Cable', family: 'toslink', unit: 'ft' },
|
||||
{ id: 'ct-cat6', name: 'Cat6 Cable', family: 'cat-rj45', unit: 'ft' },
|
||||
{ id: 'ct-fiber-lc', name: 'Fiber LC-LC Cable', family: 'fiber-lc', unit: 'ft' },
|
||||
{ id: 'ct-usb-a', name: 'USB-A to USB-A Cable', family: 'usb-a', unit: 'ft' },
|
||||
{ id: 'ct-usb-c', name: 'USB-C Cable', family: 'usb-c', unit: 'ft' },
|
||||
{ id: 'ct-usb-a-host-device', name: 'USB-A Cable (Host ↔ Device)', family: 'usb-a-host', unit: 'ft' },
|
||||
{ id: 'ct-usb-c-host-device', name: 'USB-C Cable (Host ↔ Device)', family: 'usb-c-host', unit: 'ft' },
|
||||
{ id: 'ct-usb-a-to-b', name: 'USB-A to USB-B Cable', family: 'usb-a-to-b', unit: 'ft' },
|
||||
{ id: 'ct-usb-c-to-b', name: 'USB-C to USB-B Cable', family: 'usb-c-to-b', unit: 'ft' },
|
||||
{ id: 'ct-iec-power', name: 'IEC C13 Power Cable', family: 'iec-power', unit: 'ft' },
|
||||
{ id: 'ct-nema-power', name: 'NEMA 5-15 Extension Cord', family: 'nema-power', unit: 'ft' },
|
||||
{ id: 'ct-rs232', name: 'RS-232 Serial Cable', family: 'rs232', unit: 'ft' },
|
||||
{ id: 'ct-ir', name: 'IR Emitter Cable', family: 'ir', unit: 'ft' },
|
||||
{ id: 'ct-midi-din', name: 'MIDI Cable (5-Pin DIN)', family: 'midi-din', unit: 'ft' },
|
||||
{ id: 'ct-midi-trs-a', name: '3.5mm MIDI Cable (Type A)', family: 'midi-trs-a', unit: 'ft' },
|
||||
{ id: 'ct-midi-trs-b', name: '3.5mm MIDI Cable (Type B)', family: 'midi-trs-b', unit: 'ft' },
|
||||
]
|
||||
|
||||
/** Small starter set of common AV device shapes; users add their own via the editor. */
|
||||
export const BUILT_IN_DEVICE_TEMPLATES: DeviceTemplate[] = [
|
||||
{
|
||||
id: 'dt-display',
|
||||
name: 'Display (TV / Projector)',
|
||||
category: 'display',
|
||||
ports: [
|
||||
{ id: 'p1', name: 'HDMI In 1', direction: 'input', portTypeId: 'pt-hdmi' },
|
||||
{ id: 'p2', name: 'HDMI In 2', direction: 'input', portTypeId: 'pt-hdmi' },
|
||||
{ id: 'p3', name: 'Power In', direction: 'input', portTypeId: 'pt-iec-power' },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'dt-media-player',
|
||||
name: 'Media Player / Streamer',
|
||||
category: 'video-source',
|
||||
ports: [
|
||||
{ id: 'p1', name: 'HDMI Out', direction: 'output', portTypeId: 'pt-hdmi' },
|
||||
{ id: 'p2', name: 'Power In', direction: 'input', portTypeId: 'pt-nema-power' },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'dt-avr',
|
||||
name: 'AV Receiver',
|
||||
category: 'amplifier',
|
||||
ports: [
|
||||
{ id: 'p1', name: 'HDMI In 1', direction: 'input', portTypeId: 'pt-hdmi' },
|
||||
{ id: 'p2', name: 'HDMI In 2', direction: 'input', portTypeId: 'pt-hdmi' },
|
||||
{ id: 'p3', name: 'HDMI In 3', direction: 'input', portTypeId: 'pt-hdmi' },
|
||||
{ id: 'p4', name: 'HDMI Out (Display)', direction: 'output', portTypeId: 'pt-hdmi' },
|
||||
{ id: 'p5', name: 'Speaker Out L', direction: 'output', portTypeId: 'pt-speaker-wire' },
|
||||
{ id: 'p6', name: 'Speaker Out R', direction: 'output', portTypeId: 'pt-speaker-wire' },
|
||||
{ id: 'p7', name: 'Power In', direction: 'input', portTypeId: 'pt-iec-power' },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'dt-speaker',
|
||||
name: 'Speaker (Passive)',
|
||||
category: 'speaker',
|
||||
ports: [{ id: 'p1', name: 'Speaker In', direction: 'input', portTypeId: 'pt-speaker-wire' }],
|
||||
},
|
||||
{
|
||||
id: 'dt-switch',
|
||||
name: 'Network Switch',
|
||||
category: 'network',
|
||||
ports: [
|
||||
{ id: 'p1', name: 'Port 1', direction: 'bidirectional', portTypeId: 'pt-cat-rj45' },
|
||||
{ id: 'p2', name: 'Port 2', direction: 'bidirectional', portTypeId: 'pt-cat-rj45' },
|
||||
{ id: 'p3', name: 'Port 3', direction: 'bidirectional', portTypeId: 'pt-cat-rj45' },
|
||||
{ id: 'p4', name: 'Port 4', direction: 'bidirectional', portTypeId: 'pt-cat-rj45' },
|
||||
{ id: 'p5', name: 'Power In', direction: 'input', portTypeId: 'pt-iec-power' },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'dt-camera',
|
||||
name: 'PTZ Camera',
|
||||
category: 'camera',
|
||||
ports: [
|
||||
{ id: 'p1', name: 'SDI Out', direction: 'output', portTypeId: 'pt-sdi' },
|
||||
{ id: 'p2', name: 'Control (RJ45)', direction: 'bidirectional', portTypeId: 'pt-cat-rj45' },
|
||||
{ id: 'p3', name: 'Power In', direction: 'input', portTypeId: 'pt-nema-power' },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'dt-computer',
|
||||
name: 'Computer / Laptop',
|
||||
category: 'computer',
|
||||
ports: [
|
||||
{ id: 'p1', name: 'HDMI Out', direction: 'output', portTypeId: 'pt-hdmi' },
|
||||
{ id: 'p2', name: 'USB-C', direction: 'bidirectional', portTypeId: 'pt-usb-c' },
|
||||
{ id: 'p3', name: 'Ethernet', direction: 'bidirectional', portTypeId: 'pt-cat-rj45' },
|
||||
],
|
||||
},
|
||||
// Adapters model a real standalone part (a barrel/dongle) as a tiny
|
||||
// 2-port device, so a connection that genuinely needs two physical
|
||||
// cables — e.g. 3.5mm MIDI into a DIN adapter, then a DIN cable onward —
|
||||
// shows up in the BOM as what it actually is: one adapter + two cables,
|
||||
// each with its own length, instead of being squeezed into one cable type.
|
||||
{
|
||||
id: 'dt-adapter-midi-trs-a-to-din',
|
||||
name: '3.5mm-to-DIN MIDI Adapter (Type A)',
|
||||
category: 'adapter',
|
||||
ports: [
|
||||
{ id: 'p1', name: '3.5mm In (from MIDI Out)', direction: 'input', portTypeId: 'pt-midi-trs-a' },
|
||||
{ id: 'p2', name: 'DIN Out (to MIDI In)', direction: 'output', portTypeId: 'pt-midi-din' },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'dt-adapter-midi-trs-b-to-din',
|
||||
name: '3.5mm-to-DIN MIDI Adapter (Type B)',
|
||||
category: 'adapter',
|
||||
ports: [
|
||||
{ id: 'p1', name: '3.5mm In (from MIDI Out)', direction: 'input', portTypeId: 'pt-midi-trs-b' },
|
||||
{ id: 'p2', name: 'DIN Out (to MIDI In)', direction: 'output', portTypeId: 'pt-midi-din' },
|
||||
],
|
||||
},
|
||||
]
|
||||
Reference in New Issue
Block a user