(
opts: ResolveOptions = {},
)
| 82 | |
| 83 | /** Like `resolveCredential` but returns `null` instead of throwing `NOT_CONFIGURED`. */ |
| 84 | export async function tryResolveCredential( |
| 85 | opts: ResolveOptions = {}, |
| 86 | ): Promise<ResolvedCredential | null> { |
| 87 | try { |
| 88 | return await resolveCredential(opts); |
| 89 | } catch (err) { |
| 90 | if (isAuthError(err) && err.code === "NOT_CONFIGURED") { |
| 91 | return null; |
| 92 | } |
| 93 | throw err; |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | function pickOAuth( |
| 98 | tokens: NonNullable<Awaited<ReturnType<typeof readStore>>["credentials"]["oauth"]>, |
no test coverage detected