Skip to content

Commit 345d700

Browse files
committed
Lint fix and inlining some types/functions
1 parent e1bd195 commit 345d700

File tree

3 files changed

+21
-36
lines changed

3 files changed

+21
-36
lines changed

packages/client/src/helpers.ts

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ import { decodeMapFromPayloads } from '@temporalio/common/lib/internal-non-workf
1212
import { temporal, google } from '@temporalio/proto';
1313
import {
1414
CountWorkflowExecution,
15-
CountWorkflowExecutionsAggregationGroup,
16-
RawCountWorkflowExecutions,
17-
RawCountWorkflowExecutionsAggregationGroup,
1815
RawWorkflowExecutionInfo,
1916
WorkflowExecutionInfo,
2017
WorkflowExecutionStatusName,
@@ -89,21 +86,19 @@ export async function executionInfoFromRaw<T>(
8986
};
9087
}
9188

92-
export function decodeCountWorkflowExecutionsResponse(raw: RawCountWorkflowExecutions): CountWorkflowExecution {
89+
export function decodeCountWorkflowExecutionsResponse(
90+
raw: temporal.api.workflowservice.v1.ICountWorkflowExecutionsResponse
91+
): CountWorkflowExecution {
9392
return {
9493
// Note: lossy conversion of Long to number
9594
count: raw.count!.toNumber(),
96-
groups: raw.groups!.map((group) => executionCountAggregationGroupFromRaw(group)),
97-
};
98-
}
99-
100-
export function executionCountAggregationGroupFromRaw(
101-
raw: RawCountWorkflowExecutionsAggregationGroup
102-
): CountWorkflowExecutionsAggregationGroup {
103-
return {
104-
// Note: lossy conversion of Long to number
105-
count: raw.count!.toNumber(),
106-
groupValues: raw.groupValues!.map((group_value) => searchAttributePayloadConverter.fromPayload(group_value)),
95+
groups: raw.groups!.map((group) => {
96+
return {
97+
// Note: lossy conversion of Long to number
98+
count: group.count!.toNumber(),
99+
groupValues: group.groupValues!.map((value) => searchAttributePayloadConverter.fromPayload(value)),
100+
};
101+
}),
107102
};
108103
}
109104

packages/client/src/types.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ export type GetWorkflowExecutionHistoryRequest =
1414
export type DescribeWorkflowExecutionResponse =
1515
proto.temporal.api.workflowservice.v1.IDescribeWorkflowExecutionResponse;
1616
export type RawWorkflowExecutionInfo = proto.temporal.api.workflow.v1.IWorkflowExecutionInfo;
17-
export type RawCountWorkflowExecutions = proto.temporal.api.workflowservice.v1.ICountWorkflowExecutionsResponse;
18-
export type RawCountWorkflowExecutionsAggregationGroup =
19-
proto.temporal.api.workflowservice.v1.CountWorkflowExecutionsResponse.IAggregationGroup;
2017
export type TerminateWorkflowExecutionResponse =
2118
proto.temporal.api.workflowservice.v1.ITerminateWorkflowExecutionResponse;
2219
export type RequestCancelWorkflowExecutionResponse =
@@ -57,12 +54,10 @@ export interface WorkflowExecutionInfo {
5754

5855
export interface CountWorkflowExecution {
5956
count: number;
60-
groups: CountWorkflowExecutionsAggregationGroup[];
61-
}
62-
63-
export interface CountWorkflowExecutionsAggregationGroup {
64-
count: number;
65-
groupValues: SearchAttributeValue[];
57+
groups: {
58+
count: number;
59+
groupValues: SearchAttributeValue[];
60+
}[];
6661
}
6762

6863
export type WorkflowExecutionDescription = Replace<

packages/test/src/test-integration-workflows.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { randomUUID } from 'crypto';
22
import { ExecutionContext } from 'ava';
33
import { firstValueFrom, Subject } from 'rxjs';
4-
import asyncRetry from 'async-retry';
54
import { CountWorkflowExecution, WorkflowFailedError } from '@temporalio/client';
65
import * as activity from '@temporalio/activity';
76
import { msToNumber, tsToMs } from '@temporalio/common/lib/time';
@@ -16,7 +15,7 @@ import { activityStartedSignal } from './workflows/definitions';
1615
import * as workflows from './workflows';
1716
import { Context, helpers, makeTestFunction } from './helpers-integration';
1817
import { overrideSdkInternalFlag } from './mock-internal-flags';
19-
import { asSdkLoggerSink, loadHistory, RUN_TIME_SKIPPING_TESTS, waitUntil } from './helpers';
18+
import { asSdkLoggerSink, loadHistory, RUN_TIME_SKIPPING_TESTS } from './helpers';
2019

2120
const test = makeTestFunction({
2221
workflowsPath: __filename,
@@ -1282,16 +1281,12 @@ test('Count workflow executions', async (t) => {
12821281
}
12831282

12841283
await worker.runUntil(async () => {
1285-
try {
1286-
// Run 3 workflows that complete.
1287-
await Promise.all([
1288-
executeWorkflow(completableWorkflow, { args: [true] }),
1289-
executeWorkflow(completableWorkflow, { args: [true] }),
1290-
executeWorkflow(completableWorkflow, { args: [true] }),
1291-
]);
1292-
} catch (err) {
1293-
throw new Error('executing workflow unexpectedly failed');
1294-
}
1284+
// Run 3 workflows that complete.
1285+
await Promise.all([
1286+
executeWorkflow(completableWorkflow, { args: [true] }),
1287+
executeWorkflow(completableWorkflow, { args: [true] }),
1288+
executeWorkflow(completableWorkflow, { args: [true] }),
1289+
]);
12951290
});
12961291

12971292
const actualTotal = await client.workflow.count(`TaskQueue = '${taskQueue}'`);

0 commit comments

Comments
 (0)