( items: unknown[], collection: HttpImportCollection, parentId: string | null, source: string, warnings: HttpImportWarning[], )
| 443 | } |
| 444 | |
| 445 | function 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 | |
| 486 | function parseBundledCollection( |
| 487 | file: HttpImportFile, |
no test coverage detected