Skip to content

Conversation

@GHkrishna
Copy link
Contributor

@GHkrishna GHkrishna commented Sep 23, 2025

What

  • Update nestJs version

Summary by CodeRabbit

  • New Features

    • Full Cloud Wallet API (wallet config, DIDs, connections, credentials, proofs, messages); expanded Connection and FIDO endpoints; credential-definition retrieval and templates; user activity logging.
  • Refactor

    • Standardized error handling, webhook flows, guards, validation, and NATS client call patterns; utilities persist flag parsing improved.
  • Breaking Changes

    • Removed public DID endpoints; changed return shapes for ledgers list, shortening URL, and Cloud Wallet DID list.
  • Documentation

    • Simplified Swagger Unauthorized/Forbidden metadata.
  • Chores

    • Moved NestJS deps to workspace catalog.

@coderabbitai
Copy link

coderabbitai bot commented Sep 23, 2025

Walkthrough

Removed explicit HTTP status codes from many Swagger error decorators; added and expanded multiple controller endpoints (cloud-wallet, connection, fido, etc.); refactored NATS client to use firstValueFrom and standardized headers/contextId; adjusted ClientProxy typings and DTO/interface refinements; introduced a pnpm catalog mapping for NestJS dependencies.

Changes

Cohort / File(s) Summary
Swagger decorator simplification
apps/api-gateway/src/*/*controller.ts
.../agent-service/agent-service.controller.ts, .../authz/authz.controller.ts, .../credential-definition/credential-definition.controller.ts, .../issuance/issuance.controller.ts, .../notification/notification.controller.ts, .../organization/organization.controller.ts, .../schema/schema.controller.ts, .../user/user.controller.ts, .../verification/verification.controller.ts, .../webhook/webhook.controller.ts
Removed explicit HttpStatus/status fields from ApiUnauthorizedResponse/ApiForbiddenResponse (and some ApiNotFound) decorators; retained description and type only.
Cloud Wallet API implementation
apps/api-gateway/src/cloud-wallet/*, apps/cloud-wallet/src/*
Added CloudWalletController endpoints and wiring; service formatting changes; getDidList return type changed to IProofRequestRes[] and implementation coerces nullish to empty array.
Agent API adjustments
apps/api-gateway/src/agent/*, apps/api-gateway/src/agent-service/*
Removed public DID endpoints from AgentController; simplified class-level Swagger metadata; reorganized AgentService methods and import ordering.
Connection module expansion
apps/api-gateway/src/connection/*, apps/connection/src/connection.service.ts
Controller: injected NATS ClientProxy, added logger, expanded routes/guards, added UUID validation and refined responses. Service: added getUrl/getConnections/getConnectionListFromAgent, switched to firstValueFrom, simplified error checks and some ClientProxy typings.
Credential Definition (API & Ledger)
apps/api-gateway/src/credential-definition/*, apps/ledger/src/credential-definition/*
API: Swagger decorator simplification and added getCredentialDefinitionById. Ledger: large additions (create/get/list credential definitions, schema helpers, templates) and unified agent error wrapping.
Schema DTOs & Services
apps/api-gateway/src/schema/dtos/*, apps/api-gateway/src/schema/*, apps/ledger/src/schema/schema.service.ts, libs/common/src/interfaces/schema.interface.ts
DTO validation/default refinements, ParseUUIDPipe exceptionFactory usage; ledger service simplified error handling and removed explicit ClientProxy typing; interfaces updated to use PartialICredDefData[].
Issuance module
apps/api-gateway/src/issuance/*, apps/issuance/src/issuance.service.ts
Controller decorator updates; service generics and ClientProxy typing simplified; unified error mapping to RpcException/HttpException patterns.
Notification & Webhook
apps/api-gateway/src/notification/*, apps/api-gateway/src/webhook/*
Decorator simplifications; unified response shaping; getWebhookUrl now uses OrgRolesGuard; service method rename registerOrgWebhhookEndpointregisterOrgWebhookEndpoint and import/constructor formatting changes.
Platform & Utilities
apps/api-gateway/src/platform/*, apps/api-gateway/src/utilities/*
PlatformService return types updated (getAllLedgersILedgers[], getShorteningUrlByIdobject); UtilitiesController.storeObject now uses ParseBoolPipe and passes boolean to service.
AuthZ, FIDO, Geo-location, User modules
apps/api-gateway/src/authz/*, apps/api-gateway/src/fido/*, apps/api-gateway/src/geo-location/*, apps/api-gateway/src/user/*
Swagger decorator simplifications; FIDO controller endpoints standardized with explicit parameter bindings and auth hints; imports/constructor formatting and ClientProxy import reorderings.
NATS / Common utils & error handling
libs/common/src/NATSClient.ts, libs/common/src/common.service.ts, apps/api-gateway/src/main.ts, apps/api-gateway/src/app.module.ts
NATSClient signatures tightened to Pick<ClientProxy,'send'>, headers always built via nats.headers() using CLS contextId or v4, switched to firstValueFrom; common error handling simplified to unified RpcException mapping; typed HttpAdapterHost usage and middleware exclusion tightened.
DTO corrections
apps/api-gateway/src/dtos/save-roles-permissions.dto.ts
Fixed ApiProperty decorator types for permissionsId and data.
User activity repo
libs/user-activity/repositories/index.ts
Added logActivity and _orgDeletedActivity with NATS calls, timeout handling, and HttpException wrapping; updated recent-activity retrieval.
Dependency / pnpm catalog changes
pnpm-workspace.yaml, package.json, libs/aws/package.json, libs/common/package.json
Added pnpm catalog section and replaced several NestJS dependency entries with "catalog:" placeholders.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant GW as API Gateway (CloudWalletController)
  participant S as CloudWalletService
  participant N as NATSClient
  participant Agent

  User->>GW: Authenticated request (e.g., create wallet)
  GW->>S: Delegate (attach userId/email)
  S->>N: sendNatsMessage(pattern, payload)
  N->>Agent: NATS request (headers include contextId)
  Agent-->>N: Response
  N-->>S: firstValueFrom(response)
  S-->>GW: formatted data
  GW-->>User: { statusCode, message, data }
Loading
sequenceDiagram
  autonumber
  actor User
  participant C as ConnectionController
  participant CS as ConnectionService
  participant N as NATSClient
  participant Agent

  User->>C: GET /orgs/:orgId/connections/:connectionId
  C->>C: Validate params (ParseUUID/Trim)
  C->>CS: getConnectionsById(user, connectionId, orgId)
  CS->>N: sendNatsMessage('get-connection-by-id', payload)
  N->>Agent: NATS request
  alt success
    Agent-->>N: Data
    N-->>CS: firstValueFrom(data)
    CS-->>C: Details
    C-->>User: { statusCode, message, data }
  else error
    Agent-->>N: Error
    N-->>CS: Error
    CS->>CS: Build RpcException (message, status fallback)
    CS-->>C: throw
    C-->>User: Error response
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • RinkalBhojani
  • tipusinghaw

Poem

In burrows of code I twitch my nose,
New routes sprout where cloud-wallet grows.
NATS hums headers, contextId in tow,
Swagger sheds status — docs breathe light.
Hop, tiny rabbit — CI passed tonight. 🥕🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The title “fix: nestjs version update” indicates a dependency bump for NestJS, but the changes instead span Swagger decorator simplifications, import reorganizations, controller and service method surface updates, and feature additions; there is no update to the NestJS version itself, so the title does not accurately summarize the pull request’s content. Please revise the title to clearly reflect the main modifications, such as simplifying Swagger response decorators and restructuring imports across multiple controllers and services, to help reviewers and future readers understand the core purpose of this changeset.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/nestjs-version-update

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eb9d7b7 and f72cb89.

📒 Files selected for processing (1)
  • apps/api-gateway/src/fido/fido.controller.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
apps/api-gateway/src/fido/fido.controller.ts (4)
apps/api-gateway/src/authz/decorators/roles.decorator.ts (1)
  • Roles (6-6)
libs/common/src/interfaces/response.interface.ts (1)
  • IResponseType (1-7)
apps/api-gateway/src/dtos/fido-user.dto.ts (5)
  • GenerateRegistrationDto (4-10)
  • VerifyRegistrationDto (31-58)
  • GenerateAuthenticationDto (74-78)
  • VerifyAuthenticationDto (99-126)
  • UpdateFidoUserDetailsDto (60-72)
apps/api-gateway/src/fido/fido.service.ts (2)
  • verifyRegistration (29-32)
  • verifyAuthentication (40-46)
🔇 Additional comments (6)
apps/api-gateway/src/fido/fido.controller.ts (6)

1-15: Secure passkey routes with actual guards

These passkey endpoints still expose sensitive data because the @Roles decorator is inert without guards. We previously agreed to enforce JWT + org-role checks here—please wire the guards back in (and import them) so the routes aren’t publicly reachable.

@@
-  Res,
-  UseFilters
+  Res,
+  UseFilters,
+  UseGuards
 } from '@nestjs/common';
+import { AuthGuard } from '@nestjs/passport';
@@
-import { Roles } from '../authz/decorators/roles.decorator';
+import { OrgRolesGuard } from '../authz/guards/org-roles.guard';
+import { Roles } from '../authz/decorators/roles.decorator';
@@
-  // TODO: Check if roles are required here?
-  // @UseGuards(AuthGuard('jwt'), OrgRolesGuard)
-  @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.HOLDER, OrgRoles.ISSUER, OrgRoles.SUPER_ADMIN, OrgRoles.MEMBER)
+  @UseGuards(AuthGuard('jwt'), OrgRolesGuard)
+  @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.HOLDER, OrgRoles.ISSUER, OrgRoles.SUPER_ADMIN, OrgRoles.MEMBER)

Also applies to: 62-75


162-174: Align JSON payload status with HTTP 201

The handler responds with res.status(HttpStatus.CREATED) but the payload still advertises statusCode: HttpStatus.OK. That mismatch breaks clients relying on the body metadata. Set the payload to HttpStatus.CREATED so it’s consistent.

     const finalResponse: IResponseType = {
-      statusCode: HttpStatus.OK,
+      statusCode: HttpStatus.CREATED,
       message: ResponseMessages.fido.success.generateAuthenticationOption,
       data: generateAuthentication.response
     };

242-248: Reinstate guards on device-name update

Same issue as the GET route: without @UseGuards(AuthGuard('jwt'), OrgRolesGuard), this mutation endpoint is effectively public despite the @Roles decorator. Please add the guards back.

 @Put('/passkey/:credentialId')
 @ApiBearerAuth()
-// TODO: Check if roles are required here?
-// @UseGuards(AuthGuard('jwt'), OrgRolesGuard)
 @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.HOLDER, OrgRoles.ISSUER, OrgRoles.SUPER_ADMIN, OrgRoles.MEMBER)
+@UseGuards(AuthGuard('jwt'), OrgRolesGuard)

255-262: Decode credentialId before calling the service

WebAuthn credential IDs arrive URL-encoded; sending the raw string breaks lookups. Decode it (as you already do in updateFidoUser) before delegating to the service.

-      const updateDeviceName = await this.fidoService.updateFidoUserDeviceName(credentialId, deviceName);
+      const updateDeviceName = await this.fidoService.updateFidoUserDeviceName(
+        decodeURIComponent(credentialId),
+        deviceName
+      );

275-281: Guard the delete device endpoint

Deleting a passkey without auth is just as risky—please apply the JWT + org-role guards here too.

 @Delete('/passkey/:credentialId')
 @ApiBearerAuth()
-// TODO: Check if roles are required here?
-// @UseGuards(AuthGuard('jwt'), OrgRolesGuard)
 @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.HOLDER, OrgRoles.ISSUER, OrgRoles.SUPER_ADMIN, OrgRoles.MEMBER)
+@UseGuards(AuthGuard('jwt'), OrgRolesGuard)

284-288: Decode credentialId before deleting

Mirror the other handlers and decode the credential ID before invoking the service; URL-encoded IDs currently fail to delete.

-      const deleteFidoUser = await this.fidoService.deleteFidoUserDevice(credentialId);
+      const deleteFidoUser = await this.fidoService.deleteFidoUserDevice(decodeURIComponent(credentialId));

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@GHkrishna GHkrishna self-assigned this Sep 23, 2025
@GHkrishna GHkrishna linked an issue Sep 23, 2025 that may be closed by this pull request
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 28

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (13)
apps/organization/src/organization.service.ts (1)

1762-1780: Fix HttpException status, remove deprecated toPromise, and align with NATSClient

  • Passing error.error as the HttpException status is incorrect; use error.status/statusCode or a safe default.
  • toPromise() is deprecated; prefer Promise-returning NATSClient already used elsewhere.
  • Avoid incorrect (response: string) annotation; the response is an object/array.

Apply this diff:

-      return this.organizationServiceProxy
-        .send(pattern, userEmails)
-        .pipe(
-          map((response: string) => ({
-            response
-          }))
-        )
-        .toPromise()
-        .catch((error) => {
-          this.logger.error(`getUserKeycloakIdByEmail catch: ${JSON.stringify(error)}`);
-          throw new HttpException(
-            {
-              status: error?.statusCode,
-              error: error?.message
-            },
-            error.error
-          );
-        });
+      const response = await this.natsClient
+        .send(this.organizationServiceProxy, pattern, userEmails)
+        .catch((error) => {
+          this.logger.error(`getUserKeycloakIdByEmail catch: ${JSON.stringify(error)}`);
+          const status = error?.status ?? error?.statusCode ?? 500;
+          throw new HttpException({ status, error: error?.message }, status);
+        });
+      return { response };
apps/api-gateway/src/connection/connection.service.ts (1)

129-140: Same toPromise() issue here.

Replace toPromise() with firstValueFrom.

Apply this diff:

-      const message = await this.connectionServiceProxy.send(pattern, payload).toPromise();
+      const message = await firstValueFrom(this.connectionServiceProxy.send(pattern, payload));
libs/common/src/NATSClient.ts (2)

21-36: Fix header construction and replace deprecated toPromise().

  • headers(): set the contextId explicitly on the headers object.
  • Use firstValueFrom instead of toPromise.

Apply this diff:

-  sendNats(serviceProxy, cmd: string, payload: any): Promise<any> {
+  sendNats(serviceProxy, cmd: string, payload: any): Promise<any> {
     this.logger.log(`Inside NATSClient for sendNats()`);
     const pattern = { cmd };
-    const headers = nats.headers(1, this.contextStorageService.getContextId());
-    const record = new NatsRecordBuilder(payload).setHeaders(headers).build();
+    let contextId = this.contextStorageService.getContextId() || v4();
+    const headers = nats.headers();
+    headers.set('contextId', contextId);
+    const record = new NatsRecordBuilder(payload).setHeaders(headers).build();
 
-    return serviceProxy
-      .send(pattern, record)
-      .pipe(
-        map((response: string) => ({
-          response
-        }))
-      )
-      .toPromise();
+    return firstValueFrom(
+      serviceProxy.send(pattern, record).pipe(map((response: string) => ({ response })))
+    );
   }

48-61: Use proper header construction in generic send().

Avoid passing args to nats.headers(); set header key explicitly.

Apply this diff:

   send<T>(serviceProxy, pattern: object, payload: any): Promise<T> {
     let contextId = this.contextStorageService.getContextId();
 
     if (!contextId) {
       contextId = v4();
     }
 
-    const headers = nats.headers(1, contextId);
+    const headers = nats.headers();
+    headers.set('contextId', contextId);
     const record = new NatsRecordBuilder(payload).setHeaders(headers).build();
 
-    const result = serviceProxy.send(pattern, record);
+    const result = serviceProxy.send(pattern, record);
 
     return firstValueFrom(result);
   }
apps/agent-service/src/agent-service.service.ts (1)

1859-1871: RxJS toPromise() is removed; use firstValueFrom.

This will break on Nest 11/RxJS 7+. Replace the chain accordingly and import firstValueFrom.

Apply this diff:

-    const updatedSchemaInfo = await this.agentServiceProxy
-      .send(pattern, payload)
-      .toPromise()
-      .catch((error) => {
+    const updatedSchemaInfo = await firstValueFrom(this.agentServiceProxy.send(pattern, payload)).catch((error) => {
         this.logger.error(`catch: ${JSON.stringify(error)}`);
         throw new HttpException(
           {
             status: error.status,
             error: error.message
           },
           error.status
         );
       });

Add import near other rxjs imports:

- import { from } from 'rxjs';
+ import { from, firstValueFrom } from 'rxjs';
apps/cloud-wallet/src/cloud-wallet.service.ts (8)

156-159: Fix malformed URL: stray closing brace.

Extra “}” corrupts the endpoint and will 404.

-      const url = `${agentEndpoint}${CommonConstants.CLOUD_WALLET_GET_PROOF_REQUEST}/${proofRecordId}}`;
+      const url = `${agentEndpoint}${CommonConstants.CLOUD_WALLET_GET_PROOF_REQUEST}/${proofRecordId}`;

171-179: Fix malformed URL and query appending.

  • Extra “}”
  • Avoid adding “/” before a query string.
-      const threadParam = threadId ? `?threadId=${threadId}` : '';
-      const url = `${agentEndpoint}${CommonConstants.CLOUD_WALLET_GET_PROOF_REQUEST}/${threadParam}}`;
+      const threadParam = threadId ? `?threadId=${threadId}` : '';
+      const url = `${agentEndpoint}${CommonConstants.CLOUD_WALLET_GET_PROOF_REQUEST}${threadParam}`;

256-261: Correct condition to validate createCloudWallet response.

Use OR; current AND skips the missing-id case.

-      if (!createCloudWalletResponse && !createCloudWalletResponse.id) {
+      if (!createCloudWalletResponse || !createCloudWalletResponse.id) {
         throw new InternalServerErrorException(ResponseMessages.cloudWallet.error.createCloudWallet, {
           cause: new Error(),
           description: ResponseMessages.errorMessages.serverError
         });
       }

272-284: Await token encryption; currently storing a Promise.

dataEncryption is async elsewhere; be consistent here to avoid persisting a Promise.

-      const cloudWalletResponse: ICloudWalletDetails = {
+      const encryptedAgentToken = await this.commonService.dataEncryption(createCloudWalletResponse.token);
+      const cloudWalletResponse: ICloudWalletDetails = {
         createdBy: userId,
         label,
         lastChangedBy: userId,
         tenantId: createCloudWalletResponse.id,
         type: CloudWalletType.SUB_WALLET,
         userId,
-        agentApiKey: this.commonService.dataEncryption(createCloudWalletResponse.token),
+        agentApiKey: encryptedAgentToken,
         agentEndpoint,
         email,
         key: walletKey,
         connectionImageUrl
       };

287-291: Propagate errors after handling.

Without rethrowing, callers receive undefined on failures.

     } catch (error) {
       this.logger.error(`[createCloudWallet] - error in create cloud wallet: ${error}`);
       await this.commonService.handleError(error);
-    }
+      throw error;
+    }

331-334: Propagate errors after handling.

Maintain consistent error flow.

     } catch (error) {
       this.logger.error(`[createCloudWallet] - error in receive invitation: ${error}`);
       await this.commonService.handleError(error);
-    }
+      throw error;
+    }

374-377: Propagate errors after handling.

Maintain consistent error flow.

     } catch (error) {
       this.logger.error(`[receiveInvitationByUrl] - error in accept offer: ${error}`);
       await this.commonService.handleError(error);
-    }
+      throw error;
+    }

417-420: Propagate errors after handling.

Maintain consistent error flow.

     } catch (error) {
       this.logger.error(`[createDid] - error in create DID: ${error}`);
       await this.commonService.handleError(error);
-    }
+      throw error;
+    }
🧹 Nitpick comments (64)
apps/api-gateway/src/utilities/utilities.controller.ts (1)

55-79: Optional: Prefer framework-managed responses over manual @Res.

Dropping @Res enables interceptors/transformers/exception filters to work uniformly and simplifies testing. Not blocking if you need raw Express.

apps/user/src/user.service.ts (1)

896-897: Consider adding proper error handling for the NATS send operation.

The userServiceProxy.send() call uses the older pattern without the newer natsClient wrapper that's used elsewhere in the service. This inconsistency could lead to different error handling behaviors.

Consider updating this to use the consistent natsClient pattern like other NATS calls in this service:

-    const getEcosystemConfigDetails = await this.userServiceProxy
-      .send(pattern, payload)
+    const getEcosystemConfigDetails = await this.natsClient
+      .send(this.userServiceProxy, pattern, payload)
apps/api-gateway/src/platform/platform.service.ts (1)

1-15: Re-introduce a concrete type for platformServiceProxy (ClientProxy) to preserve type-safety.

Dropping the type to implicit any weakens IDE help and compile-time checks. Typing the injected proxy keeps parity with NestJS patterns while still working with NATSClient.

Apply this diff:

-import { Injectable, Inject } from '@nestjs/common';
+import { Injectable, Inject } from '@nestjs/common';
+import { ClientProxy } from '@nestjs/microservices';
@@
-  constructor(
-    @Inject('NATS_CLIENT') private readonly platformServiceProxy,
-    private readonly natsClient: NATSClient
-  ) {
+  constructor(
+    @Inject('NATS_CLIENT') private readonly platformServiceProxy: ClientProxy,
+    private readonly natsClient: NATSClient
+  ) {
apps/organization/src/organization.service.ts (2)

74-74: Avoid implicit any: type the injected NATS client proxy

Typing preserves compile‑time safety without changing runtime behavior.

Apply this diff for the constructor param:

-    @Inject('NATS_CLIENT') private readonly organizationServiceProxy,
+    @Inject('NATS_CLIENT') private readonly organizationServiceProxy: ClientProxy,

Add the missing import:

+import { ClientProxy } from '@nestjs/microservices';

1790-1794: Use NATSClient instead of raw ClientProxy + toPromise

This aligns with the rest of the file, avoids RxJS dependency, and standardizes error handling.

-      // eslint-disable-next-line @typescript-eslint/no-explicit-any
-      const message = await this.organizationServiceProxy.send(pattern, payload).toPromise();
+      const message = await this.natsClient.send(this.organizationServiceProxy, pattern, payload);
apps/api-gateway/src/geo-location/geo-location.service.ts (2)

30-34: Fix misleading log message in getStatesByCountryId.

It refers to “cities” and wrong method name.

-    this.logger.log(`Finding cities for countryId= ${countryId},GeoLocationService::getCitiesByStateAndCountry`);
+    this.logger.log(`Finding states for countryId= ${countryId},GeoLocationService::getStatesByCountryId`);

8-11: Restore explicit type for serviceProxy (use ClientProxy)

Add an explicit ClientProxy type to avoid an implicit any and keep the DI contract clear — tsconfig files do not enable "noImplicitAny", so this is a clarity/type-safety change (not a build blocker).

-  constructor(
-    @Inject('NATS_CLIENT') private readonly serviceProxy,
-    private readonly natsClient: NATSClient
-  ) {
+  constructor(
+    @Inject('NATS_CLIENT') private readonly serviceProxy: ClientProxy,
+    private readonly natsClient: NATSClient
+  ) {
 import { Inject, Injectable } from '@nestjs/common';
+import { ClientProxy } from '@nestjs/microservices';
apps/verification/src/verification.service.ts (7)

63-63: Type the injected NATS client to retain compile-time safety.

Keeping this untyped weakens DI safety and downstream call signatures. Prefer explicit ClientProxy typing.

Apply this diff for the constructor param:

-    @Inject('NATS_CLIENT') private readonly verificationServiceProxy,
+    @Inject('NATS_CLIENT') private readonly verificationServiceProxy: ClientProxy,

Add/update the import (outside this range):

import { ClientProxy, RpcException } from '@nestjs/microservices';

Verify the provider behind 'NATS_CLIENT' is still a ClientProxy in the upgraded NestJS setup.


993-1016: Replace deprecated toPromise and RxJS wrapping; make natsCall generic and await the Promise.

natsClient.send already returns a Promise. This removes deprecated toPromise usage and unnecessary from/map, and fixes the overly narrow response: string typing.

-  async natsCall(
-    pattern: object,
-    payload: object
-  ): Promise<{
-    response: string;
-  }> {
-    return from(this.natsClient.send<string>(this.verificationServiceProxy, pattern, payload))
-      .pipe(
-        map((response) => ({
-          response
-        }))
-      )
-      .toPromise()
-      .catch((error) => {
-        this.logger.error(`catch: ${JSON.stringify(error)}`);
-        throw new HttpException(
-          {
-            status: error.statusCode,
-            error: error.error,
-            message: error.message
-          },
-          error.error
-        );
-      });
-  }
+  async natsCall<T>(
+    pattern: object,
+    payload: object
+  ): Promise<{ response: T }> {
+    try {
+      const response = await this.natsClient.send<T>(this.verificationServiceProxy, pattern, payload);
+      return { response };
+    } catch (error) {
+      this.logger.error(`catch: ${JSON.stringify(error)}`);
+      throw new HttpException(
+        {
+          status: error.statusCode,
+          error: error.error,
+          message: error.message
+        },
+        error.error
+      );
+    }
+  }

Follow-ups (outside this range):

  • Remove now-unused imports: map from 'rxjs/operators' and from from 'rxjs'.
  • If the upgrade moved you to RxJS 8 anywhere else, this avoids build breaks from removed toPromise.

980-991: Fix boolean logic in verificationErrorHandling.

Current condition uses ANDs, so it only triggers when error is falsy. Use ORs to handle partial/missing shapes.

-  verificationErrorHandling(error): void {
-    if (!error && !error?.status && !error?.status?.message && !error?.status?.message?.error) {
+  verificationErrorHandling(error): void {
+    if (!error || !error?.status || !error?.status?.message || !error?.status?.message?.error) {
       throw new RpcException(error.response ? error.response : error);
     } else {
       throw new RpcException({
         message: error?.status?.message?.error?.reason
           ? error?.status?.message?.error?.reason
           : error?.status?.message?.error,
         statusCode: error?.status?.code
       });
     }
   }

513-540: Use else-if for mutually exclusive proof types to avoid accidental override of payload.

Prevents a future edit from accidentally executing both branches.

-      if (ProofRequestType.PRESENTATIONEXCHANGE === type) {
+      else if (ProofRequestType.PRESENTATIONEXCHANGE === type) {
         payload = {
           orgId: user.orgId,
           url,
           proofRequestPayload: {
             goalCode: outOfBandRequestProof.goalCode,

1043-1047: Drop unnecessary Promise.all over a synchronous increment.

This is synchronous work; a simple loop is clearer and cheaper.

-      await Promise.all(
-        deleteProofRecords.recordsToDelete.map(async (record) => {
-          statusCounts[record.state]++;
-        })
-      );
+      for (const record of deleteProofRecords.recordsToDelete) {
+        statusCounts[record.state]++;
+      }

680-687: Tighten the return type of _sendOutOfBandProofRequest.

The caller accesses response.invitationUrl/outOfBandRecord/proofRecordThId. Reflect that in the signature to reduce any-leaks.

-  async _sendOutOfBandProofRequest(payload: IProofRequestPayload): Promise<{
-    response;
-  }> {
+  async _sendOutOfBandProofRequest(payload: IProofRequestPayload): Promise<{
+    response: { invitationUrl: string; outOfBandRecord?: { id: string }; proofRecordThId?: string };
+  }> {

Alternatively, rely on the generic natsCall and pass a dedicated interface for the expected response.


964-977: Consider narrowing the type returned by _getOrgAgentApiKey.

If the NATS response is a string API key, type it accordingly and avoid any.

-      // eslint-disable-next-line @typescript-eslint/no-explicit-any
-      const message = await this.natsClient.send<any>(this.verificationServiceProxy, pattern, payload);
+      const message = await this.natsClient.send<string>(this.verificationServiceProxy, pattern, payload);

Please confirm the actual response shape of cmd 'get-org-agent-api-key'.

libs/user-activity/repositories/index.ts (3)

50-55: Tighten txnMetadata typing to avoid using object.

Use a structural type to improve safety and autocompletion.

-    txnMetadata: object,
+    txnMetadata: Record<string, unknown>,

29-47: Guard and clamp limit to prevent invalid/abusive queries.

Negative, NaN, or very large limits can error or stress the DB.

   async getRecentActivities(userId: string, limit: number): Promise<IUsersActivity[]> {
-    return this.prisma.user_activity.findMany({
+    const safeLimit = Number.isFinite(limit) && limit > 0 ? Math.min(100, Math.trunc(limit)) : 20;
+    return this.prisma.user_activity.findMany({
       where: {
         userId
       },
       select: {
         id: true,
         userId: true,
         orgId: true,
         action: true,
         details: true,
         createDateTime: true,
         lastChangedDateTime: true
       },
       orderBy: {
         createDateTime: 'desc'
       },
-      take: limit
+      take: safeLimit
     });
   }

50-57: Public method naming: drop leading underscore.

This is a public API used across services; leading underscore suggests private. Consider renaming to orgDeletedActivity (follow-up change across call sites).

apps/api-gateway/src/verification/verification.service.ts (2)

132-140: Same here: drop .toPromise(), use lastValueFrom, and remove unused ESLint disable.

Keeps behavior while future‑proofing for RxJS 8.

Apply:

-      // eslint-disable-next-line @typescript-eslint/no-explicit-any
-      const message = await this.verificationServiceProxy.send(pattern, payload).toPromise();
-      return message;
+      const message = await lastValueFrom(this.verificationServiceProxy.send(pattern, payload));
+      return message;

Consider standardizing via NATSClient:

return this.natsClient.sendNatsMessage(this.verificationServiceProxy, 'post-webhook-response-to-webhook-url', payload);

118-126: Replace deprecated .toPromise() with lastValueFrom and remove ESLint disable

Repo uses rxjs ^7.8.1 (toPromise deprecated but present) — switch to lastValueFrom to future-proof and drop the needless eslint-disable.

Apply:

-      // eslint-disable-next-line @typescript-eslint/no-explicit-any
-      const message = await this.verificationServiceProxy.send(pattern, payload).toPromise();
-      return message;
+      const message = await lastValueFrom(this.verificationServiceProxy.send(pattern, payload));
+      return message;

Add import:

import { lastValueFrom } from 'rxjs';

Optional: for consistency with this service, consider using the existing NATSClient wrapper instead:

return this.natsClient.sendNatsMessage(this.verificationServiceProxy, 'get-webhookurl', payload);
apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts (8)

28-35: Document enum in Swagger and tighten type for sortField

Adds accurate Swagger docs and compile-time safety.

   @ApiProperty({
-    required: false
+    required: false,
+    enum: SortFields
   })
   @Transform(({ value }) => trim(value))
   @IsOptional()
   @IsEnum(SortFields)
-  sortField: string = SortFields.CREATED_DATE_TIME;
+  sortField: SortFields = SortFields.CREATED_DATE_TIME;

36-43: Optional: type sortBy to the enum

Keeps DTOs consistent and type-safe.

-  sortBy: string = SortValue.DESC;
+  sortBy: SortValue = SortValue.DESC;

59-63: Normalize search text (trim) for consistency with other DTOs

Other DTOs trim search text; mirror that here.

   @ApiProperty({ required: false })
   @IsOptional()
+  @Transform(({ value }) => trim(value))
   @Type(() => String)
   searchByText: string = '';

72-79: Optional: type sortBy to SortValue

Consistency with other DTOs.

-  sortBy: string = SortValue.DESC;
+  sortBy: SortValue = SortValue.DESC;

87-93: Avoid duplicate Swagger decorators on ledgerId

Use ApiPropertyOptional with example directly.

-  @ApiProperty({ example: '1a7eac11-ff05-40d7-8351-4d7467687cad' })
-  @ApiPropertyOptional()
+  @ApiPropertyOptional({ example: '1a7eac11-ff05-40d7-8351-4d7467687cad' })

100-104: Normalize search text (trim) for platform DTO

Aligns with other DTOs.

   @ApiProperty({ required: false })
   @IsOptional()
+  @Transform(({ value }) => trim(value))
   @Type(() => String)
   searchByText: string = '';

111-118: Document enum and tighten type for sorting; consider naming consistency

Improves Swagger and typing; consider aligning property name with sortField used elsewhere.

   @ApiProperty({
-    required: false
+    required: false,
+    enum: SortFields
   })
   @Transform(({ value }) => trim(value))
   @IsOptional()
   @IsEnum(SortFields)
-  sorting: string = SortFields.CREATED_DATE_TIME;
+  sorting: SortFields = SortFields.CREATED_DATE_TIME;

119-121: Add validation and enum docs for sortByValue

Currently unvalidated and not documented as enum.

-  @ApiProperty({ required: false })
-  @IsOptional()
-  sortByValue: string = SortValue.DESC;
+  @ApiProperty({ enum: [SortValue.DESC, SortValue.ASC], required: false })
+  @Transform(({ value }) => trim(value))
+  @IsOptional()
+  @IsEnum(SortValue)
+  sortByValue: SortValue = SortValue.DESC;
apps/api-gateway/src/fido/fido.service.ts (3)

21-27: Prefer HttpException mapping for HTTP layer consistency (avoid RpcException here).

Align error handling with AuthzService so controllers get proper HTTP status codes.

Apply this diff:

-import { RpcException } from '@nestjs/microservices';
+import { RpcException } from '@nestjs/microservices';
+import { HttpException, HttpStatus } from '@nestjs/common';
@@
   async generateRegistrationOption(deviceFlag: boolean, email: string): Promise<{ response: object }> {
     try {
       const payload = { deviceFlag, email };
       return await this.natsClient.sendNats(this.fidoServiceProxy, 'generate-registration-options', payload);
     } catch (error) {
-      throw new RpcException(error.response);
+      if (error?.status && error?.response) {
+        throw new HttpException(error.response, error.status);
+      }
+      throw new HttpException(error?.message ?? 'Internal error', HttpStatus.INTERNAL_SERVER_ERROR);
     }
   }

14-19: Optional typing: annotate the injected proxy to avoid implicit any.

If strict mode is enabled, consider adding a minimal interface or unknown and narrowing within NATSClient.

Example:

-  constructor(
-    @Inject('NATS_CLIENT') private readonly fidoServiceProxy,
+  constructor(
+    @Inject('NATS_CLIENT') private readonly fidoServiceProxy: unknown,
     private readonly natsClient: NATSClient
   ) {

23-23: Unify NATS helpers — sendNats and sendNatsMessage differ

  • sendNats(...) wraps the broker reply into { response } and uses .toPromise(); sendNatsMessage(...) returns the raw reply via firstValueFrom (send also returns raw).
  • Action: pick one API and standardize. Recommended: use the raw-returning helper (send/sendNatsMessage), update callers that expect .response (or make sendNatsMessage return the wrapper), and replace .toPromise() with firstValueFrom for consistency.

Locations: libs/common/src/NATSClient.ts (sendNats / sendNatsMessage / send); affected callers include apps/api-gateway/src/fido/fido.service.ts and apps/api-gateway/src/issuance/issuance.service.ts.

apps/api-gateway/src/authz/authz.service.ts (1)

28-29: Optional typing: annotate the injected proxy to avoid implicit any.

Keeps strict typing clean without changing behavior.

-  constructor(
-    @Inject('NATS_CLIENT') private readonly authServiceProxy,
+  constructor(
+    @Inject('NATS_CLIENT') private readonly authServiceProxy: unknown,
     private readonly natsClient: NATSClient
   ) {
apps/api-gateway/src/utilities/utilities.service.ts (2)

12-12: Fix logger name to avoid misleading logs.

Constructor passes 'OrganizationService' to BaseService in UtilitiesService.

Apply this diff:

-    super('OrganizationService');
+    super('UtilitiesService');

8-11: Optional typing: annotate the injected proxy.

Same pattern as other services; add a non-any type if strict mode is on.

-  constructor(
-    @Inject('NATS_CLIENT') private readonly serviceProxy,
+  constructor(
+    @Inject('NATS_CLIENT') private readonly serviceProxy: unknown,
     private readonly natsClient: NATSClient
   ) {
libs/common/package.json (1)

19-21: Move @nestjs/testing to devDependencies.

This is a test-only package and shouldn’t be in runtime deps.

   "dependencies": {
-    "@nestjs/axios": "catalog:",
-    "@nestjs/common": "catalog:",
-    "@nestjs/core": "catalog:",
-    "@nestjs/testing": "catalog:",
-    "@nestjs/microservices": "catalog:",
-    "@nestjs/swagger": "catalog:",
+    "@nestjs/axios": "catalog:",
+    "@nestjs/common": "catalog:",
+    "@nestjs/core": "catalog:",
+    "@nestjs/microservices": "catalog:",
+    "@nestjs/swagger": "catalog:",
@@
-  "devDependencies": {
+  "devDependencies": {
+    "@nestjs/testing": "catalog:",

Also applies to: 32-37

apps/api-gateway/src/revocation/revocation.service.ts (1)

13-15: Optional typing: annotate the injected proxy.

Keeps strict typing clean; mirrors other services.

-  constructor(
-    @Inject('NATS_CLIENT') private readonly revocationServiceProxy,
+  constructor(
+    @Inject('NATS_CLIENT') private readonly revocationServiceProxy: unknown,
     private readonly natsClient: NATSClient
   ) {
apps/api-gateway/src/webhook/webhook.controller.ts (1)

70-78: Return the BadRequestException from exceptionFactory (don’t throw inside).

Throwing inside exceptionFactory is unconventional; return the exception instance so Nest can throw it.

Apply this diff:

-      new ParseUUIDPipe({
-        exceptionFactory: (): Error => {
-          throw new BadRequestException(ResponseMessages.organisation.error.invalidOrgId);
-        }
-      })
+      new ParseUUIDPipe({
+        exceptionFactory: () =>
+          new BadRequestException(ResponseMessages.organisation.error.invalidOrgId)
+      })
apps/api-gateway/src/fido/fido.controller.ts (1)

162-175: Swagger status mismatch: decorator says 201, handler returns 200.

Align to 200 OK (or change handler to 201). Suggest 200 for “options” reads.

Apply this diff:

-  @ApiResponse({ status: HttpStatus.CREATED, description: 'Success', type: ApiResponseDto })
+  @ApiResponse({ status: HttpStatus.OK, description: 'Success', type: ApiResponseDto })
@@
-    const finalResponse: IResponseType = {
-      statusCode: HttpStatus.OK,
+    const finalResponse: IResponseType = {
+      statusCode: HttpStatus.OK,
apps/api-gateway/src/connection/connection.service.ts (1)

23-26: Type the injected proxy (optional).

Keeping this untyped promotes ‘any’ through call sites. Consider typing as ClientProxy.

Example:

import { ClientProxy } from '@nestjs/microservices';
// ...
constructor(@Inject('NATS_CLIENT') private readonly connectionServiceProxy: ClientProxy, private readonly natsClient: NATSClient) { ... }
apps/agent-service/src/agent-service.service.ts (1)

2063-2077: Simplify natsCall and drop toPromise().

Use await on the Promise returned by NATSClient; mapping is trivial.

Apply this diff:

-    try {
-      return from(this.natsClient.send<string>(this.agentServiceProxy, pattern, payload))
-        .pipe(map((response) => ({ response })))
-        .toPromise()
-        .catch((error) => {
-          this.logger.error(`catch: ${JSON.stringify(error)}`);
-          throw new HttpException(
-            {
-              status: error.statusCode,
-              error: error.message
-            },
-            error.error
-          );
-        });
-    } catch (error) {
+    try {
+      const response = await this.natsClient.send<string>(this.agentServiceProxy, pattern, payload);
+      return { response };
+    } catch (error) {
       this.logger.error(`[natsCall] - error in nats call : ${JSON.stringify(error)}`);
       throw error;
     }
apps/api-gateway/src/notification/notification.service.ts (1)

9-14: Avoid implicit any on injected proxy

Explicitly type the injected proxy (even as any) to preserve type-safety and avoid noImplicitAny failures.

Apply this diff:

-  constructor(
-    @Inject('NATS_CLIENT') private readonly serviceProxy,
-    private readonly natsClient: NATSClient
-  ) {
+  constructor(
+    // eslint-disable-next-line @typescript-eslint/no-explicit-any
+    @Inject('NATS_CLIENT') private readonly serviceProxy: any,
+    private readonly natsClient: NATSClient
+  ) {
apps/connection/src/connection.service.ts (1)

40-40: Avoid implicit any on injected proxy

Add an explicit type (at least any) to the injected NATS proxy.

-    @Inject('NATS_CLIENT') private readonly connectionServiceProxy,
+    // eslint-disable-next-line @typescript-eslint/no-explicit-any
+    @Inject('NATS_CLIENT') private readonly connectionServiceProxy: any,
apps/api-gateway/src/agent-service/agent-service.service.ts (1)

16-16: Avoid implicit any on injected proxy

Keep an explicit type for agentServiceProxy (even any) to avoid losing type checks.

-    @Inject('NATS_CLIENT') private readonly agentServiceProxy,
+    // eslint-disable-next-line @typescript-eslint/no-explicit-any
+    @Inject('NATS_CLIENT') private readonly agentServiceProxy: any,
apps/ledger/src/schema/schema.service.ts (1)

65-65: Avoid implicit any on injected proxy

Add an explicit type for schemaServiceProxy to avoid implicit any.

-    @Inject('NATS_CLIENT') private readonly schemaServiceProxy,
+    // eslint-disable-next-line @typescript-eslint/no-explicit-any
+    @Inject('NATS_CLIENT') private readonly schemaServiceProxy: any,
apps/api-gateway/src/credential-definition/credential-definition.controller.ts (2)

59-66: Use 200 OK for GET ApiResponse

GET should document 200 OK, not 201 CREATED.

-  @ApiResponse({ status: HttpStatus.CREATED, description: 'Success', type: ApiResponseDto })
+  @ApiResponse({ status: HttpStatus.OK, description: 'Success', type: ApiResponseDto })

85-96: Fix route typo: /verifiation/verification

The path has a typo that will affect routing.

-  @Get('/verifiation/cred-defs/:schemaId')
+  @Get('/verification/cred-defs/:schemaId')
apps/api-gateway/src/schema/schema.service.ts (1)

20-24: Avoid implicit any on injected proxy

Add a type to schemaServiceProxy to avoid implicit any.

-  constructor(
-    @Inject('NATS_CLIENT') private readonly schemaServiceProxy,
-    private readonly natsClient: NATSClient
-  ) {
+  constructor(
+    // eslint-disable-next-line @typescript-eslint/no-explicit-any
+    @Inject('NATS_CLIENT') private readonly schemaServiceProxy: any,
+    private readonly natsClient: NATSClient
+  ) {
apps/api-gateway/src/organization/organization.service.ts (1)

30-30: Avoid implicit any on injected proxy

Keep an explicit type on serviceProxy.

-    @Inject('NATS_CLIENT') private readonly serviceProxy,
+    // eslint-disable-next-line @typescript-eslint/no-explicit-any
+    @Inject('NATS_CLIENT') private readonly serviceProxy: any,
apps/issuance/src/issuance.service.ts (2)

101-101: Avoid implicit any on injected proxy

Type the injected proxy to avoid implicit any.

-    @Inject('NATS_CLIENT') private readonly issuanceServiceProxy,
+    // eslint-disable-next-line @typescript-eslint/no-explicit-any
+    @Inject('NATS_CLIENT') private readonly issuanceServiceProxy: any,

527-527: Unify NATS calls and add timeout handling

Prefer using the NATSClient wrapper consistently (it likely centralizes timeouts/retries). Also avoid Observable + toPromise; use async/await.

-        .send(pattern, payload)
-        .pipe(
-          map((response) => ({
-            response
-          }))
-        )
-        .toPromise()
+        .send(pattern, payload)
+        .pipe(map((response) => ({ response })))
+        .toPromise()

Or, better, route through NATSClient:

-      return this.issuanceServiceProxy
-        .send(pattern, payload)
-        .pipe(map((response) => ({ response })))
-        .toPromise()
+      const resp = await this.natsClient.send(this.issuanceServiceProxy, pattern, payload);
+      return { response: resp };
apps/api-gateway/src/credential-definition/credential-definition.service.ts (2)

13-15: Retain a concrete type for the injected NATS proxy.

Dropping the explicit type weakens type-safety and IDE support. Consider typing this as ClientProxy (or a thin interface) for compile-time checks.

+import { ClientProxy } from '@nestjs/microservices';
 ...
-  constructor(
-    @Inject('NATS_CLIENT') private readonly credDefServiceProxy,
-    private readonly natsClient: NATSClient
-  ) {
+  constructor(
+    @Inject('NATS_CLIENT') private readonly credDefServiceProxy: ClientProxy,
+    private readonly natsClient: NATSClient
+  ) {

24-27: Strongly type the return as ICredDef instead of object.

The method fetches one credential definition; prefer ICredDef over object to preserve API guarantees.

-  getCredentialDefinitionById(credentialDefinitionId: string, orgId: string): Promise<object> {
+  getCredentialDefinitionById(credentialDefinitionId: string, orgId: string): Promise<ICredDef> {
     const payload = { credentialDefinitionId, orgId };
     return this.natsClient.sendNatsMessage(this.credDefServiceProxy, 'get-credential-definition-by-id', payload);
   }
apps/api-gateway/src/schema/schema.controller.ts (3)

77-79: Validate orgId with ParseUUIDPipe for consistency.

Other endpoints validate orgId; apply the same here to avoid inconsistent input handling.

-    @Param('orgId') orgId: string,
+    @Param(
+      'orgId',
+      new ParseUUIDPipe({
+        exceptionFactory: (): Error => {
+          throw new BadRequestException(ResponseMessages.organisation.error.invalidOrgId);
+        }
+      })
+    )
+    orgId: string,

95-106: Fix minor typos in API descriptions.

“Retrives” → “Retrieves”. Improves API docs polish.

-    description: 'Retrives credential definition list by schema Id available on platform.'
+    description: 'Retrieves credential definition list by schema Id available on platform.'

116-129: Rename handler to follow camelCase and fix double f.

Method name “getcredDeffListBySchemaId” is inconsistent; prefer “getCredDefListBySchemaId”. No route changes.

-  async getcredDeffListBySchemaId(
+  async getCredDefListBySchemaId(
 ...
-    const credentialDefinitionList = await this.appService.getcredDefListBySchemaId(
+    const credentialDefinitionList = await this.appService.getcredDefListBySchemaId(
apps/cloud-wallet/src/cloud-wallet.service.ts (1)

48-52: Remove unused injected proxy from constructor.

cloudWalletServiceProxy is never used in this service; drop it to avoid dead dependencies.

 export class CloudWalletService {
   constructor(
     private readonly commonService: CommonService,
-    @Inject('NATS_CLIENT') private readonly cloudWalletServiceProxy,
     private readonly cloudWalletRepository: CloudWalletRepository,
     private readonly logger: Logger,
     @Inject(CACHE_MANAGER) private cacheService: Cache
   ) {}
apps/api-gateway/src/cloud-wallet/cloud-wallet.service.ts (2)

30-33: Keep the proxy typed for safer NATS usage.

Type the injected proxy as ClientProxy (or a minimal interface) for better editor support and compile-time checks.

+import { ClientProxy } from '@nestjs/microservices';
 ...
-  constructor(
-    @Inject('NATS_CLIENT') private readonly cloudWalletServiceProxy,
-    private readonly natsClient: NATSClient
-  ) {
+  constructor(
+    @Inject('NATS_CLIENT') private readonly cloudWalletServiceProxy: ClientProxy,
+    private readonly natsClient: NATSClient
+  ) {

100-113: Method names: prefer consistent camelCase (optional).

Consider getConnectionById/getAllConnectionsById for readability.

apps/api-gateway/src/organization/organization.controller.ts (1)

579-589: Align documented status with actual response (201 vs 200).

ApiResponse states 200 OK, but you return 201 Created. Align for accurate Swagger.

-  @ApiResponse({ status: HttpStatus.OK, description: 'Success', type: ApiResponseDto })
+  @ApiResponse({ status: HttpStatus.CREATED, description: 'Success', type: ApiResponseDto })
apps/ledger/src/credential-definition/credential-definition.service.ts (3)

45-46: Consider adding null safety for the DID splitting logic.

The DID string splitting logic assumes a specific format but doesn't validate the structure before accessing array elements. This could cause runtime errors if the DID format is unexpected.

Apply this defensive programming approach:

-const did = credDef.orgDid?.split(':').length >= 4 ? credDef.orgDid : orgDid;
+const didParts = credDef.orgDid?.split(':');
+const did = didParts && didParts.length >= 4 ? credDef.orgDid : orgDid;

285-286: Fix error log message typo.

The error message incorrectly states "creating credential definition" when this method is actually retrieving one.

-this.logger.error(`Error in creating credential definition : ${JSON.stringify(error)}`);
+this.logger.error(`Error in getting credential definition : ${JSON.stringify(error)}`);

239-241: Add null safety for nested property access.

The code accesses credDefResponse.response.resolutionMetadata.error without checking if intermediate properties exist.

-if (credDefResponse.response.resolutionMetadata.error) {
+if (credDefResponse?.response?.resolutionMetadata?.error) {
apps/api-gateway/src/cloud-wallet/cloud-wallet.controller.ts (3)

427-447: Fix typo in method name.

The method name getconnectionById should follow camelCase convention as getConnectionById.

-async getconnectionById(
+async getConnectionById(

462-479: Fix typo in method name.

The method name getAllconnectionById is misleading and has incorrect casing. It should be getAllConnections since it's retrieving multiple connections, not a single one by ID.

-async getAllconnectionById(
+async getAllConnections(

77-101: Consider adding error handling for base wallet configuration.

The configureBaseWallet endpoint doesn't have try-catch error handling unlike other endpoints. Consider wrapping the service call for consistency.

async configureBaseWallet(
  @Res() res: Response,
  @Body() cloudBaseWalletConfigure: CloudBaseWalletConfigureDto,
  @User() user: user
): Promise<Response> {
  const { id, email } = user;
  
  cloudBaseWalletConfigure.userId = id;
  cloudBaseWalletConfigure.email = email;
  
+ try {
    const configureBaseWalletData = await this.cloudWalletService.configureBaseWallet(cloudBaseWalletConfigure);
    const finalResponse: IResponse = {
      statusCode: HttpStatus.CREATED,
      message: ResponseMessages.cloudWallet.success.configureBaseWallet,
      data: configureBaseWalletData
    };
    return res.status(HttpStatus.CREATED).json(finalResponse);
+ } catch (error) {
+   this.logger.error(`Error in configureBaseWallet: ${JSON.stringify(error)}`);
+   throw error;
+ }
}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 277e96c and 2448baa.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (53)
  • apps/agent-service/src/agent-service.service.ts (1 hunks)
  • apps/api-gateway/src/agent-service/agent-service.controller.ts (1 hunks)
  • apps/api-gateway/src/agent-service/agent-service.service.ts (1 hunks)
  • apps/api-gateway/src/agent/agent.controller.ts (11 hunks)
  • apps/api-gateway/src/agent/agent.service.ts (1 hunks)
  • apps/api-gateway/src/app.module.ts (1 hunks)
  • apps/api-gateway/src/app.service.ts (1 hunks)
  • apps/api-gateway/src/authz/authz.controller.ts (2 hunks)
  • apps/api-gateway/src/authz/authz.service.ts (1 hunks)
  • apps/api-gateway/src/cloud-wallet/cloud-wallet.controller.ts (2 hunks)
  • apps/api-gateway/src/cloud-wallet/cloud-wallet.service.ts (1 hunks)
  • apps/api-gateway/src/connection/connection.controller.ts (8 hunks)
  • apps/api-gateway/src/connection/connection.service.ts (3 hunks)
  • apps/api-gateway/src/credential-definition/credential-definition.controller.ts (10 hunks)
  • apps/api-gateway/src/credential-definition/credential-definition.service.ts (2 hunks)
  • apps/api-gateway/src/dtos/save-roles-permissions.dto.ts (1 hunks)
  • apps/api-gateway/src/fido/fido.controller.ts (2 hunks)
  • apps/api-gateway/src/fido/fido.service.ts (1 hunks)
  • apps/api-gateway/src/geo-location/geo-location.service.ts (1 hunks)
  • apps/api-gateway/src/issuance/issuance.controller.ts (2 hunks)
  • apps/api-gateway/src/issuance/issuance.service.ts (0 hunks)
  • apps/api-gateway/src/main.ts (1 hunks)
  • apps/api-gateway/src/notification/notification.controller.ts (2 hunks)
  • apps/api-gateway/src/notification/notification.service.ts (1 hunks)
  • apps/api-gateway/src/organization/organization.controller.ts (1 hunks)
  • apps/api-gateway/src/organization/organization.service.ts (1 hunks)
  • apps/api-gateway/src/platform/platform.service.ts (1 hunks)
  • apps/api-gateway/src/revocation/revocation.service.ts (2 hunks)
  • apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts (1 hunks)
  • apps/api-gateway/src/schema/schema.controller.ts (8 hunks)
  • apps/api-gateway/src/schema/schema.service.ts (3 hunks)
  • apps/api-gateway/src/user/user.controller.ts (1 hunks)
  • apps/api-gateway/src/user/user.service.ts (1 hunks)
  • apps/api-gateway/src/utilities/utilities.controller.ts (3 hunks)
  • apps/api-gateway/src/utilities/utilities.service.ts (2 hunks)
  • apps/api-gateway/src/verification/verification.controller.ts (9 hunks)
  • apps/api-gateway/src/verification/verification.service.ts (3 hunks)
  • apps/api-gateway/src/webhook/webhook.controller.ts (3 hunks)
  • apps/api-gateway/src/webhook/webhook.service.ts (1 hunks)
  • apps/cloud-wallet/src/cloud-wallet.service.ts (1 hunks)
  • apps/connection/src/connection.service.ts (2 hunks)
  • apps/issuance/src/issuance.service.ts (3 hunks)
  • apps/ledger/src/credential-definition/credential-definition.service.ts (4 hunks)
  • apps/ledger/src/schema/schema.service.ts (2 hunks)
  • apps/organization/src/organization.service.ts (4 hunks)
  • apps/user/src/user.service.ts (1 hunks)
  • apps/verification/src/verification.service.ts (2 hunks)
  • libs/aws/package.json (1 hunks)
  • libs/common/package.json (1 hunks)
  • libs/common/src/NATSClient.ts (4 hunks)
  • libs/user-activity/repositories/index.ts (1 hunks)
  • package.json (3 hunks)
  • pnpm-workspace.yaml (1 hunks)
💤 Files with no reviewable changes (1)
  • apps/api-gateway/src/issuance/issuance.service.ts
🧰 Additional context used
🧬 Code graph analysis (20)
apps/api-gateway/src/agent/agent.controller.ts (2)
apps/api-gateway/src/dtos/wallet-details.dto.ts (1)
  • WalletDetailsDto (3-17)
apps/agent-service/src/interface/agent-service.interface.ts (1)
  • IUserRequestInterface (237-250)
apps/api-gateway/src/credential-definition/credential-definition.controller.ts (4)
apps/api-gateway/src/agent-service/agent-service.controller.ts (1)
  • UseFilters (54-449)
apps/api-gateway/src/organization/organization.controller.ts (1)
  • UseFilters (58-792)
apps/api-gateway/src/schema/schema.controller.ts (1)
  • UseFilters (50-262)
libs/common/src/response-messages/index.ts (1)
  • ResponseMessages (1-518)
apps/api-gateway/src/schema/schema.controller.ts (6)
libs/common/src/cast.helper.ts (1)
  • TrimStringParamPipe (167-172)
libs/common/src/response-messages/index.ts (1)
  • ResponseMessages (1-518)
apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts (1)
  • GetCredentialDefinitionBySchemaIdDto (46-84)
apps/api-gateway/src/schema/interfaces/index.ts (1)
  • IUserRequestInterface (3-16)
libs/common/src/interfaces/response.interface.ts (1)
  • IResponse (8-13)
apps/api-gateway/src/schema/dtos/update-schema-dto.ts (1)
  • UpdateSchemaDto (5-23)
apps/api-gateway/src/connection/connection.service.ts (4)
apps/issuance/src/issuance.service.ts (1)
  • Injectable (95-2074)
apps/verification/src/verification.service.ts (1)
  • Injectable (58-1071)
apps/webhook/src/webhook.service.ts (1)
  • Injectable (17-113)
libs/service/base.service.ts (1)
  • BaseService (2-9)
apps/api-gateway/src/cloud-wallet/cloud-wallet.service.ts (3)
apps/api-gateway/src/agent-service/agent-service.service.ts (1)
  • Injectable (13-103)
libs/service/base.service.ts (1)
  • BaseService (2-9)
libs/common/src/interfaces/cloud-wallet.interface.ts (7)
  • ICloudBaseWalletConfigure (147-153)
  • IGetStoredWalletInfo (72-78)
  • IGetStoredWalletInfo (103-109)
  • IWalletDetailsForDidList (192-195)
  • IConnectionDetailsById (197-201)
  • GetAllCloudWalletConnections (311-319)
  • IBasicMessage (321-325)
apps/api-gateway/src/utilities/utilities.controller.ts (1)
apps/api-gateway/src/utilities/dtos/shortening-url.dto.ts (1)
  • StoreObjectDto (43-47)
apps/api-gateway/src/webhook/webhook.service.ts (2)
apps/webhook/interfaces/webhook.interfaces.ts (2)
  • IGetWebhookUrl (5-7)
  • ICreateWebhookUrl (1-3)
apps/api-gateway/src/webhook/dtos/register-webhook-dto.ts (1)
  • RegisterWebhookDto (6-16)
apps/api-gateway/src/fido/fido.service.ts (3)
apps/api-gateway/src/agent-service/agent-service.service.ts (1)
  • Injectable (13-103)
libs/service/base.service.ts (1)
  • BaseService (2-9)
apps/api-gateway/src/dtos/fido-user.dto.ts (4)
  • VerifyRegistrationDto (31-58)
  • GenerateAuthenticationDto (74-78)
  • VerifyAuthenticationDto (99-126)
  • UpdateFidoUserDetailsDto (60-72)
apps/api-gateway/src/notification/notification.service.ts (3)
apps/api-gateway/src/notification/dtos/notification.dto.ts (2)
  • RegisterOrgWebhhookEndpointDto (29-49)
  • SendNotificationDto (51-70)
apps/api-gateway/src/notification/interfaces/notification.interfaces.ts (1)
  • INotification (1-5)
apps/notification/interfaces/notification.interfaces.ts (1)
  • INotification (3-7)
apps/ledger/src/credential-definition/credential-definition.service.ts (4)
apps/ledger/src/credential-definition/interfaces/create-credential-definition.interface.ts (6)
  • CreateCredDefPayload (19-23)
  • CredDefPayload (35-49)
  • IPlatformCredDefs (25-33)
  • GetCredDefPayload (6-17)
  • GetAllCredDefsPayload (59-63)
  • GetCredDefBySchemaId (65-67)
apps/ledger/src/credential-definition/interfaces/credential-definition.interface.ts (3)
  • CreateCredDefAgentRedirection (1-12)
  • GetCredDefAgentRedirection (20-29)
  • CredDefSchema (35-38)
libs/common/src/interfaces/cred-def.interface.ts (2)
  • IPlatformCredDefsData (30-32)
  • ICredDefDetails (1-3)
libs/common/src/interfaces/schema.interface.ts (1)
  • ISchemaDetail (48-67)
apps/api-gateway/src/schema/schema.service.ts (4)
apps/api-gateway/src/schema/interfaces/index.ts (1)
  • IUserRequestInterface (3-16)
libs/common/src/interfaces/schema.interface.ts (3)
  • ISchemaData (14-16)
  • ISchemasWithPagination (10-12)
  • ICredDefWithPagination (82-84)
apps/api-gateway/src/interfaces/ISchemaSearch.interface.ts (1)
  • ISchemaSearchPayload (4-13)
apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts (1)
  • GetCredentialDefinitionBySchemaIdDto (46-84)
apps/api-gateway/src/credential-definition/credential-definition.service.ts (4)
apps/api-gateway/src/credential-definition/dto/create-cred-defs.dto.ts (1)
  • CreateCredentialDefinitionDto (6-33)
apps/api-gateway/src/credential-definition/interfaces/index.ts (3)
  • IUserRequestInterface (3-15)
  • ICredDef (42-52)
  • ICredDefs (54-57)
apps/ledger/src/credential-definition/interfaces/create-credential-definition.interface.ts (1)
  • GetAllCredDefsDto (51-58)
libs/common/src/interfaces/schema.interface.ts (1)
  • ICredDefData (74-80)
apps/api-gateway/src/agent/agent.service.ts (3)
apps/api-gateway/src/agent-service/agent-service.service.ts (1)
  • Injectable (13-103)
libs/service/base.service.ts (1)
  • BaseService (2-9)
apps/api-gateway/src/dtos/wallet-details.dto.ts (1)
  • WalletDetailsDto (3-17)
apps/api-gateway/src/connection/connection.controller.ts (2)
apps/api-gateway/src/connection/connection.service.ts (2)
  • receiveInvitationUrl (96-103)
  • receiveInvitation (105-112)
apps/connection/src/connection.service.ts (2)
  • receiveInvitationUrl (333-367)
  • receiveInvitation (393-420)
apps/api-gateway/src/fido/fido.controller.ts (7)
libs/logger/src/logger.interface.ts (1)
  • Logger (6-20)
apps/api-gateway/src/authz/decorators/roles.decorator.ts (1)
  • Roles (6-6)
apps/api-gateway/src/fido/dto/fido-user.dto.ts (7)
  • Response (40-44)
  • Response (77-82)
  • GenerateRegistrationDto (5-15)
  • VerifyRegistrationDto (17-38)
  • GenerateAuthenticationDto (100-103)
  • VerifyAuthenticationDto (54-75)
  • UpdateFidoUserDetailsDto (88-98)
libs/common/src/interfaces/response.interface.ts (1)
  • IResponseType (1-7)
libs/common/src/response-messages/index.ts (1)
  • ResponseMessages (1-518)
apps/api-gateway/src/dtos/fido-user.dto.ts (5)
  • GenerateRegistrationDto (4-10)
  • VerifyRegistrationDto (31-58)
  • GenerateAuthenticationDto (74-78)
  • VerifyAuthenticationDto (99-126)
  • UpdateFidoUserDetailsDto (60-72)
apps/api-gateway/src/fido/fido.service.ts (2)
  • verifyRegistration (29-32)
  • verifyAuthentication (40-46)
apps/api-gateway/src/cloud-wallet/cloud-wallet.controller.ts (5)
apps/api-gateway/src/cloud-wallet/dtos/configure-base-wallet.dto.ts (1)
  • CloudBaseWalletConfigureDto (6-26)
apps/api-gateway/src/cloud-wallet/dtos/cloudWallet.dto.ts (7)
  • CreateCloudWalletDto (7-27)
  • ReceiveInvitationUrlDTO (29-96)
  • AcceptOfferDto (98-121)
  • CreateCloudWalletDidDto (123-192)
  • GetAllCloudWalletConnectionsDto (218-252)
  • CredentialListDto (194-216)
  • BasicMessageDTO (254-266)
apps/cloud-wallet/src/cloud-wallet.service.ts (3)
  • acceptProofRequest (122-144)
  • acceptOffer (341-377)
  • createConnection (97-115)
apps/api-gateway/src/cloud-wallet/dtos/accept-proof-request.dto.ts (1)
  • AcceptProofRequestDto (4-29)
libs/common/src/interfaces/cloud-wallet.interface.ts (6)
  • IGetProofPresentationById (135-139)
  • IGetProofPresentation (141-145)
  • IWalletDetailsForDidList (192-195)
  • IConnectionDetailsById (197-201)
  • ICredentialDetails (211-215)
  • IBasicMessage (321-325)
apps/api-gateway/src/notification/notification.controller.ts (6)
apps/api-gateway/src/notification/dtos/notification.dto.ts (2)
  • RegisterOrgWebhhookEndpointDto (29-49)
  • SendNotificationDto (51-70)
libs/common/src/interfaces/response.interface.ts (1)
  • IResponse (8-13)
libs/common/src/response-messages/index.ts (1)
  • ResponseMessages (1-518)
apps/api-gateway/src/notification/notification.service.ts (1)
  • sendNotification (36-38)
apps/notification/src/notification.controller.ts (1)
  • sendNotification (26-28)
apps/notification/src/notification.service.ts (1)
  • sendNotification (43-77)
libs/user-activity/repositories/index.ts (6)
apps/issuance/src/issuance.service.ts (1)
  • Injectable (95-2074)
apps/organization/src/organization.service.ts (1)
  • Injectable (69-2032)
apps/agent-service/src/agent-service.service.ts (1)
  • Injectable (83-2092)
apps/verification/src/verification.service.ts (1)
  • Injectable (58-1071)
libs/user-activity/src/user-activity.service.ts (1)
  • Injectable (7-22)
libs/user-activity/interface/index.ts (1)
  • IUsersActivity (1-9)
apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts (1)
libs/common/src/cast.helper.ts (2)
  • trim (39-43)
  • toNumber (58-76)
apps/api-gateway/src/platform/platform.service.ts (5)
apps/api-gateway/src/interfaces/ISchemaSearch.interface.ts (2)
  • ISchemaSearchPayload (4-13)
  • ILedgers (27-39)
apps/agent-service/src/interface/agent-service.interface.ts (2)
  • IUserRequestInterface (237-250)
  • ILedgers (647-659)
libs/common/src/interfaces/schema.interface.ts (2)
  • ISchemaDetails (18-20)
  • INetworkUrl (91-93)
apps/api-gateway/src/credential-definition/dto/get-all-platform-cred-defs.dto.ts (1)
  • GetAllPlatformCredDefsDto (8-30)
libs/common/src/interfaces/cred-def.interface.ts (1)
  • IPlatformCredDefsData (30-32)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (10)
apps/api-gateway/src/agent/agent.service.ts (10)

14-19: Type the injected NATS client proxy to preserve type-safety and editor support

Keeping agentServiceProxy as ClientProxy avoids silent breakages and improves DX.

Apply this diff:

-  constructor(
-    @Inject('NATS_CLIENT') private readonly agentServiceProxy,
-    private readonly natsClient: NATSClient
-  ) {
+  constructor(
+    @Inject('NATS_CLIENT') private readonly agentServiceProxy: ClientProxy,
+    private readonly natsClient: NATSClient
+  ) {

Add the import (outside the selected lines):

import { ClientProxy } from '@nestjs/microservices';

27-31: Use debug level for routine traces; optionally add explicit return type

These are high-frequency calls; prefer debug to reduce log noise. Consider : Promise<unknown> for the return type.

-    this.logger.log('**** getAllDid called...');
+    this.logger.debug('**** getAllDid called...');

36-39: Demote to debug log for routine operation

Keeps info logs clean while retaining traceability.

-    this.logger.log('**** createLocalDid called...');
+    this.logger.debug('**** createLocalDid called...');

50-53: Use debug for routine trace

-    this.logger.log('**** getPublicDid called...');
+    this.logger.debug('**** getPublicDid called...');

65-76: Update JSDoc to match current params; consider aligning id type with assignPublicDid

The comment still mentions role/alias/verkey/did, but the method takes only id and user.

-  /**
-   * Description: Calling agent service for onboard-register-ledger
-   * @param role
-   * @param alias
-   * @param verkey
-   * @param did
-   */
+  /**
+   * Description: Calling agent service to register NYM for an org
+   * @param id Organization identifier
+   * @param user Requesting user context
+   */

Also verify whether id here should be number (like assignPublicDid) or string, and unify.


78-81: Narrow the action parameter to a union type

Prevents invalid inputs at compile time.

-  restartStopAgent(action: string, orgId: string) {
+  restartStopAgent(action: 'restart' | 'stop', orgId: string) {

83-85: Add parameter and return types for clarity

Minimal type annotations improve readability without changing behavior.

-  getAgentServerStatus(user) {
+  getAgentServerStatus(user: any): Promise<unknown> {

87-91: Use debug for heartbeat pings

These are frequent and not actionable at info level.

-    this.logger.log('**** pingServiceAgent called...');
+    this.logger.debug('**** pingServiceAgent called...');

93-104: Prefer a DTO for pagination/filter params; demote log level to debug

Passing many positional args is brittle; a DTO keeps it cohesive and future-proof. If snake_case is required by downstream, keep it within the DTO shape.

-    this.logger.log('**** agentSpinupStatus called...');
+    this.logger.debug('**** agentSpinupStatus called...');

Optional DTO example (outside diff):

export interface AgentSpinupStatusDto {
  items_per_page: number;
  page: number;
  search_text: string;
  agentStatus: string;
  sortValue: string;
  user: any;
}

Then: agentSpinupStatus(params: AgentSpinupStatusDto) { ... }

Confirm whether snake_case keys are required over the wire; if not, prefer camelCase locally and map on publish.


27-104: Extract NATS subject strings to a central constant/enum

Reduces typo risk across methods and eases future renames.

Example (outside diff):

export const AgentSubjects = {
  GET_ALL_DID: 'get-all-did',
  CREATE_LOCAL_DID: 'create-local-did',
  WALLET_PROVISION: 'wallet-provision',
  GET_PUBLIC_DID: 'get-public-did',
  ASSIGN_PUBLIC_DID_ORG: 'assign-public-did-org',
  REGISTER_NYM_ORG: 'register-nym-org',
  RESTART_STOP_AGENT: 'restart-stop-agent',
  GET_AGENT_SERVER_STATUS: 'get-agent-server-status',
  PING_AGENT: 'ping-agent',
  GET_AGENT_SPINUP_STATUS: 'get-agent-spinup-status'
} as const;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2448baa and 130e252.

📒 Files selected for processing (1)
  • apps/api-gateway/src/agent/agent.service.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
apps/api-gateway/src/agent/agent.service.ts (3)
apps/api-gateway/src/authz/authz.service.ts (1)
  • Injectable (22-109)
libs/service/base.service.ts (1)
  • BaseService (2-9)
apps/api-gateway/src/dtos/wallet-details.dto.ts (1)
  • WalletDetailsDto (3-17)
🔇 Additional comments (1)
apps/api-gateway/src/agent/agent.service.ts (1)

41-45: Drop unnecessary async and clarify safe log label (prior secret‑logging concern addressed)

No await is used; async is redundant. Also add a label to the wallet name in logs. Good job not logging sensitive fields.

-  async walletProvision(walletUserDetails: WalletDetailsDto, user: any) {
-    this.logger.log(`**** walletProvision called...${walletUserDetails.walletName}`);
+  walletProvision(walletUserDetails: WalletDetailsDto, user: any) {
+    this.logger.debug(`**** walletProvision called... walletName=${walletUserDetails.walletName}`);
     const payload = { walletUserDetails, user };
     return this.natsClient.sendNats(this.agentServiceProxy, 'wallet-provision', payload);
   }

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (9)
apps/cloud-wallet/src/cloud-wallet.controller.ts (1)

96-111: Inconsistent return type usage across endpoints.

Several methods still return generic Response types (lines 63, 68, 73, 83, 88, 93, 98, 103, 108) while getDidList was updated to use typed IProofRequestRes[]. For consistency and better type safety, consider updating the other endpoints to use appropriate typed interfaces.

Consider updating other endpoints to use typed return values similar to getDidList:

-async receiveInvitationByUrl(ReceiveInvitationDetails: IReceiveInvitation): Promise<Response> {
+async receiveInvitationByUrl(ReceiveInvitationDetails: IReceiveInvitation): Promise<IConnectionInvitationResponse> {

Apply similar changes to other methods based on their actual return data structures.

apps/api-gateway/src/connection/connection.service.ts (8)

24-27: Type the injected NATS client for safety.
Loosening to any loses generics and compile‑time checks on send(). Prefer ClientProxy.

Apply this change in the constructor:

-    @Inject('NATS_CLIENT') private readonly connectionServiceProxy,
+    @Inject('NATS_CLIENT') private readonly connectionServiceProxy: ClientProxy,

Add the import:

import { ClientProxy } from '@nestjs/microservices';

31-37: Harden error rethrow (error.response may be undefined).
Ensure a useful RpcException payload in all cases.

-    } catch (error) {
-      throw new RpcException(error.response);
-    }
+    } catch (error) {
+      throw new RpcException(error?.response ?? error?.message ?? error);
+    }

39-49: Align error handling with above.
Same concern in sendBasicMessage.

-    } catch (error) {
-      throw new RpcException(error.response);
-    }
+    } catch (error) {
+      throw new RpcException(error?.response ?? error?.message ?? error);
+    }

51-54: Prefer a concrete return type over Promise.
Consider defining/using a DTO or interface for the webhook response to keep the contract explicit.


93-95: Return type Promise — consider an explicit model.
Define a QuestionAnswersRecord interface for stronger contracts.


124-126: Avoid JSON.stringify(error) in logs.
Stringifying can throw on circular refs and loses stack. Prefer passing the error object.

-      this.logger.error(`catch: ${JSON.stringify(error)}`);
+      this.logger.error('catch', error);

137-139: Same logging concern here.
Use structured logging with the error object.

-      this.logger.error(`catch: ${JSON.stringify(error)}`);
+      this.logger.error('catch', error);

84-91: Unify duplicated user types: use a single IUserRequest across services.
I found both IUserRequest (libs/user-request/src/user-request.interface.ts) and IUserRequestInterface (apps/api-gateway/src/connection/interfaces/index.ts) with effectively the same fields; apps/api-gateway/src/connection/connection.service.ts imports/uses both — pick one canonical interface (recommend the shared libs/user-request) and update usages to avoid duplication and drift.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 130e252 and 62e850e.

📒 Files selected for processing (3)
  • apps/api-gateway/src/connection/connection.service.ts (3 hunks)
  • apps/cloud-wallet/src/cloud-wallet.controller.ts (4 hunks)
  • apps/cloud-wallet/src/cloud-wallet.service.ts (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
apps/cloud-wallet/src/cloud-wallet.controller.ts (1)
libs/common/src/interfaces/cloud-wallet.interface.ts (2)
  • IWalletDetailsForDidList (192-195)
  • IProofRequestRes (162-173)
apps/cloud-wallet/src/cloud-wallet.service.ts (1)
libs/common/src/interfaces/cloud-wallet.interface.ts (2)
  • IWalletDetailsForDidList (192-195)
  • IProofRequestRes (162-173)
🔇 Additional comments (12)
apps/cloud-wallet/src/cloud-wallet.controller.ts (2)

5-26: Import reorganization looks good.

The imports have been reorganized into a cleaner multi-line format. This improves readability without affecting functionality.


78-78: Return type change aligns with interface standards.

The change from generic Response to typed IProofRequestRes[] improves type safety and aligns with NestJS 11's enhanced typing capabilities. This matches the corresponding service implementation change.

apps/cloud-wallet/src/cloud-wallet.service.ts (4)

48-48: Constructor type loosening aligns with NestJS upgrade patterns.

The removal of explicit ClientProxy typing follows the broader pattern across this PR for NestJS version updates. This provides better flexibility with dependency injection while maintaining runtime type safety through the @Inject('NATS_CLIENT') decorator.


427-427: Return type improvement enhances type safety.

The change from Promise<Response> to Promise<IProofRequestRes[]> provides better type safety and aligns with the controller interface change.


436-436: Good defensive programming with nullish coalescing.

The use of nullish coalescing operator (?? []) ensures a consistent array return type even when the HTTP GET request returns null or undefined. This prevents potential runtime errors in consuming code.


427-442: Return type mismatch — confirm /dids response and use a DID-specific interface

IProofRequestRes (libs/common/src/interfaces/cloud-wallet.interface.ts) models proof requests but getDidList calls CommonConstants.URL_AGENT_GET_DID ('/dids') and no DID interface was found; confirm the agent actually returns IProofRequestRes[] — otherwise define an IDidRecord (or equivalent) and update signatures at apps/cloud-wallet/src/cloud-wallet.service.ts (getDidList), apps/cloud-wallet/src/cloud-wallet.controller.ts (getDidList), and apps/api-gateway/src/cloud-wallet/cloud-wallet.service.ts (getDidList).

apps/api-gateway/src/connection/connection.service.ts (6)

2-3: Nest imports look good.
No issues with these updates.


5-10: DTO imports consolidated — OK.
No concerns.


13-17: Interface imports — OK.
Looks consistent with usage below.


121-123: Replaced toPromise() with firstValueFrom — good fix.
This addresses the prior review note for RxJS 7+/Nest 11.


130-136: Replaced toPromise() with firstValueFrom — good fix (again).
Consistent with Nest 11/RxJS 7+.


56-65: getUrl: no change — sendNats already returns { response }
NATSClient.sendNats maps the reply into { response } (libs/common/src/NATSClient.ts), so getUrl's Promise<{ response: object }> matches the actual returned shape; the suggested wrapper is unnecessary.

Likely an incorrect or invalid review comment.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (12)
libs/common/src/common.service.ts (1)

180-188: Remove duplicate error handling condition.

Lines 170-178 and 180-188 contain identical error handling logic for RESP_ERR_HTTP_ECONNREFUSED. This duplication should be removed to improve code maintainability.

Apply this diff to remove the duplicate condition:

-    if (error.message.toString().includes(CommonConstants.RESP_ERR_HTTP_ECONNREFUSED)) {
-      throw new HttpException(
-        {
-          statusCode: HttpStatus.NOT_FOUND,
-          error: error.message
-        },
-        HttpStatus.NOT_FOUND
-      );
-    }
apps/issuance/src/issuance.service.ts (7)

88-90: Fix p-limit import to avoid runtime “is not a function”

p-limit has a default export. Importing with * as will break at runtime.

Apply:

-import * as pLimit from 'p-limit';
+import pLimit from 'p-limit';

692-699: Null-check before destructuring to prevent TypeError

agentDetails is destructured before the null check. If it’s undefined, this throws before your NotFoundException.

Apply:

-      const { agentEndPoint } = agentDetails;
-      if (!agentDetails) {
+      if (!agentDetails) {
         throw new NotFoundException(ResponseMessages.issuance.error.agentEndPointNotFound);
       }
+      const { agentEndPoint } = agentDetails;

378-385: Null-check before destructuring (same issue here)

Destructure agentDetails only after verifying it exists.

-      const { agentEndPoint, organisation } = agentDetails;
-
-      if (!agentDetails) {
+      if (!agentDetails) {
         throw new NotFoundException(ResponseMessages.issuance.error.agentEndPointNotFound);
       }
+      const { agentEndPoint, organisation } = agentDetails;

1264-1269: Papa Parse option name and email guard

  • Option should be transformHeader (camelCase).
  • Guard email_identifier before trim() to avoid NPE.
-      const parsedData = paParse(csvData, {
+      const parsedData = paParse(csvData, {
         header: true,
         skipEmptyLines: true,
-        transformheader: (header) => header.toLowerCase().replace('#', '').trim(),
+        transformHeader: (header) => header.toLowerCase().replace('#', '').trim(),
         complete: (results) => results.data
       });
…
-      const invalidEmails = parsedData.data.filter((entry) => !validateEmail(entry.email_identifier.trim()));
+      const invalidEmails = parsedData.data.filter((entry) =>
+        !validateEmail(String(entry?.email_identifier ?? '').trim())
+      );

Also applies to: 1280-1284


1358-1363: Fix bad null-check and guard optional fields during search

  • cachedData === undefined || null is always falsy when not undefined.
  • item.name may not exist; guard it.
-        if (cachedData === undefined || null) {
+        if (cachedData === undefined || cachedData === null) {
           throw new BadRequestException(ResponseMessages.issuance.error.previewCachedData);
         }
…
-          filteredData = parsedData.filter(
-            (item) =>
-              item.email_identifier.toLowerCase().includes(searchTerm) || item.name.toLowerCase().includes(searchTerm)
-          );
+          filteredData = parsedData.filter((item) => {
+            const email = String(item?.email_identifier ?? '').toLowerCase();
+            const name = String(item?.name ?? '').toLowerCase();
+            return email.includes(searchTerm) || name.includes(searchTerm);
+          });

Also applies to: 1367-1371


1591-1595: Wrong argument order: passing requestId where orgId is expected

This will break ledger/agent lookups inside uploadCSVTemplate.

-        await this.uploadCSVTemplate(reqPayload, requestId);
+        await this.uploadCSVTemplate(reqPayload, orgId, requestId);

527-544: Replace deprecated toPromise with firstValueFrom and add try/catch

toPromise is deprecated. Use firstValueFrom for RxJS 7+.

-      return this.issuanceServiceProxy
-        .send(pattern, payload)
-        .pipe(
-          map((response) => ({
-            response
-          }))
-        )
-        .toPromise()
-        .catch((error) => {
-          this.logger.error(`catch: ${JSON.stringify(error)}`);
-          throw new HttpException(
-            {
-              status: error.statusCode,
-              error: error.message
-            },
-            error.error
-          );
-        });
+      try {
+        const response = await firstValueFrom(
+          this.issuanceServiceProxy.send(pattern, payload)
+        );
+        return { response };
+      } catch (error) {
+        this.logger.error(`catch: ${JSON.stringify(error)}`);
+        throw new HttpException(
+          { status: error.statusCode, error: error.message },
+          error.statusCode ?? HttpStatus.INTERNAL_SERVER_ERROR
+        );
+      }

Also update imports:

-import { map } from 'rxjs';
+import { firstValueFrom } from 'rxjs';
apps/connection/src/connection.service.ts (4)

189-197: Null-check before destructuring to prevent TypeError

These blocks destructure agentDetails before verifying it exists.

Example fix pattern (apply to each occurrence):

-      const { agentEndPoint } = agentDetails;
-      if (!agentDetails) {
+      if (!agentDetails) {
         throw new NotFoundException(ResponseMessages.issuance.error.agentEndPointNotFound);
       }
+      const { agentEndPoint } = agentDetails;

Also applies to: 255-261, 280-286, 339-345, 399-405, 444-449, 712-718


632-649: Use firstValueFrom instead of toPromise for RxJS

Modernize natsCall and avoid chained .catch() on the Promise.

-      return from(this.natsClient.send<string>(this.connectionServiceProxy, pattern, payload))
-        .pipe(
-          map((response) => ({
-            response
-          }))
-        )
-        .toPromise()
-        .catch((error) => {
-          this.logger.error(`catch: ${JSON.stringify(error)}`);
-          throw new HttpException(
-            {
-              status: error.statusCode,
-              error: error.message
-            },
-            error.error
-          );
-        });
+      try {
+        const response = await firstValueFrom(
+          from(this.natsClient.send<string>(this.connectionServiceProxy, pattern, payload))
+        );
+        return { response };
+      } catch (error) {
+        this.logger.error(`catch: ${JSON.stringify(error)}`);
+        throw new HttpException(
+          { status: error.statusCode, error: error.message },
+          error?.statusCode ?? HttpStatus.INTERNAL_SERVER_ERROR
+        );
+      }

And update imports:

-import { from, map } from 'rxjs';
+import { from, firstValueFrom } from 'rxjs';

287-289: Return normalized response shape

_getQuestionAnswersRecord returns { response }. Expose the response for callers.

-      const record = await this._getQuestionAnswersRecord(url, orgId);
-      return record;
+      const record = await this._getQuestionAnswersRecord(url, orgId);
+      return record.response;

118-126: Fix getUrl: return stored invitation URL (not referenceId)

getShorteningUrl returns a shortening_url record (schema stores invitationPayload as JSON; there is no url column). getUrl currently returns urlDetails.referenceId — that returns the key, not the invitation URL. Either return the actual invitation URL (e.g. urlDetails.invitationPayload or the URL field inside it) and adjust the return type/docstring, or change the documentation/signature to explicitly return the referenceId.

Locations:

  • apps/connection/src/connection.service.ts — getUrl (returns referenceId)
  • apps/connection/src/connection.repository.ts — getShorteningUrl (returns shortening_url)
  • libs/prisma-service/prisma/schema.prisma — model shortening_url (invitationPayload present; url column removed)
🧹 Nitpick comments (9)
libs/common/src/common.service.ts (1)

27-36: Migrate deprecated .toPromise()firstValueFrom / lastValueFrom

Repo contains many .toPromise() calls and package.json shows "rxjs": "^7.8.1" (toPromise is deprecated in RxJS v7 and removed in v8). Replace patterns like:

  • await observable.toPromise() → await firstValueFrom(observable) (preferred for single-emission observables such as HttpService and ClientProxy.send)
  • use lastValueFrom(observable) only if you need the last emission after completion

Representative affected files: libs/common/src/common.service.ts, libs/common/src/NATSClient.ts, apps/api-gateway/, apps/organization/, apps/ledger/, apps/agent-service/, apps/issuance/, apps/connection/, apps/user/, apps/verification/

apps/issuance/src/issuance.service.ts (3)

504-511: HttpException status should be numeric

error.error may be a message, not a status code. Use a safe fallback.

-          throw new HttpException(
-            {
-              status: error.statusCode,
-              error: error.message
-            },
-            error.error
-          );
+          throw new HttpException(
+            { status: error.statusCode, error: error.message },
+            error?.statusCode ?? HttpStatus.INTERNAL_SERVER_ERROR
+          );

If upstream guarantees a numeric error.error, confirm and ignore this.


1491-1535: p-limit usage here is a no-op

limit(() => job) just returns objects; no async work is being limited. Either remove p-limit here or apply it where actual async occurs (e.g., chunking addBulk or upstream writes).


1810-1848: Socket created but never closed

io(...) returns synchronously; await is unnecessary and the socket isn’t disconnected, which can leak connections.

-        const socket = await io(`${process.env.SOCKET_HOST}`, {
+        const socket = io(`${process.env.SOCKET_HOST}`, {
           reconnection: true,
           reconnectionDelay: 5000,
           reconnectionAttempts: Infinity,
           autoConnect: true,
           transports: ['websocket']
         });
…
+        socket.disconnect();

Repeat in the catch block below as well.

apps/connection/src/connection.service.ts (3)

656-664: handleError signature/type

This never resolves; it throws. Remove async and return never (or void) for clarity.

-  handleError(error): Promise<void> {
+  handleError(error): never {
     if (error?.status?.message?.error) {
       throw new RpcException({
         message: error.status.message.error.reason || error.status.message.error,
         statusCode: error.status?.code ?? HttpStatus.INTERNAL_SERVER_ERROR
       });
     }
     throw new RpcException(error.response || error);
   }

709-716: Typo: sendBasicMesage

Minor naming nit. Consider renaming to sendBasicMessage (API ripple).


463-470: Consistent error wrapping fallback

Good normalization with error?.status?.message?.error. Ensure fallback status uses a numeric code.

-          statusCode: error.status?.code ?? HttpStatus.INTERNAL_SERVER_ERROR
+          statusCode: Number(error?.status?.code) || HttpStatus.INTERNAL_SERVER_ERROR

Also applies to: 729-736

apps/ledger/src/credential-definition/credential-definition.service.ts (2)

119-129: Harden response shape access

If agent shape changes, these nested property reads can throw. Use optional chaining with safe defaults.

-      } else if ('finished' === response.credentialDefinition.state) {
-        credDefData.tag = response.credentialDefinition.credentialDefinition.tag;
+      } else if ('finished' === response?.credentialDefinition?.state) {
+        credDefData.tag = response?.credentialDefinition?.credentialDefinition?.tag;

421-428: HttpException status fallback

Use numeric status fallback to avoid throwing with undefined/non-numeric codes.

-      throw new HttpException(
-        {
-          status: error.status,
-          error: error.message
-        },
-        error.status
-      );
+      throw new HttpException(
+        { status: error?.status, error: error?.message },
+        error?.status ?? HttpStatus.INTERNAL_SERVER_ERROR
+      );
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b88926e and 52f2d15.

📒 Files selected for processing (5)
  • apps/connection/src/connection.service.ts (5 hunks)
  • apps/issuance/src/issuance.service.ts (4 hunks)
  • apps/ledger/src/credential-definition/credential-definition.service.ts (4 hunks)
  • apps/ledger/src/schema/schema.service.ts (3 hunks)
  • libs/common/src/common.service.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • apps/ledger/src/schema/schema.service.ts
🧰 Additional context used
🧬 Code graph analysis (2)
apps/ledger/src/credential-definition/credential-definition.service.ts (4)
apps/ledger/src/credential-definition/interfaces/create-credential-definition.interface.ts (6)
  • CreateCredDefPayload (19-23)
  • CredDefPayload (35-49)
  • IPlatformCredDefs (25-33)
  • GetCredDefPayload (6-17)
  • GetAllCredDefsPayload (59-63)
  • GetCredDefBySchemaId (65-67)
apps/ledger/src/credential-definition/interfaces/credential-definition.interface.ts (3)
  • CreateCredDefAgentRedirection (1-12)
  • GetCredDefAgentRedirection (20-29)
  • CredDefSchema (35-38)
libs/common/src/interfaces/cred-def.interface.ts (2)
  • IPlatformCredDefsData (30-32)
  • ICredDefDetails (1-3)
libs/common/src/interfaces/schema.interface.ts (1)
  • ISchemaDetail (48-67)
apps/issuance/src/issuance.service.ts (1)
libs/logger/src/logger.service.ts (1)
  • error (51-54)
🔇 Additional comments (3)
libs/common/src/common.service.ts (1)

241-247: LGTM! Error handling logic correctly streamlined.

The simplified error handling logic is cleaner and maintains the same functionality. The conditional check has been appropriately streamlined to only verify the essential path (error?.status?.message?.error), and the fallback behavior remains consistent.

apps/ledger/src/credential-definition/credential-definition.service.ts (2)

136-145: LGTM: simplified error handling

This aligns with prior review guidance and standardizes RpcException construction.


156-174: Replace toPromise with firstValueFrom and unify error wrapping

Modernize RxJS usage and avoid Promise .catch() chains for consistency.

-import { from } from 'rxjs';
+import { firstValueFrom } from 'rxjs';-      const credDefResponse = await from(this.natsClient.send<string>(this.credDefServiceProxy, pattern, payload))
-        .pipe(
-          map((response) => ({
-            response
-          }))
-        )
-        .toPromise()
-        .catch((error) => {
-          this.logger.error(`Catch : ${JSON.stringify(error)}`);
-          throw new HttpException(
-            {
-              status: error.statusCode,
-              error: error.message
-            },
-            error.error
-          );
-        });
+      try {
+        const response = await firstValueFrom(this.natsClient.send<string>(this.credDefServiceProxy, pattern, payload));
+        return { response };
+      } catch (error) {
+        this.logger.error(`Catch : ${JSON.stringify(error)}`);
+        throw new HttpException(
+          { status: error?.statusCode ?? error?.status, error: error?.message },
+          error?.statusCode ?? error?.status ?? HttpStatus.INTERNAL_SERVER_ERROR
+        );
+      }

And for _getSchemaDetails:

-    const getSchemaDetails = await this.credDefServiceProxy
-      .send(pattern, payload)
-      .toPromise()
-      .catch((error) => {
-        this.logger.error(`catch: ${JSON.stringify(error)}`);
-        throw new HttpException(
-          {
-            status: error.status,
-            error: error.message
-          },
-          error.status
-        );
-      });
-    return getSchemaDetails;
+    try {
+      return await firstValueFrom(this.credDefServiceProxy.send(pattern, payload));
+    } catch (error) {
+      this.logger.error(`catch: ${JSON.stringify(error)}`);
+      throw new HttpException(
+        { status: error?.status, error: error?.message },
+        error?.status ?? HttpStatus.INTERNAL_SERVER_ERROR
+      );
+    }

Also applies to: 260-277, 327-341

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
libs/common/src/interfaces/schema.interface.ts (2)

1-1: Use a type-only import to avoid runtime dependency and satisfy strict TS configs.

Since ICredDefData is only used for typing, prefer import type (helps with verbatimModuleSyntax/importsNotUsedAsValues).

-import { ICredDefData } from './cred-def.interface';
+import type { ICredDefData } from './cred-def.interface';

76-76: Use a type alias instead of an empty interface extending Pick<>.

This is purely an alias; a type is clearer here. Consider keeping the current name to minimize churn.

-export interface PartialICredDefData extends Pick<ICredDefData, 'createdBy' | 'schemaId' | 'orgId'> {}
+export type PartialICredDefData = Pick<ICredDefData, 'createdBy' | 'schemaId' | 'orgId'>;

Optional: The name “PartialICredDefData” can be confusing (it suggests optional fields). Consider ICredDefSummary in a follow-up.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 52f2d15 and cea5806.

📒 Files selected for processing (1)
  • libs/common/src/interfaces/schema.interface.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
libs/common/src/interfaces/schema.interface.ts (1)
libs/common/src/interfaces/cred-def.interface.ts (1)
  • ICredDefData (5-14)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
libs/common/src/interfaces/schema.interface.ts (2)

1-1: Reduce cross-module coupling: avoid importing cred-def types into schema interfaces

Bringing ICredDefData into schema.interface.ts increases coupling between schema and cred-def modules. Consider relocating the cred-def–related result shapes (ICredDefWithPagination, ICredDefWithCount, and the picked type) into cred-def.interface.ts and importing them where needed. This keeps boundaries cleaner and reduces the risk of circular deps over time.

Please confirm there are no circular imports between schema.interface.ts and cred-def.interface.ts after this change.


76-76: Rename for clarity and prefer a type alias over interface extends Pick<...>

“PartialICredDefData” suggests optional fields (like Partial<T>), but this is a strict subset. A clearer name (e.g., ICredDefSummary) and a type alias are more idiomatic with utility types.

Apply this diff:

-export interface PartialICredDefData extends Pick<ICredDefData, 'createdBy' | 'schemaId' | 'orgId'> {}
+export type ICredDefSummary = Pick<ICredDefData, 'createdBy' | 'schemaId' | 'orgId'>;

Follow-ups are provided below to update usages.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 52f2d15 and cea5806.

📒 Files selected for processing (1)
  • libs/common/src/interfaces/schema.interface.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
libs/common/src/interfaces/schema.interface.ts (1)
libs/common/src/interfaces/cred-def.interface.ts (1)
  • ICredDefData (5-14)
🔇 Additional comments (1)
libs/common/src/interfaces/schema.interface.ts (1)

79-85: Verify downstream usage after narrowing the cred-def list item shape

Changing list items from ICredDefData[] to a 3-field subset is a breaking type change. Any consumer reading fields like credentialDefinitionId, tag, schemaLedgerId, revocable, or createDateTime from data[] or credDefResult[] will now break.

  • If UIs/services link to a specific cred-def, consider including credentialDefinitionId in the picked set to avoid extra lookups.
  • If you accept the rename in the earlier comment, also update the references here:
 export interface ICredDefWithPagination extends IPaginationDetails {
-  data: PartialICredDefData[];
+  data: ICredDefSummary[];
 }
 
 export interface ICredDefWithCount {
   credDefCount: number;
-  credDefResult: PartialICredDefData[];
+  credDefResult: ICredDefSummary[];
 }

Run this script to surface potential breakages where removed fields may still be accessed on these collections:

Signed-off-by: Krishna Waske <[email protected]>
Signed-off-by: Krishna Waske <[email protected]>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
apps/api-gateway/src/platform/platform.service.ts (3)

12-17: Restore explicit ClientProxy typing for DI to retain type safety

Keeping the injected proxy typed avoids any leakage and preserves IDE help; Nest v10 still exports ClientProxy.

Apply within this block:

-  constructor(
-    @Inject('NATS_CLIENT') private readonly platformServiceProxy,
-    private readonly natsClient: NATSClient
-  ) {
+  constructor(
+    @Inject('NATS_CLIENT') private readonly platformServiceProxy: ClientProxy,
+    private readonly natsClient: NATSClient
+  ) {
     super('PlatformService');
   }

Add import at the top of the file:

import { ClientProxy } from '@nestjs/microservices';

19-22: Inline the payload to reduce noise

Minor cleanup; no behavior change.

-  async getAllSchema(schemaSearchCriteria: ISchemaSearchPayload, user: IUserRequestInterface): Promise<ISchemaDetails> {
-    const schemaSearch = { schemaSearchCriteria, user };
-    return this.natsClient.sendNatsMessage(this.platformServiceProxy, 'get-all-schemas', schemaSearch);
-  }
+  async getAllSchema(schemaSearchCriteria: ISchemaSearchPayload, user: IUserRequestInterface): Promise<ISchemaDetails> {
+    return this.natsClient.sendNatsMessage(this.platformServiceProxy, 'get-all-schemas', { schemaSearchCriteria, user });
+  }

24-30: Consistent style: inline the cred-defs payload

Matches the pattern suggested above; optional readability tweak.

   async getAllPlatformCredDefs(
     getAllPlatformCredDefs: GetAllPlatformCredDefsDto,
     user: IUserRequestInterface
   ): Promise<IPlatformCredDefsData> {
-    const credDefs = { ...getAllPlatformCredDefs, user };
-    return this.natsClient.sendNatsMessage(this.platformServiceProxy, 'get-all-platform-cred-defs', credDefs);
+    return this.natsClient.sendNatsMessage(this.platformServiceProxy, 'get-all-platform-cred-defs', { ...getAllPlatformCredDefs, user });
   }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cea5806 and 5ddd324.

📒 Files selected for processing (1)
  • apps/api-gateway/src/platform/platform.service.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
apps/api-gateway/src/platform/platform.service.ts (5)
apps/api-gateway/src/interfaces/ISchemaSearch.interface.ts (2)
  • ISchemaSearchPayload (4-13)
  • ILedgers (27-39)
apps/agent-service/src/interface/agent-service.interface.ts (2)
  • IUserRequestInterface (237-250)
  • ILedgers (647-659)
libs/common/src/interfaces/schema.interface.ts (1)
  • INetworkUrl (87-89)
apps/api-gateway/src/credential-definition/dto/get-all-platform-cred-defs.dto.ts (1)
  • GetAllPlatformCredDefsDto (8-30)
libs/common/src/interfaces/cred-def.interface.ts (1)
  • IPlatformCredDefsData (30-32)
🔇 Additional comments (3)
apps/api-gateway/src/platform/platform.service.ts (3)

32-35: Inline empty payload; remove temp var (already flagged earlier)

This was suggested previously; good to tidy up now.

   async getAllLedgers(): Promise<ILedgers[]> {
-    const payload = {};
-    return this.natsClient.sendNatsMessage(this.platformServiceProxy, 'get-all-ledgers', payload);
+    return this.natsClient.sendNatsMessage(this.platformServiceProxy, 'get-all-ledgers', {});
   }

37-39: LGTM: network URL retrieval is correctly typed

Return type matches INetworkUrl shape; call pattern looks correct.


41-44: Clarify/align return type and nullability for get-shortening-url

Earlier reviews noted the handler may return an object or null. The current signature Promise<string> may be inaccurate.

Please confirm the handler’s return shape and adjust the signature (e.g., Promise<string | null> or a DTO like Promise<ShorteningUrlDto | null>). To verify quickly:

#!/bin/bash
# Locate the NATS handler(s) and inspect return types/shapes.
rg -n -C3 -P "get-shortening-url"
rg -n -C3 -P "getShorteningUrlById\\("

Signed-off-by: Krishna Waske <[email protected]>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
apps/api-gateway/src/fido/fido.controller.ts (3)

254-261: Decode credentialId to match other endpoints and handle URL-encoded IDs.

Consistent with updateFidoUser.

-      const updateDeviceName = await this.fidoService.updateFidoUserDeviceName(credentialId, deviceName);
+      const updateDeviceName = await this.fidoService.updateFidoUserDeviceName(
+        decodeURIComponent(credentialId),
+        deviceName
+      );

281-286: Decode credentialId before service call (delete).

Handles URL-encoded IDs consistently.

-      const deleteFidoUser = await this.fidoService.deleteFidoUserDevice(credentialId);
+      const deleteFidoUser = await this.fidoService.deleteFidoUserDevice(decodeURIComponent(credentialId));

224-233: Variable naming nit: avoid misleading “verifyRegistration” in updateFidoUser.

Minor clarity improvement.

-    const verifyRegistration = await this.fidoService.updateFidoUser(
+    const updateUserDetails = await this.fidoService.updateFidoUser(
       updateFidoUserDetailsDto,
       decodeURIComponent(credentialId)
     );
     const finalResponse: IResponseType = {
       statusCode: HttpStatus.OK,
       message: ResponseMessages.fido.success.updateUserDetails,
-      data: verifyRegistration.response
+      data: updateUserDetails.response
     };
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5ddd324 and 32f5e3e.

📒 Files selected for processing (1)
  • apps/api-gateway/src/fido/fido.controller.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
apps/api-gateway/src/fido/fido.controller.ts (4)
libs/common/src/interfaces/response.interface.ts (1)
  • IResponseType (1-7)
libs/common/src/response-messages/index.ts (1)
  • ResponseMessages (1-518)
apps/api-gateway/src/dtos/fido-user.dto.ts (5)
  • GenerateRegistrationDto (4-10)
  • VerifyRegistrationDto (31-58)
  • GenerateAuthenticationDto (74-78)
  • VerifyAuthenticationDto (99-126)
  • UpdateFidoUserDetailsDto (60-72)
apps/api-gateway/src/fido/fido.service.ts (2)
  • verifyRegistration (29-32)
  • verifyAuthentication (40-46)
🔇 Additional comments (7)
apps/api-gateway/src/fido/fido.controller.ts (7)

27-45: Import missing guards (AuthGuard, OrgRolesGuard).

Required to actually enforce @roles.

 import { ApiResponseDto } from '../dtos/apiResponse.dto';
 import { BadRequestErrorDto } from '../dtos/bad-request-error.dto';
+import { AuthGuard } from '@nestjs/passport';
+import { OrgRolesGuard } from '../authz/guards/org-roles.guard';

1-15: Enforce @roles with guards — add UseGuards to imports.

Without UseGuards, @roles is not enforced. Import UseGuards.

 import {
   Body,
   Controller,
   Delete,
   Get,
   HttpStatus,
   Logger,
   Param,
   Post,
   Put,
   Query,
   Request,
   Res,
-  UseFilters
+  UseFilters,
+  UseGuards
 } from '@nestjs/common';

62-73: Protect fetch endpoint with guards.

@roles without guards leaves the route public.

 @Get('/passkey/:email')
 @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.HOLDER, OrgRoles.ISSUER, OrgRoles.SUPER_ADMIN, OrgRoles.MEMBER)
+@UseGuards(AuthGuard('jwt'), OrgRolesGuard)
 @ApiBearerAuth()

243-248: Protect update device-name endpoint with guards.

@roles is currently ineffective.

 @Put('/passkey/:credentialId')
 @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.HOLDER, OrgRoles.ISSUER, OrgRoles.SUPER_ADMIN, OrgRoles.MEMBER)
+@UseGuards(AuthGuard('jwt'), OrgRolesGuard)
 @ApiBearerAuth()

274-279: Protect delete device endpoint with guards.

@roles is currently ineffective.

 @Delete('/passkey/:credentialId')
 @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.HOLDER, OrgRoles.ISSUER, OrgRoles.SUPER_ADMIN, OrgRoles.MEMBER)
+@UseGuards(AuthGuard('jwt'), OrgRolesGuard)
 @ApiBearerAuth()

139-142: Use the method param instead of req.params for email.

Safer and consistent with other handlers.

   const verifyRegistration = await this.fidoService.verifyRegistration(
     verifyRegistrationDto,
-    req.params.email.toLowerCase()
+    email.toLowerCase()
   );

195-198: Use the method param instead of req.params for email (verify auth).

Consistent param usage.

   const verifyAuthentication = await this.fidoService.verifyAuthentication(
     verifyAuthenticationDto,
-    req.params.email.toLowerCase()
+    email.toLowerCase()
   );

…url) instead of a string(url)

Signed-off-by: Krishna Waske <[email protected]>
Signed-off-by: Krishna Waske <[email protected]>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (3)
libs/common/src/NATSClient.ts (1)

33-34: Nit: Fix the typo in the inline comment.

Please tweak the comment to say “response” instead of “reposne” for readability.

apps/api-gateway/src/agent/agent.service.ts (2)

6-6: Restore explicit ClientProxy typing for agentServiceProxy.

Dropping the ClientProxy annotation turns the injected proxy into any, which removes the compile-time safety we rely on when calling microservice APIs. NestJS v11 still exports ClientProxy, so we can keep the strong typing without issue.

-import { Injectable, Inject } from '@nestjs/common';
+import { Injectable, Inject } from '@nestjs/common';
+import { ClientProxy } from '@nestjs/microservices';
@@
-    @Inject('NATS_CLIENT') private readonly agentServiceProxy,
+    @Inject('NATS_CLIENT') private readonly agentServiceProxy: ClientProxy,

Also applies to: 14-19


48-57: Update registerNym docblock to match its parameters.

The comment still references role/alias/verkey/did even though the method only accepts id and user. Please refresh the documentation so it reflects the actual signature.

   /**
    * Description: Calling agent service for onboard-register-ledger
-   * @param role
-   * @param alias
-   * @param verkey
-   * @param did
+   * @param id Organization identifier forwarded to the agent
+   * @param user Authenticated user context attached to the request
    */
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8b5c3ce and 5c5b873.

📒 Files selected for processing (7)
  • apps/api-gateway/src/agent/agent.controller.ts (9 hunks)
  • apps/api-gateway/src/agent/agent.service.ts (1 hunks)
  • apps/api-gateway/src/fido/fido.controller.ts (2 hunks)
  • apps/api-gateway/src/platform/platform.service.ts (1 hunks)
  • apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts (1 hunks)
  • apps/api-gateway/src/webhook/webhook.controller.ts (3 hunks)
  • libs/common/src/NATSClient.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (6)
apps/api-gateway/src/agent/agent.controller.ts (2)
apps/api-gateway/src/dtos/wallet-details.dto.ts (1)
  • WalletDetailsDto (3-17)
apps/agent-service/src/interface/agent-service.interface.ts (1)
  • IUserRequestInterface (237-250)
apps/api-gateway/src/webhook/webhook.controller.ts (2)
libs/common/src/response-messages/index.ts (1)
  • ResponseMessages (1-518)
apps/api-gateway/src/authz/decorators/roles.decorator.ts (1)
  • Roles (6-6)
apps/api-gateway/src/platform/platform.service.ts (5)
apps/api-gateway/src/interfaces/ISchemaSearch.interface.ts (2)
  • ISchemaSearchPayload (4-13)
  • ILedgers (27-39)
apps/agent-service/src/interface/agent-service.interface.ts (2)
  • IUserRequestInterface (237-250)
  • ILedgers (647-659)
libs/common/src/interfaces/schema.interface.ts (2)
  • ISchemaDetails (20-22)
  • INetworkUrl (87-89)
apps/api-gateway/src/credential-definition/dto/get-all-platform-cred-defs.dto.ts (1)
  • GetAllPlatformCredDefsDto (8-30)
libs/common/src/interfaces/cred-def.interface.ts (1)
  • IPlatformCredDefsData (30-32)
apps/api-gateway/src/fido/fido.controller.ts (3)
libs/common/src/interfaces/response.interface.ts (1)
  • IResponseType (1-7)
apps/api-gateway/src/dtos/fido-user.dto.ts (4)
  • GenerateRegistrationDto (4-10)
  • VerifyRegistrationDto (31-58)
  • GenerateAuthenticationDto (74-78)
  • VerifyAuthenticationDto (99-126)
apps/api-gateway/src/fido/fido.service.ts (2)
  • verifyRegistration (29-32)
  • verifyAuthentication (40-46)
apps/api-gateway/src/agent/agent.service.ts (4)
libs/common/src/NATSClient.ts (1)
  • Injectable (11-62)
apps/api-gateway/src/agent-service/agent-service.service.ts (1)
  • Injectable (13-103)
libs/service/base.service.ts (1)
  • BaseService (2-9)
apps/api-gateway/src/dtos/wallet-details.dto.ts (1)
  • WalletDetailsDto (3-17)
apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts (1)
libs/common/src/cast.helper.ts (2)
  • trim (39-43)
  • toNumber (58-76)
🔇 Additional comments (12)
apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts (7)

64-71: Type the sortField property as CredDefSortFields

Runtime validation now uses CredDefSortFields, but the property remains typed as string, leaving room for invalid assignments and misaligned API metadata. Updating the type tightens both TypeScript and Swagger contracts.

-  sortField: string = CredDefSortFields.CREATED_DATE_TIME;
+  sortField: CredDefSortFields = CredDefSortFields.CREATED_DATE_TIME;

16-20: Restore default pageNumber when query param is absent

toNumber returns undefined when value is missing, which overwrites the pageNumber = 1 initializer. That nullifies the default pagination and breaks downstream expectations. Please supply the default/min options to keep the fallback intact.

-  @Transform(({ value }) => toNumber(value))
+  @Transform(({ value }) => toNumber(value, { default: 1, min: 1 }))

22-26: Preserve pageSize default when the client omits it

Same issue here: toNumber without defaults can return undefined, wiping out pageSize = 10. Pass the default and minimum so pagination never devolves to undefined.

-  @Transform(({ value }) => toNumber(value))
+  @Transform(({ value }) => toNumber(value, { default: 10, min: 1 }))

47-51: Keep GetCredentialDefinitionBySchemaIdDto.pageNumber defaulting to 1

For this DTO, missing pageNumber also becomes undefined post-transform. Mirror the fix suggested above so the initializer survives and validators work on a concrete value.

-  @Transform(({ value }) => toNumber(value))
+  @Transform(({ value }) => toNumber(value, { default: 1, min: 1 }))

53-57: Stop GetCredentialDefinitionBySchemaIdDto.pageSize from becoming undefined

Apply the same default/min guard on pageSize; otherwise, omitting the query param wipes out the intended default of 10.

-  @Transform(({ value }) => toNumber(value))
+  @Transform(({ value }) => toNumber(value, { default: 10, min: 1 }))

95-99: Maintain GetAllSchemaByPlatformDto.pageNumber default

Here too, omitting the query param yields undefined. Please propagate the default/min options so pagination stays deterministic.

-  @Transform(({ value }) => toNumber(value))
+  @Transform(({ value }) => toNumber(value, { default: 1, min: 1 }))

106-110: Retain GetAllSchemaByPlatformDto.pageSize default

Without the default/min guard, pageSize loses its fallback of 10. Align this transform with the rest to avoid undefined leaking downstream.

-  @Transform(({ value }) => toNumber(value))
+  @Transform(({ value }) => toNumber(value, { default: 10, min: 1 }))
apps/api-gateway/src/webhook/webhook.controller.ts (1)

106-113: Great to see OrgRolesGuard applied here

Thanks for closing the roles-enforcement gap on this endpoint; the guard pairing now matches the roles declared.

apps/api-gateway/src/agent/agent.controller.ts (1)

46-49: No action needed: CommonService is already wired into AgentModule
AgentModule imports CommonModule and lists CommonService in its providers.

libs/common/src/NATSClient.ts (1)

25-28: Context headers now consistent—nice catch.

Thanks for standardizing the contextId header creation across all three send helpers; this keeps downstream correlation logic intact.

Also applies to: 42-45, 54-55

apps/api-gateway/src/fido/fido.controller.ts (2)

63-85: Secure @Roles-protected routes with guards.

Every endpoint annotated with @Roles(...) is still missing @UseGuards(AuthGuard('jwt'), OrgRolesGuard), so the role checks never execute and these passkey operations remain publicly callable. Please wire the guards back in (and add the required imports) before shipping.

@@
 @Get('/passkey/:email')
 @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.HOLDER, OrgRoles.ISSUER, OrgRoles.SUPER_ADMIN, OrgRoles.MEMBER)
+@UseGuards(AuthGuard('jwt'), OrgRolesGuard)
@@
 @Put('/passkey/:credentialId')
 @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.HOLDER, OrgRoles.ISSUER, OrgRoles.SUPER_ADMIN, OrgRoles.MEMBER)
+@UseGuards(AuthGuard('jwt'), OrgRolesGuard)
@@
 @Delete('/passkey/:credentialId')
 @Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.HOLDER, OrgRoles.ISSUER, OrgRoles.SUPER_ADMIN, OrgRoles.MEMBER)
+@UseGuards(AuthGuard('jwt'), OrgRolesGuard)

Remember to extend the top-level imports accordingly:

@@
-  Res,
-  UseFilters
+  Res,
+  UseFilters,
+  UseGuards
+import { AuthGuard } from '@nestjs/passport';
+import { OrgRolesGuard } from '../authz/guards/org-roles.guard';

Also applies to: 243-262, 274-288


164-176: Align HTTP status with documented contract.

The handler body advertises statusCode: HttpStatus.OK while the decorator and actual response emit 201 Created. This mismatch is confusing for clients. Please return 200 across the board (or adjust both decorator and payload to 201) so the status codes line up.

-  @ApiResponse({ status: HttpStatus.CREATED, description: 'Success', type: ApiResponseDto })
+  @ApiResponse({ status: HttpStatus.OK, description: 'Success', type: ApiResponseDto })
@@
-    return res.status(HttpStatus.CREATED).json(finalResponse);
+    return res.status(HttpStatus.OK).json(finalResponse);

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
apps/connection/src/connection.service.ts (1)

118-125: Return the stored invitation payload instead of echoing the reference ID

getShorteningUrl() already receives the reference ID; sending the same value back makes the endpoint useless. Callers rely on this method to retrieve the stored (shortened) invitation/URL that was persisted alongside the reference. Echoing the reference ID breaks that flow and regresses existing clients.

Please return the persisted invitation field (e.g., connectionInvitation / connectionInvitationUrl) from the repository result.

-      const urlDetails = await this.connectionRepository.getShorteningUrl(referenceId);
-      return urlDetails.referenceId;
+      const urlDetails = await this.connectionRepository.getShorteningUrl(referenceId);
+      return urlDetails.connectionInvitation;
apps/api-gateway/src/connection/connection.service.ts (1)

56-64: Align with the reverted sendNats return type.

Because sendNats now continues to return the raw value, this helper should consume that raw payload. Changing the return type here will keep the public API consistent with existing clients.

-  getUrl(referenceId: string): Promise<{
-    response: object;
-  }> {
+  getUrl(referenceId: string): Promise<object> {
🧹 Nitpick comments (13)
apps/api-gateway/src/notification/notification.service.ts (1)

22-29: Fix the lingering webhhook typo in the parameter name.

The method name is now registerOrgWebhookEndpoint, but the parameter still carries the old webhhook spelling. Renaming the variable keeps the codebase consistent and avoids propagating the typo.

-  async registerOrgWebhookEndpoint(
-    registerOrgWebhhookEndpointDto: RegisterOrgWebhhookEndpointDto
-  ): Promise<INotification> {
+  async registerOrgWebhookEndpoint(
+    registerOrgWebhookEndpointDto: RegisterOrgWebhhookEndpointDto
+  ): Promise<INotification> {
     return this.natsClient.sendNatsMessage(
       this.serviceProxy,
       'register-org-webhook-endpoint-for-notification',
-      registerOrgWebhhookEndpointDto
+      registerOrgWebhookEndpointDto
     );
   }
apps/api-gateway/src/verification/verification.service.ts (2)

16-16: Import firstValueFrom for the new promise conversion.

Since we should move off the deprecated toPromise() path, please pull in firstValueFrom from rxjs so the updated calls compile.

Apply this diff:

-import { ClientProxy } from '@nestjs/microservices';
+import { ClientProxy } from '@nestjs/microservices';
+import { firstValueFrom } from 'rxjs';

119-136: Replace deprecated .toPromise() with firstValueFrom.

Lines 121 and 135 still rely on the deprecated .toPromise() helper. NestJS 11 ships with RxJS 7.8+, where toPromise is slated for removal; sticking with it makes future upgrades brittle and can trigger linting/TS errors. Switching to firstValueFrom keeps the same semantics and aligns with RxJS guidance.

Apply this diff:

-      const message = await this.verificationServiceProxy.send(pattern, payload).toPromise();
+      const message = await firstValueFrom(this.verificationServiceProxy.send(pattern, payload));

Make the same change for the call on Line 135.

apps/api-gateway/src/agent/agent.service.ts (1)

48-58: Sync the JSDoc with the current signature.

The comment still references role/alias/verkey/did parameters, but the method now only accepts { id, user }. Please update the doc so future readers don’t chase nonexistent args.

apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts (8)

28-35: Expose enum in Swagger and type the field

Make the OpenAPI enum explicit and use the enum type instead of string.

Apply:

-  @ApiProperty({
-    required: false
-  })
+  @ApiProperty({
+    required: false,
+    enum: SortFields
+  })
   @Transform(({ value }) => trim(value))
   @IsOptional()
   @IsEnum(SortFields)
-  sortField: string = SortFields.CREATED_DATE_TIME;
+  sortField: SortFields = SortFields.CREATED_DATE_TIME;

36-43: Type sortBy as SortValue

Tighten typing; Swagger already lists the enum values.

Apply:

   @IsEnum(SortValue)
-  sortBy: string = SortValue.DESC;
+  sortBy: SortValue = SortValue.DESC;

64-71: Type sortField as CredDefSortFields

Validation is enum-based; align the property type for safety and clearer OpenAPI.

Apply:

   @IsEnum(CredDefSortFields)
-  sortField: string = CredDefSortFields.CREATED_DATE_TIME;
+  sortField: CredDefSortFields = CredDefSortFields.CREATED_DATE_TIME;

73-80: Type sortBy as SortValue

Same reasoning as above.

Apply:

   @IsEnum(SortValue)
-  sortBy: string = SortValue.DESC;
+  sortBy: SortValue = SortValue.DESC;

82-84: Add validation/Swagger for schemaId and orgId

These are bare fields; add ApiProperty and validators (UUID assumed—adjust if not).

Apply:

-  schemaId: string;
+  @ApiProperty({ description: 'Schema ID', example: '1a7eac11-ff05-40d7-8351-4d7467687cad' })
+  @IsUUID('4', { message: 'Invalid format of schemaId' })
+  schemaId: string;
 
-  orgId: string;
+  @ApiProperty({ description: 'Organization ID', example: '3c69d3a2-9b1d-4d5e-b9b0-0c3f8b9b6cde' })
+  @IsUUID('4', { message: 'Invalid format of orgId' })
+  orgId: string;

88-93: Remove redundant Swagger decorators

Use only ApiPropertyOptional and keep the example.

Apply:

-  @ApiProperty({ example: '1a7eac11-ff05-40d7-8351-4d7467687cad' })
-  @ApiPropertyOptional()
+  @ApiPropertyOptional({ example: '1a7eac11-ff05-40d7-8351-4d7467687cad' })

112-119: Expose enum in Swagger and type the field (sorting)

Align typing with validation and show enum in OpenAPI.

Apply:

-  @ApiProperty({
-    required: false
-  })
+  @ApiProperty({
+    required: false,
+    enum: SortFields
+  })
   @Transform(({ value }) => trim(value))
   @IsOptional()
   @IsEnum(SortFields)
-  sorting: string = SortFields.CREATED_DATE_TIME;
+  sorting: SortFields = SortFields.CREATED_DATE_TIME;

120-123: Validate and document sortByValue

Currently unvalidated; enforce enum and document values (or merge with sortBy for consistency).

Apply:

-  @ApiProperty({ required: false })
-  @IsOptional()
-  sortByValue: string = SortValue.DESC;
+  @ApiProperty({ required: false, enum: [SortValue.DESC, SortValue.ASC] })
+  @IsOptional()
+  @IsEnum(SortValue)
+  sortByValue: SortValue = SortValue.DESC;
apps/issuance/src/issuance.service.ts (1)

527-543: Replace deprecated .toPromise() with firstValueFrom.

Everywhere else in this upgrade we standardised on firstValueFrom. Leaving .toPromise() here keeps the deprecated API in play and will bite us the moment RxJS 8 lands. Please switch this call to firstValueFrom and add the corresponding import at the top.

-      return this.issuanceServiceProxy
-        .send(pattern, payload)
-        .pipe(
-          map((response) => ({
-            response
-          }))
-        )
-        .toPromise()
-        .catch((error) => {
+      return firstValueFrom(
+        this.issuanceServiceProxy.send(pattern, payload).pipe(
+          map((response) => ({
+            response
+          }))
+        )
+      ).catch((error) => {
         this.logger.error(`catch: ${JSON.stringify(error)}`);
         throw new HttpException(
           {
             status: error.statusCode,
             error: error.message
           },
           error.error
         );
       });
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5c5b873 and a9a4902.

📒 Files selected for processing (30)
  • apps/api-gateway/src/agent-service/agent-service.service.ts (1 hunks)
  • apps/api-gateway/src/agent/agent.service.ts (1 hunks)
  • apps/api-gateway/src/app.service.ts (1 hunks)
  • apps/api-gateway/src/authz/authz.service.ts (1 hunks)
  • apps/api-gateway/src/cloud-wallet/cloud-wallet.service.ts (1 hunks)
  • apps/api-gateway/src/connection/connection.controller.ts (8 hunks)
  • apps/api-gateway/src/connection/connection.service.ts (3 hunks)
  • apps/api-gateway/src/credential-definition/credential-definition.service.ts (2 hunks)
  • apps/api-gateway/src/fido/fido.service.ts (1 hunks)
  • apps/api-gateway/src/geo-location/geo-location.service.ts (1 hunks)
  • apps/api-gateway/src/issuance/issuance.service.ts (1 hunks)
  • apps/api-gateway/src/notification/notification.service.ts (1 hunks)
  • apps/api-gateway/src/organization/organization.service.ts (1 hunks)
  • apps/api-gateway/src/platform/platform.service.ts (1 hunks)
  • apps/api-gateway/src/revocation/revocation.service.ts (2 hunks)
  • apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts (1 hunks)
  • apps/api-gateway/src/schema/schema.service.ts (2 hunks)
  • apps/api-gateway/src/user/user.service.ts (1 hunks)
  • apps/api-gateway/src/utilities/utilities.controller.ts (3 hunks)
  • apps/api-gateway/src/utilities/utilities.service.ts (2 hunks)
  • apps/api-gateway/src/verification/verification.service.ts (3 hunks)
  • apps/api-gateway/src/webhook/webhook.service.ts (1 hunks)
  • apps/cloud-wallet/src/cloud-wallet.service.ts (3 hunks)
  • apps/connection/src/connection.service.ts (3 hunks)
  • apps/issuance/src/issuance.service.ts (2 hunks)
  • apps/ledger/src/credential-definition/credential-definition.service.ts (4 hunks)
  • apps/ledger/src/schema/schema.service.ts (2 hunks)
  • apps/organization/src/organization.service.ts (2 hunks)
  • libs/common/src/NATSClient.ts (1 hunks)
  • libs/user-activity/repositories/index.ts (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • apps/api-gateway/src/schema/schema.service.ts
  • apps/api-gateway/src/organization/organization.service.ts
🚧 Files skipped from review as they are similar to previous changes (12)
  • apps/api-gateway/src/authz/authz.service.ts
  • apps/api-gateway/src/revocation/revocation.service.ts
  • apps/api-gateway/src/cloud-wallet/cloud-wallet.service.ts
  • apps/api-gateway/src/issuance/issuance.service.ts
  • apps/api-gateway/src/webhook/webhook.service.ts
  • apps/api-gateway/src/user/user.service.ts
  • apps/cloud-wallet/src/cloud-wallet.service.ts
  • apps/api-gateway/src/geo-location/geo-location.service.ts
  • apps/api-gateway/src/utilities/utilities.service.ts
  • apps/api-gateway/src/app.service.ts
  • apps/organization/src/organization.service.ts
  • apps/ledger/src/schema/schema.service.ts
🧰 Additional context used
🧬 Code graph analysis (11)
apps/api-gateway/src/credential-definition/credential-definition.service.ts (2)
apps/api-gateway/src/agent-service/agent-service.service.ts (1)
  • Injectable (14-104)
libs/service/base.service.ts (1)
  • BaseService (2-9)
apps/api-gateway/src/utilities/utilities.controller.ts (1)
apps/api-gateway/src/utilities/dtos/shortening-url.dto.ts (1)
  • StoreObjectDto (43-47)
apps/ledger/src/credential-definition/credential-definition.service.ts (5)
apps/ledger/src/credential-definition/interfaces/create-credential-definition.interface.ts (6)
  • CreateCredDefPayload (19-23)
  • CredDefPayload (35-49)
  • IPlatformCredDefs (25-33)
  • GetCredDefPayload (6-17)
  • GetAllCredDefsPayload (59-63)
  • GetCredDefBySchemaId (65-67)
apps/ledger/src/credential-definition/interfaces/credential-definition.interface.ts (3)
  • CreateCredDefAgentRedirection (1-12)
  • GetCredDefAgentRedirection (20-29)
  • CredDefSchema (35-38)
libs/common/src/interfaces/cred-def.interface.ts (2)
  • IPlatformCredDefsData (30-32)
  • ICredDefDetails (1-3)
libs/common/src/interfaces/schema.interface.ts (1)
  • ISchemaDetail (50-69)
apps/ledger/src/schema/schema.service.ts (1)
  • getSchemaDetails (530-537)
apps/api-gateway/src/fido/fido.service.ts (4)
apps/api-gateway/src/agent-service/agent-service.service.ts (1)
  • Injectable (14-104)
apps/api-gateway/src/connection/connection.service.ts (1)
  • Injectable (22-155)
libs/service/base.service.ts (1)
  • BaseService (2-9)
apps/api-gateway/src/dtos/fido-user.dto.ts (4)
  • VerifyRegistrationDto (31-58)
  • GenerateAuthenticationDto (74-78)
  • VerifyAuthenticationDto (99-126)
  • UpdateFidoUserDetailsDto (60-72)
apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts (1)
libs/common/src/cast.helper.ts (2)
  • trim (39-43)
  • toNumber (58-76)
apps/api-gateway/src/platform/platform.service.ts (5)
apps/api-gateway/src/utilities/utilities.service.ts (1)
  • Injectable (7-25)
libs/service/base.service.ts (1)
  • BaseService (2-9)
apps/api-gateway/src/interfaces/ISchemaSearch.interface.ts (2)
  • ISchemaSearchPayload (4-13)
  • ILedgers (27-39)
libs/common/src/interfaces/schema.interface.ts (2)
  • ISchemaDetails (20-22)
  • INetworkUrl (87-89)
libs/common/src/interfaces/cred-def.interface.ts (1)
  • IPlatformCredDefsData (30-32)
apps/api-gateway/src/agent/agent.service.ts (2)
libs/service/base.service.ts (1)
  • BaseService (2-9)
apps/api-gateway/src/dtos/wallet-details.dto.ts (1)
  • WalletDetailsDto (3-17)
apps/api-gateway/src/notification/notification.service.ts (4)
libs/service/base.service.ts (1)
  • BaseService (2-9)
apps/api-gateway/src/notification/dtos/notification.dto.ts (2)
  • RegisterOrgWebhhookEndpointDto (29-49)
  • SendNotificationDto (51-70)
apps/notification/interfaces/notification.interfaces.ts (1)
  • INotification (3-7)
apps/api-gateway/src/notification/interfaces/notification.interfaces.ts (1)
  • INotification (1-5)
libs/user-activity/repositories/index.ts (5)
apps/issuance/src/issuance.service.ts (1)
  • Injectable (95-2070)
apps/organization/src/organization.service.ts (1)
  • Injectable (69-2032)
apps/verification/src/verification.service.ts (1)
  • Injectable (58-1071)
apps/agent-service/src/agent-service.service.ts (1)
  • Injectable (83-2092)
libs/user-activity/src/user-activity.service.ts (1)
  • Injectable (7-22)
apps/issuance/src/issuance.service.ts (1)
libs/logger/src/logger.service.ts (1)
  • error (51-54)
apps/api-gateway/src/connection/connection.controller.ts (2)
libs/common/src/cast.helper.ts (1)
  • TrimStringParamPipe (167-172)
apps/api-gateway/src/connection/connection.service.ts (2)
  • receiveInvitationUrl (97-104)
  • receiveInvitation (106-113)
🔇 Additional comments (16)
apps/api-gateway/src/agent-service/agent-service.service.ts (1)

12-12: Import alignment looks good

Pulling ClientProxy from @nestjs/microservices matches the NestJS 11 catalog shift and keeps the dependency surface tidy. 👍

apps/api-gateway/src/utilities/utilities.controller.ts (1)

68-74: Boolean param parsing fix LGTM

Applying ParseBoolPipe to persist closes the string-truthiness gap and keeps the downstream service call clean. Nicely done.

apps/api-gateway/src/platform/platform.service.ts (1)

42-45: Return type and null handling for shortening URL still wrong

The NATS handler can return null, and callers expect a shaped DTO (e.g., referenceId, invitationPayload). Typing this as Promise<object> both hides the real structure and forbids representing null, so we can still explode at runtime when the record is missing. Please introduce a proper interface (or reuse an existing DTO) and return Promise<IShorteningUrl | null> (or throw a typed exception when absent), updating downstream code to handle the null/exception path.

apps/api-gateway/src/credential-definition/credential-definition.service.ts (1)

7-34: Return type mismatch for getAllCredDefs.

sendNatsMessage resolves to the paginated wrapper (ICredDefDetails), not a single ICredDefData. The wrong signature leaks all the way up the controller and misleads callers about the shape they receive. Please align the import and return type with what the ledger service actually sends.

-import { ICredDefData } from '@credebl/common/interfaces/cred-def.interface';
+import { ICredDefDetails } from '@credebl/common/interfaces/cred-def.interface';
@@
-  ): Promise<ICredDefData> {
+  ): Promise<ICredDefDetails> {
apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts (10)

10-14: LGTM on searchByText setup

Optional string with trim + Type is fine.


59-63: LGTM on searchByText

Consistent with other DTOs.


101-105: LGTM on searchByText

Consistent and harmless.


124-131: LGTM on schemaType

Enum validation + optional looks good.


16-21: Fix pagination default: toNumber(undefined) overrides pageNumber=1

Provide a default and min to preserve 1 when query param is absent.

Apply:

-  @Transform(({ value }) => toNumber(value))
+  @Transform(({ value }) => toNumber(value, { default: 1, min: 1 }))

22-27: Fix pagination default: toNumber(undefined) overrides pageSize=10

Add default and min to keep 10 when omitted.

Apply:

-  @Transform(({ value }) => toNumber(value))
+  @Transform(({ value }) => toNumber(value, { default: 10, min: 1 }))

47-51: Fix pagination default: pageNumber

Same undefined override; add default + min.

Apply:

-  @Transform(({ value }) => toNumber(value))
+  @Transform(({ value }) => toNumber(value, { default: 1, min: 1 }))

53-57: Fix pagination default: pageSize

Same undefined override; add default + min.

Apply:

-  @Transform(({ value }) => toNumber(value))
+  @Transform(({ value }) => toNumber(value, { default: 10, min: 1 }))

95-100: Fix pagination default: pageNumber (platform DTO)

Default lost when omitted; set default + min.

Apply:

-  @Transform(({ value }) => toNumber(value, { min: 1 }))
+  @Transform(({ value }) => toNumber(value, { default: 1, min: 1 }))

106-111: Fix pagination default: pageSize (platform DTO)

Provide default + min to preserve 10.

Apply:

-  @Transform(({ value }) => toNumber(value, { min: 1 }))
+  @Transform(({ value }) => toNumber(value, { default: 10, min: 1 }))
apps/api-gateway/src/connection/connection.controller.ts (2)

378-395: Don't swallow failures when persisting connection webhooks

By catching the promise and only logging at debug, we still respond with 201 even when saving the webhook data (or forwarding it) fails. That silently drops webhook payloads and breaks downstream processing.

Let the exception surface (or rethrow after logging at error) so the caller gets a failure and the issue can be monitored.

-    const connectionData = await this.connectionService.getConnectionWebhook(connectionDto, orgId).catch((error) => {
-      this.logger.debug(`error in saving connection webhook ::: ${JSON.stringify(error)}`);
-    });
+    const connectionData = await this.connectionService.getConnectionWebhook(connectionDto, orgId).catch((error) => {
+      this.logger.error(`error in saving connection webhook ::: ${JSON.stringify(error)}`, error);
+      throw error;
+    });
@@
-    const webhookUrl = await this.connectionService
-      ._getWebhookUrl(connectionDto?.contextCorrelationId, orgId)
-      .catch((error) => {
-        this.logger.debug(`error in getting webhook url ::: ${JSON.stringify(error)}`);
-      });
+    const webhookUrl = await this.connectionService
+      ._getWebhookUrl(connectionDto?.contextCorrelationId, orgId)
+      .catch((error) => {
+        this.logger.error(`error in getting webhook url ::: ${JSON.stringify(error)}`, error);
+        throw error;
+      });
@@
-      await this.connectionService._postWebhookResponse(webhookUrl, { data: connectionDto }).catch((error) => {
-        this.logger.debug(`error in posting webhook  response to webhook url ::: ${JSON.stringify(error)}`);
-      });
+      await this.connectionService._postWebhookResponse(webhookUrl, { data: connectionDto }).catch((error) => {
+        this.logger.error(`error in posting webhook response to webhook url ::: ${JSON.stringify(error)}`, error);
+        throw error;
+      });

425-435: Surface webhook delivery failures instead of hiding them

The question-answer webhook path repeats the same silent .catch pattern, returning 201 even if delivery fails. That masks outages and drops webhook events.

Let the error bubble (or rethrow after logging at error) so callers can retry and we can monitor failures.

-    const webhookUrl = await this.connectionService
-      ._getWebhookUrl(questionAnswerWebhookDto?.contextCorrelationId, orgId)
-      .catch((error) => {
-        this.logger.debug(`error in getting webhook url ::: ${JSON.stringify(error)}`);
-      });
+    const webhookUrl = await this.connectionService
+      ._getWebhookUrl(questionAnswerWebhookDto?.contextCorrelationId, orgId)
+      .catch((error) => {
+        this.logger.error(`error in getting webhook url ::: ${JSON.stringify(error)}`, error);
+        throw error;
+      });
@@
-      await this.connectionService
-        ._postWebhookResponse(webhookUrl, { data: questionAnswerWebhookDto })
-        .catch((error) => {
-          this.logger.debug(`error in posting webhook  response to webhook url ::: ${JSON.stringify(error)}`);
-        });
+      await this.connectionService
+        ._postWebhookResponse(webhookUrl, { data: questionAnswerWebhookDto })
+        .catch((error) => {
+          this.logger.error(`error in posting webhook response to webhook url ::: ${JSON.stringify(error)}`, error);
+          throw error;
+        });

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
apps/api-gateway/src/fido/fido.controller.ts (2)

143-146: Use the routed email parameter instead of req.params.

You already receive the email via @Param('email'), but still dereference req.params. Relying on the decorator keeps the handler framework-agnostic and avoids subtle bugs when adapters differ.

-    const verifyRegistration = await this.fidoService.verifyRegistration(
-      verifyRegistrationDto,
-      req.params.email.toLowerCase()
-    );
+    const verifyRegistration = await this.fidoService.verifyRegistration(
+      verifyRegistrationDto,
+      email.toLowerCase()
+    );

199-202: Same as above—lean on the email param instead of req.params.

Stick to the decorated argument to keep the handler consistent across adapters and avoid Express-only assumptions.

-    const verifyAuthentication = await this.fidoService.verifyAuthentication(
-      verifyAuthenticationDto,
-      req.params.email.toLowerCase()
-    );
+    const verifyAuthentication = await this.fidoService.verifyAuthentication(
+      verifyAuthenticationDto,
+      email.toLowerCase()
+    );
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f026820 and 4be4bdb.

📒 Files selected for processing (1)
  • apps/api-gateway/src/fido/fido.controller.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
apps/api-gateway/src/fido/fido.controller.ts (1)
apps/api-gateway/src/fido/fido.service.ts (2)
  • verifyRegistration (29-32)
  • verifyAuthentication (40-46)
🔇 Additional comments (1)
apps/api-gateway/src/fido/fido.controller.ts (1)

167-179: Fix status code mismatch (payload says 200 but response returns 201).

The handler builds a payload with statusCode: HttpStatus.OK yet returns res.status(HttpStatus.CREATED). Clients receive a 201 response whose body claims 200, and Swagger advertises 201 as well. Align everything to 200 to keep the transport and documented contract consistent.

Apply this diff:

-  @ApiResponse({ status: HttpStatus.CREATED, description: 'Success', type: ApiResponseDto })
+  @ApiResponse({ status: HttpStatus.OK, description: 'Success', type: ApiResponseDto })
@@
-    return res.status(HttpStatus.CREATED).json(finalResponse);
+    return res.status(HttpStatus.OK).json(finalResponse);

@GHkrishna GHkrishna requested a review from sairanjit September 25, 2025 11:06
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 645a0af and eb9d7b7.

📒 Files selected for processing (1)
  • apps/api-gateway/src/fido/fido.controller.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
apps/api-gateway/src/fido/fido.controller.ts (4)
apps/api-gateway/src/authz/decorators/roles.decorator.ts (1)
  • Roles (6-6)
libs/common/src/interfaces/response.interface.ts (1)
  • IResponseType (1-7)
libs/common/src/response-messages/index.ts (1)
  • ResponseMessages (1-518)
apps/api-gateway/src/fido/fido.service.ts (2)
  • verifyRegistration (29-32)
  • verifyAuthentication (40-46)

@sonarqubecloud
Copy link

@GHkrishna GHkrishna merged commit 3e2a29b into main Sep 25, 2025
8 checks passed
@GHkrishna GHkrishna deleted the fix/nestjs-version-update branch September 25, 2025 12:14
ankita-p17 pushed a commit that referenced this pull request Sep 30, 2025
* fix: update nest version and add them to catalog in pnpm

Signed-off-by: Krishna Waske <[email protected]>

* fix: nest version update changes for services

Signed-off-by: Krishna Waske <[email protected]>

* fix: add remaining packages in catalog

Signed-off-by: Krishna Waske <[email protected]>

* fix: logging and unnecessary await

Signed-off-by: Krishna Waske <[email protected]>

* fix: inconsistent return type

Signed-off-by: Krishna Waske <[email protected]>

* fix: remove toPromise in favour of firstValueFrom

Signed-off-by: Krishna Waske <[email protected]>

* fix: toPromise to lastValuFrom

Signed-off-by: Krishna Waske <[email protected]>

* fix: update error message

Signed-off-by: Krishna Waske <[email protected]>

* fix: update duplicate credDefData interface

Signed-off-by: Krishna Waske <[email protected]>

* fix: get all ledgers

Signed-off-by: Krishna Waske <[email protected]>

* fix: throw error

Signed-off-by: Krishna Waske <[email protected]>

* fix: proper use of params

Signed-off-by: Krishna Waske <[email protected]>

* fix: path excluded properly

Signed-off-by: Krishna Waske <[email protected]>

* fix: api-response code

Signed-off-by: Krishna Waske <[email protected]>

* fix: remove unwanted controllers, with no matching nats call available

Signed-off-by: Krishna Waske <[email protected]>

* fix: header setting for nats

Signed-off-by: Krishna Waske <[email protected]>

* fix: add missing roleguard

Signed-off-by: Krishna Waske <[email protected]>

* fix: return type is actually an object(including referenceId and the url) instead of a string(url)

Signed-off-by: Krishna Waske <[email protected]>

* fix: update correct enum

Signed-off-by: Krishna Waske <[email protected]>

* fix: min value for transformation

Signed-off-by: Krishna Waske <[email protected]>

* fix: parsing string as a boolean to handle boolean values correctly

Signed-off-by: Krishna Waske <[email protected]>

* fix: add required typing

Signed-off-by: Krishna Waske <[email protected]>

* fix: error handling

Signed-off-by: Krishna Waske <[email protected]>

* fix: add dependency for loggerModule

Signed-off-by: Krishna Waske <[email protected]>

* fix: add typing and todo for the nested response issue

Signed-off-by: Krishna Waske <[email protected]>

* fix: add roleguards where role level access is expected

Signed-off-by: Krishna Waske <[email protected]>

* fix: interface type

Signed-off-by: Krishna Waske <[email protected]>

* fix: adding a todo for unsure changes regarding authguards in fido controller

Signed-off-by: Krishna Waske <[email protected]>

* fix: use params directly instead of through req object

Signed-off-by: Krishna Waske <[email protected]>

---------

Signed-off-by: Krishna Waske <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: update nestjs version

4 participants