fix(core): Remove circular references before serializing executions in public API (#8043)

## Summary
Handle circular references in the public API for executions created
prior to the fix from #8030

## Related tickets
[PAY-1119](https://linear.app/n8n/issue/PAY-1119)

## Review / Merge checklist
- [x] PR title and summary are descriptive.
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-12-15 16:01:41 +01:00
committed by GitHub
parent 1e7a309e63
commit 989888d9bc
5 changed files with 7 additions and 9 deletions

View File

@@ -89,7 +89,7 @@ type JSONStringifyOptions = {
replaceCircularRefs?: boolean;
};
const replaceCircularReferences = <T>(value: T, knownObjects = new WeakSet()): T => {
export const replaceCircularReferences = <T>(value: T, knownObjects = new WeakSet()): T => {
if (typeof value !== 'object' || value === null || value instanceof RegExp) return value;
if ('toJSON' in value && typeof value.toJSON === 'function') return value.toJSON() as T;
if (knownObjects.has(value)) return '[Circular Reference]' as T;