( table: unknown, )
| 180 | * the entry. |
| 181 | */ |
| 182 | export function normalizeRelayModelProfiles( |
| 183 | table: unknown, |
| 184 | ): Record<string, RelayModelProfile> | undefined { |
| 185 | if (!isRecord(table)) return undefined; |
| 186 | const parsed: [string, RelayModelProfile][] = []; |
| 187 | for (const [modelId, entry] of Object.entries(table)) { |
| 188 | if (modelId.length === 0 || modelId.length > 512) continue; |
| 189 | const declared = normalizeRelayModelProfile(entry); |
| 190 | if (declared) parsed.push([modelId, declared]); |
| 191 | } |
| 192 | return parsed.length > 0 ? Object.fromEntries(parsed) : undefined; |
| 193 | } |
| 194 | |
| 195 | /** |
| 196 | * Restore the `keys(profiles) ⊆ enabledModelIds` invariant after a selection |
no test coverage detected