(scopes: readonly string[])
| 791 | // absurd list is truncated. |
| 792 | const MAX_DISCOVERED_SCOPE_CHARS = 8192; |
| 793 | const capScopes = (scopes: readonly string[]): readonly string[] => { |
| 794 | const unique = dedupeScopes(scopes); |
| 795 | let length = 0; |
| 796 | let count = 0; |
| 797 | for (const scope of unique) { |
| 798 | const next = length + scope.length + (count > 0 ? 1 : 0); |
| 799 | if (next > MAX_DISCOVERED_SCOPE_CHARS) break; |
| 800 | length = next; |
| 801 | count += 1; |
| 802 | } |
| 803 | return unique.slice(0, count); |
| 804 | }; |
| 805 | |
| 806 | // Bound a whole discovery sequence (PRM + up to MAX_DISCOVERY_AUTH_SERVERS AS |
| 807 | // fetches, each with its own request timeout). 30s is larger than a single |
no test coverage detected