Skip to content

Commit 9cd8d9e

Browse files
committed
Fixed circular dependency build issue
1 parent 0086bda commit 9cd8d9e

5 files changed

Lines changed: 28 additions & 26 deletions

File tree

packages/client/src/activity-client.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { status } from '@grpc/grpc-js';
2+
import { v4 as uuid4 } from 'uuid';
23
import type {
34
LoadedDataConverter,
45
Next,
@@ -7,7 +8,13 @@ import type {
78
SearchAttributePair,
89
TypedSearchAttributes,
910
} from '@temporalio/common';
10-
import { compilePriority, compileRetryPolicy, decodePriority, decompileRetryPolicy } from '@temporalio/common';
11+
import {
12+
compilePriority,
13+
compileRetryPolicy,
14+
convertDeploymentVersion,
15+
decodePriority,
16+
decompileRetryPolicy,
17+
} from '@temporalio/common';
1118
import type { Duration } from '@temporalio/common/lib/time';
1219
import { msOptionalToTs, optionalTsToDate, optionalTsToMs } from '@temporalio/common/lib/time';
1320
import { SymbolBasedInstanceOfError } from '@temporalio/common/lib/type-helpers';
@@ -17,15 +24,13 @@ import {
1724
encodeUnifiedSearchAttributes,
1825
searchAttributePayloadConverter,
1926
} from '@temporalio/common/lib/converter/payload-search-attributes';
20-
import { convertDeploymentVersion } from '@temporalio/worker/lib/utils';
2127
import {
2228
decodeArrayFromPayloads,
2329
decodeFromPayloadsAtIndex,
2430
decodeOptionalFailureToOptionalError,
2531
encodeToPayloads,
2632
encodeUserMetadata,
2733
} from '@temporalio/common/lib/internal-non-workflow';
28-
import { uuid4 } from '@temporalio/workflow';
2934
import type { temporal } from '@temporalio/proto';
3035
import type {
3136
ActivityCancelInput,

packages/common/src/worker-deployments.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { temporal } from '@temporalio/proto';
1+
import type { coresdk, temporal } from '@temporalio/proto';
22
import { makeProtoEnumConverters } from './internal-workflow';
33

44
/**
@@ -98,3 +98,19 @@ export const [encodeInitialVersioningBehavior, decodeInitialVersioningBehavior]
9898
} as const,
9999
'CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_'
100100
);
101+
102+
/**
103+
* @internal
104+
*/
105+
export function convertDeploymentVersion(
106+
v: coresdk.common.IWorkerDeploymentVersion | null | undefined
107+
): WorkerDeploymentVersion | undefined {
108+
if (!v || !v.buildId) {
109+
return undefined;
110+
}
111+
112+
return {
113+
buildId: v.buildId,
114+
deploymentName: v.deploymentName ?? '',
115+
};
116+
}

packages/worker/src/utils.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { WorkerDeploymentVersion } from '@temporalio/common';
21
import type { coresdk, temporal } from '@temporalio/proto';
32
import type { ParentWorkflowInfo, RootWorkflowInfo } from '@temporalio/workflow';
43

@@ -26,19 +25,6 @@ export function convertToParentWorkflowType(
2625
};
2726
}
2827

29-
export function convertDeploymentVersion(
30-
v: coresdk.common.IWorkerDeploymentVersion | null | undefined
31-
): WorkerDeploymentVersion | undefined {
32-
if (!v || !v.buildId) {
33-
return undefined;
34-
}
35-
36-
return {
37-
buildId: v.buildId,
38-
deploymentName: v.deploymentName ?? '',
39-
};
40-
}
41-
4228
export function convertToRootWorkflowType(
4329
root: temporal.api.common.v1.IWorkflowExecution | null | undefined
4430
): RootWorkflowInfo | undefined {

packages/worker/src/worker.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
decodePriority,
2424
CancelledFailure,
2525
ActivityCancellationDetails,
26+
convertDeploymentVersion,
2627
} from '@temporalio/common';
2728
import type { Decoded } from '@temporalio/common/lib/internal-non-workflow';
2829
import {
@@ -65,12 +66,7 @@ import type { History } from './runtime';
6566
import { Runtime } from './runtime';
6667
import type { CloseableGroupedObservable } from './rxutils';
6768
import { closeableGroupBy, mapWithState, mergeMapWithState } from './rxutils';
68-
import {
69-
byteArrayToBuffer,
70-
convertDeploymentVersion,
71-
convertToParentWorkflowType,
72-
convertToRootWorkflowType,
73-
} from './utils';
69+
import { byteArrayToBuffer, convertToParentWorkflowType, convertToRootWorkflowType } from './utils';
7470
import type {
7571
CompiledWorkerOptions,
7672
CompiledWorkerOptionsWithBuildId,

packages/worker/src/workflow/vm-shared.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import assert from 'node:assert';
55
import { URL, URLSearchParams } from 'node:url';
66
import { TextDecoder, TextEncoder } from 'node:util';
77
import { SourceMapConsumer } from 'source-map';
8-
import { cutoffStackTrace, IllegalStateError } from '@temporalio/common';
8+
import { cutoffStackTrace, IllegalStateError, convertDeploymentVersion } from '@temporalio/common';
99
import { suggestContinueAsNewReasonsFromProto } from '@temporalio/common/lib/continue-as-new';
1010
import { tsToMs } from '@temporalio/common/lib/time';
1111
import { coresdk } from '@temporalio/proto';
@@ -15,7 +15,6 @@ import type * as internals from '@temporalio/workflow/lib/worker-interface';
1515
import type { Activator } from '@temporalio/workflow/lib/internals';
1616
import { SdkFlags } from '@temporalio/workflow/lib/flags';
1717
import { UnhandledRejectionError } from '../errors';
18-
import { convertDeploymentVersion } from '../utils';
1918
import type { Workflow } from './interface';
2019
import type { WorkflowBundleWithSourceMapAndFilename } from './workflow-worker-thread/input';
2120

0 commit comments

Comments
 (0)