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

Function listClients

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

Source from the content-addressed store, hash-verified

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