Skip to content

Commit a564a3c

Browse files
💥 Rename NexusClient to NexusServiceClient (#1993)
1 parent 1f50ddc commit a564a3c

6 files changed

Lines changed: 19 additions & 19 deletions

File tree

‎packages/test/src/test-nexus-codec-converter-errors.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const testService = nexus.service('codec-converter-test', {
1616
});
1717

1818
export async function nexusEchoCaller(endpoint: string): Promise<string> {
19-
const client = workflow.createNexusClient({
19+
const client = workflow.createNexusServiceClient({
2020
endpoint,
2121
service: testService,
2222
});

‎packages/test/src/test-nexus-operation-timeouts.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const scheduleToStartService = nexus.service('nexus-schedule-to-start-timeout-te
2222
});
2323

2424
export async function scheduleToStartTimeoutCallerWorkflow(endpoint: string): Promise<string> {
25-
const client = workflow.createNexusClient({
25+
const client = workflow.createNexusServiceClient({
2626
endpoint,
2727
service: scheduleToStartService,
2828
});
@@ -72,7 +72,7 @@ const startToCloseService = nexus.service('nexus-start-to-close-timeout-test-ser
7272
});
7373

7474
export async function startToCloseTimeoutCallerWorkflow(endpoint: string): Promise<string> {
75-
const client = workflow.createNexusClient({
75+
const client = workflow.createNexusServiceClient({
7676
endpoint,
7777
service: startToCloseService,
7878
});

‎packages/test/src/test-nexus-workflow-caller.ts‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export async function caller(
2525
action: string,
2626
cancellationType?: workflow.NexusOperationCancellationType
2727
): Promise<string> {
28-
const client = workflow.createNexusClient({
28+
const client = workflow.createNexusServiceClient({
2929
endpoint,
3030
service,
3131
});
@@ -199,7 +199,7 @@ const clientOperationTypeSafetyCheckerService = nexus.service('test', {
199199
export async function clientOperationTypeSafetyCheckerWorkflow(endpoint: string): Promise<void> {
200200
const Service = clientOperationTypeSafetyCheckerService;
201201
const operations = Service.operations;
202-
const client = workflow.createNexusClient({
202+
const client = workflow.createNexusServiceClient({
203203
endpoint,
204204
service: Service,
205205
});
@@ -276,7 +276,7 @@ const nonExistentService = nexus.service('nonExistentService', {
276276
});
277277

278278
export async function callNonExistentService(endpoint: string): Promise<string> {
279-
const client = workflow.createNexusClient({
279+
const client = workflow.createNexusServiceClient({
280280
endpoint,
281281
service: nonExistentService,
282282
});
@@ -445,9 +445,7 @@ test('inbound executeCancelOperation interceptor can modify input', async (t) =>
445445
}
446446
});
447447

448-
////////////////////////////////////////////////////////////////////////////////////////////////////
449-
450-
test('NexusClient is type-safe in regard to Operation Definitions', async (t) => {
448+
test('NexusServiceClient is type-safe in regard to Operation Definitions', async (t) => {
451449
const { createWorker, executeWorkflow, registerNexusEndpoint } = helpers(t);
452450
const { endpointName, endpointIdentifier } = await registerNexusEndpoint();
453451
try {

‎packages/test/src/test-workflow-nexus-cancellation.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export async function cancellationTestCallerWorkflow(
4343
): Promise<void> {
4444
const { cancellationType, operationName: nexusOperationName } = scenario;
4545
try {
46-
const client = workflow.createNexusClient({ endpoint, service });
46+
const client = workflow.createNexusServiceClient({ endpoint, service });
4747
await client.executeOperation(nexusOperationName, scenario, { cancellationType });
4848
throw ApplicationFailure.nonRetryable('Unexpected Success');
4949
} catch (err) {

‎packages/workflow/src/index.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ export * from './workflow';
109109
export { ChildWorkflowHandle, ExternalWorkflowHandle } from './workflow-handle';
110110
export { metricMeter } from './metrics';
111111
export {
112-
createNexusClient,
113-
NexusClientOptions,
114-
NexusClient,
112+
createNexusServiceClient,
113+
NexusServiceClientOptions,
114+
NexusServiceClient,
115115
NexusOperationHandle,
116116
NexusOperationCancellationType,
117117
} from './nexus';

‎packages/workflow/src/nexus.ts‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { StartNexusOperationInput, StartNexusOperationOutput, StartNexusOperatio
1414
*
1515
* @experimental Nexus support in Temporal SDK is experimental.
1616
*/
17-
export interface NexusClient<T extends nexus.ServiceDefinition> {
17+
export interface NexusServiceClient<T extends nexus.ServiceDefinition> {
1818
/**
1919
* Start a Nexus Operation and wait for its completion taking a {@link nexus.operation}.
2020
* Returns the operation's result.
@@ -104,9 +104,9 @@ export interface NexusOperationHandle<T> {
104104
}
105105

106106
/**
107-
* Options for {@link createNexusClient}.
107+
* Options for {@link createNexusServiceClient}.
108108
*/
109-
export interface NexusClientOptions<T> {
109+
export interface NexusServiceClientOptions<T> {
110110
endpoint: string;
111111
service: T;
112112
}
@@ -116,8 +116,10 @@ export interface NexusClientOptions<T> {
116116
*
117117
* @experimental Nexus support in Temporal SDK is experimental.
118118
*/
119-
export function createNexusClient<T extends nexus.ServiceDefinition>(options: NexusClientOptions<T>): NexusClient<T> {
120-
class NexusClientImpl<T extends nexus.ServiceDefinition> implements NexusClient<T> {
119+
export function createNexusServiceClient<T extends nexus.ServiceDefinition>(
120+
options: NexusServiceClientOptions<T>
121+
): NexusServiceClient<T> {
122+
class NexusServiceClientImpl<T extends nexus.ServiceDefinition> implements NexusServiceClient<T> {
121123
async executeOperation<O extends T['operations'][keyof T['operations']]>(
122124
operation: string | T['operations'][nexus.OperationKey<T['operations']>],
123125
input: nexus.OperationInput<T['operations'][nexus.OperationKey<T['operations']>]>,
@@ -176,7 +178,7 @@ export function createNexusClient<T extends nexus.ServiceDefinition>(options: Ne
176178
}
177179
}
178180

179-
return new NexusClientImpl<T>();
181+
return new NexusServiceClientImpl<T>();
180182
}
181183

182184
function startNexusOperationNextHandler({

0 commit comments

Comments
 (0)