@outputai/core 0.5.1-next.2dc6fd0.0 → 0.5.1-next.93f660c.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
CHANGED
|
@@ -3,7 +3,7 @@ import { Storage } from '#async_storage';
|
|
|
3
3
|
import * as Tracing from '#tracing';
|
|
4
4
|
import { headersToObject } from '../sandboxed_utils.js';
|
|
5
5
|
import { BusEventType, METADATA_ACCESS_SYMBOL } from '#consts';
|
|
6
|
-
import { activityHeartbeatEnabled, activityHeartbeatIntervalMs } from '../configs.js';
|
|
6
|
+
import { activityHeartbeatEnabled, activityHeartbeatIntervalMs, namespace } from '../configs.js';
|
|
7
7
|
import { messageBus } from '#bus';
|
|
8
8
|
import { Client } from '@temporalio/client';
|
|
9
9
|
|
|
@@ -38,7 +38,7 @@ export class ActivityExecutionInterceptor {
|
|
|
38
38
|
|
|
39
39
|
async execute( input, next ) {
|
|
40
40
|
const startDate = Date.now();
|
|
41
|
-
const client = new Client( { connection: this.connection } );
|
|
41
|
+
const client = new Client( { connection: this.connection, namespace } );
|
|
42
42
|
|
|
43
43
|
const { workflowExecution: { workflowId }, activityId: id, activityType: name, workflowType: workflowName } = Context.current().info;
|
|
44
44
|
const { executionContext } = headersToObject( input.headers );
|
|
@@ -4,6 +4,7 @@ import { BusEventType } from '#consts';
|
|
|
4
4
|
const METADATA_ACCESS_SYMBOL = vi.hoisted( () => Symbol( '__metadata' ) );
|
|
5
5
|
const workflowHandleMock = vi.hoisted( () => ( { signal: vi.fn() } ) );
|
|
6
6
|
const getHandleMock = vi.hoisted( () => vi.fn( () => workflowHandleMock ) );
|
|
7
|
+
const clientConstructorMock = vi.hoisted( () => vi.fn() );
|
|
7
8
|
|
|
8
9
|
const heartbeatMock = vi.fn();
|
|
9
10
|
const runWithContextMock = vi.hoisted( () => vi.fn().mockImplementation( async fn => fn() ) );
|
|
@@ -25,6 +26,10 @@ vi.mock( '@temporalio/activity', () => ( {
|
|
|
25
26
|
|
|
26
27
|
vi.mock( '@temporalio/client', () => ( {
|
|
27
28
|
Client: class Client {
|
|
29
|
+
constructor( options ) {
|
|
30
|
+
clientConstructorMock( options );
|
|
31
|
+
}
|
|
32
|
+
|
|
28
33
|
workflow = {
|
|
29
34
|
getHandle: getHandleMock
|
|
30
35
|
};
|
|
@@ -68,6 +73,9 @@ vi.mock( '../configs.js', () => ( {
|
|
|
68
73
|
},
|
|
69
74
|
get activityHeartbeatIntervalMs() {
|
|
70
75
|
return parseInt( process.env.OUTPUT_ACTIVITY_HEARTBEAT_INTERVAL_MS || '120000', 10 );
|
|
76
|
+
},
|
|
77
|
+
get namespace() {
|
|
78
|
+
return process.env.TEMPORAL_NAMESPACE || 'default';
|
|
71
79
|
}
|
|
72
80
|
} ) );
|
|
73
81
|
|
|
@@ -116,6 +124,7 @@ describe( 'ActivityExecutionInterceptor', () => {
|
|
|
116
124
|
expect( addEventStartMock ).toHaveBeenCalledOnce();
|
|
117
125
|
expect( addEventEndMock ).toHaveBeenCalledOnce();
|
|
118
126
|
expect( addEventErrorMock ).not.toHaveBeenCalled();
|
|
127
|
+
expect( clientConstructorMock ).toHaveBeenCalledWith( { connection: undefined, namespace: 'default' } );
|
|
119
128
|
expect( runWithContextMock ).toHaveBeenCalledWith(
|
|
120
129
|
expect.any( Function ),
|
|
121
130
|
expect.objectContaining( {
|