import Builder from './Builder'; import Definition from './Definition'; import Schematic from './Schematic'; import ArrayDefinition from './definitions/Array'; import BoolDefinition from './definitions/Bool'; import EnumDefinition from './definitions/Enum'; import InstanceDefinition from './definitions/Instance'; import KeyDefinition from './definitions/Key'; import NumberDefinition from './definitions/Number'; import ObjectDefinition from './definitions/Object'; import PolymorphDefinition from './definitions/Polymorph'; import ReferenceDefinition from './definitions/Reference'; import ShapeDefinition from './definitions/Shape'; import StringDefinition from './definitions/String'; import UnionDefinition from './definitions/Union'; import { Config, ImportStructure, MetadataField, Options, PrimitiveType, TypeDefinition } from './types'; export default class Renderer { builder: Builder; options: Options; schematic: Schematic; suffix: string; constructor(options: Options, builder: Builder, schematic: Schematic); /** * Triggered after parsing finished. */ afterParse(): void; /** * Triggered before parsing begins. */ beforeParse(): void; /** * Format a list (or string) of items into an array respecting depth indentation. */ formatArray(items: string | string[], depth: number, itemSpacer?: string, indentSpacer?: string): string; /** * Format a list (or string) of properties into an object respecting depth indentation. */ formatObject(properties: string | string[], depth: number, propSpacer?: string, indentSpacer?: string): string; /** * Format the property key of an object. If unsupported characters are used, wrap in quotes. */ formatObjectProperty(value: string): string; /** * Format a primitive value to it's visual representation. */ formatValue(value: unknown, type?: TypeDefinition): string; /** * Return the export name to be used as the prop type or type alias name. */ getObjectName(...names: string[]): string; /** * Return the schema name with a lowercase first character. */ getSchemaInstanceName(name: string): string; /** * Parse and render all information defined in the schema. */ parse(): void; /** * Parse all constants out of the schema and append to the renderer. */ parseConstants(): void; /** * Parse all imports out of the schema and append to the renderer. */ parseImports(): void; /** * Parse out all reference paths. */ parseReferences(): void; /** * Parse out all schemas. */ parseSchemas(): void; /** * Parse all type subsets out of the schema and append to the renderer. */ parseSets(): void; /** * Render re-usable shapes. */ parseShapes(): void; /** * Render the current schema into a formatted output. */ render(setName: string, attributes?: Definition[]): string; /** * Render a definition to it's visual representation. */ renderAttribute(definition: Definition, depth?: number): string; /** * Render an array definition. */ renderArray(definition: ArrayDefinition, depth: number): string; /** * Render an array of values by formatting each value and prepending an indentation. */ renderArrayItems(items: PrimitiveType[], depth?: number, valueType?: string): string[]; /** * Render an array of definitions by formatting each value and prepending an indentation. */ renderArrayDefinitions(items: Definition[], depth?: number): string[]; /** * Render a boolean definition. */ renderBool(definition: BoolDefinition): string; /** * Render a constant. */ renderConstant(name: string, value: PrimitiveType | PrimitiveType[]): string; /** * Render an enum definition. */ renderEnum(definition: EnumDefinition, depth: number): string; /** * Render an import statement. */ renderImport(statement: ImportStructure): string; /** * Render an instance definition. */ renderInstance(definition: InstanceDefinition): string; /** * Render a key definition. */ renderKey(definition: KeyDefinition): string; /** * Render a number definition. */ renderNumber(definition: NumberDefinition): string; /** * Render an object definition. */ renderObject(definition: ObjectDefinition, depth: number): string; /** * Render a mapping of properties by formatting each value and prepending an indentation. */ renderObjectProps(properties: Definition[], depth?: number, sep?: string): string[]; /** * Either render a definition or format a value. */ renderOrFormat(value: PrimitiveType | Definition, depth: number, valueType?: TypeDefinition): string; /** * Render a plain JS object. */ renderPlainObject(object: object, depth?: number): string; /** * Render a polymorph definition. */ renderPolymorph(definition: PolymorphDefinition, depth: number): string; /** * Render a reference definition. */ renderReference(definition: ReferenceDefinition): string; /** * Render a class schema. */ renderSchema(name: string, attributes: Definition[], metadata: MetadataField): string; /** * Render the generics callsite for a schema. */ renderSchemaGenerics(name: string): string; /** * Render a shape definition. */ renderShape(definition: ShapeDefinition, depth: number): string; /** * Render a shape reference definition. */ renderShapeReference(definition: ShapeDefinition): string; /** * Render a string definition. */ renderString(definition: StringDefinition): string; /** * Render a union definition. */ renderUnion(definition: UnionDefinition, depth: number): string; /** * Throws an error if a definition is not supported. */ unsupported(definition: string): string; /** * Render a name and optional arguments into an function representation. */ wrapFunction(name: string, args?: string): string; /** * Render a generics alias with optional type arguments. */ wrapGenerics(alias: string, ...types: string[]): string; /** * Return a piece of code wrapped in an IIFE. */ wrapIIFE(code: string): string; /** * Render a value into an array item representation. */ wrapItem(value: string, depth?: number): string; /** * Render a key and value into an object property representation. */ wrapProperty(key: string, value: string, depth?: number, sep?: string): string; /** * Return the property name as is. */ wrapPropertyName(definition: Definition): string; } //# sourceMappingURL=Renderer.d.ts.map