import { bioTemplateCatalog } from './catalog' import type { TemplateId, TemplatePackId } from './types' import { templateIdentifierMatches, templateSearchMatches } from './lookup' export interface BioTemplatePackEntry { name: TemplatePackId label: string category: 'bio-template-pack' purpose: string templates: readonly TemplateId[] aliases: readonly string[] frontend_adapters: readonly string[] components: readonly string[] add_command: string docs_command: string } interface BioTemplatePackDefinition { name: TemplatePackId label: string purpose: string templates: readonly TemplateId[] aliases: readonly string[] } const templateInfoById = new Map( bioTemplateCatalog.map(entry => [entry.template_id, entry]), ) function collectTemplateField( templateIds: readonly TemplateId[], field: 'frontend_adapters' | 'components', ): readonly string[] { const values: string[] = [] for (const templateId of templateIds) { const entry = templateInfoById.get(templateId) if (!entry) { throw new Error(`Unknown bio template in pack catalog: ${templateId}`) } for (const value of entry[field]) { if (!values.includes(value)) { values.push(value) } } } return values } function createPack(definition: BioTemplatePackDefinition): BioTemplatePackEntry { return { ...definition, category: 'bio-template-pack', frontend_adapters: collectTemplateField(definition.templates, 'frontend_adapters'), components: collectTemplateField(definition.templates, 'components'), add_command: `mint add data-template-pack ${definition.name} --page`, docs_command: `mint docs template-pack ${definition.name}`, } } const bioTemplatePackDefinitions = [ { name: 'cell-culture-screen', label: 'Cell culture screen', purpose: 'Plate layout, sample metadata, sample prep, reagents, protocol, dose-response, and flow-panel setup.', templates: [ 'sample-sheet', 'sample-prep', 'plate-map', 'reagent-list', 'protocol-steps', 'dose-response', 'flow-cytometry-panel', ], aliases: ['cell culture', 'screen', 'drug screen', 'plate screen'], }, { name: 'omics-assay', label: 'Omics assay', purpose: 'Sample metadata, sample prep, reagents, protocol, instrument run queue, calibration curve, and measurement matrix.', templates: [ 'sample-sheet', 'sample-prep', 'reagent-list', 'protocol-steps', 'instrument-run', 'calibration-curve', 'assay-matrix', ], aliases: [ 'omics', 'metabolomics', 'metabolism', 'metabolite profiling', 'proteomics', 'assay matrix', 'lcms', 'standard curve', ], }, { name: 'longitudinal-study', label: 'Longitudinal study', purpose: 'Sample metadata, time-course schedule, protocol, and measurement matrix.', templates: [ 'sample-sheet', 'time-course', 'protocol-steps', 'assay-matrix', ], aliases: ['time series', 'time-course study', 'kinetics', 'longitudinal'], }, { name: 'molecular-assay', label: 'Molecular assay', purpose: 'Sample metadata, sample prep, reagents, protocol, instrument run queue, calibration curve, and qPCR/ddPCR plate setup.', templates: [ 'sample-sheet', 'sample-prep', 'reagent-list', 'protocol-steps', 'instrument-run', 'calibration-curve', 'qpcr-plate', ], aliases: ['molecular', 'qpcr', 'qPCR', 'gene expression', 'rt-qpcr', 'ddpcr'], }, ] as const satisfies readonly BioTemplatePackDefinition[] /** @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 const bioTemplatePacks = bioTemplatePackDefinitions.map(createPack) as readonly BioTemplatePackEntry[] /** @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 listBioTemplatePacks(): readonly BioTemplatePackEntry[] { return bioTemplatePacks } /** @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 getBioTemplatePackInfo(name: string): BioTemplatePackEntry | undefined { return bioTemplatePacks.find(entry => { const identifiers = [ entry.name, entry.label, ...entry.aliases, ] return templateIdentifierMatches(name, identifiers) }) } /** @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 searchBioTemplatePacks(query: string): readonly BioTemplatePackEntry[] { const normalized = query.trim().toLowerCase() if (!normalized) return bioTemplatePacks return bioTemplatePacks.filter(entry => templateSearchMatches(normalized, [ entry.name, entry.label, entry.purpose, entry.add_command, entry.docs_command, ...entry.templates, ...entry.aliases, ...entry.frontend_adapters, ...entry.components, ])) }