import { getTemplateData } from './templateEnvelopes' import { validateReagentListData } from './templateValidators' import type { ReagentColumnsAdapterResult, ReagentDataFrameAdapterResult, ReagentListItemsAdapterResult, ReagentListTemplate, ReagentListTemplateData, ReagentRowsAdapterResult, } 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 toReagentListItems( template: ReagentListTemplate | ReagentListTemplateData ): ReagentListItemsAdapterResult { const data = getTemplateData(template, 'reagent-list') validateReagentListData(data) return data.reagents.map(reagent => ({ id: reagent.id, name: reagent.name, catalogNumber: reagent.catalogNumber, lotNumber: reagent.lotNumber, expiryDate: reagent.expiryDate, storageCondition: reagent.storageCondition, location: reagent.location, stockLevel: reagent.stockLevel, stockUnit: reagent.stockUnit, supplier: reagent.supplier, url: reagent.url, })) } /** @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 toReagentRows( template: ReagentListTemplate | ReagentListTemplateData ): ReagentRowsAdapterResult { const data = getTemplateData(template, 'reagent-list') validateReagentListData(data) return data.reagents.map(reagent => ({ id: reagent.id, name: reagent.name, kind: reagent.kind, catalogNumber: reagent.catalogNumber, lotNumber: reagent.lotNumber, expiryDate: reagent.expiryDate, storageCondition: reagent.storageCondition, location: reagent.location, stockLevel: reagent.stockLevel, stockUnit: reagent.stockUnit, supplier: reagent.supplier, concentration: reagent.concentration, ...(reagent.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 toReagentColumns(): ReagentColumnsAdapterResult { return [ { key: 'name', label: 'Name', sortable: true }, { key: 'kind', label: 'Kind', sortable: true }, { key: 'catalogNumber', label: 'Catalog', sortable: true }, { key: 'lotNumber', label: 'Lot', sortable: true }, { key: 'expiryDate', label: 'Expiry', sortable: true }, { key: 'storageCondition', label: 'Storage', sortable: true }, { key: 'location', label: 'Location', sortable: true }, { key: 'stockLevel', label: 'Stock', sortable: true, align: 'right' }, { key: 'stockUnit', label: 'Unit', sortable: true }, { key: 'supplier', label: 'Supplier', 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 toReagentDataFrame( template: ReagentListTemplate | ReagentListTemplateData ): ReagentDataFrameAdapterResult { return { data: toReagentRows(template), columns: toReagentColumns(), rowKey: 'id', } }