import { getTemplateData } from './templateEnvelopes' import { validateProtocolStepsData } from './templateValidators' import type { ProtocolColumnsAdapterResult, ProtocolDataFrameAdapterResult, ProtocolRowsAdapterResult, ProtocolStepsAdapterResult, ProtocolStepsTemplate, ProtocolStepsTemplateData, } 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 toProtocolSteps( template: ProtocolStepsTemplate | ProtocolStepsTemplateData ): ProtocolStepsAdapterResult { const data = getTemplateData(template, 'protocol-steps') validateProtocolStepsData(data) return [...data.steps] .sort((a, b) => a.order - b.order) .map(step => ({ id: step.id, type: step.type, name: step.name, description: step.description, duration: step.duration, status: step.status, parameters: step.parameters, order: step.order, })) } /** @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 toProtocolRows( template: ProtocolStepsTemplate | ProtocolStepsTemplateData ): ProtocolRowsAdapterResult { const data = getTemplateData(template, 'protocol-steps') validateProtocolStepsData(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, description: step.description, duration: step.duration, status: step.status, ...(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 toProtocolColumns(): ProtocolColumnsAdapterResult { return [ { key: 'order', label: 'Order', sortable: true, align: 'right' }, { key: 'name', label: 'Name', sortable: true }, { key: 'type', label: 'Type', sortable: true }, { key: 'duration', label: 'Duration', sortable: true, align: 'right' }, { key: 'status', label: 'Status', sortable: true }, { key: 'description', label: 'Description', 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 toProtocolDataFrame( template: ProtocolStepsTemplate | ProtocolStepsTemplateData ): ProtocolDataFrameAdapterResult { return { data: toProtocolRows(template), columns: toProtocolColumns(), rowKey: 'id', } }