Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

968 B
Raw Blame
import * as z from "zod/mini";
import { BasePropertySchema, TPropertyValue } from "./common";
import { PropertyType } from "./property-type";


// Code should be a valid javascript function that takes a single argument which is an object
/*
(ctx: {containerId:string, value: unknown, onChange: (value: unknown) => void, isEmbeded: boolean, projectId:string}) => void
*/
export const CustomProperty = z.object({
  ...BasePropertySchema.shape,
  ...TPropertyValue(z.unknown(), PropertyType.CUSTOM).shape,
  code: z.string(),
})

export type CustomProperty<R extends boolean> = BasePropertySchema &
  TPropertyValue<unknown, PropertyType.CUSTOM, R> & {
    code:string;
  }

export type CustomPropertyCodeFunctionParams =
  {
    containerId:string,
    value: unknown,
    onChange: (value: unknown) => void,
    isEmbeded: boolean,
    projectId:string,
    property: Pick<CustomProperty<boolean>, 'displayName' | 'description' | 'required'>,
    disabled: boolean
  }