comon_orm library
Classes
- AggregateQuery
- Backend-neutral aggregate query.
- AggregateQueryResult
- Aggregate output returned by AggregateQuery and GroupByQuery.
- BoolFilter
- Boolean field predicates used in generated and manual query inputs.
- ClientGenerator
- Generates a typed Dart client from a validated schema AST.
- ClientGeneratorOptions
- Configuration for generated client runtime helper emission.
- 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.
- ComonOrmClient
- Entry point for ad-hoc access to models through a DatabaseAdapter.
- CountQuery
- Query object for counting records.
- CreateManyQuery
- Query object for inserting multiple records in a single operation.
- CreateQuery
- Query object for creating a single record.
- CreateRelationWrite
- Nested create payload for a single relation.
- DatabaseAdapter
- Backend contract used by generated clients and low-level query delegates.
- DatabaseExecutionMiddleware
- Optional execution wrapper for middleware that must scope the query run.
- DatabaseMiddleware
- Hook surface for observing or mutating adapter operations.
- DatabaseMiddlewareContext
- Mutable middleware context passed to DatabaseMiddleware.beforeQuery.
- DatabaseMiddlewareResult
- Result passed to DatabaseMiddleware.afterQuery.
- DatasourceDefinition
- Parsed datasource block.
- DeleteManyQuery
- Query object for bulk deletes.
- DeleteQuery
- Query object for deleting a single record.
- DeployResult
- Result of applying all pending local migrations.
- DoubleFilter
- Numeric predicates used by aggregate filters and numeric comparisons.
- EnumDefinition
- Parsed enum declaration.
- FieldAttribute
- Parsed field-level attribute.
- FieldDefinition
- Parsed field declaration.
- FindFirstQuery
- Query object for fetching the first matching record.
- FindManyQuery
- Query object for fetching multiple records.
- FindUniqueQuery
- Query object for fetching a unique record.
- GeneratedClientWriter
- Writes generated client output for a loaded schema.
- GeneratedClientWriteResult
- Result of writing generated client code to disk.
- GeneratedDatasourceMetadata
- Generated datasource metadata for runtime bootstrap.
- GeneratedDatasourceUrl
- Generated datasource URL description for runtime bootstrap.
- GeneratedEnumMetadata
- Generated enum metadata for runtime lookup and normalization.
- GeneratedFieldDefaultMetadata
- Generated default metadata for a field.
- GeneratedFieldMetadata
- Generated field metadata used by runtime bridge and adapters.
- GeneratedModelMetadata
- Generated model metadata for runtime lookup and relation resolution.
- GeneratedRelationMetadata
- Generated relation metadata attached to a relation field.
- GeneratedRuntimeSchema
- Root generated runtime schema emitted by generated clients.
- GeneratorDefinition
- Parsed generator block.
- GroupByOrderBy
- Ordering entry used by group-by queries.
- GroupByQuery
- Backend-neutral group-by query.
- GroupByQueryResultRow
- Single grouped row returned by GroupByQuery.
- ImplicitManyToManyStorageDefinition
- Resolved storage mapping for an implicit many-to-many relation.
- InMemoryDatabaseAdapter
- In-memory adapter intended for tests, examples, and local experimentation.
- IntFilter
- Integer field predicates used in generated and manual query inputs.
- LoadedSchemaDocument
- Validated schema together with its source file path.
- LocalMigrationArtifact
- Describes a migration artifact loaded from disk.
- MiddlewareDatabaseAdapter
- Decorator that applies DatabaseMiddleware to a DatabaseAdapter.
-
MigrationDraft<
TPlan extends PlannedMigration> - File-backed migration draft created from schema diffing.
-
MigrationRecord<
TKind extends Enum> - Single migration history record stored by a relational provider.
-
MigrationResult<
TPlan extends PlannedMigration> - Result of applying a relational migration plan.
-
MigrationStatus<
TIssue extends MigrationStatusIssue> - Summary returned by relational migration status checks.
- MigrationStatusIssue
- Issue reported when local and database migration state differ.
- ModelAttribute
- Parsed model-level attribute.
- ModelDefinition
- Parsed model declaration.
- ModelDelegate
- Binds model-scoped query objects to a concrete model name.
- NumericAggregatesFilter
-
Numeric aggregate filters used in generated
havinginputs. - ParsedImplicitManyToManyTableName
- Parsed components extracted from an implicit many-to-many table name.
- PlannedMigration
- Contract implemented by relational migration plans.
- PlannedOperation
- Provider-agnostic execution plan derived from query input.
- QueryAggregatePredicate
-
Aggregate predicate used by
havingand aggregate-aware ordering. - QueryCountAggregateResult
- Count values returned by an aggregate query.
- QueryCountSelection
- Count selection for aggregate and group-by queries.
- QueryCursor
- Unique cursor selector used for cursor-based pagination.
- QueryInclude
- Include tree for eager-loading relations.
- QueryIncludeEntry
- Single entry inside an include tree.
- QueryLogicalGroup
- Logical OR group represented as branches of predicates.
- QueryOrderBy
- Single field ordering entry.
- QueryPlanner
- Converts high-level query objects into a compact execution plan.
- QueryPredicate
- Backend-neutral predicate used by adapters.
- QueryRelation
- Relation metadata used for includes, filters, and nested writes.
- QueryRelationFilter
- Relation-scoped predicates used by nested filters.
- QuerySelect
- Scalar field projection.
- ResolvedDatasourceConfig
- Resolved datasource settings used by runtime adapters and CLIs.
- ResolvedGeneratorConfig
- Resolved generator settings used by code generation commands.
- ResolvedRuntimeDatasourceConfig
- Datasource settings resolved from runtime metadata.
- ResolveResult
- Result of marking migration history manually.
- RollbackResult
- Result of rolling back relational migration state.
- RuntimeDatasourceResolver
- Resolves datasource configuration from runtime metadata bridges.
- RuntimeDatasourceUrlView
- Runtime view of a datasource URL.
- RuntimeDatasourceView
- Runtime datasource bridge.
- RuntimeEnumView
- Runtime enum bridge.
- RuntimeFieldDefaultView
- Runtime view of a field default.
- RuntimeFieldView
- Runtime field bridge.
- RuntimeImplicitManyToManyStorage
- Bridge-level implicit many-to-many storage description.
- RuntimeModelView
- Runtime model bridge.
- RuntimeRelationView
- Runtime relation view resolved from AST or generated metadata.
- RuntimeSchemaView
- Runtime schema bridge used by adapters and bootstrap helpers.
- 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.
- SqliteQuerySupport
- Shared helper methods for SQLite-family query assembly and value coercion.
- StringFilter
- String field predicates used in generated and manual query inputs.
- Token
- A single lexer token with source position.
- UpdateManyQuery
- Query object for bulk updates.
- UpdateQuery
- Query object for updating a single record.
- UpsertQuery
- Query object for atomically creating or updating a single record.
- ValidationIssue
- Validation issue emitted by the schema validator.
Enums
- DatabaseMiddlewareOperation
- Operation kinds that can be intercepted by DatabaseMiddleware.
- GeneratedDatasourceUrlKind
- Parser-independent URL source kinds for generated datasource metadata.
- GeneratedRuntimeDefaultKind
- Runtime default-value strategies relevant to adapters.
- GeneratedRuntimeFieldKind
- Runtime field categories used by generated metadata.
- GeneratedRuntimeRelationCardinality
- Cardinality of a generated relation from the source field point of view.
- GeneratedRuntimeRelationStorageKind
- Physical storage strategy for a generated relation.
- IncludeStrategy
- Strategy an adapter should use to resolve include relations.
- PlannedAction
- Describes the high-level operation an adapter should perform.
- QueryAggregateFunction
- Aggregate function names supported by the query engine.
- QueryRelationCardinality
- Cardinality of a relation from the source model point of view.
- QueryRelationStorageKind
- Physical storage strategy used by a relation.
- QueryStringMode
- Case-sensitivity mode for string filter predicates.
- RuntimeDatasourceUrlKind
- Bridge-level datasource URL kinds used by runtime metadata consumers.
- RuntimeDefaultKind
- Bridge-level default strategies relevant to runtime behavior.
- RuntimeFieldKind
- Bridge-level field categories used by runtime consumers.
- RuntimeRelationCardinality
- Bridge-level relation cardinality.
- RuntimeRelationStorageKind
- Bridge-level relation storage kind.
- SortOrder
-
Sort direction used in
orderByclauses. - SqliteClientHelperKind
- Controls which SQLite-specific generated convenience helper is emitted.
- 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
-
applyDistinctRecords(
Iterable< Map< records, Iterable<String, Object?> >String> fields) → List<Map< String, Object?> > -
Returns
recordswith duplicate rows removed according tofields. -
attributeToSource(
FieldAttribute attribute) → String - Converts a field attribute back into schema source.
-
buildAggregateInputIr(
SchemaDocument schema, ModelDefinition model) → CodeUnit -
Builds aggregate-input IR classes for
modelwithout rendering to a string. -
buildMigrationSqlScript(
PlannedMigration plan) → String -
Builds the canonical SQL script for a migration
plan. -
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. -
collectRuntimeImplicitManyToManyStorages(
RuntimeSchemaView schema) → List< RuntimeImplicitManyToManyStorage> - Collects all implicit many-to-many storages from a runtime schema view.
-
computeAggregateQueryResult(
Iterable< Map< records, AggregateQuery query) → AggregateQueryResultString, Object?> > -
Computes aggregate values for
recordsaccording toquery. -
computeGroupByQueryResultRows(
Iterable< Map< records, GroupByQuery query) → List<String, Object?> >GroupByQueryResultRow> -
Computes grouped rows for
recordsaccording toquery. -
computeMigrationChecksum(
{required String provider, required String beforeSchema, required String afterSchema, required String migrationSql, required List< String> warnings, required bool requiresRebuild}) → String - Computes the stable checksum stored with a migration artifact.
-
containsManualMigrationWarnings(
Iterable< String> warnings) → bool - Whether any warning indicates that the migration requires manual intervention.
-
decodeMigrationWarnings(
String? rawWarnings) → List< String> - Decodes warnings from either JSON or the legacy line-based format.
-
defaultMigrationsDirectory(
String schemaPath) → String - Returns the default migrations directory for a given schema path.
-
detectPotentialDataLossWarnings(
{required SchemaDocument from, required SchemaDocument to}) → List< String> - Returns human-readable warnings for schema transitions that may lose data.
-
discoverSchemaPath(
{String? explicitPath}) → String -
Discovers
schema.prismaor validates an explicit schema path. -
encodeMigrationWarnings(
List< String> warnings) → String - Serializes warning lines into the canonical metadata representation.
-
filterSchemaForUserModels(
SchemaDocument schema, {required String historyTableName}) → SchemaDocument -
Returns
schemawithout the provider history table model. -
findNearestPubspec(
Directory start) → File? -
Finds the nearest
pubspec.yamlwalking upwards fromstart. -
isImplicitManyToManyTableName(
String tableName) → bool -
Returns whether
tableNamebelongs to implicit relation storage. -
isManualMigrationWarning(
String warning) → bool -
Whether
warningindicates that the migration cannot be applied automatically. -
loadLocalMigrationArtifacts(
String directoryPath, {required String provider}) → List< LocalMigrationArtifact> - File-backed migration artifact loading is unavailable on web builds.
-
mergeMigrationWarnings(
List< String> warnings, List<String> riskWarnings) → List<String> - Returns the union of plan warnings and detected risk warnings.
-
metadataText(
{required String name, required DateTime generatedAt, required int statementCount, required int warningCount, required bool rebuildRequired, required String provider, required String checksum}) → String -
Builds the
metadata.txtpayload for a migration artifact directory. -
modelAttributeToSource(
ModelAttribute attribute) → String - Converts a model-level attribute back into schema source.
-
parseImplicitManyToManyTableName(
String tableName) → ParsedImplicitManyToManyTableName? - Parses an implicit relation table name produced by this package.
-
parseMetadataText(
String text) → Map< String, String> -
Parses
metadata.txtcontent into key-value pairs. -
pubspecReferencesPackage(
String source, String packageName) → bool -
Returns whether a pubspec references
packageName. -
resolveClientGeneratorOptions(
{required ResolvedGeneratorConfig generator, 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.
-
resolveRollbackTarget<
TRecord> ({required List< TRecord> activeHistory, required String? migrationName, required String migrationNameOf(TRecord record)}) → TRecord - Resolves which active migration should be rolled back.
-
resolveRuntimeImplicitManyToManyStorage(
{required RuntimeSchemaView schema, required String sourceModelName, required String relationFieldName}) → RuntimeImplicitManyToManyStorage? - Resolves the storage mapping for a runtime implicit many-to-many relation.
-
runtimeSchemaViewFromGeneratedSchema(
GeneratedRuntimeSchema schema) → RuntimeSchemaView -
Creates a runtime schema bridge over
schema. -
runtimeSchemaViewFromSchemaDocument(
SchemaDocument schema) → RuntimeSchemaView -
Creates a runtime schema bridge over
schema. -
schemaToSource(
SchemaDocument schema) → String -
Converts a schema AST back into
schema.prismasource text. -
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.
-
SqliteSqlClause
= ({List<
Object?> parameters, String sql}) - Lightweight SQL clause payload used by shared SQLite-family helper methods.
Exceptions / Errors
- ManualMigrationRequiredException
- Exception raised when a migration requires manual intervention.
- SchemaParseException
-
Error thrown when
schema.prismasource cannot be parsed. - SchemaValidationException
- Exception thrown when schema validation returns one or more issues.