MCPcopy Create free account
hub / github.com/Effect-TS/effect / inline

Function inline

packages/effect/src/ui/Query.ts:4505–4526  ·  view source on GitHub ↗
(component: unknown, encoded: unknown)

Source from the content-addressed store, hash-verified

4503 }
4504
4505 const inline = (component: unknown, encoded: unknown): unknown => {
4506 const bound = queryCore.boundOf(
4507 component as { readonly "~queries": unknown }
4508 )
4509 const queries = (encoded as { readonly queries?: unknown } | null)?.queries
4510 if (
4511 bound === undefined || typeof queries !== "object" || queries === null
4512 ) {
4513 return encoded
4514 }
4515 const out: Record<string, unknown> = { ...queries }
4516 for (const entry of bound.entries) {
4517 const def = defOf(entry.query)
4518 const field = out[entry.name]
4519 out[entry.name] = !entry.keyed
4520 ? inlineTuple(def, field)
4521 : Array.isArray(field)
4522 ? field.map((tuple) => inlineTuple(def, tuple))
4523 : field
4524 }
4525 return { ...(encoded as object), queries: out }
4526 }
4527
4528 return { lookup, decodeRaw, inline, cancelPending }
4529}

Callers

nothing calls this directly

Calls 3

defOfFunction · 0.85
inlineTupleFunction · 0.85
mapMethod · 0.45

Tested by

no test coverage detected