(input: {
hooks: Hooks[]
existingProviders: Record<string, unknown>
disabled: Set<string>
enabled?: Set<string>
providerNames: Record<string, string | undefined>
})
| 210 | }) |
| 211 | |
| 212 | export function resolvePluginProviders(input: { |
| 213 | hooks: Hooks[] |
| 214 | existingProviders: Record<string, unknown> |
| 215 | disabled: Set<string> |
| 216 | enabled?: Set<string> |
| 217 | providerNames: Record<string, string | undefined> |
| 218 | }): Array<{ id: string; name: string }> { |
| 219 | const seen = new Set<string>() |
| 220 | const result: Array<{ id: string; name: string }> = [] |
| 221 | |
| 222 | for (const hook of input.hooks) { |
| 223 | if (!hook.auth) continue |
| 224 | const id = hook.auth.provider |
| 225 | if (seen.has(id)) continue |
| 226 | seen.add(id) |
| 227 | if (Object.hasOwn(input.existingProviders, id)) continue |
| 228 | if (input.disabled.has(id)) continue |
| 229 | if (input.enabled && !input.enabled.has(id)) continue |
| 230 | result.push({ |
| 231 | id, |
| 232 | name: input.providerNames[id] ?? id, |
| 233 | }) |
| 234 | } |
| 235 | |
| 236 | return result |
| 237 | } |
| 238 | |
| 239 | export const ProvidersCommand = cmd({ |
| 240 | command: "providers", |
no test coverage detected