go.uber.org/cadence@v1.2.9/internal/compatibility/proto/types.go (about)

     1  // Copyright (c) 2021 Uber Technologies, Inc.
     2  //
     3  // Permission is hereby granted, free of charge, to any person obtaining a copy
     4  // of this software and associated documentation files (the "Software"), to deal
     5  // in the Software without restriction, including without limitation the rights
     6  // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     7  // copies of the Software, and to permit persons to whom the Software is
     8  // furnished to do so, subject to the following conditions:
     9  //
    10  // The above copyright notice and this permission notice shall be included in
    11  // all copies or substantial portions of the Software.
    12  //
    13  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    14  // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    15  // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    16  // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    17  // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    18  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    19  // THE SOFTWARE.
    20  
    21  package proto
    22  
    23  import (
    24  	"go.uber.org/cadence/.gen/go/shared"
    25  
    26  	apiv1 "github.com/uber/cadence-idl/go/proto/api/v1"
    27  )
    28  
    29  func Payload(data []byte) *apiv1.Payload {
    30  	if data == nil {
    31  		return nil
    32  	}
    33  	return &apiv1.Payload{
    34  		Data: data,
    35  	}
    36  }
    37  
    38  func Failure(reason *string, details []byte) *apiv1.Failure {
    39  	if reason == nil {
    40  		return nil
    41  	}
    42  	return &apiv1.Failure{
    43  		Reason:  *reason,
    44  		Details: details,
    45  	}
    46  }
    47  
    48  func WorkflowExecution(t *shared.WorkflowExecution) *apiv1.WorkflowExecution {
    49  	if t == nil {
    50  		return nil
    51  	}
    52  	if t.WorkflowId == nil && t.RunId == nil {
    53  		return nil
    54  	}
    55  	return &apiv1.WorkflowExecution{
    56  		WorkflowId: t.GetWorkflowId(),
    57  		RunId:      t.GetRunId(),
    58  	}
    59  }
    60  
    61  func WorkflowRunPair(workflowId, runId string) *apiv1.WorkflowExecution {
    62  	if workflowId == "" && runId == "" {
    63  		return nil
    64  	}
    65  	return &apiv1.WorkflowExecution{
    66  		WorkflowId: workflowId,
    67  		RunId:      runId,
    68  	}
    69  }
    70  
    71  func ActivityType(t *shared.ActivityType) *apiv1.ActivityType {
    72  	if t == nil {
    73  		return nil
    74  	}
    75  	return &apiv1.ActivityType{
    76  		Name: t.GetName(),
    77  	}
    78  }
    79  
    80  func WorkflowType(t *shared.WorkflowType) *apiv1.WorkflowType {
    81  	if t == nil {
    82  		return nil
    83  	}
    84  	return &apiv1.WorkflowType{
    85  		Name: t.GetName(),
    86  	}
    87  }
    88  
    89  func TaskList(t *shared.TaskList) *apiv1.TaskList {
    90  	if t == nil {
    91  		return nil
    92  	}
    93  	return &apiv1.TaskList{
    94  		Name: t.GetName(),
    95  		Kind: TaskListKind(t.Kind),
    96  	}
    97  }
    98  
    99  func TaskListMetadata(t *shared.TaskListMetadata) *apiv1.TaskListMetadata {
   100  	if t == nil {
   101  		return nil
   102  	}
   103  	return &apiv1.TaskListMetadata{
   104  		MaxTasksPerSecond: fromDoubleValue(t.MaxTasksPerSecond),
   105  	}
   106  }
   107  
   108  func RetryPolicy(t *shared.RetryPolicy) *apiv1.RetryPolicy {
   109  	if t == nil {
   110  		return nil
   111  	}
   112  	return &apiv1.RetryPolicy{
   113  		InitialInterval:          secondsToDuration(t.InitialIntervalInSeconds),
   114  		BackoffCoefficient:       t.GetBackoffCoefficient(),
   115  		MaximumInterval:          secondsToDuration(t.MaximumIntervalInSeconds),
   116  		MaximumAttempts:          t.GetMaximumAttempts(),
   117  		NonRetryableErrorReasons: t.NonRetriableErrorReasons,
   118  		ExpirationInterval:       secondsToDuration(t.ExpirationIntervalInSeconds),
   119  	}
   120  }
   121  
   122  func Header(t *shared.Header) *apiv1.Header {
   123  	if t == nil {
   124  		return nil
   125  	}
   126  	return &apiv1.Header{
   127  		Fields: PayloadMap(t.Fields),
   128  	}
   129  }
   130  
   131  func Memo(t *shared.Memo) *apiv1.Memo {
   132  	if t == nil {
   133  		return nil
   134  	}
   135  	return &apiv1.Memo{
   136  		Fields: PayloadMap(t.Fields),
   137  	}
   138  }
   139  
   140  func SearchAttributes(t *shared.SearchAttributes) *apiv1.SearchAttributes {
   141  	if t == nil {
   142  		return nil
   143  	}
   144  	return &apiv1.SearchAttributes{
   145  		IndexedFields: PayloadMap(t.IndexedFields),
   146  	}
   147  }
   148  
   149  func BadBinaries(t *shared.BadBinaries) *apiv1.BadBinaries {
   150  	if t == nil {
   151  		return nil
   152  	}
   153  	return &apiv1.BadBinaries{
   154  		Binaries: BadBinaryInfoMap(t.Binaries),
   155  	}
   156  }
   157  
   158  func BadBinaryInfo(t *shared.BadBinaryInfo) *apiv1.BadBinaryInfo {
   159  	if t == nil {
   160  		return nil
   161  	}
   162  	return &apiv1.BadBinaryInfo{
   163  		Reason:      t.GetReason(),
   164  		Operator:    t.GetOperator(),
   165  		CreatedTime: unixNanoToTime(t.CreatedTimeNano),
   166  	}
   167  }
   168  
   169  func ClusterReplicationConfiguration(t *shared.ClusterReplicationConfiguration) *apiv1.ClusterReplicationConfiguration {
   170  	if t == nil {
   171  		return nil
   172  	}
   173  	return &apiv1.ClusterReplicationConfiguration{
   174  		ClusterName: t.GetClusterName(),
   175  	}
   176  }
   177  
   178  func WorkflowQuery(t *shared.WorkflowQuery) *apiv1.WorkflowQuery {
   179  	if t == nil {
   180  		return nil
   181  	}
   182  	return &apiv1.WorkflowQuery{
   183  		QueryType: t.GetQueryType(),
   184  		QueryArgs: Payload(t.QueryArgs),
   185  	}
   186  }
   187  
   188  func WorkflowQueryResult(t *shared.WorkflowQueryResult) *apiv1.WorkflowQueryResult {
   189  	if t == nil {
   190  		return nil
   191  	}
   192  	return &apiv1.WorkflowQueryResult{
   193  		ResultType:   QueryResultType(t.ResultType),
   194  		Answer:       Payload(t.Answer),
   195  		ErrorMessage: t.GetErrorMessage(),
   196  	}
   197  }
   198  
   199  func StickyExecutionAttributes(t *shared.StickyExecutionAttributes) *apiv1.StickyExecutionAttributes {
   200  	if t == nil {
   201  		return nil
   202  	}
   203  	return &apiv1.StickyExecutionAttributes{
   204  		WorkerTaskList:         TaskList(t.WorkerTaskList),
   205  		ScheduleToStartTimeout: secondsToDuration(t.ScheduleToStartTimeoutSeconds),
   206  	}
   207  }
   208  
   209  func WorkerVersionInfo(t *shared.WorkerVersionInfo) *apiv1.WorkerVersionInfo {
   210  	if t == nil {
   211  		return nil
   212  	}
   213  	return &apiv1.WorkerVersionInfo{
   214  		Impl:           t.GetImpl(),
   215  		FeatureVersion: t.GetFeatureVersion(),
   216  	}
   217  }
   218  
   219  func StartTimeFilter(t *shared.StartTimeFilter) *apiv1.StartTimeFilter {
   220  	if t == nil {
   221  		return nil
   222  	}
   223  	return &apiv1.StartTimeFilter{
   224  		EarliestTime: unixNanoToTime(t.EarliestTime),
   225  		LatestTime:   unixNanoToTime(t.LatestTime),
   226  	}
   227  }
   228  
   229  func WorkflowExecutionFilter(t *shared.WorkflowExecutionFilter) *apiv1.WorkflowExecutionFilter {
   230  	if t == nil {
   231  		return nil
   232  	}
   233  	return &apiv1.WorkflowExecutionFilter{
   234  		WorkflowId: t.GetWorkflowId(),
   235  		RunId:      t.GetRunId(),
   236  	}
   237  }
   238  
   239  func WorkflowTypeFilter(t *shared.WorkflowTypeFilter) *apiv1.WorkflowTypeFilter {
   240  	if t == nil {
   241  		return nil
   242  	}
   243  	return &apiv1.WorkflowTypeFilter{
   244  		Name: t.GetName(),
   245  	}
   246  }
   247  
   248  func StatusFilter(t *shared.WorkflowExecutionCloseStatus) *apiv1.StatusFilter {
   249  	if t == nil {
   250  		return nil
   251  	}
   252  	return &apiv1.StatusFilter{
   253  		Status: WorkflowExecutionCloseStatus(t),
   254  	}
   255  }
   256  
   257  func PayloadMap(t map[string][]byte) map[string]*apiv1.Payload {
   258  	if t == nil {
   259  		return nil
   260  	}
   261  	v := make(map[string]*apiv1.Payload, len(t))
   262  	for key := range t {
   263  		v[key] = Payload(t[key])
   264  	}
   265  	return v
   266  }
   267  
   268  func BadBinaryInfoMap(t map[string]*shared.BadBinaryInfo) map[string]*apiv1.BadBinaryInfo {
   269  	if t == nil {
   270  		return nil
   271  	}
   272  	v := make(map[string]*apiv1.BadBinaryInfo, len(t))
   273  	for key := range t {
   274  		v[key] = BadBinaryInfo(t[key])
   275  	}
   276  	return v
   277  }
   278  
   279  func ClusterReplicationConfigurationArray(t []*shared.ClusterReplicationConfiguration) []*apiv1.ClusterReplicationConfiguration {
   280  	if t == nil {
   281  		return nil
   282  	}
   283  	v := make([]*apiv1.ClusterReplicationConfiguration, len(t))
   284  	for i := range t {
   285  		v[i] = ClusterReplicationConfiguration(t[i])
   286  	}
   287  	return v
   288  }
   289  
   290  func WorkflowQueryResultMap(t map[string]*shared.WorkflowQueryResult) map[string]*apiv1.WorkflowQueryResult {
   291  	if t == nil {
   292  		return nil
   293  	}
   294  	v := make(map[string]*apiv1.WorkflowQueryResult, len(t))
   295  	for key := range t {
   296  		v[key] = WorkflowQueryResult(t[key])
   297  	}
   298  	return v
   299  }
   300  
   301  func DataBlob(t *shared.DataBlob) *apiv1.DataBlob {
   302  	if t == nil {
   303  		return nil
   304  	}
   305  	return &apiv1.DataBlob{
   306  		EncodingType: EncodingType(t.EncodingType),
   307  		Data:         t.Data,
   308  	}
   309  }
   310  
   311  func ExternalExecutionInfo(we *shared.WorkflowExecution, initiatedID *int64) *apiv1.ExternalExecutionInfo {
   312  	if we == nil && initiatedID == nil {
   313  		return nil
   314  	}
   315  	if we == nil || initiatedID == nil {
   316  		panic("either all or none external execution info fields must be set")
   317  	}
   318  	return &apiv1.ExternalExecutionInfo{
   319  		WorkflowExecution: WorkflowExecution(we),
   320  		InitiatedId:       *initiatedID,
   321  	}
   322  }
   323  
   324  func ResetPoints(t *shared.ResetPoints) *apiv1.ResetPoints {
   325  	if t == nil {
   326  		return nil
   327  	}
   328  	return &apiv1.ResetPoints{
   329  		Points: ResetPointInfoArray(t.Points),
   330  	}
   331  }
   332  
   333  func ResetPointInfo(t *shared.ResetPointInfo) *apiv1.ResetPointInfo {
   334  	if t == nil {
   335  		return nil
   336  	}
   337  	return &apiv1.ResetPointInfo{
   338  		BinaryChecksum:           t.GetBinaryChecksum(),
   339  		RunId:                    t.GetRunId(),
   340  		FirstDecisionCompletedId: t.GetFirstDecisionCompletedId(),
   341  		CreatedTime:              unixNanoToTime(t.CreatedTimeNano),
   342  		ExpiringTime:             unixNanoToTime(t.ExpiringTimeNano),
   343  		Resettable:               t.GetResettable(),
   344  	}
   345  }
   346  
   347  func PollerInfo(t *shared.PollerInfo) *apiv1.PollerInfo {
   348  	if t == nil {
   349  		return nil
   350  	}
   351  	return &apiv1.PollerInfo{
   352  		LastAccessTime: unixNanoToTime(t.LastAccessTime),
   353  		Identity:       t.GetIdentity(),
   354  		RatePerSecond:  t.GetRatePerSecond(),
   355  	}
   356  }
   357  
   358  func TaskListStatus(t *shared.TaskListStatus) *apiv1.TaskListStatus {
   359  	if t == nil {
   360  		return nil
   361  	}
   362  	return &apiv1.TaskListStatus{
   363  		BacklogCountHint: t.GetBacklogCountHint(),
   364  		ReadLevel:        t.GetReadLevel(),
   365  		AckLevel:         t.GetAckLevel(),
   366  		RatePerSecond:    t.GetRatePerSecond(),
   367  		TaskIdBlock:      TaskIdBlock(t.TaskIDBlock),
   368  	}
   369  }
   370  
   371  func TaskIdBlock(t *shared.TaskIDBlock) *apiv1.TaskIDBlock {
   372  	if t == nil {
   373  		return nil
   374  	}
   375  	return &apiv1.TaskIDBlock{
   376  		StartId: t.GetStartID(),
   377  		EndId:   t.GetEndID(),
   378  	}
   379  }
   380  
   381  func WorkflowExecutionConfiguration(t *shared.WorkflowExecutionConfiguration) *apiv1.WorkflowExecutionConfiguration {
   382  	if t == nil {
   383  		return nil
   384  	}
   385  	return &apiv1.WorkflowExecutionConfiguration{
   386  		TaskList:                     TaskList(t.TaskList),
   387  		ExecutionStartToCloseTimeout: secondsToDuration(t.ExecutionStartToCloseTimeoutSeconds),
   388  		TaskStartToCloseTimeout:      secondsToDuration(t.TaskStartToCloseTimeoutSeconds),
   389  	}
   390  }
   391  
   392  func WorkflowExecutionInfo(t *shared.WorkflowExecutionInfo) *apiv1.WorkflowExecutionInfo {
   393  	if t == nil {
   394  		return nil
   395  	}
   396  	return &apiv1.WorkflowExecutionInfo{
   397  		WorkflowExecution:   WorkflowExecution(t.Execution),
   398  		Type:                WorkflowType(t.Type),
   399  		StartTime:           unixNanoToTime(t.StartTime),
   400  		CloseTime:           unixNanoToTime(t.CloseTime),
   401  		CloseStatus:         WorkflowExecutionCloseStatus(t.CloseStatus),
   402  		HistoryLength:       t.GetHistoryLength(),
   403  		ParentExecutionInfo: ParentExecutionInfo2(t.ParentDomainId, t.ParentExecution),
   404  		ExecutionTime:       unixNanoToTime(t.ExecutionTime),
   405  		Memo:                Memo(t.Memo),
   406  		SearchAttributes:    SearchAttributes(t.SearchAttributes),
   407  		AutoResetPoints:     ResetPoints(t.AutoResetPoints),
   408  		TaskList:            t.GetTaskList(),
   409  		IsCron:              t.GetIsCron(),
   410  	}
   411  }
   412  
   413  func ParentExecutionInfo(domainID, domainName *string, we *shared.WorkflowExecution, initiatedID *int64) *apiv1.ParentExecutionInfo {
   414  	if domainID == nil && domainName == nil && we == nil && initiatedID == nil {
   415  		return nil
   416  	}
   417  	if domainName == nil || we == nil || initiatedID == nil {
   418  		panic("either all or none parent execution info must be set")
   419  	}
   420  
   421  	// Domain ID was added to unify parent execution info in several places.
   422  	// However it may not be present:
   423  	// - on older histories
   424  	// - if conversion involves thrift data types
   425  	// Fallback to empty string in those cases
   426  	parentDomainID := ""
   427  	if domainID != nil {
   428  		parentDomainID = *domainID
   429  	}
   430  
   431  	return &apiv1.ParentExecutionInfo{
   432  		DomainId:          parentDomainID,
   433  		DomainName:        *domainName,
   434  		WorkflowExecution: WorkflowExecution(we),
   435  		InitiatedId:       *initiatedID,
   436  	}
   437  }
   438  
   439  func ParentExecutionInfo2(domainID *string, we *shared.WorkflowExecution) *apiv1.ParentExecutionInfo {
   440  	if domainID == nil && we == nil {
   441  		return nil
   442  	}
   443  
   444  	return &apiv1.ParentExecutionInfo{
   445  		DomainId:          *domainID,
   446  		WorkflowExecution: WorkflowExecution(we),
   447  	}
   448  }
   449  
   450  func PendingActivityInfo(t *shared.PendingActivityInfo) *apiv1.PendingActivityInfo {
   451  	if t == nil {
   452  		return nil
   453  	}
   454  	return &apiv1.PendingActivityInfo{
   455  		ActivityId:         t.GetActivityID(),
   456  		ActivityType:       ActivityType(t.ActivityType),
   457  		State:              PendingActivityState(t.State),
   458  		HeartbeatDetails:   Payload(t.HeartbeatDetails),
   459  		LastHeartbeatTime:  unixNanoToTime(t.LastHeartbeatTimestamp),
   460  		LastStartedTime:    unixNanoToTime(t.LastStartedTimestamp),
   461  		Attempt:            t.GetAttempt(),
   462  		MaximumAttempts:    t.GetMaximumAttempts(),
   463  		ScheduledTime:      unixNanoToTime(t.ScheduledTimestamp),
   464  		ExpirationTime:     unixNanoToTime(t.ExpirationTimestamp),
   465  		LastFailure:        Failure(t.LastFailureReason, t.LastFailureDetails),
   466  		LastWorkerIdentity: t.GetLastWorkerIdentity(),
   467  	}
   468  }
   469  
   470  func PendingChildExecutionInfo(t *shared.PendingChildExecutionInfo) *apiv1.PendingChildExecutionInfo {
   471  	if t == nil {
   472  		return nil
   473  	}
   474  	return &apiv1.PendingChildExecutionInfo{
   475  		WorkflowExecution: WorkflowRunPair(t.GetWorkflowID(), t.GetRunID()),
   476  		WorkflowTypeName:  t.GetWorkflowTypName(),
   477  		InitiatedId:       t.GetInitiatedID(),
   478  		ParentClosePolicy: ParentClosePolicy(t.ParentClosePolicy),
   479  	}
   480  }
   481  
   482  func PendingDecisionInfo(t *shared.PendingDecisionInfo) *apiv1.PendingDecisionInfo {
   483  	if t == nil {
   484  		return nil
   485  	}
   486  	return &apiv1.PendingDecisionInfo{
   487  		State:                 PendingDecisionState(t.State),
   488  		ScheduledTime:         unixNanoToTime(t.ScheduledTimestamp),
   489  		StartedTime:           unixNanoToTime(t.StartedTimestamp),
   490  		Attempt:               int32(t.GetAttempt()),
   491  		OriginalScheduledTime: unixNanoToTime(t.OriginalScheduledTimestamp),
   492  	}
   493  }
   494  
   495  func ActivityLocalDispatchInfo(t *shared.ActivityLocalDispatchInfo) *apiv1.ActivityLocalDispatchInfo {
   496  	if t == nil {
   497  		return nil
   498  	}
   499  	return &apiv1.ActivityLocalDispatchInfo{
   500  		ActivityId:                 t.GetActivityId(),
   501  		ScheduledTime:              unixNanoToTime(t.ScheduledTimestamp),
   502  		StartedTime:                unixNanoToTime(t.StartedTimestamp),
   503  		ScheduledTimeOfThisAttempt: unixNanoToTime(t.ScheduledTimestampOfThisAttempt),
   504  		TaskToken:                  t.TaskToken,
   505  	}
   506  }
   507  
   508  func SupportedClientVersions(t *shared.SupportedClientVersions) *apiv1.SupportedClientVersions {
   509  	if t == nil {
   510  		return nil
   511  	}
   512  	return &apiv1.SupportedClientVersions{
   513  		GoSdk:   t.GetGoSdk(),
   514  		JavaSdk: t.GetJavaSdk(),
   515  	}
   516  }
   517  
   518  func DescribeDomainResponseDomain(t *shared.DescribeDomainResponse) *apiv1.Domain {
   519  	if t == nil {
   520  		return nil
   521  	}
   522  	domain := apiv1.Domain{
   523  		FailoverVersion: t.GetFailoverVersion(),
   524  		IsGlobalDomain:  t.GetIsGlobalDomain(),
   525  	}
   526  	if info := t.DomainInfo; info != nil {
   527  		domain.Id = info.GetUUID()
   528  		domain.Name = info.GetName()
   529  		domain.Status = DomainStatus(info.Status)
   530  		domain.Description = info.GetDescription()
   531  		domain.OwnerEmail = info.GetOwnerEmail()
   532  		domain.Data = info.Data
   533  	}
   534  	if config := t.Configuration; config != nil {
   535  		domain.WorkflowExecutionRetentionPeriod = daysToDuration(config.WorkflowExecutionRetentionPeriodInDays)
   536  		domain.BadBinaries = BadBinaries(config.BadBinaries)
   537  		domain.HistoryArchivalStatus = ArchivalStatus(config.HistoryArchivalStatus)
   538  		domain.HistoryArchivalUri = config.GetHistoryArchivalURI()
   539  		domain.VisibilityArchivalStatus = ArchivalStatus(config.VisibilityArchivalStatus)
   540  		domain.VisibilityArchivalUri = config.GetVisibilityArchivalURI()
   541  	}
   542  	if repl := t.ReplicationConfiguration; repl != nil {
   543  		domain.ActiveClusterName = repl.GetActiveClusterName()
   544  		domain.Clusters = ClusterReplicationConfigurationArray(repl.Clusters)
   545  	}
   546  	return &domain
   547  }
   548  
   549  func TaskListPartitionMetadata(t *shared.TaskListPartitionMetadata) *apiv1.TaskListPartitionMetadata {
   550  	if t == nil {
   551  		return nil
   552  	}
   553  	return &apiv1.TaskListPartitionMetadata{
   554  		Key:           t.GetKey(),
   555  		OwnerHostName: t.GetOwnerHostName(),
   556  	}
   557  }
   558  
   559  func QueryRejected(t *shared.QueryRejected) *apiv1.QueryRejected {
   560  	if t == nil {
   561  		return nil
   562  	}
   563  	return &apiv1.QueryRejected{
   564  		CloseStatus: WorkflowExecutionCloseStatus(t.CloseStatus),
   565  	}
   566  }
   567  
   568  func PollerInfoArray(t []*shared.PollerInfo) []*apiv1.PollerInfo {
   569  	if t == nil {
   570  		return nil
   571  	}
   572  	v := make([]*apiv1.PollerInfo, len(t))
   573  	for i := range t {
   574  		v[i] = PollerInfo(t[i])
   575  	}
   576  	return v
   577  }
   578  
   579  func ResetPointInfoArray(t []*shared.ResetPointInfo) []*apiv1.ResetPointInfo {
   580  	if t == nil {
   581  		return nil
   582  	}
   583  	v := make([]*apiv1.ResetPointInfo, len(t))
   584  	for i := range t {
   585  		v[i] = ResetPointInfo(t[i])
   586  	}
   587  	return v
   588  }
   589  
   590  func PendingActivityInfoArray(t []*shared.PendingActivityInfo) []*apiv1.PendingActivityInfo {
   591  	if t == nil {
   592  		return nil
   593  	}
   594  	v := make([]*apiv1.PendingActivityInfo, len(t))
   595  	for i := range t {
   596  		v[i] = PendingActivityInfo(t[i])
   597  	}
   598  	return v
   599  }
   600  
   601  func PendingChildExecutionInfoArray(t []*shared.PendingChildExecutionInfo) []*apiv1.PendingChildExecutionInfo {
   602  	if t == nil {
   603  		return nil
   604  	}
   605  	v := make([]*apiv1.PendingChildExecutionInfo, len(t))
   606  	for i := range t {
   607  		v[i] = PendingChildExecutionInfo(t[i])
   608  	}
   609  	return v
   610  }
   611  
   612  func IndexedValueTypeMap(t map[string]shared.IndexedValueType) map[string]apiv1.IndexedValueType {
   613  	if t == nil {
   614  		return nil
   615  	}
   616  	v := make(map[string]apiv1.IndexedValueType, len(t))
   617  	for key := range t {
   618  		v[key] = IndexedValueType(t[key])
   619  	}
   620  	return v
   621  }
   622  
   623  func DataBlobArray(t []*shared.DataBlob) []*apiv1.DataBlob {
   624  	if t == nil {
   625  		return nil
   626  	}
   627  	v := make([]*apiv1.DataBlob, len(t))
   628  	for i := range t {
   629  		v[i] = DataBlob(t[i])
   630  	}
   631  	return v
   632  }
   633  
   634  func WorkflowExecutionInfoArray(t []*shared.WorkflowExecutionInfo) []*apiv1.WorkflowExecutionInfo {
   635  	if t == nil {
   636  		return nil
   637  	}
   638  	v := make([]*apiv1.WorkflowExecutionInfo, len(t))
   639  	for i := range t {
   640  		v[i] = WorkflowExecutionInfo(t[i])
   641  	}
   642  	return v
   643  }
   644  
   645  func DescribeDomainResponseArray(t []*shared.DescribeDomainResponse) []*apiv1.Domain {
   646  	if t == nil {
   647  		return nil
   648  	}
   649  	v := make([]*apiv1.Domain, len(t))
   650  	for i := range t {
   651  		v[i] = DescribeDomainResponseDomain(t[i])
   652  	}
   653  	return v
   654  }
   655  
   656  func TaskListPartitionMetadataArray(t []*shared.TaskListPartitionMetadata) []*apiv1.TaskListPartitionMetadata {
   657  	if t == nil {
   658  		return nil
   659  	}
   660  	v := make([]*apiv1.TaskListPartitionMetadata, len(t))
   661  	for i := range t {
   662  		v[i] = TaskListPartitionMetadata(t[i])
   663  	}
   664  	return v
   665  }
   666  
   667  func WorkflowQueryMap(t map[string]*shared.WorkflowQuery) map[string]*apiv1.WorkflowQuery {
   668  	if t == nil {
   669  		return nil
   670  	}
   671  	v := make(map[string]*apiv1.WorkflowQuery, len(t))
   672  	for key := range t {
   673  		v[key] = WorkflowQuery(t[key])
   674  	}
   675  	return v
   676  }
   677  
   678  func ActivityLocalDispatchInfoMap(t map[string]*shared.ActivityLocalDispatchInfo) map[string]*apiv1.ActivityLocalDispatchInfo {
   679  	if t == nil {
   680  		return nil
   681  	}
   682  	v := make(map[string]*apiv1.ActivityLocalDispatchInfo, len(t))
   683  	for key := range t {
   684  		v[key] = ActivityLocalDispatchInfo(t[key])
   685  	}
   686  	return v
   687  }