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)
.map(({ id }) => ({
type: CommitType.DELETE,
secretVersionId: secretVersions[id].id
}));
secretVersionId: secretVersions[id]?.id
}))
.filter((el) => el.secretVersionId);
if (changes.length > 0) {
if (commitChanges) {
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({
message: `One or more secrets does not exist: ${secretsToDelete.map((el) => el.key).join(", ")}`
});