feat(core): reimplement blocking workflow updates on interim changes (#4446)
* 📘 Update request type * 📘 Update FE types * ⚡ Adjust store * ⚡ Set received hash * ⚡ Send and load hash * ⚡ Make helper more flexible * 🗃️ Add new field to entity * 🚨 Add check to endpoint * 🧪 Add tests * ⚡ Add `forceSave` flag * 🐛 Fix workflow update failing on new workflow * 🧪 Add more tests * ⚡ Move check to `updateWorkflow()` * ⚡ Refactor to accommodate latest changes * 🧪 Refactor tests to keep them passing * ⚡ Improve syntax
This commit is contained in:
@@ -121,6 +121,7 @@ export class EEWorkflowsService extends WorkflowsService {
|
||||
workflow: WorkflowEntity,
|
||||
workflowId: string,
|
||||
tags?: string[],
|
||||
forceSave?: boolean,
|
||||
): Promise<WorkflowEntity> {
|
||||
const previousVersion = await EEWorkflowsService.get({ id: parseInt(workflowId, 10) });
|
||||
if (!previousVersion) {
|
||||
@@ -128,13 +129,13 @@ export class EEWorkflowsService extends WorkflowsService {
|
||||
}
|
||||
const allCredentials = await EECredentials.getAll(user);
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
|
||||
workflow = WorkflowHelpers.validateWorkflowCredentialUsage(
|
||||
workflow,
|
||||
previousVersion,
|
||||
allCredentials,
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
throw new ResponseHelper.ResponseError(
|
||||
'Invalid workflow credentials - make sure you have access to all credentials and try again.',
|
||||
undefined,
|
||||
@@ -142,6 +143,6 @@ export class EEWorkflowsService extends WorkflowsService {
|
||||
);
|
||||
}
|
||||
|
||||
return super.updateWorkflow(user, workflow, workflowId, tags);
|
||||
return super.updateWorkflow(user, workflow, workflowId, tags, forceSave);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user