mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(core): fix workflow hasing for MySQL (#4491)
* 🐛 Alphabetize node keys * 🔥 Remove excess braces
This commit is contained in:
@@ -29,6 +29,7 @@ import { SharedWorkflow } from './SharedWorkflow';
|
|||||||
import { objectRetriever, sqlite } from '../utils/transformers';
|
import { objectRetriever, sqlite } from '../utils/transformers';
|
||||||
import { AbstractEntity, jsonColumnType } from './AbstractEntity';
|
import { AbstractEntity, jsonColumnType } from './AbstractEntity';
|
||||||
import type { IWorkflowDb } from '../../Interfaces';
|
import type { IWorkflowDb } from '../../Interfaces';
|
||||||
|
import { alphabetizeKeys } from '../../utils';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class WorkflowEntity extends AbstractEntity implements IWorkflowDb {
|
export class WorkflowEntity extends AbstractEntity implements IWorkflowDb {
|
||||||
@@ -103,7 +104,7 @@ export class WorkflowEntity extends AbstractEntity implements IWorkflowDb {
|
|||||||
const state = JSON.stringify({
|
const state = JSON.stringify({
|
||||||
name,
|
name,
|
||||||
active,
|
active,
|
||||||
nodes,
|
nodes: nodes ? nodes.map(alphabetizeKeys) : [],
|
||||||
connections,
|
connections,
|
||||||
settings,
|
settings,
|
||||||
staticData,
|
staticData,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
import { CliWorkflowOperationError, SubworkflowOperationError } from 'n8n-workflow';
|
import { CliWorkflowOperationError, SubworkflowOperationError } from 'n8n-workflow';
|
||||||
import type { INode } from 'n8n-workflow';
|
import type { INode } from 'n8n-workflow';
|
||||||
|
|
||||||
@@ -28,3 +29,15 @@ function findWorkflowStart(executionMode: 'integrated' | 'cli') {
|
|||||||
export const findSubworkflowStart = findWorkflowStart('integrated');
|
export const findSubworkflowStart = findWorkflowStart('integrated');
|
||||||
|
|
||||||
export const findCliWorkflowStart = findWorkflowStart('cli');
|
export const findCliWorkflowStart = findWorkflowStart('cli');
|
||||||
|
|
||||||
|
export const alphabetizeKeys = (obj: INode) =>
|
||||||
|
Object.keys(obj)
|
||||||
|
.sort()
|
||||||
|
.reduce<Partial<INode>>(
|
||||||
|
(acc, key) => ({
|
||||||
|
...acc,
|
||||||
|
// @ts-expect-error @TECH_DEBT Adding index signature to INode causes type issues downstream
|
||||||
|
[key]: obj[key],
|
||||||
|
}),
|
||||||
|
{},
|
||||||
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user