import type { Maybe } from '@takeshape/util';
import type { ProjectSchemaJSON, PropertySchema, ShapeJSON, ShapeMap } from './project-schema/index.ts';
import type { LegacyRelationship, PropertySchemaWithRelationship, Relationship, RelationshipEnv, ShapeRefs } from './types/index.ts';
/**
 * Turn a LegacyRelationship into a partial PropertySchemaWithRelationship.
 */
export declare function getRelationshipSchema(projectSchema: ProjectSchemaJSON, relationship: LegacyRelationship | Relationship): PropertySchemaWithRelationship;
/**
 * Get a list of refs given a property schema with a relationship resolver.
 */
export declare function getRelationshipShapeRefs(propertySchema: PropertySchemaWithRelationship): ShapeRefs;
/**
 * Get a list of shapes given a property schema with a relationship resolver.
 */
export declare function getRelationshipShapes(shapes: ShapeMap, refs: ShapeRefs): ShapeJSON[];
/**
 * Get a list of shape ids given a property schema with a relationship resolver.
 */
export declare function getRelationshipShapeIds(shapes: ShapeMap, refs: ShapeRefs): string[];
/**
 * Turn a Relationship into a LegacyRelationship object.
 */
export declare function getLegacyRelationship(projectSchema: ProjectSchemaJSON, relationship: Relationship): LegacyRelationship;
/**
 * Get relationship details from a PropertySchema.
 */
export declare function getRelationship(propertySchema: PropertySchema): Maybe<Relationship>;
export declare function findExistingRelationships(projectSchema: ProjectSchemaJSON, shapes: ShapeMap): Record<string, RelationshipEnv[]>;
/**
 * Test whether two PropertySchemas have equal relationships
 */
export declare function isEqualRelationship(a: PropertySchema, b: PropertySchema): boolean;
/**
 * Test whether an array of PropertySchemas have unequal relationships
 */
export declare function hasUnequalRelationships(relationships: PropertySchema[]): boolean;
/**
 * Adds backreference fields to the schema.
 */
export declare function addRelatedFields(projectSchema: ProjectSchemaJSON, allRelationships: Record<string, RelationshipEnv[]>): ProjectSchemaJSON;
