@@ -14,13 +14,13 @@ import {
1414 ActivityCancellationType ,
1515 ApplicationFailure ,
1616 defineSearchAttributeKey ,
17- JsonPayloadConverter ,
1817 SearchAttributePair ,
1918 SearchAttributeType ,
2019 TypedSearchAttributes ,
2120 WorkflowExecutionAlreadyStartedError ,
2221} from '@temporalio/common' ;
2322import { temporal } from '@temporalio/proto' ;
23+ import { decodeOptionalSinglePayload } from '@temporalio/common/lib/internal-non-workflow' ;
2424import { signalSchedulingWorkflow } from './activities/helpers' ;
2525import { activityStartedSignal } from './workflows/definitions' ;
2626import * as workflows from './workflows' ;
@@ -1348,12 +1348,15 @@ export async function userMetadataWorkflow(): Promise<string> {
13481348 } ) ;
13491349
13501350 // That workflow should call an activity (with summary)
1351- const { activityWithSummary } = workflow . proxyActivities ( { scheduleToCloseTimeout : '10s' } ) . withSummaries ( {
1352- activityWithSummary : 'activity summary' ,
1353- } ) ;
1354- await activityWithSummary ( ) ;
1351+ const { activityWithSummary } = workflow . proxyActivities ( { scheduleToCloseTimeout : '10s' } ) ;
1352+ await activityWithSummary . runWithOptions (
1353+ {
1354+ staticSummary : 'activity summary' ,
1355+ } ,
1356+ [ ]
1357+ ) ;
13551358 // Should have a timer (with summary)
1356- await workflow . sleep ( 5 , 'timer summary' ) ;
1359+ await workflow . sleep ( 5 , { summary : 'timer summary' } ) ;
13571360 // Set current details
13581361 workflow . setCurrentDetails ( 'current wf details' ) ;
13591362 // Unblock on var -> query current details (or return)
@@ -1377,8 +1380,8 @@ test('User metadata on workflow, timer, activity', async (t) => {
13771380 } ) ;
13781381 // Describe workflow -> static summary, static details
13791382 const desc = await handle . describe ( ) ;
1380- t . true ( desc . staticSummary === 'wf static summary' ) ;
1381- t . true ( desc . staticDetails === 'wf static details' ) ;
1383+ t . true ( ( await desc . staticSummary ( ) ) === 'wf static summary' ) ;
1384+ t . true ( ( await desc . staticDetails ( ) ) === 'wf static details' ) ;
13821385
13831386 await handle . signal ( 'done' ) ;
13841387 const res = await handle . result ( ) ;
@@ -1392,15 +1395,38 @@ test('User metadata on workflow, timer, activity', async (t) => {
13921395 runId : handle . firstExecutionRunId ,
13931396 } ,
13941397 } ) ;
1395- const jsonConverter = new JsonPayloadConverter ( ) ;
13961398 for ( const event of resp . history ?. events ?? [ ] ) {
13971399 if ( event . eventType === temporal . api . enums . v1 . EventType . EVENT_TYPE_WORKFLOW_EXECUTION_STARTED ) {
1398- t . deepEqual ( jsonConverter . fromPayload ( event . userMetadata ?. summary ?? { } ) , 'wf static summary' ) ;
1399- t . deepEqual ( jsonConverter . fromPayload ( event . userMetadata ?. details ?? { } ) , 'wf static details' ) ;
1400+ t . deepEqual (
1401+ await decodeOptionalSinglePayload (
1402+ t . context . env . client . options . loadedDataConverter ,
1403+ event . userMetadata ?. summary ?? { }
1404+ ) ,
1405+ 'wf static summary'
1406+ ) ;
1407+ t . deepEqual (
1408+ await decodeOptionalSinglePayload (
1409+ t . context . env . client . options . loadedDataConverter ,
1410+ event . userMetadata ?. details ?? { }
1411+ ) ,
1412+ 'wf static details'
1413+ ) ;
14001414 } else if ( event . eventType === temporal . api . enums . v1 . EventType . EVENT_TYPE_ACTIVITY_TASK_SCHEDULED ) {
1401- t . deepEqual ( jsonConverter . fromPayload ( event . userMetadata ?. summary ?? { } ) , 'activity summary' ) ;
1415+ t . deepEqual (
1416+ await decodeOptionalSinglePayload (
1417+ t . context . env . client . options . loadedDataConverter ,
1418+ event . userMetadata ?. summary ?? { }
1419+ ) ,
1420+ 'activity summary'
1421+ ) ;
14021422 } else if ( event . eventType === temporal . api . enums . v1 . EventType . EVENT_TYPE_TIMER_STARTED ) {
1403- t . deepEqual ( jsonConverter . fromPayload ( event . userMetadata ?. summary ?? { } ) , 'timer summary' ) ;
1423+ t . deepEqual (
1424+ await decodeOptionalSinglePayload (
1425+ t . context . env . client . options . loadedDataConverter ,
1426+ event . userMetadata ?. summary ?? { }
1427+ ) ,
1428+ 'timer summary'
1429+ ) ;
14041430 }
14051431 }
14061432
0 commit comments