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

Function listClients

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

Source from the content-addressed store, hash-verified

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