@flexkit/schema
Types and helpers for flexkit.config.ts:
defineConfiganddefineEntityto author a project configuration with full typing.- The schema types (
Entity,Attribute,ProjectConfig, …) and their deployed counterparts (UiEntity,UiAttribute,UiProjectSchema). serializeConfig, used byflexkit deploy, which turns the config into pure data: Zodvalidationfunctions are compiled to JSON Schema (draft-07), and anything that cannot be expressed that way fails with aSchemaSerializationErrornaming the entity and attribute.
import { defineConfig, defineEntity } from '@flexkit/schema';
export default defineConfig({
projectId: 'abcdefghij',
title: 'Shop',
menuGroups: [{ name: 'catalog', title: 'Catalog' }],
scopes: [{ name: 'default', label: 'Default', isDefault: true }],
schema: [
defineEntity({
name: 'product',
plural: 'products',
menu: { group: 'catalog', icon: 'Tag' },
attributes: [
{
name: 'name',
label: 'Name',
dataType: 'string',
inputType: 'text',
scope: 'global',
validation: (z) => z.string().min(1),
},
],
}),
],
});