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

Function buildSearchConditions

apps/sim/lib/logs/filters.ts:167–195  ·  view source on GitHub ↗
(params: {
  search?: string
  workflowName?: string
  folderName?: string
  executionId?: string
})

Source from the content-addressed store, hash-verified

165}
166
167function buildSearchConditions(params: {
168 search?: string
169 workflowName?: string
170 folderName?: string
171 executionId?: string
172}): SQL[] {
173 const conditions: SQL[] = []
174
175 if (params.search) {
176 const searchTerm = `%${params.search}%`
177 conditions.push(sql`${workflowExecutionLogs.executionId} ILIKE ${searchTerm}`)
178 }
179
180 if (params.workflowName) {
181 const nameTerm = `%${params.workflowName}%`
182 conditions.push(sql`${workflow.name} ILIKE ${nameTerm}`)
183 }
184
185 if (params.folderName) {
186 const folderTerm = `%${params.folderName}%`
187 conditions.push(sql`${workflow.name} ILIKE ${folderTerm}`)
188 }
189
190 if (params.executionId) {
191 conditions.push(eq(workflowExecutionLogs.executionId, params.executionId))
192 }
193
194 return conditions
195}
196
197function buildCostCondition(operator: ComparisonOperator, value: number): SQL {
198 // Indexed projection of the usage_log ledger (dollars); no live aggregation.

Callers 1

buildFilterConditionsFunction · 0.85

Calls 2

eqFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected