mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-16 08:36:40 +01:00
18 lines
424 B
TypeScript
18 lines
424 B
TypeScript
import type { TemplateFunctionPlugin } from '@yaakapp/api';
|
|
|
|
export function migrateTemplateFunctionSelectOptions(
|
|
f: TemplateFunctionPlugin,
|
|
): TemplateFunctionPlugin {
|
|
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 };
|
|
}
|