Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

use enum for dep sync status

x032205e9f07c5873e1
diff --git a/backend/src/ee/services/pam-discovery/pam-discovery-enums.ts b/backend/src/ee/services/pam-discovery/pam-discovery-enums.ts
index 68d67ce2ff..e766971fb6 100644
--- a/backend/src/ee/services/pam-discovery/pam-discovery-enums.ts
+++ b/backend/src/ee/services/pam-discovery/pam-discovery-enums.ts
@@ -54,3 +54,9 @@ export enum PamAccountDependencySource {
Discovery = "discovery",
Manual = "manual"
}
+
+export enum PamDependencySyncStatus {
+ Pending = "pending",
+ Success = "success",
+ Failed = "failed"
+}
diff --git a/backend/src/ee/services/pam-resource/shared/dependency-sync-fns.ts b/backend/src/ee/services/pam-resource/shared/dependency-sync-fns.ts
index 6c6c7eebd2..6897ae920d 100644
--- a/backend/src/ee/services/pam-resource/shared/dependency-sync-fns.ts
+++ b/backend/src/ee/services/pam-resource/shared/dependency-sync-fns.ts
@@ -10,7 +10,7 @@ import { KmsDataKey } from "@app/services/kms/kms-types";
import { verifyHostInputValidity } from "../../dynamic-secret/dynamic-secret-fns";
import { TGatewayV2ServiceFactory } from "../../gateway-v2/gateway-v2-service";
-import { PamAccountDependencyType } from "../../pam-discovery/pam-discovery-enums";
+import { PamAccountDependencyType, PamDependencySyncStatus } from "../../pam-discovery/pam-discovery-enums";
import { decryptResource } from "../pam-resource-fns";
import { TPostRotateContext } from "../pam-resource-types";
@@ -159,7 +159,7 @@ export const syncDependenciesAfterRotation = async ({
for (const dep of deps) {
try {
// eslint-disable-next-line no-await-in-loop
- await ctx.pamAccountDependenciesDAL.updateById(dep.id, { syncStatus: "pending" });
+ await ctx.pamAccountDependenciesDAL.updateById(dep.id, { syncStatus: PamDependencySyncStatus.Pending });
const script = buildDependencySyncScript(dep, newCredentials.username, newCredentials.password);
@@ -199,7 +199,7 @@ export const syncDependenciesAfterRotation = async ({
// eslint-disable-next-line no-await-in-loop
await ctx.pamAccountDependenciesDAL.updateById(dep.id, {
- syncStatus: "success",
+ syncStatus: PamDependencySyncStatus.Success,
lastSyncedAt: new Date(),
encryptedLastSyncMessage: null
});
@@ -221,7 +221,7 @@ export const syncDependenciesAfterRotation = async ({
// eslint-disable-next-line no-await-in-loop
await ctx.pamAccountDependenciesDAL.updateById(dep.id, {
- syncStatus: "failed",
+ syncStatus: PamDependencySyncStatus.Failed,
lastSyncedAt: new Date(),
encryptedLastSyncMessage: encryptedMessage
});
@@ -229,7 +229,7 @@ export const syncDependenciesAfterRotation = async ({
logger.error(encryptErr, `[DependencySync] Failed to encrypt error message for dep ${dep.id}`);
// eslint-disable-next-line no-await-in-loop
await ctx.pamAccountDependenciesDAL.updateById(dep.id, {
- syncStatus: "failed",
+ syncStatus: PamDependencySyncStatus.Failed,
lastSyncedAt: new Date()
});
}