MCPcopy Create free account
hub / github.com/massCodeIO/massCode / parseBundledItems

Function parseBundledItems

src/main/http/import/opencollection.ts:445–484  ·  view source on GitHub ↗
(
  items: unknown[],
  collection: HttpImportCollection,
  parentId: string | null,
  source: string,
  warnings: HttpImportWarning[],
)

Source from the content-addressed store, hash-verified

443}
444
445function parseBundledItems(
446 items: unknown[],
447 collection: HttpImportCollection,
448 parentId: string | null,
449 source: string,
450 warnings: HttpImportWarning[],
451) {
452 for (const [index, item] of items.entries()) {
453 if (!isRecord(item))
454 continue
455
456 const info = getInfo(item)
457 const name = normalizeImportName(info.name, `Item ${index + 1}`)
458 const childItems = asArray(item.items)
459
460 if (info.type === 'folder' || childItems.length > 0) {
461 const folder: HttpImportFolder = {
462 id: `${source}:${collection.folders.length}`,
463 name,
464 parentId,
465 }
466 collection.folders.push(folder)
467 parseBundledItems(childItems, collection, folder.id, source, warnings)
468 continue
469 }
470
471 if (!isRequestFile(item))
472 continue
473
474 const request = parseRequest(
475 { content: '', name: `${source}/${name}.yml` },
476 item,
477 parentId,
478 warnings,
479 )
480 if (request) {
481 collection.requests.push(request)
482 }
483 }
484}
485
486function parseBundledCollection(
487 file: HttpImportFile,

Callers 1

parseBundledCollectionFunction · 0.85

Calls 6

normalizeImportNameFunction · 0.90
isRequestFileFunction · 0.85
isRecordFunction · 0.70
getInfoFunction · 0.70
asArrayFunction · 0.70
parseRequestFunction · 0.70

Tested by

no test coverage detected