trellis
Version:
Agentic State Engine — event-sourced causal graph with branching, decision traces, and realtime sync for AI-native applications
72 lines • 3.86 kB
TypeScript
/**
* Forms Ontology — `trellis:Form` / `trellis:FormField` graph entities.
*
* Forms are **derived** from entity schemas (`./derive.ts`), but a
* `Form` entity in the graph is a first-class override surface: rename
* fields, change controls, hide, reorder, regoup. This mirrors the
* workflow/pipeline registry packages: schemas are the default, graph
* entities are the exception.
*
* @module trellis/forms
*/
import { z } from 'zod';
import { type InferType } from '../schema/define.js';
import { type FieldControl, type FormMode } from './types.js';
/**
* `trellis:FormField` — one field override, keyed by its schema attribute
* name. `hidden: true` removes the field from the derived descriptor.
*/
export declare const FormFieldType: import("../schema/define.js").TrellisType<"FormField", {
/** Attribute name in the entity record — must match a schema field. */
fieldName: z.ZodString;
label: z.ZodOptional<z.ZodString>;
control: z.ZodOptional<z.ZodEnum<["text", "textarea", "number", "checkbox", "select", "multi_select", "date", "relation", "people", "files", "json", "readonly"]>>;
required: z.ZodOptional<z.ZodBoolean>;
readonly: z.ZodOptional<z.ZodBoolean>;
hidden: z.ZodOptional<z.ZodBoolean>;
/** Render order within the section (relative). */
order: z.ZodOptional<z.ZodNumber>;
/** Move the field to a section (created on demand). */
section: z.ZodOptional<z.ZodString>;
options: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>, "many">>;
defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
placeholder: z.ZodOptional<z.ZodString>;
description: z.ZodOptional<z.ZodString>;
}, Record<never, never>, Record<never, never>>;
/**
* `trellis:Form` — form override for one entity type. `mode` undefined
* applies to every mode; a mode-scoped entity wins for that mode.
*/
export declare const FormType: import("../schema/define.js").TrellisType<"Form", {
/** Bare entity type name (e.g. `Task`). */
entityType: z.ZodString;
/** Undefined = applies to all modes. */
mode: z.ZodOptional<z.ZodEnum<["create", "edit", "view"]>>;
/** Overrides the schema label / form title. */
title: z.ZodOptional<z.ZodString>;
description: z.ZodOptional<z.ZodString>;
}, {
fields: import("../schema/define.js").Relation<import("../schema/define.js").TrellisType<"FormField", {
/** Attribute name in the entity record — must match a schema field. */
fieldName: z.ZodString;
label: z.ZodOptional<z.ZodString>;
control: z.ZodOptional<z.ZodEnum<["text", "textarea", "number", "checkbox", "select", "multi_select", "date", "relation", "people", "files", "json", "readonly"]>>;
required: z.ZodOptional<z.ZodBoolean>;
readonly: z.ZodOptional<z.ZodBoolean>;
hidden: z.ZodOptional<z.ZodBoolean>;
/** Render order within the section (relative). */
order: z.ZodOptional<z.ZodNumber>;
/** Move the field to a section (created on demand). */
section: z.ZodOptional<z.ZodString>;
options: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>, "many">>;
defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
placeholder: z.ZodOptional<z.ZodString>;
description: z.ZodOptional<z.ZodString>;
}, Record<never, never>, Record<never, never>>, "many">;
}, Record<never, never>>;
export type FormEntity = InferType<typeof FormType>;
export type FormFieldEntity = InferType<typeof FormFieldType>;
/** Both schemas for kernel registration (`client.registerType`). */
export declare const FORMS_ONTOLOGY: import("../core/ontology/types.js").SchemaDefinition[];
export type { FieldControl, FormMode };
//# sourceMappingURL=ontology.d.ts.map