MCPcopy Index your code
hub / github.com/simstudioai/sim / getFilterValues

Method getFilterValues

apps/sim/lib/logs/search-suggestions.ts:242–340  ·  view source on GitHub ↗

* Get filter values for a specific key

(key: string, partial = '')

Source from the content-addressed store, hash-verified

240 * Get filter values for a specific key
241 */
242 private getFilterValues(key: string, partial = ''): SuggestionGroup | null {
243 const filterDef = FILTER_DEFINITIONS.find((f) => f.key === key)
244
245 if (filterDef) {
246 const suggestions: Suggestion[] = filterDef.options
247 .filter(
248 (opt) =>
249 !partial ||
250 opt.value.toLowerCase().includes(partial.toLowerCase()) ||
251 opt.label.toLowerCase().includes(partial.toLowerCase())
252 )
253 .map((opt) => ({
254 id: `filter-value-${key}-${opt.value}`,
255 value: `${key}:${opt.value}`,
256 label: opt.label,
257 description: opt.description,
258 category: key as Suggestion['category'],
259 }))
260
261 // Handle custom date input
262 if (key === 'date' && partial) {
263 const dateSuggestions = this.getDateSuggestions(partial)
264 if (dateSuggestions.length > 0) {
265 suggestions.unshift(...dateSuggestions)
266 }
267 }
268
269 return suggestions.length > 0
270 ? {
271 type: 'filter-values',
272 filterKey: key,
273 suggestions,
274 }
275 : null
276 }
277
278 if (key === 'trigger') {
279 const allTriggers = this.getAllTriggers()
280 const suggestions = allTriggers
281 .filter((t) => !partial || t.label.toLowerCase().includes(partial.toLowerCase()))
282 .map((t) => ({
283 id: `filter-value-trigger-${t.value}`,
284 value: `trigger:${t.value}`,
285 label: t.label,
286 description: `${t.label}-triggered runs`,
287 category: 'trigger' as const,
288 color: t.color,
289 }))
290
291 return suggestions.length > 0
292 ? {
293 type: 'filter-values',
294 filterKey: 'trigger',
295 suggestions,
296 }
297 : null
298 }
299

Callers 1

getSuggestionsMethod · 0.95

Calls 3

getDateSuggestionsMethod · 0.95
getAllTriggersMethod · 0.95
unshiftMethod · 0.80

Tested by

no test coverage detected