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

Function applyNode

packages/effect/src/internal/schema/toCodeDocument.ts:356–372  ·  view source on GitHub ↗
(
    base: SchemaRepresentation.Code,
    representation: Exclude<SchemaRepresentation.Representation, SchemaRepresentation.Reference>,
    path: Path,
    includeTypeBrands: boolean = true
  )

Source from the content-addressed store, hash-verified

354 }
355
356 function applyNode(
357 base: SchemaRepresentation.Code,
358 representation: Exclude<SchemaRepresentation.Representation, SchemaRepresentation.Reference>,
359 path: Path,
360 includeTypeBrands: boolean = true
361 ): SchemaRepresentation.Code {
362 const nodeBrands = InternalAnnotations.collectBrands(representation.annotations)
363 let runtime = base.runtime + runtimeAnnotate(representation.annotations) + runtimeBrands(nodeBrands)
364 let Type = base.Type + (includeTypeBrands ? typeBrands(nodeBrands) : "")
365 for (let index = 0; index < representation.checks.length; index++) {
366 const check = representation.checks[index]
367 const brands = checkBrands(check)
368 runtime += `.check(${compileCheck(check, [...path, "checks", index])})${runtimeBrands(brands)}`
369 if (includeTypeBrands) Type += typeBrands(brands)
370 }
371 return makeCode(runtime, Type)
372 }
373
374 function recur(
375 representation: SchemaRepresentation.Representation,

Callers 1

recurFunction · 0.85

Calls 6

runtimeAnnotateFunction · 0.85
runtimeBrandsFunction · 0.85
typeBrandsFunction · 0.85
checkBrandsFunction · 0.85
makeCodeFunction · 0.85
compileCheckFunction · 0.70

Tested by

no test coverage detected