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

Function applyFilterParams

apps/sim/hooks/queries/logs.ts:67–105  ·  view source on GitHub ↗
(
  params: URLSearchParams,
  filters: Omit<LogFilters, 'limit' | 'sortBy' | 'sortOrder'>
)

Source from the content-addressed store, hash-verified

65}
66
67function applyFilterParams(
68 params: URLSearchParams,
69 filters: Omit<LogFilters, 'limit' | 'sortBy' | 'sortOrder'>
70): void {
71 if (filters.level !== 'all') {
72 params.set('level', filters.level)
73 }
74
75 if (filters.triggers.length > 0) {
76 params.set('triggers', filters.triggers.join(','))
77 }
78
79 if (filters.workflowIds.length > 0) {
80 params.set('workflowIds', filters.workflowIds.join(','))
81 }
82
83 if (filters.folderIds.length > 0) {
84 params.set('folderIds', filters.folderIds.join(','))
85 }
86
87 const startDate = getStartDateFromTimeRange(filters.timeRange, filters.startDate)
88 if (startDate) {
89 params.set('startDate', startDate.toISOString())
90 }
91
92 const endDate = getEndDateFromTimeRange(filters.timeRange, filters.endDate)
93 if (endDate) {
94 params.set('endDate', endDate.toISOString())
95 }
96
97 if (filters.searchQuery.trim()) {
98 const parsedQuery = parseQuery(filters.searchQuery.trim())
99 const searchParams = queryToApiParams(parsedQuery)
100
101 for (const [key, value] of Object.entries(searchParams)) {
102 params.set(key, value)
103 }
104 }
105}
106
107function buildListQuery(workspaceId: string, filters: LogFilters, cursor: string | null) {
108 const params = new URLSearchParams()

Callers 2

buildListQueryFunction · 0.85
fetchDashboardStatsFunction · 0.85

Calls 6

getEndDateFromTimeRangeFunction · 0.90
parseQueryFunction · 0.90
queryToApiParamsFunction · 0.90
joinMethod · 0.80
setMethod · 0.65

Tested by

no test coverage detected