(
base: readonly string[],
operation: string,
)
| 212 | ): Effect.Effect<OnePasswordService, OnePasswordError> => |
| 213 | Effect.sync(() => { |
| 214 | const run = ( |
| 215 | base: readonly string[], |
| 216 | operation: string, |
| 217 | ): Effect.Effect<string, OnePasswordError> => { |
| 218 | const spawn = Effect.promise((signal) => |
| 219 | opCliExec({ args: cliArgs(auth, base), env: cliEnv(auth), timeoutMs, signal }), |
| 220 | ).pipe( |
| 221 | Effect.flatMap((result) => { |
| 222 | if (result.ok) return Effect.succeed(result.stdout); |
| 223 | return Effect.fail( |
| 224 | result.timedOut |
| 225 | ? new OnePasswordError({ |
| 226 | operation, |
| 227 | message: makeTimeoutMessage(operation, timeoutMs), |
| 228 | }) |
| 229 | : new OnePasswordError({ |
| 230 | operation, |
| 231 | message: messageWithCause(`1Password CLI ${operation} failed`, result), |
| 232 | }), |
| 233 | ); |
| 234 | }), |
| 235 | ); |
| 236 | return (auth.kind === "desktop-app" ? cliPromptLock.withPermits(1)(spawn) : spawn).pipe( |
| 237 | Effect.withSpan(`onepassword.cli.${operation}`), |
| 238 | ); |
| 239 | }; |
| 240 | |
| 241 | const runJson = <A>( |
| 242 | base: readonly string[], |
no test coverage detected