Remove secret_version_v1 changes

This commit is contained in:
carlosmonastyrski
2025-03-06 11:31:26 -03:00
parent 07e1d1b130
commit efc3b6d474
5 changed files with 4 additions and 76 deletions
@@ -761,11 +761,7 @@ export const secretApprovalRequestServiceFactory = ({
secretDAL, secretDAL,
secretVersionDAL, secretVersionDAL,
secretTagDAL, secretTagDAL,
secretVersionTagDAL, secretVersionTagDAL
actor: {
type: actor,
actorId
}
}) })
: []; : [];
const updatedSecrets = secretUpdationCommits.length const updatedSecrets = secretUpdationCommits.length
@@ -811,11 +807,7 @@ export const secretApprovalRequestServiceFactory = ({
secretDAL, secretDAL,
secretVersionDAL, secretVersionDAL,
secretTagDAL, secretTagDAL,
secretVersionTagDAL, secretVersionTagDAL
actor: {
type: actor,
actorId
}
}) })
: []; : [];
const deletedSecret = secretDeletionCommits.length const deletedSecret = secretDeletionCommits.length
@@ -710,10 +710,6 @@ export const secretReplicationServiceFactory = ({
tx, tx,
secretTagDAL, secretTagDAL,
secretVersionTagDAL, secretVersionTagDAL,
actor: {
type: actor,
actorId
},
inputSecrets: locallyCreatedSecrets.map((doc) => { inputSecrets: locallyCreatedSecrets.map((doc) => {
return { return {
keyEncoding: doc.keyEncoding, keyEncoding: doc.keyEncoding,
@@ -745,10 +741,6 @@ export const secretReplicationServiceFactory = ({
tx, tx,
secretTagDAL, secretTagDAL,
secretVersionTagDAL, secretVersionTagDAL,
actor: {
type: actor,
actorId
},
inputSecrets: locallyUpdatedSecrets.map((doc) => { inputSecrets: locallyUpdatedSecrets.map((doc) => {
return { return {
filter: { filter: {
+1 -17
View File
@@ -525,7 +525,6 @@ export const fnSecretBulkInsert = async ({
secretVersionDAL, secretVersionDAL,
secretTagDAL, secretTagDAL,
secretVersionTagDAL, secretVersionTagDAL,
actor,
tx tx
}: TFnSecretBulkInsert) => { }: TFnSecretBulkInsert) => {
const sanitizedInputSecrets = inputSecrets.map( const sanitizedInputSecrets = inputSecrets.map(
@@ -581,16 +580,9 @@ export const fnSecretBulkInsert = async ({
})) }))
); );
const userActorId = actor && actor?.type === ActorType.USER ? actor?.actorId : undefined;
const identityActorId = actor && actor?.type !== ActorType.USER ? actor?.actorId : undefined;
const actorType = actor?.type || ActorType.PLATFORM;
const secretVersions = await secretVersionDAL.insertMany( const secretVersions = await secretVersionDAL.insertMany(
sanitizedInputSecrets.map((el) => ({ sanitizedInputSecrets.map((el) => ({
...el, ...el,
userActorId,
identityActorId,
actorType,
secretId: newSecretGroupByBlindIndex[el.secretBlindIndex as string][0].id secretId: newSecretGroupByBlindIndex[el.secretBlindIndex as string][0].id
})), })),
tx tx
@@ -623,8 +615,7 @@ export const fnSecretBulkUpdate = async ({
secretDAL, secretDAL,
secretVersionDAL, secretVersionDAL,
secretTagDAL, secretTagDAL,
secretVersionTagDAL, secretVersionTagDAL
actor
}: TFnSecretBulkUpdate) => { }: TFnSecretBulkUpdate) => {
const sanitizedInputSecrets = inputSecrets.map( const sanitizedInputSecrets = inputSecrets.map(
({ ({
@@ -674,17 +665,10 @@ export const fnSecretBulkUpdate = async ({
}) })
); );
const userActorId = actor && actor?.type === ActorType.USER ? actor?.actorId : undefined;
const identityActorId = actor && actor?.type !== ActorType.USER ? actor?.actorId : undefined;
const actorType = actor?.type || ActorType.PLATFORM;
const newSecrets = await secretDAL.bulkUpdate(sanitizedInputSecrets, tx); const newSecrets = await secretDAL.bulkUpdate(sanitizedInputSecrets, tx);
const secretVersions = await secretVersionDAL.insertMany( const secretVersions = await secretVersionDAL.insertMany(
newSecrets.map(({ id, createdAt, updatedAt, ...el }) => ({ newSecrets.map(({ id, createdAt, updatedAt, ...el }) => ({
...el, ...el,
userActorId,
identityActorId,
actorType,
secretId: id secretId: id
})), })),
tx tx
+1 -33
View File
@@ -284,10 +284,6 @@ export const secretServiceFactory = ({
secretVersionDAL, secretVersionDAL,
secretTagDAL, secretTagDAL,
secretVersionTagDAL, secretVersionTagDAL,
actor: {
type: actor,
actorId
},
tx tx
}) })
); );
@@ -433,10 +429,6 @@ export const secretServiceFactory = ({
secretVersionDAL, secretVersionDAL,
secretTagDAL, secretTagDAL,
secretVersionTagDAL, secretVersionTagDAL,
actor: {
type: actor,
actorId
},
tx tx
}) })
); );
@@ -830,10 +822,6 @@ export const secretServiceFactory = ({
secretVersionDAL, secretVersionDAL,
secretTagDAL, secretTagDAL,
secretVersionTagDAL, secretVersionTagDAL,
actor: {
type: actor,
actorId
},
tx tx
}) })
); );
@@ -943,11 +931,7 @@ export const secretServiceFactory = ({
secretDAL, secretDAL,
secretVersionDAL, secretVersionDAL,
secretTagDAL, secretTagDAL,
secretVersionTagDAL, secretVersionTagDAL
actor: {
type: actor,
actorId
}
}) })
); );
@@ -2420,10 +2404,6 @@ export const secretServiceFactory = ({
secretVersionDAL, secretVersionDAL,
secretTagDAL, secretTagDAL,
secretVersionTagDAL, secretVersionTagDAL,
actor: {
type: actor,
actorId
},
tx tx
}) })
); );
@@ -2534,10 +2514,6 @@ export const secretServiceFactory = ({
secretVersionDAL, secretVersionDAL,
secretTagDAL, secretTagDAL,
secretVersionTagDAL, secretVersionTagDAL,
actor: {
type: actor,
actorId
},
tx tx
}) })
); );
@@ -2872,10 +2848,6 @@ export const secretServiceFactory = ({
secretDAL, secretDAL,
tx, tx,
secretTagDAL, secretTagDAL,
actor: {
type: actor,
actorId
},
secretVersionTagDAL, secretVersionTagDAL,
inputSecrets: locallyCreatedSecrets.map((doc) => { inputSecrets: locallyCreatedSecrets.map((doc) => {
return { return {
@@ -2907,10 +2879,6 @@ export const secretServiceFactory = ({
tx, tx,
secretTagDAL, secretTagDAL,
secretVersionTagDAL, secretVersionTagDAL,
actor: {
type: actor,
actorId
},
inputSecrets: locallyUpdatedSecrets.map((doc) => { inputSecrets: locallyUpdatedSecrets.map((doc) => {
return { return {
filter: { filter: {
@@ -322,10 +322,6 @@ export type TFnSecretBulkInsert = {
secretVersionDAL: Pick<TSecretVersionDALFactory, "insertMany">; secretVersionDAL: Pick<TSecretVersionDALFactory, "insertMany">;
secretTagDAL: Pick<TSecretTagDALFactory, "saveTagsToSecret">; secretTagDAL: Pick<TSecretTagDALFactory, "saveTagsToSecret">;
secretVersionTagDAL: Pick<TSecretVersionTagDALFactory, "insertMany">; secretVersionTagDAL: Pick<TSecretVersionTagDALFactory, "insertMany">;
actor?: {
type?: string;
actorId?: string;
};
}; };
export type TFnSecretBulkUpdate = { export type TFnSecretBulkUpdate = {
@@ -340,10 +336,6 @@ export type TFnSecretBulkUpdate = {
secretTagDAL: Pick<TSecretTagDALFactory, "saveTagsToSecret" | "deleteTagsManySecret">; secretTagDAL: Pick<TSecretTagDALFactory, "saveTagsToSecret" | "deleteTagsManySecret">;
secretVersionTagDAL: Pick<TSecretVersionTagDALFactory, "insertMany">; secretVersionTagDAL: Pick<TSecretVersionTagDALFactory, "insertMany">;
tx?: Knex; tx?: Knex;
actor?: {
type?: string;
actorId?: string;
};
}; };
export type TAttachSecretTagsDTO = { export type TAttachSecretTagsDTO = {