MCPcopy Index your code
hub / github.com/massCodeIO/massCode / getFolderId

Function getFolderId

src/main/http/import/openapi.ts:473–498  ·  view source on GitHub ↗
(
  collection: HttpImportCollection,
  foldersByTag: Map<string, string>,
  operation: UnknownRecord,
)

Source from the content-addressed store, hash-verified

471}
472
473function getFolderId(
474 collection: HttpImportCollection,
475 foldersByTag: Map<string, string>,
476 operation: UnknownRecord,
477): string | null {
478 const tag = asArray(operation.tags)
479 .map(asString)
480 .map(value => value.trim())
481 .find(Boolean)
482 if (!tag)
483 return null
484
485 const existing = foldersByTag.get(tag)
486 if (existing)
487 return existing
488
489 const id = `tag:${tag}`
490 const folder: HttpImportFolder = {
491 id,
492 name: normalizeImportName(tag, 'OpenAPI'),
493 parentId: null,
494 }
495 foldersByTag.set(tag, id)
496 collection.folders.push(folder)
497 return id
498}
499
500function parseOperation(
501 root: UnknownRecord,

Callers 1

parseOperationFunction · 0.85

Calls 4

normalizeImportNameFunction · 0.90
asArrayFunction · 0.70
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected