@outputai/core 0.10.1-dev.b7b2fbe.0 → 0.10.1-next.09ed166.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/bus.js +58 -20
- package/src/bus.spec.js +135 -77
- package/src/helpers/object.js +5 -1
- package/src/helpers/object.spec.js +5 -0
- package/src/hooks/index.d.ts +48 -45
- package/src/hooks/index.js +49 -44
- package/src/hooks/index.spec.js +74 -102
- package/src/sdk/runtime/events.d.ts +4 -6
- package/src/sdk/runtime/events.js +2 -15
- package/src/sdk/runtime/events.spec.js +14 -92
- package/src/worker/global_functions.js +2 -2
- package/src/worker/global_functions.spec.js +3 -3
- package/src/worker/index.js +3 -3
- package/src/worker/index.spec.js +6 -6
- package/src/worker/interceptors/activity.js +4 -4
- package/src/worker/interceptors/activity.spec.js +9 -9
- package/src/worker/log_hooks.js +9 -9
- package/src/worker/log_hooks.spec.js +2 -2
- package/src/worker/sinks.js +8 -8
- package/src/worker/sinks.spec.js +9 -9
package/src/worker/index.spec.js
CHANGED
|
@@ -7,7 +7,7 @@ const {
|
|
|
7
7
|
connectionMonitorInstance,
|
|
8
8
|
createCatalogMock,
|
|
9
9
|
initInterceptorsMock,
|
|
10
|
-
|
|
10
|
+
mainEventBusMock,
|
|
11
11
|
mockConnection,
|
|
12
12
|
mockLog,
|
|
13
13
|
mockWorker,
|
|
@@ -110,7 +110,7 @@ const {
|
|
|
110
110
|
loadActivitiesMock: vi.fn().mockResolvedValue( {} ),
|
|
111
111
|
loadHooksMock: vi.fn().mockResolvedValue( undefined ),
|
|
112
112
|
loadWorkflowsMock: vi.fn().mockResolvedValue( [] ),
|
|
113
|
-
|
|
113
|
+
mainEventBusMock: { emit: vi.fn(), on: vi.fn() },
|
|
114
114
|
mockConnection: { close: vi.fn().mockResolvedValue( undefined ) },
|
|
115
115
|
mockLog: { error: vi.fn(), info: vi.fn(), warn: vi.fn() },
|
|
116
116
|
mockWorker,
|
|
@@ -128,7 +128,7 @@ vi.mock( '#consts', async importOriginal => {
|
|
|
128
128
|
} );
|
|
129
129
|
const initTracing = vi.fn().mockResolvedValue( undefined );
|
|
130
130
|
vi.mock( '#tracing', () => ( { init: initTracing } ) );
|
|
131
|
-
vi.mock( '#bus', () => ( {
|
|
131
|
+
vi.mock( '#bus', () => ( { mainEventBus: mainEventBusMock } ) );
|
|
132
132
|
|
|
133
133
|
const loadWorkflowsMock = vi.fn().mockResolvedValue( { workflows: [], entrypoint: '/fake/workflows/path.js' } );
|
|
134
134
|
const loadActivitiesMock = vi.fn().mockResolvedValue( { activities: {} } );
|
|
@@ -357,7 +357,7 @@ describe( 'worker/index', () => {
|
|
|
357
357
|
error: 'Big Failure'
|
|
358
358
|
} ) );
|
|
359
359
|
} );
|
|
360
|
-
expect(
|
|
360
|
+
expect( mainEventBusMock.emit ).toHaveBeenCalledWith( expect.any( String ), { error } );
|
|
361
361
|
await vi.waitFor( () => expect( exitMock ).toHaveBeenCalledWith( 1 ) );
|
|
362
362
|
} );
|
|
363
363
|
|
|
@@ -378,7 +378,7 @@ describe( 'worker/index', () => {
|
|
|
378
378
|
} );
|
|
379
379
|
expect( mockWorker.shutdown ).toHaveBeenCalledOnce();
|
|
380
380
|
expect( catalogJobInstance.interrupt ).toHaveBeenCalledOnce();
|
|
381
|
-
expect(
|
|
381
|
+
expect( mainEventBusMock.emit ).toHaveBeenCalledWith( expect.any( String ), { error } );
|
|
382
382
|
} );
|
|
383
383
|
|
|
384
384
|
it( 'throws catalog job errors after graceful shutdown', async () => {
|
|
@@ -398,7 +398,7 @@ describe( 'worker/index', () => {
|
|
|
398
398
|
} );
|
|
399
399
|
expect( mockWorker.shutdown ).toHaveBeenCalledOnce();
|
|
400
400
|
expect( connectionMonitorInstance.stop ).toHaveBeenCalledOnce();
|
|
401
|
-
expect(
|
|
401
|
+
expect( mainEventBusMock.emit ).toHaveBeenCalledWith( expect.any( String ), { error } );
|
|
402
402
|
} );
|
|
403
403
|
|
|
404
404
|
it( 'cleans up partial startup failures after connecting', async () => {
|
|
@@ -4,7 +4,7 @@ import * as Tracing from '#tracing';
|
|
|
4
4
|
import { headersToObject } from './headers.js';
|
|
5
5
|
import { ACTIVITY_WRAPPER_VERSION_FIELD, BusEventType, METADATA_ACCESS_SYMBOL } from '#consts';
|
|
6
6
|
import { activityHeartbeatEnabled, activityHeartbeatIntervalMs } from '../configs.js';
|
|
7
|
-
import {
|
|
7
|
+
import { mainEventBus } from '#bus';
|
|
8
8
|
import { aggregateAttributes } from '#helpers/aggregations';
|
|
9
9
|
import { buildApplicationFailureWithDetails } from '#helpers/errors';
|
|
10
10
|
|
|
@@ -68,7 +68,7 @@ export class ActivityExecutionInterceptor {
|
|
|
68
68
|
addAttribute
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
mainEventBus.emit( BusEventType.ACTIVITY_START, { activityInfo, workflowDetails, outputActivityKind } );
|
|
72
72
|
Tracing.addEventStart( { id: activityId, name: activityType, kind: outputActivityKind, parentId: runId, details: input.args[0], traceInfo } );
|
|
73
73
|
|
|
74
74
|
try {
|
|
@@ -79,14 +79,14 @@ export class ActivityExecutionInterceptor {
|
|
|
79
79
|
|
|
80
80
|
const aggregations = state.attributes.length > 0 ? aggregateAttributes( state.attributes ) : null;
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
mainEventBus.emit( BusEventType.ACTIVITY_END, { activityInfo, aggregations, workflowDetails, outputActivityKind } );
|
|
83
83
|
Tracing.addEventEnd( { id: activityId, details: output, traceInfo } );
|
|
84
84
|
|
|
85
85
|
return { [ACTIVITY_WRAPPER_VERSION_FIELD]: 1, output, aggregations };
|
|
86
86
|
|
|
87
87
|
} catch ( error ) {
|
|
88
88
|
const aggregations = state.attributes.length > 0 ? aggregateAttributes( state.attributes ) : null;
|
|
89
|
-
|
|
89
|
+
mainEventBus.emit( BusEventType.ACTIVITY_ERROR, { activityInfo, aggregations, workflowDetails, outputActivityKind, error } );
|
|
90
90
|
Tracing.addEventError( { id: activityId, details: error, traceInfo } );
|
|
91
91
|
|
|
92
92
|
throw aggregations ? buildApplicationFailureWithDetails( error, { aggregations } ) : error;
|
|
@@ -61,8 +61,8 @@ vi.mock( './headers.js', () => ( {
|
|
|
61
61
|
headersToObject: () => ( { traceInfo: traceInfoMock, workflowDetails: workflowDetailsMock } )
|
|
62
62
|
} ) );
|
|
63
63
|
|
|
64
|
-
const
|
|
65
|
-
vi.mock( '#bus', () => ( {
|
|
64
|
+
const mainEventBusEmitMock = vi.fn();
|
|
65
|
+
vi.mock( '#bus', () => ( { mainEventBus: { emit: mainEventBusEmitMock } } ) );
|
|
66
66
|
|
|
67
67
|
vi.mock( '#consts', async importOriginal => {
|
|
68
68
|
const actual = await importOriginal();
|
|
@@ -135,11 +135,11 @@ describe( 'ActivityExecutionInterceptor', () => {
|
|
|
135
135
|
aggregations: null,
|
|
136
136
|
[ACTIVITY_WRAPPER_VERSION_FIELD]: 1
|
|
137
137
|
} );
|
|
138
|
-
expect(
|
|
138
|
+
expect( mainEventBusEmitMock ).toHaveBeenCalledWith(
|
|
139
139
|
BusEventType.ACTIVITY_START,
|
|
140
140
|
{ activityInfo: activityInfoMock, workflowDetails: workflowDetailsMock, outputActivityKind: 'step' }
|
|
141
141
|
);
|
|
142
|
-
expect(
|
|
142
|
+
expect( mainEventBusEmitMock ).toHaveBeenCalledWith(
|
|
143
143
|
BusEventType.ACTIVITY_END,
|
|
144
144
|
{ activityInfo: activityInfoMock, aggregations: null, workflowDetails: workflowDetailsMock, outputActivityKind: 'step' }
|
|
145
145
|
);
|
|
@@ -178,7 +178,7 @@ describe( 'ActivityExecutionInterceptor', () => {
|
|
|
178
178
|
[ACTIVITY_WRAPPER_VERSION_FIELD]: 1
|
|
179
179
|
} );
|
|
180
180
|
|
|
181
|
-
expect(
|
|
181
|
+
expect( mainEventBusEmitMock ).toHaveBeenCalledWith( BusEventType.ACTIVITY_END, expect.any( Object ) );
|
|
182
182
|
expect( addEventEndMock ).toHaveBeenCalledWith( { id: 'act-1', details: { result: 'sync' }, traceInfo: traceInfoMock } );
|
|
183
183
|
expect( addEventErrorMock ).not.toHaveBeenCalled();
|
|
184
184
|
} );
|
|
@@ -198,7 +198,7 @@ describe( 'ActivityExecutionInterceptor', () => {
|
|
|
198
198
|
[ACTIVITY_WRAPPER_VERSION_FIELD]: 1
|
|
199
199
|
} );
|
|
200
200
|
|
|
201
|
-
expect(
|
|
201
|
+
expect( mainEventBusEmitMock ).toHaveBeenCalledWith( BusEventType.ACTIVITY_END, {
|
|
202
202
|
activityInfo: activityInfoMock,
|
|
203
203
|
aggregations: httpRequestAggregations,
|
|
204
204
|
workflowDetails: workflowDetailsMock,
|
|
@@ -226,7 +226,7 @@ describe( 'ActivityExecutionInterceptor', () => {
|
|
|
226
226
|
} ],
|
|
227
227
|
cause: error
|
|
228
228
|
} );
|
|
229
|
-
expect(
|
|
229
|
+
expect( mainEventBusEmitMock ).toHaveBeenCalledWith( BusEventType.ACTIVITY_ERROR, {
|
|
230
230
|
activityInfo: activityInfoMock,
|
|
231
231
|
aggregations: httpRequestAggregations,
|
|
232
232
|
workflowDetails: workflowDetailsMock,
|
|
@@ -318,8 +318,8 @@ describe( 'ActivityExecutionInterceptor', () => {
|
|
|
318
318
|
vi.advanceTimersByTime( 0 );
|
|
319
319
|
|
|
320
320
|
await expect( promise ).rejects.toThrow( 'step failed' );
|
|
321
|
-
expect(
|
|
322
|
-
expect(
|
|
321
|
+
expect( mainEventBusEmitMock ).toHaveBeenCalledWith( BusEventType.ACTIVITY_START, expect.any( Object ) );
|
|
322
|
+
expect( mainEventBusEmitMock ).toHaveBeenCalledWith( BusEventType.ACTIVITY_ERROR, {
|
|
323
323
|
activityInfo: activityInfoMock,
|
|
324
324
|
aggregations: null,
|
|
325
325
|
workflowDetails: workflowDetailsMock,
|
package/src/worker/log_hooks.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { mainEventBus } from '#bus';
|
|
2
2
|
import { createChildLogger } from '#logger';
|
|
3
3
|
import { ACTIVITY_GET_TRACE_DESTINATIONS, BusEventType, LifecycleEvent, WORKFLOW_CATALOG } from '#consts';
|
|
4
4
|
|
|
@@ -25,21 +25,21 @@ const serializedActivityFields = activityInfo => ( {
|
|
|
25
25
|
|
|
26
26
|
const shouldLogActivity = activityInfo => activityInfo.activityType !== ACTIVITY_GET_TRACE_DESTINATIONS;
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
mainEventBus.on( BusEventType.ACTIVITY_START, ( { activityInfo, outputActivityKind } ) =>
|
|
29
29
|
shouldLogActivity( activityInfo ) && activityLog.info( `Started ${activityInfo.activityType} ${outputActivityKind}`, {
|
|
30
30
|
event: LifecycleEvent.START,
|
|
31
31
|
...serializedActivityFields( activityInfo )
|
|
32
32
|
} )
|
|
33
33
|
);
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
mainEventBus.on( BusEventType.ACTIVITY_END, ( { activityInfo, outputActivityKind } ) =>
|
|
36
36
|
shouldLogActivity( activityInfo ) && activityLog.info( `Ended ${activityInfo.activityType} ${outputActivityKind}`, {
|
|
37
37
|
event: LifecycleEvent.END,
|
|
38
38
|
...serializedActivityFields( activityInfo )
|
|
39
39
|
} )
|
|
40
40
|
);
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
mainEventBus.on( BusEventType.ACTIVITY_ERROR, ( { activityInfo, outputActivityKind, error } ) =>
|
|
43
43
|
shouldLogActivity( activityInfo ) && activityLog.error( `Error ${activityInfo.activityType} ${outputActivityKind}: ${error.constructor.name}`, {
|
|
44
44
|
event: LifecycleEvent.ERROR,
|
|
45
45
|
...serializedActivityFields( activityInfo ),
|
|
@@ -47,7 +47,7 @@ messageBus.on( BusEventType.ACTIVITY_ERROR, ( { activityInfo, outputActivityKind
|
|
|
47
47
|
} )
|
|
48
48
|
);
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
mainEventBus.on( BusEventType.ACTIVITY_LOG, ( { level, message, metadata, activityInfo } ) =>
|
|
51
51
|
activityLog[level]( message, {
|
|
52
52
|
...metadata ?? {},
|
|
53
53
|
...serializedActivityFields( activityInfo )
|
|
@@ -68,21 +68,21 @@ const serializeWorkflowFields = workflowDetails => ( {
|
|
|
68
68
|
|
|
69
69
|
const shouldLogWorkflow = workflowDetails => workflowDetails.workflowType !== WORKFLOW_CATALOG;
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
mainEventBus.on( BusEventType.WORKFLOW_START, ( { workflowDetails } ) =>
|
|
72
72
|
shouldLogWorkflow( workflowDetails ) && workflowLog.info( `Started ${workflowDetails.workflowType} workflow`, {
|
|
73
73
|
event: LifecycleEvent.START,
|
|
74
74
|
...serializeWorkflowFields( workflowDetails )
|
|
75
75
|
} )
|
|
76
76
|
);
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
mainEventBus.on( BusEventType.WORKFLOW_END, ( { workflowDetails } ) =>
|
|
79
79
|
shouldLogWorkflow( workflowDetails ) && workflowLog.info( `Ended ${workflowDetails.workflowType} workflow`, {
|
|
80
80
|
event: LifecycleEvent.END,
|
|
81
81
|
...serializeWorkflowFields( workflowDetails )
|
|
82
82
|
} )
|
|
83
83
|
);
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
mainEventBus.on( BusEventType.WORKFLOW_ERROR, ( { workflowDetails, error } ) =>
|
|
86
86
|
shouldLogWorkflow( workflowDetails ) && workflowLog.error( `Error ${workflowDetails.workflowType} workflow: ${error.constructor.name}`, {
|
|
87
87
|
event: LifecycleEvent.ERROR,
|
|
88
88
|
...serializeWorkflowFields( workflowDetails ),
|
|
@@ -90,7 +90,7 @@ messageBus.on( BusEventType.WORKFLOW_ERROR, ( { workflowDetails, error } ) =>
|
|
|
90
90
|
} )
|
|
91
91
|
);
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
mainEventBus.on( BusEventType.WORKFLOW_LOG, ( { level, message, metadata, workflowDetails } ) =>
|
|
94
94
|
workflowLog[level]( message, {
|
|
95
95
|
...metadata ?? {},
|
|
96
96
|
...serializeWorkflowFields( workflowDetails )
|
|
@@ -22,14 +22,14 @@ const createChildLoggerMock = vi.hoisted( () =>
|
|
|
22
22
|
);
|
|
23
23
|
|
|
24
24
|
const onHandlers = vi.hoisted( () => ( {} ) );
|
|
25
|
-
const
|
|
25
|
+
const mainEventBusMock = vi.hoisted( () => ( {
|
|
26
26
|
on: vi.fn( ( eventType, handler ) => {
|
|
27
27
|
onHandlers[eventType] = handler;
|
|
28
28
|
} )
|
|
29
29
|
} ) );
|
|
30
30
|
|
|
31
31
|
vi.mock( '#logger', () => ( { createChildLogger: createChildLoggerMock } ) );
|
|
32
|
-
vi.mock( '#bus', () => ( {
|
|
32
|
+
vi.mock( '#bus', () => ( { mainEventBus: mainEventBusMock } ) );
|
|
33
33
|
|
|
34
34
|
import './log_hooks.js';
|
|
35
35
|
|
package/src/worker/sinks.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BusEventType, ComponentType } from '#consts';
|
|
2
2
|
import * as Tracing from '#tracing';
|
|
3
|
-
import {
|
|
3
|
+
import { mainEventBus } from '#bus';
|
|
4
4
|
import { createWorkflowDetails } from '#helpers/temporal_context';
|
|
5
5
|
|
|
6
6
|
// This sink allow for sandbox Temporal environment to send trace logs back to the main thread.
|
|
@@ -12,15 +12,15 @@ export const sinks = {
|
|
|
12
12
|
workflow: {
|
|
13
13
|
log: {
|
|
14
14
|
fn: ( workflowInfo, { level, message, metadata } ) => {
|
|
15
|
-
|
|
15
|
+
mainEventBus.emit( BusEventType.WORKFLOW_LOG, { level, message, metadata, workflowDetails: createWorkflowDetails( workflowInfo ) } );
|
|
16
16
|
},
|
|
17
17
|
callDuringReplay: false
|
|
18
18
|
},
|
|
19
19
|
start: {
|
|
20
20
|
fn: ( workflowInfo, input ) => {
|
|
21
21
|
const { runId, workflowType, memo: { traceInfo }, parent } = workflowInfo;
|
|
22
|
-
|
|
23
|
-
if ( traceInfo ) {
|
|
22
|
+
mainEventBus.emit( BusEventType.WORKFLOW_START, { workflowDetails: createWorkflowDetails( workflowInfo ) } );
|
|
23
|
+
if ( traceInfo ) {
|
|
24
24
|
Tracing.addEventStart( {
|
|
25
25
|
id: runId,
|
|
26
26
|
kind: ComponentType.WORKFLOW,
|
|
@@ -37,8 +37,8 @@ export const sinks = {
|
|
|
37
37
|
end: {
|
|
38
38
|
fn: ( workflowInfo, output ) => {
|
|
39
39
|
const { runId, memo: { traceInfo } } = workflowInfo;
|
|
40
|
-
|
|
41
|
-
if ( traceInfo ) {
|
|
40
|
+
mainEventBus.emit( BusEventType.WORKFLOW_END, { workflowDetails: createWorkflowDetails( workflowInfo ) } );
|
|
41
|
+
if ( traceInfo ) {
|
|
42
42
|
Tracing.addEventEnd( { id: runId, details: output, traceInfo } );
|
|
43
43
|
}
|
|
44
44
|
},
|
|
@@ -48,8 +48,8 @@ export const sinks = {
|
|
|
48
48
|
error: {
|
|
49
49
|
fn: ( workflowInfo, error ) => {
|
|
50
50
|
const { runId, memo: { traceInfo } } = workflowInfo;
|
|
51
|
-
|
|
52
|
-
if ( traceInfo ) {
|
|
51
|
+
mainEventBus.emit( BusEventType.WORKFLOW_ERROR, { workflowDetails: createWorkflowDetails( workflowInfo ), error } );
|
|
52
|
+
if ( traceInfo ) {
|
|
53
53
|
Tracing.addEventError( { id: runId, details: error, traceInfo } );
|
|
54
54
|
}
|
|
55
55
|
},
|
package/src/worker/sinks.spec.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
2
|
import { BusEventType, ComponentType } from '#consts';
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const mainEventBusMock = vi.hoisted( () => ( {
|
|
5
5
|
emit: vi.fn()
|
|
6
6
|
} ) );
|
|
7
7
|
|
|
@@ -15,7 +15,7 @@ const createWorkflowDetailsMock = vi.hoisted( () => vi.fn( workflowInfo => ( {
|
|
|
15
15
|
runId: workflowInfo.runId
|
|
16
16
|
} ) ) );
|
|
17
17
|
|
|
18
|
-
vi.mock( '#bus', () => ( {
|
|
18
|
+
vi.mock( '#bus', () => ( { mainEventBus: mainEventBusMock } ) );
|
|
19
19
|
vi.mock( '#tracing', () => ( {
|
|
20
20
|
addEventStart: addEventStartMock,
|
|
21
21
|
addEventEnd: addEventEndMock,
|
|
@@ -69,7 +69,7 @@ describe( 'worker/sinks', () => {
|
|
|
69
69
|
} );
|
|
70
70
|
|
|
71
71
|
expect( createWorkflowDetailsMock ).toHaveBeenCalledWith( workflowInfo );
|
|
72
|
-
expect(
|
|
72
|
+
expect( mainEventBusMock.emit ).toHaveBeenCalledWith( BusEventType.WORKFLOW_LOG, {
|
|
73
73
|
level: 'info',
|
|
74
74
|
message: 'workflow detail',
|
|
75
75
|
metadata,
|
|
@@ -83,7 +83,7 @@ describe( 'worker/sinks', () => {
|
|
|
83
83
|
|
|
84
84
|
sinks.workflow.start.fn( workflowInfo, input );
|
|
85
85
|
|
|
86
|
-
expect(
|
|
86
|
+
expect( mainEventBusMock.emit ).toHaveBeenCalledWith( BusEventType.WORKFLOW_START, { workflowDetails } );
|
|
87
87
|
expect( addEventStartMock ).toHaveBeenCalledWith( {
|
|
88
88
|
id: 'run-1',
|
|
89
89
|
kind: ComponentType.WORKFLOW,
|
|
@@ -99,7 +99,7 @@ describe( 'worker/sinks', () => {
|
|
|
99
99
|
|
|
100
100
|
sinks.workflow.start.fn( { ...workflowInfo, memo: {} }, { value: 'input' } );
|
|
101
101
|
|
|
102
|
-
expect(
|
|
102
|
+
expect( mainEventBusMock.emit ).toHaveBeenCalledWith( BusEventType.WORKFLOW_START, { workflowDetails } );
|
|
103
103
|
expect( addEventStartMock ).not.toHaveBeenCalled();
|
|
104
104
|
} );
|
|
105
105
|
|
|
@@ -109,7 +109,7 @@ describe( 'worker/sinks', () => {
|
|
|
109
109
|
|
|
110
110
|
sinks.workflow.end.fn( workflowInfo, output );
|
|
111
111
|
|
|
112
|
-
expect(
|
|
112
|
+
expect( mainEventBusMock.emit ).toHaveBeenCalledWith( BusEventType.WORKFLOW_END, { workflowDetails } );
|
|
113
113
|
expect( addEventEndMock ).toHaveBeenCalledWith( {
|
|
114
114
|
id: 'run-1',
|
|
115
115
|
details: output,
|
|
@@ -122,7 +122,7 @@ describe( 'worker/sinks', () => {
|
|
|
122
122
|
|
|
123
123
|
sinks.workflow.end.fn( { ...workflowInfo, memo: {} }, { value: 'output' } );
|
|
124
124
|
|
|
125
|
-
expect(
|
|
125
|
+
expect( mainEventBusMock.emit ).toHaveBeenCalledWith( BusEventType.WORKFLOW_END, { workflowDetails } );
|
|
126
126
|
expect( addEventEndMock ).not.toHaveBeenCalled();
|
|
127
127
|
} );
|
|
128
128
|
|
|
@@ -132,7 +132,7 @@ describe( 'worker/sinks', () => {
|
|
|
132
132
|
|
|
133
133
|
sinks.workflow.error.fn( workflowInfo, error );
|
|
134
134
|
|
|
135
|
-
expect(
|
|
135
|
+
expect( mainEventBusMock.emit ).toHaveBeenCalledWith( BusEventType.WORKFLOW_ERROR, { workflowDetails, error } );
|
|
136
136
|
expect( addEventErrorMock ).toHaveBeenCalledWith( {
|
|
137
137
|
id: 'run-1',
|
|
138
138
|
details: error,
|
|
@@ -146,7 +146,7 @@ describe( 'worker/sinks', () => {
|
|
|
146
146
|
|
|
147
147
|
sinks.workflow.error.fn( { ...workflowInfo, memo: {} }, error );
|
|
148
148
|
|
|
149
|
-
expect(
|
|
149
|
+
expect( mainEventBusMock.emit ).toHaveBeenCalledWith( BusEventType.WORKFLOW_ERROR, { workflowDetails, error } );
|
|
150
150
|
expect( addEventErrorMock ).not.toHaveBeenCalled();
|
|
151
151
|
} );
|
|
152
152
|
|