Files
yaak/packages/plugin-runtime/src/migrations.ts
Gregory Schier 1d37a15cfe Fix types
2025-01-27 06:06:02 -08:00

19 lines
407 B
TypeScript

import { TemplateFunction } from '@yaakapp/api';
export function migrateTemplateFunctionSelectOptions(f: TemplateFunction): TemplateFunction {
const migratedArgs = f.args.map((a) => {
if (a.type === 'select') {
a.options = a.options.map((o) => ({
...o,
label: o.label || (o as any).name,
}));
}
return a;
});
return {
...f,
args: migratedArgs,
};
}