codegen library
Classes
- ClientGenerator
- Generates a typed Dart client from a validated schema AST.
- ClientGeneratorOptions
-
Provider-agnostic customization points used when generating
ComonOrm. - CliPrompter
- Minimal terminal prompt helper for interactive CLI flows.
- CodeClass
- A full Dart class declaration.
- CodeConstructor
- A constructor declaration for a class.
- CodeField
-
A field declaration inside a class:
final Type name;or similar. - CodeMethod
- A method declaration inside a class.
- CodeParameter
- A constructor parameter, either positional or named.
- CodeRenderer
- Renders CodeClass IR nodes to Dart source strings.
- CodeUnit
- A model of a generated Dart source file, containing zero or more classes.
- DatasourceDefinition
- Parsed datasource block.
- EnumDefinition
- Parsed enum declaration.
- FieldAttribute
- Parsed field-level attribute.
- FieldDefinition
- Parsed field declaration.
- GeneratedClientWriter
- Writes generated client output for a loaded schema.
- GeneratedClientWriteResult
- Result of writing generated client code to disk.
- GeneratorDefinition
- Parsed generator block.
- ImplicitManyToManyStorageDefinition
- Resolved storage mapping for an implicit many-to-many relation.
- LoadedSchemaDocument
- Validated schema together with its source file path.
- ModelAttribute
- Parsed model-level attribute.
- ModelDefinition
- Parsed model declaration.
- NativeTypeRule
- Validation rule describing how one provider native type can be used.
- ParsedImplicitManyToManyTableName
- Parsed components extracted from an implicit many-to-many table name.
- ProviderCodegenSnippet
- Provider-emitted code fragments consumed by the core generator.
- ResolvedDatasourceConfig
- Resolved datasource settings used by runtime adapters and CLIs.
- ResolvedGeneratorConfig
- Resolved generator settings used by code generation commands.
- SchemaDocument
-
Parsed
schema.prismadocument. - SchemaLexer
-
Tokenizes a Prisma-style
schema.prismasource into a flat Token list. - SchemaParseError
- A single parse error returned by SchemaParser.parseResult.
- SchemaParser
- Parses Prisma-inspired schema source into a SchemaDocument.
- SchemaParseResult
- Result of a tolerant parse via SchemaParser.parseResult.
- SchemaValidator
- Validates parsed schema documents against the supported feature set.
- SchemaWorkflow
- Convenience workflow for loading, validating, and resolving schema config.
- Token
- A single lexer token with source position.
- ValidationIssue
- Validation issue emitted by the schema validator.
Enums
- NativeTypeArgumentRule
- Additional validation rule applied to native-type arguments.
- TokenKind
- Token types produced by SchemaLexer.
Constants
- kImplicitManyToManyTablePrefix → const String
- Prefix used for generated implicit many-to-many storage tables.
-
kScalarTypes
→ const Set<
String> - Scalar types recognized by the core schema layer.
Functions
-
buildAggregateInputIr(
SchemaDocument schema, ModelDefinition model) → CodeUnit -
Builds aggregate-input IR classes for
modelwithout rendering to a string. -
buildFlutterSqliteClientGeneratorOptions(
) → ClientGeneratorOptions - Builds provider helper options for Flutter SQLite clients.
-
buildPostgresqlClientGeneratorOptions(
) → ClientGeneratorOptions - Builds provider helper options for generated PostgreSQL clients.
-
buildVmSqliteClientGeneratorOptions(
) → ClientGeneratorOptions - Builds provider helper options for VM and CLI SQLite clients.
-
cliError(
String message, {required bool ansiEnabled}) → String - Formats an error CLI line.
-
cliInfo(
String message, {required bool ansiEnabled}) → String - Formats an informational CLI line.
-
cliMuted(
String message, {required bool ansiEnabled}) → String - Formats muted helper text such as usage strings.
-
cliSuccess(
String message, {required bool ansiEnabled}) → String - Formats a success CLI line.
-
cliTitle(
String message, {required bool ansiEnabled}) → String - Formats a CLI title line with a package emoji and accent color.
-
cliWarning(
String message, {required bool ansiEnabled}) → String - Formats a warning CLI line.
-
collectImplicitManyToManyStorages(
SchemaDocument schema) → List< ImplicitManyToManyStorageDefinition> -
Collects all implicit many-to-many storages declared by
schema. -
defaultMigrationsDirectory(
String schemaPath) → String - Returns the default migrations directory for a given schema path.
-
discoverSchemaPath(
{String? explicitPath}) → String -
Discovers
schema.prismaor validates an explicit schema path. -
findNearestPubspec(
Directory start) → File? -
Finds the nearest
pubspec.yamlwalking upwards fromstart. -
isImplicitManyToManyTableName(
String tableName) → bool -
Returns whether
tableNamebelongs to implicit relation storage. -
mergeClientGeneratorOptions(
ClientGeneratorOptions left, ClientGeneratorOptions right) → ClientGeneratorOptions - Merges provider-specific generator options into one combined option set.
-
parseImplicitManyToManyTableName(
String tableName) → ParsedImplicitManyToManyTableName? - Parses an implicit relation table name produced by this package.
-
pubspecReferencesPackage(
String source, String packageName) → bool -
Returns whether a pubspec references
packageName. -
resolveClientGeneratorOptions(
{required SchemaDocument schema, String? schemaPath, required Directory anchorDirectory}) → ClientGeneratorOptions - Resolves generator options for a concrete output location.
-
resolveImplicitManyToManyStorage(
{required SchemaDocument schema, required String sourceModelName, required String relationFieldName}) → ImplicitManyToManyStorageDefinition? - Resolves the join-table storage used by an implicit relation field.
-
sinkSupportsAnsi(
StringSink sink) → bool - Returns whether the provided sink supports ANSI escapes.
Typedefs
- CliReadLine = String? Function()
- Signature used to read a single line from the terminal.
- DatasourceUrlResolver = String Function(String schemaPath, String rawUrl, String provider)
- Provider-specific datasource URL normalization hook.
Exceptions / Errors
- GeneratedClientSchemaMismatchException
- Thrown when a checked-in/generated client was produced from a different schema than the current one.
- SchemaParseException
-
Error thrown when
schema.prismasource cannot be parsed. - SchemaValidationException
- Exception thrown when schema validation returns one or more issues.