import { getPayload } from 'payload'; import configPromise from '@payload-config'; async function main() { const payload = await getPayload({ config: configPromise }); const result = await payload.find({ collection: 'products', where: { slug: { equals: 'n2xsy' } }, locale: 'en' as any, }); const doc = result.docs[0]; if (!doc) { console.log('No doc found'); process.exit(0); } console.log('--- doc.title:', doc.title); if (doc.content?.root?.children) { const children = doc.content.root.children as any[]; console.log(`--- ${children.length} children found`); for (let i = 0; i < children.length; i++) { const child = children[i]; console.log(`\n[${i}] type=${child.type} blockType=${child.blockType}`); if (child.fields) { console.log(' fields keys:', Object.keys(child.fields)); if (child.fields.items) console.log(' fields.items count:', child.fields.items.length); if (child.fields.technicalItems) console.log(' fields.technicalItems count:', child.fields.technicalItems.length); if (child.fields.voltageTables) console.log(' fields.voltageTables count:', child.fields.voltageTables.length); } // Also check top-level (in case fields are flat) const topKeys = Object.keys(child).filter(k => !['children', 'type', 'version', 'format', 'indent', 'direction', 'textFormat', 'textStyle', 'fields'].includes(k)); if (topKeys.length > 0) console.log(' top-level keys:', topKeys); if (child.items) console.log(' items (top-level) count:', child.items.length); if (child.technicalItems) console.log(' technicalItems (top-level) count:', child.technicalItems.length); if (child.voltageTables) console.log(' voltageTables (top-level) count:', child.voltageTables.length); } } else { console.log('No content.root.children'); } process.exit(0); } main().catch((e) => { console.error(e); process.exit(1); });