Files
twenty/packages/twenty-sdk/scripts/remote-dom/generators/utils/generate-properties-config.ts
T
Raphaël Bosi f0bc9fcb43 [FRONT COMPONENTS] Move to twenty-sdk (#17587)
Move front components from twenty-shared to twenty-sdk
2026-02-02 12:21:53 +00:00

21 lines
556 B
TypeScript

import { type PropertySchema } from '../schemas';
import { schemaTypeToConstructor } from './schema-type-to-constructor';
export const generatePropertiesConfig = (
properties: Record<string, PropertySchema>,
): string => {
const entries = Object.entries(properties);
if (entries.length === 0) {
return '{}';
}
const props = entries
.map(([name, schema]) => {
const constructorType = schemaTypeToConstructor(schema.type);
return `'${name}': { type: ${constructorType} }`;
})
.join(', ');
return `{ ${props} }`;
};