import { F as FileProviderOptions, S as SchemaInfo, D as Dtype, M as MapResult } from '../file-CHhO3loF.cjs'; declare function extractSchemaFromFile(path: string, options?: FileProviderOptions): Promise; interface DbExtractOptions { table: string; sampleSize?: number; } /** Extract a SchemaInfo from a database table by URI + table name. */ declare function extractDbSchema(uri: string, options: DbExtractOptions): Promise; declare function sqliteTypeToInfermap(sqliteType: string | null | undefined): Dtype; declare function pgTypeToInfermap(pgType: string | null | undefined): Dtype; declare function duckdbTypeToInfermap(duckdbType: string | null | undefined): Dtype; type DbDriver = "sqlite" | "postgresql" | "mysql" | "duckdb"; interface SqliteConnInfo { driver: "sqlite"; path: string; } interface DuckdbConnInfo { driver: "duckdb"; path: string; } interface PgConnInfo { driver: "postgresql"; host: string | null; port: number; user: string | null; password: string | null; database: string; } interface MysqlConnInfo { driver: "mysql"; host: string | null; port: number; user: string | null; password: string | null; database: string; } type ConnInfo = SqliteConnInfo | DuckdbConnInfo | PgConnInfo | MysqlConnInfo; declare class DbError extends Error { constructor(message: string); } /** * Parse a database URI into normalized ConnInfo. * Supported schemes: sqlite, postgresql/postgres, mysql, duckdb. */ declare function parseConnection(uri: string): ConnInfo; /** * InferMap -> Identity Graph bridge (node-only). * * Helper that writes InferMap's schema-mapping output into the GoldenMatch * Identity Graph as `IdentityAlias` rows. When InferMap discovers that * `crm.cust_id` maps to `customer_id` (the canonical entity-id field on the * target schema), each source record's `crm.cust_id` value becomes an alias * that resolves to that record's identity. * * This is **per-record** alias writing -- InferMap tells us *which column * holds the id of this kind*, we record one row per (record, alias-kind). * Schema-level "this column maps to that column" aliasing without a record * context is intentionally **not** modeled -- the alias table is keyed on the * alias *value*, not the column name. * * Node-only: callers pass a goldenmatch Identity Graph `IdentityStore`. The * edge-safe core never imports this module. To keep the published package free * of a goldenmatch runtime dependency, the store/alias shapes are modelled by * the local {@link AliasStore} / {@link IdentityAliasRow} structural * interfaces; a real goldenmatch `IdentityStore` satisfies `AliasStore`. * * TS parity with `packages/python/infermap/infermap/identity.py`. The Python * sibling lazily imports `goldenmatch.identity`; here the caller supplies the * store, so there is no import to fail. `store.addAlias` may be async, so this * function is async too and the `entityIdResolver` may return a value or a * Promise. * * See issue #206 for the design discussion. */ /** * Minimal structural shape of a goldenmatch `IdentityAlias` row. Declared * locally so the *published* infermap package takes no dependency on * goldenmatch — callers pass a real goldenmatch `IdentityStore`, which is * structurally compatible. (The integration test exercises the real store * via a dev-only dependency.) */ interface IdentityAliasRow { alias: string; entityId: string; kind: string; dataset?: string | null; recordedAt?: Date; } /** * Minimal structural shape of a goldenmatch `IdentityStore`. Only `addAlias` * is used by this bridge; a real `IdentityStore` satisfies it. */ interface AliasStore { addAlias(alias: IdentityAliasRow): unknown | Promise; } /** Summary of one `writeAliasesFromMapping` invocation. */ interface AliasWriteResult { aliasesWritten: number; recordsProcessed: number; mappingsUsed: number; skippedLowConfidence: number; skippedNoValue: number; skippedNoEntity: number; skippedNoKind: number; } /** Serialize an AliasWriteResult to the Python `as_dict()` snake_case shape. */ declare function aliasWriteResultAsDict(r: AliasWriteResult): Record; /** * Target field names that count as alias-kinds by default. Mirrors the Python * `alias_kinds` default. Pass an extended set when your target schema has * domain-specific ids (e.g. `"npi"` for healthcare). */ declare const DEFAULT_ALIAS_KINDS: ReadonlySet; /** Default minimum confidence -- matches InferMap's "strong match" threshold. */ declare const DEFAULT_MIN_CONFIDENCE = 0.85; type EntityIdResolver = (record: Record) => string | null | undefined | Promise; interface WriteAliasesOptions { /** Source name (e.g. `"crm"`). Namespaces the alias value (`source:value`). */ sourceName: string; /** * Target field names that count as alias-kinds. Defaults to * {@link DEFAULT_ALIAS_KINDS}. */ aliasKinds?: ReadonlySet | Iterable; /** Drop any mapping below this confidence. Defaults to 0.85. */ minConfidence?: number; /** Optional dataset name flowed onto each `IdentityAlias` row. */ dataset?: string | null; /** * Logger invoked when a single `addAlias` call throws. Defaults to * `console.warn`. A bad row never aborts the batch (identity is additive). */ onError?: (info: { alias: string; kind: string; entityId: string; error: unknown; }) => void; } /** * Write `IdentityAlias` rows for each record where InferMap mapped a source * column to a known alias-kind target column. * * @param mapping InferMap's `MapResult` (e.g. from `map(source, target)`). * @param records Iterable of source records (dicts keyed by source field name). * @param store A goldenmatch `IdentityStore` instance. * @param entityIdResolver `record -> entityId | null` (may be async). Returning * null/undefined skips alias writing for that row. * @param options See {@link WriteAliasesOptions}; `sourceName` is required. */ declare function writeAliasesFromMapping(mapping: MapResult, records: Iterable>, store: AliasStore, entityIdResolver: EntityIdResolver, options: WriteAliasesOptions): Promise; export { type AliasWriteResult, type ConnInfo, DEFAULT_ALIAS_KINDS, DEFAULT_MIN_CONFIDENCE, type DbDriver, DbError, type DbExtractOptions, type DuckdbConnInfo, type EntityIdResolver, type MysqlConnInfo, type PgConnInfo, type SqliteConnInfo, type WriteAliasesOptions, aliasWriteResultAsDict, duckdbTypeToInfermap, extractDbSchema, extractSchemaFromFile, parseConnection, pgTypeToInfermap, sqliteTypeToInfermap, writeAliasesFromMapping };