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

Function parseBundledCollection

src/main/http/import/opencollection.ts:486–514  ·  view source on GitHub ↗
(
  file: HttpImportFile,
  raw: UnknownRecord,
  warnings: HttpImportWarning[],
)

Source from the content-addressed store, hash-verified

484}
485
486function parseBundledCollection(
487 file: HttpImportFile,
488 raw: UnknownRecord,
489 warnings: HttpImportWarning[],
490): {
491 collection: HttpImportCollection | null
492 environment: HttpImportEnvironment | null
493 } {
494 const info = getInfo(raw)
495 const collectionName = normalizeImportName(info.name, basename(file.name))
496 const collection: HttpImportCollection = {
497 folders: [],
498 name: collectionName,
499 requests: [],
500 }
501
502 parseBundledItems(asArray(raw.items), collection, null, file.name, warnings)
503
504 const variables = parseEnvironmentVariables(raw.variables ?? raw.vars)
505 const environment
506 = Object.keys(variables).length > 0
507 ? { name: `${collectionName} Variables`, variables }
508 : null
509
510 return {
511 collection: collection.requests.length > 0 ? collection : null,
512 environment,
513 }
514}
515
516export function parseOpenCollectionFiles(
517 files: HttpImportFile[],

Callers 1

parseOpenCollectionFilesFunction · 0.85

Calls 6

normalizeImportNameFunction · 0.90
parseBundledItemsFunction · 0.85
getInfoFunction · 0.70
basenameFunction · 0.70
asArrayFunction · 0.70

Tested by

no test coverage detected