( file: HttpImportFile, raw: UnknownRecord, warnings: HttpImportWarning[], )
| 484 | } |
| 485 | |
| 486 | function 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 | |
| 516 | export function parseOpenCollectionFiles( |
| 517 | files: HttpImportFile[], |
no test coverage detected