Skip to content

ChainGraph API Documentation / @badaitech/chaingraph-codegen / CodeGenerator

Class: CodeGenerator

Defined in: core/CodeGenerator.ts:47

ChainGraph Code Generator Public API exports

Constructors

Constructor

new CodeGenerator(options): CodeGenerator

Defined in: core/CodeGenerator.ts:53

Parameters

options

GeneratorOptions

Returns

CodeGenerator

Methods

generate()

generate(): Promise<string>

Defined in: core/CodeGenerator.ts:69

Generate ChainGraph schema code from external library type This is the old single-schema generation method (kept for backward compatibility)

Returns

Promise<string>


generateMultiSchema()

generateMultiSchema(maxDepth): Promise<string>

Defined in: core/CodeGenerator.ts:104

Generate ChainGraph schemas with multi-schema support Discovers all nested types and generates separate schemas for each

Parameters

maxDepth

number = 10

Returns

Promise<string>


resolveDtsPath()

resolveDtsPath(library): string

Defined in: core/CodeGenerator.ts:166

Resolve path to .d.ts file in node_modules Public to allow CLI watch mode Handles both regular npm and pnpm structures

Parameters

library

string

Returns

string

Licensed under BUSL-1.1