MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / run

Function run

packages/plugins/onepassword/src/sdk/service.ts:214–239  ·  view source on GitHub ↗
(
      base: readonly string[],
      operation: string,
    )

Source from the content-addressed store, hash-verified

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[],

Callers 2

runJsonFunction · 0.70
makeCliServiceFunction · 0.70

Calls 5

opCliExecFunction · 0.90
cliArgsFunction · 0.85
cliEnvFunction · 0.85
makeTimeoutMessageFunction · 0.85
messageWithCauseFunction · 0.85

Tested by

no test coverage detected