@@ -22,7 +22,6 @@ import {
2222 decodeRetryState ,
2323 encodeWorkflowIdConflictPolicy ,
2424 WorkflowIdConflictPolicy ,
25- JsonPayloadConverter ,
2625} from '@temporalio/common' ;
2726import { encodeUnifiedSearchAttributes } from '@temporalio/common/lib/converter/payload-search-attributes' ;
2827import { composeInterceptors } from '@temporalio/common/lib/interceptors' ;
@@ -32,7 +31,9 @@ import {
3231 decodeArrayFromPayloads ,
3332 decodeFromPayloadsAtIndex ,
3433 decodeOptionalFailureToOptionalError ,
34+ decodeOptionalSinglePayload ,
3535 encodeMapToPayloads ,
36+ encodeOptionalToPayload ,
3637 encodeToPayloads ,
3738 filterNullAndUndefined ,
3839} from '@temporalio/common/lib/internal-non-workflow' ;
@@ -1197,7 +1198,6 @@ export class WorkflowClient extends BaseClient {
11971198 protected async _signalWithStartWorkflowHandler ( input : WorkflowSignalWithStartInput ) : Promise < string > {
11981199 const { identity } = this . options ;
11991200 const { options, workflowType, signalName, signalArgs, headers } = input ;
1200- const jsonConverter = new JsonPayloadConverter ( ) ;
12011201 const req : temporal . api . workflowservice . v1 . ISignalWithStartWorkflowExecutionRequest = {
12021202 namespace : this . options . namespace ,
12031203 identity,
@@ -1228,8 +1228,8 @@ export class WorkflowClient extends BaseClient {
12281228 cronSchedule : options . cronSchedule ,
12291229 header : { fields : headers } ,
12301230 userMetadata : {
1231- summary : jsonConverter . toPayload ( options ?. staticSummary ) ,
1232- details : jsonConverter . toPayload ( options ?. staticDetails ) ,
1231+ summary : await encodeOptionalToPayload ( this . dataConverter , options ?. staticSummary ) ,
1232+ details : await encodeOptionalToPayload ( this . dataConverter , options ?. staticDetails ) ,
12331233 } ,
12341234 } ;
12351235 try {
@@ -1271,7 +1271,6 @@ export class WorkflowClient extends BaseClient {
12711271 protected async createStartWorkflowRequest ( input : WorkflowStartInput ) : Promise < StartWorkflowExecutionRequest > {
12721272 const { options : opts , workflowType, headers } = input ;
12731273 const { identity, namespace } = this . options ;
1274- const jsonConverter = new JsonPayloadConverter ( ) ;
12751274 return {
12761275 namespace,
12771276 identity,
@@ -1300,8 +1299,8 @@ export class WorkflowClient extends BaseClient {
13001299 cronSchedule : opts . cronSchedule ,
13011300 header : { fields : headers } ,
13021301 userMetadata : {
1303- summary : jsonConverter . toPayload ( opts ?. staticSummary ) ,
1304- details : jsonConverter . toPayload ( opts ?. staticDetails ) ,
1302+ summary : await encodeOptionalToPayload ( this . dataConverter , opts ?. staticSummary ) ,
1303+ details : await encodeOptionalToPayload ( this . dataConverter , opts ?. staticDetails ) ,
13051304 } ,
13061305 } ;
13071306 }
@@ -1436,12 +1435,11 @@ export class WorkflowClient extends BaseClient {
14361435 workflowExecution : { workflowId, runId } ,
14371436 } ) ;
14381437 const info = await executionInfoFromRaw ( raw . workflowExecutionInfo ?? { } , this . client . dataConverter , raw ) ;
1439- const jsonConverter = new JsonPayloadConverter ( ) ;
14401438 const userMetadata = raw . executionConfig ?. userMetadata ;
14411439 return {
14421440 ...info ,
1443- staticDetails : userMetadata ?. details ? jsonConverter . fromPayload ( userMetadata . details ) : undefined ,
1444- staticSummary : userMetadata ?. summary ? jsonConverter . fromPayload ( userMetadata . summary ) : undefined ,
1441+ staticDetails : await decodeOptionalSinglePayload ( this . client . dataConverter , userMetadata ?. details ) ?? undefined ,
1442+ staticSummary : await decodeOptionalSinglePayload ( this . client . dataConverter , userMetadata ?. summary ) ?? undefined ,
14451443 raw,
14461444 } ;
14471445 } ,
0 commit comments