Skip to content

Commit bddf8ed

Browse files
authored
making expression debug info serializable (#78727)
1 parent 69ac94c commit bddf8ed

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/plugins/expressions/common/ast/types.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
*/
1919

2020
import { ExpressionValue, ExpressionValueError } from '../expression_types';
21-
import { ExpressionFunction } from '../../common';
2221

2322
export type ExpressionAstNode =
2423
| ExpressionAstExpression
@@ -48,9 +47,9 @@ export interface ExpressionAstFunctionDebug {
4847
success: boolean;
4948

5049
/**
51-
* Reference to the expression function this AST node represents.
50+
* Id of expression function.
5251
*/
53-
fn: ExpressionFunction;
52+
fn: string;
5453

5554
/**
5655
* Input that expression function received as its first argument.

src/plugins/expressions/common/execution/execution.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ describe('Execution', () => {
491491
await execution.result;
492492

493493
for (const node of execution.state.get().ast.chain) {
494-
expect(node.debug?.fn.name).toBe('add');
494+
expect(node.debug?.fn).toBe('add');
495495
}
496496
});
497497

@@ -667,7 +667,7 @@ describe('Execution', () => {
667667

668668
expect(node2.debug).toMatchObject({
669669
success: false,
670-
fn: expect.any(Object),
670+
fn: 'throws',
671671
input: expect.any(Object),
672672
args: expect.any(Object),
673673
error: expect.any(Object),

src/plugins/expressions/common/execution/execution.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ export class Execution<
235235
const timeEnd: number = now();
236236
(link as ExpressionAstFunction).debug = {
237237
success: true,
238-
fn,
238+
fn: fn.name,
239239
input,
240240
args: resolvedArgs,
241241
output,
@@ -253,7 +253,7 @@ export class Execution<
253253
if (this.params.debug) {
254254
(link as ExpressionAstFunction).debug = {
255255
success: false,
256-
fn,
256+
fn: fn.name,
257257
input,
258258
args,
259259
error,

0 commit comments

Comments
 (0)