Member Junction
    Preparing search index...

    Base class for generating entity sub-classes, you can sub-class this class to modify/extend your own entity sub-class generator logic

    Index

    Constructors

    Methods

    • Parameters

      • pool: CodeGenConnection
      • entities: EntityInfo[]
      • directory: string
      • skipDBUpdate: boolean

        when set to true, no updates are written back to the database - which happens after code generation when newly generated code from AI has been generated, but in the case where this flag is true, we don't ever write back to the DB because the assumption is we are only emitting code to the file that was already in the DB.

      Returns Promise<boolean>

    • Generates the description string for a Zod schema field, including field metadata, value list documentation, and JSONType annotations with entity-prefixed type names.

      Parameters

      • entityField: EntityFieldInfo

        The entity field to generate a description for

      • Optionalentity: EntityInfo

        Optional entity context, used to compute the entity-prefixed JSONType name

      Returns string

      A formatted description string for the Zod .describe() call

    • Escapes sequences in description text that would break generated code. Handles JSDoc comment terminators, nested comment openers, backticks, and template literal interpolation sequences.

      Parameters

      • text: string

      Returns string

    • Validates that a JSONTypeDefinition string contains valid TypeScript and (optionally) exports the expected type name. Uses the TypeScript compiler API to parse without writing any files to disk.

      Parameters

      • definition: string

        The raw TypeScript code from EntityField.JSONTypeDefinition

      • expectedTypeName: string

        The JSONType name that should be defined/exported in the definition

      • entityName: string

        Entity name for error messages

      • fieldName: string

        Field name for error messages

      Returns { errors: string[]; valid: boolean }

      An object with valid boolean and optional errors array of diagnostic messages