import { getTemplateData } from './templateEnvelopes' import { validateSamplePrepData } from './templateValidators' import type { SamplePrepColumnsAdapterResult, SamplePrepDataFrameAdapterResult, SamplePrepRowsAdapterResult, SamplePrepTemplate, SamplePrepTemplateData, } from './types' /** @deprecated Scheduled for removal from the core SDK in MINT 1.4; the biology templates move to a dedicated package or the owning plugins. */ export function toSamplePrepRows( template: SamplePrepTemplate | SamplePrepTemplateData ): SamplePrepRowsAdapterResult { const data = getTemplateData(template, 'sample-prep') validateSamplePrepData(data) return [...data.steps] .sort((a, b) => a.order - b.order) .map(step => ({ id: step.id, order: step.order, type: step.type, name: step.name, sourceSampleId: step.sourceSampleId, sourceWellId: step.sourceWellId, destinationSampleId: step.destinationSampleId, destinationWellId: step.destinationWellId, reagentId: step.reagentId, inputVolume: step.inputVolume, outputVolume: step.outputVolume, volumeUnit: step.volumeUnit, durationMin: step.durationMin, status: step.status, protocolName: data.protocolName, ...(step.metadata ?? {}), })) } /** @deprecated Scheduled for removal from the core SDK in MINT 1.4; the biology templates move to a dedicated package or the owning plugins. */ export function toSamplePrepColumns(): SamplePrepColumnsAdapterResult { return [ { key: 'order', label: 'Order', sortable: true, align: 'right' }, { key: 'type', label: 'Type', sortable: true }, { key: 'name', label: 'Step', sortable: true }, { key: 'sourceSampleId', label: 'Source', sortable: true }, { key: 'sourceWellId', label: 'Source well', sortable: true }, { key: 'destinationSampleId', label: 'Destination', sortable: true }, { key: 'destinationWellId', label: 'Destination well', sortable: true }, { key: 'reagentId', label: 'Reagent', sortable: true }, { key: 'inputVolume', label: 'Input', sortable: true, align: 'right' }, { key: 'outputVolume', label: 'Output', sortable: true, align: 'right' }, { key: 'volumeUnit', label: 'Unit', sortable: true }, { key: 'status', label: 'Status', sortable: true }, ] } /** @deprecated Scheduled for removal from the core SDK in MINT 1.4; the biology templates move to a dedicated package or the owning plugins. */ export function toSamplePrepDataFrame( template: SamplePrepTemplate | SamplePrepTemplateData ): SamplePrepDataFrameAdapterResult { return { data: toSamplePrepRows(template), columns: toSamplePrepColumns(), rowKey: 'id', } }