fix: default duplicate secret deletion

This commit is contained in:
Piyush Gupta
2025-11-25 20:23:04 +05:30
parent 0d62ef6fb5
commit f031339d83
3 changed files with 6 additions and 8 deletions
@@ -424,8 +424,10 @@ export const fnSecretBulkDelete = async ({
.filter(({ type }) => type === SecretType.Shared) .filter(({ type }) => type === SecretType.Shared)
.map(({ id }) => ({ .map(({ id }) => ({
type: CommitType.DELETE, type: CommitType.DELETE,
secretVersionId: secretVersions[id].id secretVersionId: secretVersions[id]?.id
})); }))
.filter((el) => el.secretVersionId);
if (changes.length > 0) { if (changes.length > 0) {
if (commitChanges) { if (commitChanges) {
commitChanges.push(...changes); commitChanges.push(...changes);
@@ -2254,7 +2254,8 @@ export const secretV2BridgeServiceFactory = ({
] ]
} }
}); });
if (secretsToDelete.length !== inputSecrets.length) const secretsToDeleteSet = new Set(secretsToDelete.map((el) => el.key));
if (secretsToDeleteSet.size !== inputSecrets.length)
throw new NotFoundError({ throw new NotFoundError({
message: `One or more secrets does not exist: ${secretsToDelete.map((el) => el.key).join(", ")}` message: `One or more secrets does not exist: ${secretsToDelete.map((el) => el.key).join(", ")}`
}); });
-5
View File
@@ -14,11 +14,6 @@ const secretsToBeAdded = [
secretValue: "OVERRIDE_THIS", secretValue: "OVERRIDE_THIS",
secretComment: "Override secrets with personal value" secretComment: "Override secrets with personal value"
}, },
{
secretKey: "DB_PASSWORD",
secretValue: "OVERRIDE_THIS",
secretComment: "Another secret override"
},
{ {
secretKey: "DB_PASSWORD", secretKey: "DB_PASSWORD",
secretValue: "example_password" secretValue: "example_password"