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

Function accountStatus

packages/plugins/onepassword/src/sdk/plugin.ts:572–603  ·  view source on GitHub ↗
(account: OnePasswordAccount)

Source from the content-addressed store, hash-verified

570 const serviceFor: ServiceForAccount = (account) => serviceForAuth(account.auth);
571
572 const accountStatus = (account: OnePasswordAccount): Effect.Effect<AccountStatus, never> =>
573 serviceFor(account).pipe(
574 Effect.flatMap((svc) => svc.listVaults()),
575 Effect.map((live) => {
576 const liveById = new Map(live.map((v) => [v.id, v.title]));
577 const missing = account.vaults.filter((vault) => !liveById.has(vault.id));
578 return AccountStatus.make({
579 id: account.id,
580 name: account.name,
581 connected: true,
582 vaultNames: account.vaults.map((vault) => liveById.get(vault.id) ?? vault.name),
583 ...(missing.length > 0
584 ? {
585 error: `Configured vaults not found: ${missing
586 .map((vault) => vault.name)
587 .join(", ")}`,
588 }
589 : {}),
590 });
591 }),
592 Effect.catchTag("OnePasswordError", (error) =>
593 Effect.succeed(
594 AccountStatus.make({
595 id: account.id,
596 name: account.name,
597 connected: false,
598 // oxlint-disable-next-line executor/no-unknown-error-message -- boundary: OnePasswordError carries a typed `message`
599 error: error.message,
600 }),
601 ),
602 ),
603 );
604
605 return {
606 /** Add or replace one account. A payload without an id creates a new

Callers

nothing calls this directly

Calls 2

serviceForFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected