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

Function listClients

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

Source from the content-addressed store, hash-verified

899 // needed. The `client_secret` column is deliberately never projected.
900 // -----------------------------------------------------------------------
901 const listClients = (): Effect.Effect<readonly OAuthClientSummary[], StorageFailure> =>
902 deps.fuma
903 .use("oauth_client.findMany", (db) => looseDb(db).findMany("oauth_client", {}))
904 .pipe(
905 Effect.flatMap((rows) =>
906 Effect.forEach(rows, (row) => {
907 const grant = parseGrant(row.grant);
908 // EXPLICIT — a row with an unknown grant is corrupt; surface it
909 // loudly rather than silently displaying it as authorization_code.
910 if (grant === null) {
911 return Effect.fail(
912 new StorageError({
913 message: `oauth_client ${String(row.slug)} has an unknown grant: ${String(row.grant)}`,
914 cause: undefined,
915 }),
916 );
917 }
918 return Effect.succeed({
919 owner: String(row.owner) as Owner,
920 slug: OAuthClientSlug.make(String(row.slug)),
921 grant,
922 authorizationUrl: String(row.authorization_url),
923 tokenUrl: String(row.token_url),
924 resource: row.resource == null ? null : String(row.resource),
925 clientId: String(row.client_id),
926 origin: parseOAuthClientOrigin(row),
927 } satisfies OAuthClientSummary);
928 }),
929 ),
930 );
931
932 // -----------------------------------------------------------------------
933 // 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