/** * Relationship Resolver * * Resolves JSON relationship definitions to frontend representations * including form fields, imports, and service methods. */ import { JsonRelationshipDefinition } from "../types/json-schema.interface"; import { FrontendRelationship, RelationshipServiceMethod } from "../types/template-data.interface"; /** * Foundation package constants for web imports * Components (selectors) come from /components * Data (interfaces, services) come from /core */ export declare const FOUNDATION_COMPONENTS_PACKAGE = "@carlonicora/nextjs-jsonapi/components"; export declare const FOUNDATION_CORE_PACKAGE = "@carlonicora/nextjs-jsonapi/core"; /** * Check if a directory represents a foundation import (from the package) * * @param directory - The directory string from relationship definition * @returns True if this should import from the foundation package */ export declare function isFoundationImport(directory: string): boolean; /** * Resolve a JSON relationship to frontend representation * * @param rel - JSON relationship definition * @returns Frontend relationship representation */ export declare function resolveRelationship(rel: JsonRelationshipDefinition, targetHasNameMap?: Map): FrontendRelationship; /** * Resolve all relationships from JSON schema * * @param relationships - Array of JSON relationship definitions * @returns Array of frontend relationship representations */ export declare function resolveRelationships(relationships: JsonRelationshipDefinition[], targetHasNameMap?: Map): FrontendRelationship[]; /** * Map directory value to web path * Strips the leading "features/" or "foundations/" prefix since @/features/ already includes it * * @param directory - Directory value from JSON (e.g., "features/expertise") * @returns Web path segment without the base prefix (e.g., "expertise") */ export declare function mapDirectoryToWebPath(directory: string): string; /** * Generate service method definitions for relationships * * @param relationships - Array of frontend relationships * @returns Array of service method definitions */ export declare function generateServiceMethods(relationships: FrontendRelationship[], conflictingAliases?: Set): RelationshipServiceMethod[]; /** * Get unique selector imports needed for the editor * * @param relationships - Array of frontend relationships * @returns Deduplicated array of import statements */ export declare function getSelectorImports(relationships: FrontendRelationship[]): string[]; /** * Get form JSX for a relationship field * * @param rel - Frontend relationship * @param moduleName - Module name for i18n keys * @returns JSX code for the relationship selector */ export declare function getRelationshipFormJsx(rel: FrontendRelationship, moduleName: string): string; /** * Get default value expression for a relationship in form * * @param rel - Frontend relationship * @param modelVarName - Variable name for the model (e.g., "article") * @returns Expression for default value */ export declare function getDefaultValueExpression(rel: FrontendRelationship, modelVarName: string): string; /** * Get payload mapping for a relationship * * @param rel - Frontend relationship * @returns Payload field assignment code */ export declare function getPayloadMapping(rel: FrontendRelationship): string; //# sourceMappingURL=relationship-resolver.d.ts.map