( connectorType: string, metadata: Record<string, unknown>, sourceConfig?: Record<string, unknown> )
| 242 | * tagSlotMapping stored in sourceConfig during connector creation. |
| 243 | */ |
| 244 | export function resolveTagMapping( |
| 245 | connectorType: string, |
| 246 | metadata: Record<string, unknown>, |
| 247 | sourceConfig?: Record<string, unknown> |
| 248 | ): Partial<DocumentTags> | undefined { |
| 249 | const config = CONNECTOR_REGISTRY[connectorType] |
| 250 | if (!config?.mapTags || !metadata) return undefined |
| 251 | |
| 252 | const semanticTags = config.mapTags(metadata) |
| 253 | const mapping = sourceConfig?.tagSlotMapping as Record<string, string> | undefined |
| 254 | if (!mapping || !semanticTags) return undefined |
| 255 | |
| 256 | const result: Partial<DocumentTags> = {} |
| 257 | for (const [semanticKey, slot] of Object.entries(mapping)) { |
| 258 | const value = semanticTags[semanticKey] |
| 259 | ;(result as Record<string, unknown>)[slot] = value != null ? value : null |
| 260 | } |
| 261 | return result |
| 262 | } |
| 263 | |
| 264 | /** |
| 265 | * Dispatch a connector sync using the configured background execution backend. |
no outgoing calls
no test coverage detected