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

Function listClients

packages/core/sdk/src/oauth-service.ts:844–873  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

842 // needed. The `client_secret` column is deliberately never projected.
843 // -----------------------------------------------------------------------
844 const listClients = (): Effect.Effect<readonly OAuthClientSummary[], StorageFailure> =>
845 deps.fuma
846 .use("oauth_client.findMany", (db) => looseDb(db).findMany("oauth_client", {}))
847 .pipe(
848 Effect.flatMap((rows) =>
849 Effect.forEach(rows, (row) => {
850 const grant = parseGrant(row.grant);
851 // EXPLICIT — a row with an unknown grant is corrupt; surface it
852 // loudly rather than silently displaying it as authorization_code.
853 if (grant === null) {
854 return Effect.fail(
855 new StorageError({
856 message: `oauth_client ${String(row.slug)} has an unknown grant: ${String(row.grant)}`,
857 cause: undefined,
858 }),
859 );
860 }
861 return Effect.succeed({
862 owner: String(row.owner) as Owner,
863 slug: OAuthClientSlug.make(String(row.slug)),
864 grant,
865 authorizationUrl: String(row.authorization_url),
866 tokenUrl: String(row.token_url),
867 resource: row.resource == null ? null : String(row.resource),
868 clientId: String(row.client_id),
869 origin: parseOAuthClientOrigin(row),
870 } satisfies OAuthClientSummary);
871 }),
872 ),
873 );
874
875 // -----------------------------------------------------------------------
876 // Load an oauth_client row by (owner, slug).

Callers

nothing calls this directly

Calls 3

looseDbFunction · 0.85
parseGrantFunction · 0.85
parseOAuthClientOriginFunction · 0.85

Tested by

no test coverage detected