import { S as SchemaInfo, a as FieldInfo, b as ScorerResult, M as MapResult, D as Dtype } from '../file-CHhO3loF.cjs'; export { c as FieldMapping, F as FileProviderOptions, d as MapResultReport, V as VALID_DTYPES, e as clampScore, i as inferSchemaFromCsvText, f as inferSchemaFromJsonText, m as makeFieldInfo, g as makeSchemaInfo, h as makeScorerResult, j as mapResultToJson, k as mapResultToReport } from '../file-CHhO3loF.cjs'; import { DomainPack, DetectionResult } from 'goldencheck-types'; interface AssignmentPair { row: number; col: number; cost: number; } /** * Solve the rectangular linear sum assignment problem. * Returns one pair per min(rows, cols), minimizing total cost. */ declare function linearSumAssignment(costMatrix: number[][]): AssignmentPair[]; /** * Convenience: optimal assignment on a score matrix (higher = better), * matching Python infermap.assignment.optimal_assign. Filters by min_confidence * and rounds scores to 4 decimal places for parity with scipy output. */ interface ScoreAssignment { sourceIdx: number; targetIdx: number; score: number; } declare function optimalAssign(scoreMatrix: number[][], minConfidence?: number): ScoreAssignment[]; declare class DomainPackTarget { readonly pack: DomainPack; constructor(pack: DomainPack); toSchemaInfo(): SchemaInfo; } declare function isDomainPackTarget(x: unknown): x is DomainPackTarget; declare const DEFAULT_MIN_SCORE = 0.3; interface DetectInput { columns: string[]; } declare function detectDomain(input: DetectInput | { records?: ReadonlyArray>; }, candidates?: string[], minScore?: number): string | null; /** Auto-detect with full diagnostic info. See `DetectionResult` for the * shape. Callers like `goldenpipe`'s infer_schema stage use this to * distinguish "confident pick" from "tied" / "below threshold" / * "no data" and surface that to the InferredSchema's evidence map. */ declare function detectDomainDetailed(input: DetectInput | { records?: ReadonlyArray>; }, candidates?: string[], minScore?: number): DetectionResult; interface Scorer { readonly name: string; readonly weight: number; score(source: FieldInfo, target: FieldInfo): ScorerResult | null; } declare class ExactScorer implements Scorer { readonly name = "ExactScorer"; readonly weight = 1; score(source: FieldInfo, target: FieldInfo): ScorerResult; } /** Default alias dict, seeded from the shipped `generic` domain. */ declare const DEFAULT_ALIASES: Record; /** Build a reverse lookup: every alias (and canonical) -> canonical key. */ declare function buildLookup(aliases: Record): Map; interface AliasScorerOptions { /** Per-instance alias dict that REPLACES defaults. */ aliases?: Record; } declare class AliasScorer implements Scorer { readonly name = "AliasScorer"; readonly weight = 0.95; private readonly lookup; constructor(arg?: Record | AliasScorerOptions); private canonical; score(source: FieldInfo, target: FieldInfo): ScorerResult | null; } /** * Ordered registry — iteration order matches insertion order, so earlier * entries take precedence on ambiguous samples. Matches the Python dict order. */ declare const SEMANTIC_TYPES: Record; declare function classifyField(field: FieldInfo, threshold?: number): string | null; declare class PatternTypeScorer implements Scorer { readonly name = "PatternTypeScorer"; readonly weight = 0.7; score(source: FieldInfo, target: FieldInfo): ScorerResult | null; } /** * Profile comparison dimensions and weights: * dtype match 0.4 * null rate 0.2 * uniqueness rate 0.2 * value length 0.1 * cardinality ratio 0.1 */ declare class ProfileScorer implements Scorer { readonly name = "ProfileScorer"; readonly weight = 0.5; score(source: FieldInfo, target: FieldInfo): ScorerResult | null; } declare class FuzzyNameScorer implements Scorer { readonly name = "FuzzyNameScorer"; readonly weight = 0.4; score(source: FieldInfo, target: FieldInfo): ScorerResult; } type LLMAdapter = (prompt: string) => Promise; interface LLMScorerOptions { weight?: number; adapter?: LLMAdapter; } declare class LLMScorer implements Scorer { readonly name = "LLMScorer"; readonly weight: number; readonly adapter: LLMAdapter | undefined; constructor(options?: LLMScorerOptions); score(_source: FieldInfo, _target: FieldInfo): ScorerResult | null; } declare function defaultScorers(): Scorer[]; /** Build a Scorer from a plain function. Matches the Python `@scorer` decorator. */ declare function defineScorer(name: string, fn: (source: FieldInfo, target: FieldInfo) => ScorerResult | null, weight?: number): Scorer; declare function jaroSimilarity(s1: string, s2: string): number; declare function jaroWinklerSimilarity(s1: string, s2: string, prefixScale?: number): number; declare function levenshteinDistance(s1: string, s2: string): number; declare class InitialismScorer implements Scorer { readonly name = "InitialismScorer"; readonly weight = 0.75; score(source: FieldInfo, target: FieldInfo): ScorerResult | null; } interface CalibratorJSON { kind: string; [k: string]: unknown; } interface Calibrator { readonly kind: string; fit(scores: readonly number[], correct: readonly number[]): void; transform(scores: readonly number[]): number[]; toJSON(): CalibratorJSON; } declare class IdentityCalibrator implements Calibrator { readonly kind = "identity"; fit(_scores: readonly number[], _correct: readonly number[]): void; transform(scores: readonly number[]): number[]; toJSON(): CalibratorJSON; static fromJSON(_obj: CalibratorJSON): IdentityCalibrator; } declare class IsotonicCalibrator implements Calibrator { readonly kind = "isotonic"; private _x; private _y; constructor(x?: number[], y?: number[]); fit(scores: readonly number[], correct: readonly number[]): void; transform(scores: readonly number[]): number[]; toJSON(): CalibratorJSON; static fromJSON(obj: CalibratorJSON): IsotonicCalibrator; } declare class PlattCalibrator implements Calibrator { readonly kind = "platt"; private _a; private _b; get a(): number; get b(): number; constructor(a?: number, b?: number); fit(scores: readonly number[], correct: readonly number[]): void; transform(scores: readonly number[]): number[]; toJSON(): CalibratorJSON; static fromJSON(obj: CalibratorJSON): PlattCalibrator; } declare function loadCalibrator(obj: CalibratorJSON | string): Calibrator; declare function saveCalibrator(cal: Calibrator): CalibratorJSON; declare class UnknownDomainError extends Error { constructor(message: string); } declare function availableDomains(): string[]; declare function loadDomain(name: string): Record; declare function mergeDomains(names: readonly string[]): Record; declare const MIN_CONTRIBUTORS = 2; /** * Find a common delimiter-bounded affix across *names*, else "". * Mirrors Python engine._common_affix_tokens. */ declare function commonAffixTokens(names: readonly string[], atStart: boolean): string; /** Populate FieldInfo.canonicalName on each field. Mutates *fields*. */ declare function populateCanonicalNames(fields: FieldInfo[]): void; interface MapEngineOptions { minConfidence?: number; scorers?: Scorer[]; /** Logger callback invoked when a scorer throws. Defaults to console.warn. */ onScorerError?: (info: { scorer: string; source: string; target: string; error: unknown; }) => void; /** If true, attach the full MxN score matrix to MapResult.scoreMatrix. */ returnScoreMatrix?: boolean; /** * Optional post-assignment confidence calibrator. Applied AFTER * `optimalAssign` has picked mappings, so it never changes WHICH mappings * are chosen — only the confidence attached to each. min_confidence * filtering happens during assignment on raw scores; calibration is about * user-facing trust, not assignment behavior. */ calibrator?: Calibrator; /** * Domain dictionaries to load in addition to `generic`. When set, the * engine builds a per-instance AliasScorer whose alias dict merges * generic + requested domains, and swaps it into the default scorer list. */ domains?: readonly string[]; } interface MapSchemasOptions { /** Extra required target field names, merged with schema.requiredFields. */ required?: string[]; /** Schema-file alias source: merges its fields' metadata.aliases into target. */ schemaFile?: SchemaInfo; } declare class MapEngine { readonly minConfidence: number; readonly scorers: readonly Scorer[]; readonly returnScoreMatrix: boolean; readonly calibrator: Calibrator | undefined; readonly domains: readonly string[] | undefined; private readonly onScorerError; constructor(options?: MapEngineOptions); /** * Core mapping path: given two pre-extracted schemas, return a MapResult. * This is the edge-safe entry point — providers/extractors layer on top. */ mapSchemas(sourceSchema: SchemaInfo, targetSchema: SchemaInfo, opts?: MapSchemasOptions): MapResult; } interface CsvParseResult { headers: string[]; rows: Record[]; } declare function parseCsv(text: string): CsvParseResult; declare function isNullLike(value: unknown): boolean; declare function inferDtype(values: readonly unknown[]): Dtype; interface ProfileStats { nullRate: number; uniqueRate: number; valueCount: number; sampleValues: string[]; } declare function profileColumn(values: readonly unknown[], sampleSize?: number): ProfileStats; declare function profileFieldFromValues(name: string, values: readonly unknown[], sampleSize?: number): FieldInfo; interface InMemoryOptions { sourceName?: string; sampleSize?: number; /** * Optional column order. If omitted, keys are collected from the union of * the first 100 records in order of first appearance. Providing a fixed * order is recommended for deterministic field ordering across runs. */ columns?: string[]; } declare function inferSchemaFromRecords(records: readonly Record[], options?: InMemoryOptions): SchemaInfo; declare class InMemoryProvider { extract(records: readonly Record[], options?: InMemoryOptions): SchemaInfo; } interface SchemaFieldEntry { name: string; dtype?: string; aliases?: string[]; required?: boolean; } interface SchemaDefinition { fields: SchemaFieldEntry[]; } declare class SchemaParseError extends Error { constructor(message: string); } declare function parseSchemaDefinition(json: string | SchemaDefinition, sourceName?: string): SchemaInfo; interface ScorerOverride { enabled?: boolean; weight?: number; } interface EngineConfig { scorers?: Record; aliases?: Record; } declare class ConfigError extends Error { constructor(message: string); } /** Parse + validate engine config JSON. Returns a normalized EngineConfig. */ declare function loadEngineConfig(json: string | EngineConfig): EngineConfig; /** * Apply scorer overrides (enable/disable + reweight) to a scorer list. * Returns a new array; original is untouched. Disabled scorers are dropped. */ declare function applyScorerOverrides(scorers: readonly Scorer[], overrides: Record | undefined): Scorer[]; interface MapResultConfig { version: string; mappings: Array<{ source: string; target: string; confidence: number; }>; unmapped_source?: string[]; unmapped_target?: string[]; } /** * Reconstruct a MapResult from a saved config JSON. * The resulting MapResult has empty breakdowns and reasoning (not serialized). */ declare function fromConfig(json: string | MapResultConfig): MapResult; /** Serialize a MapResult to the saved-config JSON shape. */ declare function mapResultToConfigJson(result: MapResult): string; /** * Polymorphic input accepted by `map()`. * Edge-core knows nothing about filesystem paths or database URIs; * the Node wrapper (Step 15) layers those on top of this type. */ type MapInput = SchemaInfo | DomainPackTarget | { records: ReadonlyArray>; sourceName?: string; } | { csvText: string; sourceName?: string; } | { jsonText: string; sourceName?: string; } | { schemaDefinition: string | object; sourceName?: string; }; interface MapOptions extends MapSchemasOptions { engineOptions?: MapEngineOptions; /** * Engine config (JSON string or parsed object). Takes effect by rebuilding * the default scorer list with overrides + alias extensions applied. * Ignored if `engineOptions.scorers` is provided explicitly. */ config?: string | EngineConfig; sampleSize?: number; /** * When true, post-process so any mapping with confidence below the resolved * threshold has ``target=null`` (treated as ``unknown`` downstream). */ soft?: boolean; /** * Default threshold used when no per-type override is provided. */ defaultThreshold?: number; } /** Normalize any MapInput to a SchemaInfo. */ declare function toSchemaInfo(input: MapInput, sampleSize?: number): SchemaInfo; /** * Convenience wrapper: extracts schemas from both inputs and runs the engine. */ declare function map(source: MapInput, target: MapInput, options?: MapOptions): MapResult; export { AliasScorer, type AssignmentPair, type Calibrator, type CalibratorJSON, ConfigError, type CsvParseResult, DEFAULT_ALIASES, DEFAULT_MIN_SCORE, DomainPackTarget, Dtype, type EngineConfig, ExactScorer, FieldInfo, FuzzyNameScorer, IdentityCalibrator, type InMemoryOptions, InMemoryProvider, InitialismScorer, IsotonicCalibrator, type LLMAdapter, LLMScorer, type LLMScorerOptions, MIN_CONTRIBUTORS, MapEngine, type MapEngineOptions, type MapInput, type MapOptions, MapResult, type MapResultConfig, type MapSchemasOptions, PatternTypeScorer, PlattCalibrator, ProfileScorer, SEMANTIC_TYPES, SchemaInfo, SchemaParseError, type ScoreAssignment, type Scorer, type ScorerOverride, ScorerResult, UnknownDomainError, applyScorerOverrides, availableDomains, buildLookup, classifyField, commonAffixTokens, defaultScorers, defineScorer, detectDomain, detectDomainDetailed, fromConfig, inferDtype, inferSchemaFromRecords, isDomainPackTarget, isNullLike, jaroSimilarity, jaroWinklerSimilarity, levenshteinDistance, linearSumAssignment, loadCalibrator, loadDomain, loadEngineConfig, map, mapResultToConfigJson, mergeDomains, optimalAssign, parseCsv, parseSchemaDefinition, populateCanonicalNames, profileColumn, profileFieldFromValues, saveCalibrator, toSchemaInfo };