MCPcopy Index your code
hub / github.com/Effect-TS/effect / process

Function process

packages/platform/src/HttpApi.ts:358–389  ·  view source on GitHub ↗
(type: AST.AST)

Source from the content-addressed store, hash-verified

356}> => {
357 const members = new Map(inherited)
358 function process(type: AST.AST) {
359 if (AST.isNeverKeyword(type)) {
360 return
361 }
362 const annotations = HttpApiSchema.extractAnnotations(ast.annotations)
363 // Avoid changing the reference unless necessary
364 // Otherwise, deduplication of the ASTs below will not be possible
365 if (!Record.isEmptyRecord(annotations)) {
366 type = AST.annotations(type, {
367 ...annotations,
368 ...type.annotations
369 })
370 }
371 const status = getStatus(type)
372 const emptyDecodeable = HttpApiSchema.getEmptyDecodeable(type)
373 const current = members.get(status)
374 members.set(
375 status,
376 {
377 description: (current ? current.description : Option.none()).pipe(
378 Option.orElse(() => getDescriptionOrIdentifier(type))
379 ),
380 ast: (current ? current.ast : Option.none()).pipe(
381 // Deduplicate the ASTs
382 Option.map((current) => HttpApiSchema.UnionUnifyAST(current, type)),
383 Option.orElse(() =>
384 !emptyDecodeable && AST.isVoidKeyword(AST.encodedAST(type)) ? Option.none() : Option.some(type)
385 )
386 )
387 }
388 )
389 }
390
391 HttpApiSchema.extractUnionTypes(ast).forEach(process)
392 return members

Callers 2

extractPayloadsFunction · 0.70
workerRunner.tsFile · 0.50

Calls 8

getStatusFunction · 0.85
annotationsMethod · 0.65
getMethod · 0.65
setMethod · 0.65
pipeMethod · 0.65
mapMethod · 0.65
makeMethod · 0.65

Tested by

no test coverage detected