import { createDirectus, rest, authentication, readDashboards, createPanel, readPanels } from '@directus/sdk'; async function createDefaultList() { const url = 'http://localhost:8059'; const email = 'marc@mintel.me'; const password = 'Tim300493.'; console.log(`🚀 Creating Default List Panel: ${url}`); const client = createDirectus(url).with(authentication('json')).with(rest()); try { await client.login(email, password); console.log('✅ Authenticated'); const dashboards = await client.request(readDashboards({ filter: { name: { _eq: 'Feedback Operational Intelligence' } } })); const db = dashboards[0]; // Create a completely default list panel const panel = await client.request(createPanel({ dashboard: db.id, name: 'Debug Default List', type: 'list', width: 12, height: 10, position_x: 0, position_y: 24, // below options: { collection: 'visual_feedback' } })); console.log(`Created Debug Panel: ${panel.id}`); console.log(`Options: ${JSON.stringify(panel.options, null, 2)}`); // Let's read it back to see if Directus enriched it with defaults const panels = await client.request(readPanels({ filter: { id: { _eq: panel.id } } })); console.log(`Enriched Options: ${JSON.stringify(panels[0].options, null, 2)}`); } catch (e: any) { console.error('❌ Creation failed:'); console.error(e.message); } } createDefaultList();