(
identifiers: Array<{ type: string; value: string }>
)
| 691 | // ═══════════════════════════════════════════════════════════════════════════ |
| 692 | |
| 693 | async batchLookupIdentifiers( |
| 694 | identifiers: Array<{ type: string; value: string }> |
| 695 | ): Promise<Map<string, { property_rid: string; classification: string; source: string } | null>> { |
| 696 | if (identifiers.length === 0) return new Map(); |
| 697 | |
| 698 | const types = identifiers.map(i => i.type); |
| 699 | const values = identifiers.map(i => i.value); |
| 700 | |
| 701 | const result = await query<{ |
| 702 | identifier_type: string; |
| 703 | identifier_value: string; |
| 704 | property_rid: string; |
| 705 | classification: string; |
| 706 | source: string; |
| 707 | }>( |
| 708 | `SELECT ci.identifier_type, ci.identifier_value, ci.property_rid, cp.classification, cp.source |
| 709 | FROM catalog_identifiers ci |
| 710 | JOIN catalog_properties cp ON cp.property_rid = ci.property_rid |
| 711 | WHERE ci.disputed = FALSE |
| 712 | AND (ci.identifier_type, ci.identifier_value) IN ( |
| 713 | SELECT unnest($1::text[]), unnest($2::text[]) |
| 714 | )`, |
| 715 | [types, values] |
| 716 | ); |
| 717 | |
| 718 | const map = new Map<string, { property_rid: string; classification: string; source: string } | null>(); |
| 719 | for (const row of result.rows) { |
| 720 | map.set(`${row.identifier_type}:${row.identifier_value}`, { |
| 721 | property_rid: row.property_rid, |
| 722 | classification: row.classification, |
| 723 | source: row.source, |
| 724 | }); |
| 725 | } |
| 726 | return map; |
| 727 | } |
| 728 | |
| 729 | private async batchResolveAliases(rids: string[]): Promise<Map<string, string>> { |
| 730 | if (rids.length === 0) return new Map(); |
no test coverage detected