/** * PatchOp to MEL Renderer * * Converts PatchOp AST to MEL syntax snippets. * * Note: These are fragments, not complete domain definitions. * The caller is responsible for assembling fragments into a valid MEL domain. */ import { TypeExpr, TypeField } from "./type-expr.js"; import { ExprNode } from "./expr-node.js"; export type AddTypeOp = { kind: "addType"; typeName: string; typeExpr: TypeExpr; }; export type AddFieldOp = { kind: "addField"; typeName: string; field: TypeField & { defaultValue?: unknown; }; }; export type SetFieldTypeOp = { kind: "setFieldType"; path: string; typeExpr: TypeExpr; }; export type SetDefaultValueOp = { kind: "setDefaultValue"; path: string; value: unknown; }; export type AddConstraintOp = { kind: "addConstraint"; targetPath: string; rule: ExprNode; message?: string; }; export type AddComputedOp = { kind: "addComputed"; name: string; expr: ExprNode; deps?: string[]; }; export type AddActionAvailableOp = { kind: "addActionAvailable"; actionName: string; expr: ExprNode; }; export type PatchOp = AddTypeOp | AddFieldOp | SetFieldTypeOp | SetDefaultValueOp | AddConstraintOp | AddComputedOp | AddActionAvailableOp; export interface RenderOptions { /** * Indentation string (default: " ") */ indent?: string; /** * Include comments with metadata */ includeComments?: boolean; /** * Comment prefix for metadata */ commentPrefix?: string; } /** * Renders a PatchOp to MEL syntax string. * * @param op - The PatchOp to render * @param options - Rendering options * @returns MEL syntax string */ export declare function renderPatchOp(op: PatchOp, options?: RenderOptions): string; /** * Gets the type name from a semantic path. * * @example * // "Todo.title" -> "Todo" * // "User.address.city" -> "User" * // "count" -> undefined */ export declare function extractTypeName(path: string): string | undefined;