/**
 * Registry utilities for filtering and grouping ContractSpec items.
 * Provides shared logic used across all registry types.
 */
import type { Stability } from './ownership';
/**
 * Filter criteria for registry items.
 * All criteria are optional and combined with AND logic.
 */
export interface RegistryFilter {
    /** Filter by tags (item must have at least one matching tag) */
    tags?: string[];
    /** Filter by owners (item must have at least one matching owner) */
    owners?: string[];
    /** Filter by stability levels */
    stability?: Stability[];
    /** Filter by domain (first segment of name) */
    domain?: string;
    /** Filter by key pattern (glob or regex) */
    keyPattern?: string;
}
/**
 * Item with standard metadata for filtering.
 */
export interface FilterableItem {
    meta: {
        key?: string;
        tags?: string[];
        owners?: string[];
        stability?: Stability;
        domain?: string;
    };
}
/**
 * Grouping key function type.
 */
export type GroupKeyFn<T> = (item: T) => string;
/**
 * Grouped items result.
 */
export interface GroupedItems<T> {
    key: string;
    items: T[];
}
/**
 * Pre-built grouping strategies for common use cases.
 */
export declare const GroupingStrategies: {
    /**
     * Group by first tag.
     */
    byTag: <T extends FilterableItem>(item: T) => string;
    /**
     * Group by all tags (item appears in multiple groups).
     */
    byAllTags: <T extends FilterableItem>(item: T) => string[];
    /**
     * Group by first owner.
     */
    byOwner: <T extends FilterableItem>(item: T) => string;
    /**
     * Group by domain (first segment of name).
     */
    byDomain: <T extends FilterableItem>(item: T) => string;
    /**
     * Group by stability level.
     */
    byStability: <T extends FilterableItem>(item: T) => string;
    /**
     * Create URL path grouping strategy with configurable depth.
     */
    byUrlPath: (level: number) => (item: {
        path?: string;
    }) => string;
};
/**
 * Filter items by criteria.
 * All criteria are combined with AND logic.
 */
export declare function filterBy<T extends FilterableItem>(items: T[], filter: RegistryFilter): T[];
/**
 * Group items by key function.
 */
export declare function groupBy<T>(items: T[], keyFn: GroupKeyFn<T>): Map<string, T[]>;
/**
 * Group items by key function, returning array format.
 */
export declare function groupByToArray<T>(items: T[], keyFn: GroupKeyFn<T>): GroupedItems<T>[];
/**
 * Group items where one item can belong to multiple groups.
 * Useful for byAllTags grouping.
 */
export declare function groupByMultiple<T>(items: T[], keysFn: (item: T) => string[]): Map<string, T[]>;
/**
 * Get unique tags from a collection of items.
 */
export declare function getUniqueTags<T extends FilterableItem>(items: T[]): string[];
/**
 * Get unique owners from a collection of items.
 */
export declare function getUniqueOwners<T extends FilterableItem>(items: T[]): string[];
/**
 * Get unique domains from a collection of items.
 */
export declare function getUniqueDomains<T extends FilterableItem>(items: T[]): string[];
