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

Function filterNamesToIds

apps/sim/lib/table/column-keys.ts:155–165  ·  view source on GitHub ↗
(filter: Filter, idByName: ReadonlyMap<string, string>)

Source from the content-addressed store, hash-verified

153 * at the name-translating boundaries before handing a filter to the query layer.
154 */
155export function filterNamesToIds(filter: Filter, idByName: ReadonlyMap<string, string>): Filter {
156 const out: Filter = {}
157 for (const [key, value] of Object.entries(filter)) {
158 if ((key === '$or' || key === '$and') && Array.isArray(value)) {
159 out[key] = (value as Filter[]).map((f) => filterNamesToIds(f, idByName))
160 } else {
161 out[idByName.get(key) ?? key] = value
162 }
163 }
164 return out
165}
166
167/** Translates a sort's field names → column ids. Unknown fields pass through. */
168export function sortNamesToIds(sort: Sort, idByName: ReadonlyMap<string, string>): Sort {

Callers 4

executeFunction · 0.90
rowWireTranslatorsFunction · 0.90
route.tsFile · 0.90

Calls 1

getMethod · 0.65

Tested by

no test coverage detected