(provider)
| 48 | } |
| 49 | |
| 50 | function stripProvider(provider) { |
| 51 | if (typeof provider !== "object" || provider === null) return undefined; |
| 52 | const result = {}; |
| 53 | for (const key of Object.keys(provider)) { |
| 54 | if (!KEEP_PROVIDER.has(key)) continue; |
| 55 | const value = provider[key]; |
| 56 | if (key === "models") { |
| 57 | const stripped = {}; |
| 58 | for (const [mId, m] of Object.entries(value)) { |
| 59 | const s = stripModel(m); |
| 60 | if (s !== undefined) stripped[mId] = s; |
| 61 | } |
| 62 | if (Object.keys(stripped).length > 0) result[key] = stripped; |
| 63 | } else { |
| 64 | result[key] = value; |
| 65 | } |
| 66 | } |
| 67 | return result; |
| 68 | } |
| 69 | |
| 70 | async function fetchCatalog(url) { |
| 71 | const res = await fetch(url, { headers: { Accept: "application/json" } }); |
no test coverage detected