import type { FieldValue } from '../../../model/Properties'; import type { NodeDef } from '../../NodeRegistry'; import { asField } from '../../values'; import { struct } from '../shared'; /** * Bundles its declared inputs into one struct, so a group of values travels along a single edge * instead of one edge per part. The counterpart of Expand. */ export const PackStruct: NodeDef = { type: 'PackStruct', label: 'Pack', category: 'data', description: 'Bundles named values into one struct, one input per field.', inputs: [], outputs: [struct('value')], params: [], declaresPorts: 'inputs', run: (_ctx, inputs) => { const fields: Record = {}; for (const [field, value] of Object.entries(inputs)) fields[field] = asField(value); return { outputs: { value: fields } }; }, };