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

Function resolveFilterFieldLabel

apps/sim/lib/workflows/subblocks/display.ts:329–346  ·  view source on GitHub ↗
(
  subBlock: SubBlockConfig | undefined,
  rawValue: unknown
)

Source from the content-addressed store, hash-verified

327 * to apply monospace styling.
328 */
329export function resolveFilterFieldLabel(
330 subBlock: SubBlockConfig | undefined,
331 rawValue: unknown
332): string | null {
333 const isFilterField =
334 subBlock?.id === 'filter' || subBlock?.id === 'filterCriteria' || subBlock?.id === 'sort'
335 if (!isFilterField || !rawValue) return null
336
337 const parsedValue = tryParseJson(rawValue)
338 if (!isRecordLike(parsedValue) && !Array.isArray(parsedValue)) return null
339
340 try {
341 const jsonStr = JSON.stringify(parsedValue, null, 0)
342 return jsonStr.length <= 35 ? jsonStr : truncate(jsonStr, 32)
343 } catch {
344 return null
345 }
346}
347
348/**
349 * Resolves a static dropdown/combobox value to its option label.

Callers 2

display.test.tsFile · 0.90
workflow-block.tsxFile · 0.90

Calls 3

isRecordLikeFunction · 0.90
truncateFunction · 0.90
tryParseJsonFunction · 0.70

Tested by

no test coverage detected