( raw: UnknownRecord, fileName: string, warnings: HttpImportWarning[], )
| 355 | } |
| 356 | |
| 357 | function parseCollection( |
| 358 | raw: UnknownRecord, |
| 359 | fileName: string, |
| 360 | warnings: HttpImportWarning[], |
| 361 | ): HttpImportCollection { |
| 362 | const info = isRecord(raw.info) ? raw.info : {} |
| 363 | const name = normalizeImportName(info.name, fileName.replace(/\.json$/i, '')) |
| 364 | const auth = parseAuth(raw.auth, fileName, warnings) ?? { |
| 365 | type: 'none' as const, |
| 366 | } |
| 367 | const collection: HttpImportCollection = { |
| 368 | description: asString(info.description), |
| 369 | folders: [], |
| 370 | name, |
| 371 | requests: [], |
| 372 | } |
| 373 | |
| 374 | walkItems(asArray(raw.item), collection, null, { auth }, name, warnings) |
| 375 | return collection |
| 376 | } |
| 377 | |
| 378 | export function parsePostmanFiles(files: HttpImportFile[]): HttpImportResult { |
| 379 | const warnings: HttpImportWarning[] = [] |
no test coverage detected