From 0f8bb4d256ed008d60037ae6bfb38a2c8156b1fc Mon Sep 17 00:00:00 2001 From: Tom Lanser Date: Tue, 26 Nov 2024 21:29:41 +0100 Subject: [PATCH] fix: Typing Signed-off-by: Tom Lanser --- agent/src/endpoints.ts | 34 ++++++++++++++++------------------ agent/src/verifiers/index.ts | 2 +- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/agent/src/endpoints.ts b/agent/src/endpoints.ts index 61b0a78..160e641 100644 --- a/agent/src/endpoints.ts +++ b/agent/src/endpoints.ts @@ -198,24 +198,22 @@ apiRouter.post('/offers/receive', async (request: Request, response: Response) = apiRouter.get('/verifier', async (_, response: Response) => { return response.json({ - presentationRequests: verifiers - .filter((v) => 'useCase' in v) - .flatMap((verifier) => [ - ...verifier.presentationRequests.map((c) => { - return { - useCase: verifier.useCase, - display: `${verifier.clientMetadata.client_name} - ${c.name} - DIF PEX`, - id: c.id, - } - }), - ...verifier.dcqlRequests.map((c) => { - return { - useCase: verifier.useCase, - display: `${verifier.clientMetadata.client_name} - ${c.name} - DCQL`, - id: c.id, - } - }), - ]), + presentationRequests: verifiers.flatMap((verifier) => [ + ...verifier.presentationRequests.map((c) => { + return { + useCase: 'useCase' in verifier ? verifier.useCase : undefined, + display: `${verifier.clientMetadata.client_name} - ${c.name} - DIF PEX`, + id: c.id, + } + }), + ...verifier.dcqlRequests.map((c) => { + return { + useCase: 'useCase' in verifier ? verifier.useCase : undefined, + display: `${verifier.clientMetadata.client_name} - ${c.name} - DCQL`, + id: c.id, + } + }), + ]), }) }) diff --git a/agent/src/verifiers/index.ts b/agent/src/verifiers/index.ts index 35c2a46..1d27641 100644 --- a/agent/src/verifiers/index.ts +++ b/agent/src/verifiers/index.ts @@ -22,7 +22,7 @@ export const verifiers = [ farmatecVerifier, pgeuVerifier, europeanUnionVerifier, -] as const +] export const allDefinitions = verifiers.flatMap( ( v