import { Entity } from "./types/entity"; import { ApsorcRelationship, RelationshipMap } from "./types/relationship"; import { AuthConfig } from "./types/auth"; import { TargetLanguage } from "./types/generator"; export declare enum ApiType { Graphql = "graphql", Rest = "rest" } export type ApsorcType = { version: number; rootFolder: string; entities: Entity[]; apiType: ApiType; relationships: ApsorcRelationship[]; auth?: AuthConfig; language?: TargetLanguage; /** * Top-level default for the opt-in DomainEvent ("emitEvents") feature. * When true, every entity emits domain events unless it opts out with * its own `emitEvents: false`. */ emitEvents?: boolean; /** * Top-level default for HTTP controller generation. When false, no entity * gets a generated controller unless it opts back in with `http: true`. */ http?: boolean; /** * Opt-out for the Apso commit co-author hook. When false, the CLI will not * install the `prepare-commit-msg` hook that appends the Apso co-author * trailer. Defaults to enabled. */ coAuthor?: boolean; }; type ParsedApsorcData = { entities: Entity[]; relationshipMap: RelationshipMap; }; type ParsedApsorc = { rootFolder: string; apiType: string; entities: Entity[]; relationshipMap: RelationshipMap; auth?: AuthConfig; language?: TargetLanguage; /** Top-level default for the DomainEvent ("emitEvents") feature. */ emitEvents?: boolean; /** Top-level default for HTTP controller generation. */ http?: boolean; /** Opt-out for the Apso commit co-author hook (defaults to enabled). */ coAuthor?: boolean; }; export declare const parseApsorcV1: (apsorc: ApsorcType) => ParsedApsorcData; /** * A schema problem that would make `apso generate` emit code that does not * compile. `code` is the @apso/schema-tools rule id (FIELD_RELATIONSHIP_COLLISION, * DUPLICATE_FIELD_NAME, ...), the same codes the apso-client-v2 validator used. */ export declare class ApsorcNamingError extends Error { code: string; entity: string; field?: string | undefined; /** A problem in the user's .apsorc, not a CLI bug: PostHog only, never Sentry. */ readonly userError = true; constructor(message: string, code: string, entity: string, field?: string | undefined); } /** * Throws an ApsorcNamingError for the first @apso/schema-tools error, e.g. a * text field `notes` on Contact plus Note ManyToOne Contact, whose inverse * side is `notes: Note[]` on Contact (TS2300 Duplicate identifier). The client * schema builder runs the same rules, so a schema that passes there passes here. */ export declare const assertCodegenSafeNames: (apsorc: Pick) => void; /** * Drop indexes the database cannot create alongside another. TypeORM names an * index from its table and columns only, so a plain and a unique index on the * same columns get one name and the second CREATE fails, rolling back the * schema (prod svc 52: Warehouse.manager_email). The unique index also serves * lookups, so it is kept; exact duplicates are dropped too. * * @param {Entity} entity - An entity from .apsorc. * @returns {Entity} The entity, with a filtered copy of its indexes when needed. */ export declare const dedupeIndexes: (entity: Entity) => Entity; export declare const parseApsorcV2: (apsorc: ApsorcType) => ParsedApsorcData; export declare const parseApsorc: () => ParsedApsorc; /** * Finds the .apsorc configuration file path. * Searches upwards from the current working directory. * @returns The absolute path to the .apsorc file, or null if not found. */ /** Reads the .apsorc file itself (not rc-merged), for commands that rewrite it. */ export declare const readApsorcFile: () => { configPath: string; apsorc: ApsorcType; }; export declare const findConfigPath: () => string | null; export {};