MCPcopy
hub / github.com/simstudioai/sim / resolveTagMapping

Function resolveTagMapping

apps/sim/lib/knowledge/connectors/sync-engine.ts:244–262  ·  view source on GitHub ↗
(
  connectorType: string,
  metadata: Record<string, unknown>,
  sourceConfig?: Record<string, unknown>
)

Source from the content-addressed store, hash-verified

242 * tagSlotMapping stored in sourceConfig during connector creation.
243 */
244export 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.

Callers 4

buildSkippedDocumentRowFunction · 0.85
addDocumentFunction · 0.85
updateDocumentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected