/** * Schema Conversion Utilities * * Converts between local .apsorc format and platform ServiceSchema format. */ import { Entity } from "../types/entity"; import { RelationshipMap } from "../types/relationship"; import { ServiceSchema } from "../api/types"; /** * Parsed .apsorc data shape (subset of ParsedApsorc from apsorc-parser.ts) */ export interface ParsedApsorcInput { rootFolder: string; apiType: string; entities: Entity[]; relationshipMap: RelationshipMap; } /** * Shape returned by serviceSchemaToApsorc for writing back to .apsorc */ export interface ApsorcOutput { version: number; rootFolder: string; apiType: string; entities: ApsorcEntityOutput[]; relationships: ApsorcRelationshipOutput[]; } export interface ApsorcEntityOutput { name: string; primaryKeyType?: "serial" | "uuid"; created_at?: boolean; updated_at?: boolean; fields?: ApsorcFieldOutput[]; scopeBy?: string | string[]; } export interface ApsorcFieldOutput { name: string; type: string; nullable?: boolean; unique?: boolean; default?: unknown; index?: boolean; } export interface ApsorcRelationshipOutput { from: string; to: string; type: "OneToMany" | "ManyToOne" | "ManyToMany" | "OneToOne"; to_name?: string; nullable?: boolean; bi_directional?: boolean; cascadeDelete?: boolean; } /** * Convert parsed .apsorc data to platform ServiceSchema format. * * The local .apsorc stores relationships as a flat RelationshipMap keyed by entity name. * The platform ServiceSchema stores relationships embedded per-entity. */ export declare function apsorcToServiceSchema(parsed: ParsedApsorcInput): Omit; /** * Convert platform ServiceSchema to .apsorc format for writing to disk. * * Reverses the conversion: flattens per-entity relationships back into a * top-level relationships array in v2 format. */ export declare function serviceSchemaToApsorc(schema: ServiceSchema): ApsorcOutput; /** * Compute a SHA-256 hash of a schema for sync tracking. * Uses deterministic JSON serialization (recursively sorted keys). */ export declare function computeSchemaHash(schema: unknown): string;