import type { MetaData } from "@metaobjectsdev/metadata"; import type { PersistenceDriver, Row } from "./persistence-driver.js"; import { type Filter, type QueryOpts } from "./query-builder.js"; import { type ColumnNamingStrategy } from "@metaobjectsdev/metadata"; import { type FieldViewSpec, type EntityViewSpec } from "./view.js"; import type { ValidationResult } from "./validator-runner.js"; export interface ObjectManagerOptions { metadata: MetaData; driver: PersistenceDriver; /** * Column-naming strategy for fields with no `@column` override. Defaults to * `"snake_case"`. Must agree with the codegen / migration config that * created the schema (a mismatch yields columns the runtime can't address). */ columnNamingStrategy?: ColumnNamingStrategy; } export interface ReadOpts extends QueryOpts { view?: string; include?: string[]; tx?: PersistenceDriver; } export interface WriteOpts { view?: string; tx?: PersistenceDriver; ifMissing?: "throw" | "ignore"; } export declare class ObjectManager { private readonly metadata; private readonly driver; private readonly columnNamingStrategy; private readonly nameMapCache; constructor(opts: ObjectManagerOptions); private nameMap; /** TPH discriminator scope for a subtype entity, or undefined for non-TPH. */ private tphScope; /** AND the TPH discriminator predicate into a filter (subtype-scoped reads). */ private scopeFilter; /** * Coerce a raw string id (typically an HTTP path param) to the PK field's * DECLARED type: a numeric-subtype pk gets Number(); a string/uuid pk keeps * the string EXACTLY — '0123' and '123' are different keys, and Number()-ing * them conflates the two (SQLite affinity then matches the WRONG row). * Non-string ids and composite-pk entities pass through untouched. */ private coerceIdArg; findById(entityName: string, id: unknown, opts?: ReadOpts): Promise; findFirst(entityName: string, filter: Filter, opts?: ReadOpts): Promise; findMany(entityName: string, filter?: Filter, opts?: ReadOpts): Promise; count(entityName: string, filter?: Filter, opts?: Pick): Promise; load(refString: string): Promise; refOf(entityName: string, record: Row): string; create(entityName: string, data: Row, opts?: WriteOpts): Promise; update(entityName: string, id: unknown, data: Row, opts?: WriteOpts): Promise; delete(entityName: string, id: unknown, opts?: WriteOpts): Promise; createMany(entityName: string, dataArray: Row[], opts?: WriteOpts): Promise; updateMany(entityName: string, filter: Filter, partial: Row, opts?: WriteOpts): Promise; deleteMany(entityName: string, filter: Filter, opts?: WriteOpts): Promise; transaction(fn: (txOm: ObjectManager) => Promise): Promise; relate(entityName: string, record: Row, relationName: string, opts?: ReadOpts): Promise; viewFields(entityName: string, viewName: string): string[]; fieldView(entityName: string, fieldName: string, viewName: string): FieldViewSpec | null; entityView(entityName: string, viewName: string): EntityViewSpec; validate(entityName: string, data: Row): ValidationResult; private attachIncludes; private toDbRow; private allDbColumns; private applyViewRestriction; private requireEntity; private toJsRow; } //# sourceMappingURL=object-manager.d.ts.map