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

Function listClients

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

Source from the content-addressed store, hash-verified

953 // needed. The `client_secret` column is deliberately never projected.
954 // -----------------------------------------------------------------------
955 const listClients = (): Effect.Effect<readonly OAuthClientSummary[], StorageFailure> =>
956 deps.fuma
957 .use("oauth_client.findMany", (db) => looseDb(db).findMany("oauth_client", {}))
958 .pipe(
959 Effect.flatMap((rows) =>
960 Effect.forEach(rows, (row) => {
961 const grant = parseGrant(row.grant);
962 // EXPLICIT — a row with an unknown grant is corrupt; surface it
963 // loudly rather than silently displaying it as authorization_code.
964 if (grant === null) {
965 return Effect.fail(
966 new StorageError({
967 message: `oauth_client ${String(row.slug)} has an unknown grant: ${String(row.grant)}`,
968 cause: undefined,
969 }),
970 );
971 }
972 return Effect.succeed({
973 owner: String(row.owner) as Owner,
974 slug: OAuthClientSlug.make(String(row.slug)),
975 grant,
976 authorizationUrl: String(row.authorization_url),
977 tokenUrl: String(row.token_url),
978 resource: row.resource == null ? null : String(row.resource),
979 clientId: String(row.client_id),
980 origin: parseOAuthClientOrigin(row),
981 } satisfies OAuthClientSummary);
982 }),
983 ),
984 );
985
986 // -----------------------------------------------------------------------
987 // 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