From e8640403db26d1eb2e31514598a2ccdaf67ee007 Mon Sep 17 00:00:00 2001 From: CodeWithAryanK <172922447+CodeWithAryanK@users.noreply.github.com> Date: Tue, 24 Jun 2025 00:00:05 +0530 Subject: [PATCH] Refactor AgentType enum: Replace 'AFJ' with 'Credo' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **What does this PR do?** This pull request refactors the `AgentType` enum by replacing the outdated `'AFJ'` value with `'Credo'` in `libs/enum/src/enum.ts`. All usages of `AgentType.AFJ` and the string `'AFJ'` across the codebase have been updated to `AgentType.Credo` and `'Credo'` respectively. The lingering TODO comment has also been removed. **Why is this change necessary?** There was a TODO to update the agent type for consistency and clarity. Using the correct agent name avoids confusion and ensures uniform reference across services. **What has changed?** - `AgentType.AFJ` → `AgentType.Credo` - `'AFJ'` string values replaced with `'Credo'` - TODO comment removed **How was this tested?** All references and usages were carefully updated and verified. ✅ (Optional) If tests were run: "The test suite was executed to ensure no regressions." Signed-off-by: CodeWithAryanK <172922447+CodeWithAryanK@users.noreply.github.com> --- apps/agent-provisioning/src/agent-provisioning.service.ts | 2 +- apps/agent-service/src/agent-service.service.ts | 4 ++-- .../src/repositories/agent-service.repository.ts | 2 +- libs/enum/src/enum.ts | 3 +-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/apps/agent-provisioning/src/agent-provisioning.service.ts b/apps/agent-provisioning/src/agent-provisioning.service.ts index 92d382358..6ca3f2ee7 100644 --- a/apps/agent-provisioning/src/agent-provisioning.service.ts +++ b/apps/agent-provisioning/src/agent-provisioning.service.ts @@ -23,7 +23,7 @@ export class AgentProvisioningService { try { const { containerName, externalIp, orgId, seed, walletName, walletPassword, walletStorageHost, walletStoragePassword, walletStoragePort, walletStorageUser, webhookEndpoint, agentType, protocol, credoImage, tenant, indyLedger, inboundEndpoint } = payload; - if (agentType === AgentType.AFJ) { + if (agentType === AgentType.Credo) { // The wallet provision command is used to invoke a shell script const walletProvision = `${process.cwd() + process.env.AFJ_AGENT_SPIN_UP} ${orgId} "${externalIp}" "${walletName}" "${walletPassword}" ${seed} ${webhookEndpoint} ${walletStorageHost} ${walletStoragePort} ${walletStorageUser} ${walletStoragePassword} ${containerName} ${protocol} ${tenant} ${credoImage} "${indyLedger}" ${inboundEndpoint} ${process.env.SCHEMA_FILE_SERVER_URL} ${process.env.AGENT_HOST} ${process.env.AWS_ACCOUNT_ID} ${process.env.S3_BUCKET_ARN} ${process.env.CLUSTER_NAME} ${process.env.TESKDEFINITION_FAMILY}`; const spinUpResponse: object = new Promise(async (resolve) => { diff --git a/apps/agent-service/src/agent-service.service.ts b/apps/agent-service/src/agent-service.service.ts index 4a61dba6f..0265144fd 100644 --- a/apps/agent-service/src/agent-service.service.ts +++ b/apps/agent-service/src/agent-service.service.ts @@ -414,7 +414,7 @@ export class AgentServiceService { walletStoragePassword: process.env.WALLET_STORAGE_PASSWORD || '', inboundEndpoint, containerName: orgData.name.split(' ').join('_'), - agentType: AgentType.AFJ, + agentType: AgentType.Credo, orgName: orgData?.name, indyLedger: escapedJsonString, credoImage: process.env.AFJ_VERSION || '', @@ -862,7 +862,7 @@ export class AgentServiceService { // Get shared agent type const orgAgentTypeId = await this.agentServiceRepository.getOrgAgentTypeDetails(OrgAgentType.SHARED); // Get agent type details - const agentTypeId = await this.agentServiceRepository.getAgentTypeId(AgentType.AFJ); + const agentTypeId = await this.agentServiceRepository.getAgentTypeId(AgentType.Credo); const storeOrgAgentData: IStoreOrgAgentDetails = { did: tenantDetails.DIDCreationOption.did, diff --git a/apps/agent-service/src/repositories/agent-service.repository.ts b/apps/agent-service/src/repositories/agent-service.repository.ts index 4eb239932..d5bf68552 100644 --- a/apps/agent-service/src/repositories/agent-service.repository.ts +++ b/apps/agent-service/src/repositories/agent-service.repository.ts @@ -297,7 +297,7 @@ export class AgentServiceRepository { try { const { id } = await this.prisma.agents_type.findFirstOrThrow({ where: { - agent: AgentType.AFJ + agent: AgentType.Credo } }); return id; diff --git a/libs/enum/src/enum.ts b/libs/enum/src/enum.ts index fa0eba90b..1fe01f84f 100644 --- a/libs/enum/src/enum.ts +++ b/libs/enum/src/enum.ts @@ -26,8 +26,7 @@ export enum CredDefSortFields { } export enum AgentType { - // TODO: Change to Credo - AFJ = 'AFJ', + Credo = 'Credo', ACAPY = 'ACAPY' }