Skip to content

Commit cfb071f

Browse files
Replace deprecated PromiseClient with Client (#628)
1 parent 81d1ffa commit cfb071f

File tree

40 files changed

+94
-160
lines changed

40 files changed

+94
-160
lines changed

src/app/billing-client.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import {
2-
createPromiseClient,
3-
type PromiseClient,
4-
type Transport,
5-
} from '@connectrpc/connect';
1+
import { createClient, type Client, type Transport } from '@connectrpc/connect';
62
import { BillingService } from '../gen/app/v1/billing_connect';
73
import type { GetCurrentMonthUsageResponse as PBGetCurrentMonthUsageResponse } from '../gen/app/v1/billing_pb';
84

@@ -13,10 +9,10 @@ export type GetCurrentMonthUsageResponse =
139
};
1410

1511
export class BillingClient {
16-
private client: PromiseClient<typeof BillingService>;
12+
private client: Client<typeof BillingService>;
1713

1814
constructor(transport: Transport) {
19-
this.client = createPromiseClient(BillingService, transport);
15+
this.client = createClient(BillingService, transport);
2016
}
2117

2218
/**

src/app/data-client.ts

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import { BSON } from 'bsonfy';
22
import { Struct, Timestamp, type JsonValue } from '@bufbuild/protobuf';
3-
import {
4-
createPromiseClient,
5-
type PromiseClient,
6-
type Transport,
7-
} from '@connectrpc/connect';
3+
import { createClient, type Client, type Transport } from '@connectrpc/connect';
84
import { DataService } from '../gen/app/data/v1/data_connect';
95
import {
106
BinaryID,
@@ -73,19 +69,16 @@ const logDeprecationWarning = () => {
7369
};
7470

7571
export class DataClient {
76-
private dataClient: PromiseClient<typeof DataService>;
77-
private datasetClient: PromiseClient<typeof DatasetService>;
78-
private dataSyncClient: PromiseClient<typeof DataSyncService>;
79-
private dataPipelinesClient: PromiseClient<typeof DataPipelinesService>;
72+
private dataClient: Client<typeof DataService>;
73+
private datasetClient: Client<typeof DatasetService>;
74+
private dataSyncClient: Client<typeof DataSyncService>;
75+
private dataPipelinesClient: Client<typeof DataPipelinesService>;
8076

8177
constructor(transport: Transport) {
82-
this.dataClient = createPromiseClient(DataService, transport);
83-
this.datasetClient = createPromiseClient(DatasetService, transport);
84-
this.dataSyncClient = createPromiseClient(DataSyncService, transport);
85-
this.dataPipelinesClient = createPromiseClient(
86-
DataPipelinesService,
87-
transport
88-
);
78+
this.dataClient = createClient(DataService, transport);
79+
this.datasetClient = createClient(DatasetService, transport);
80+
this.dataSyncClient = createClient(DataSyncService, transport);
81+
this.dataPipelinesClient = createClient(DataPipelinesService, transport);
8982
}
9083

9184
/**
@@ -1519,9 +1512,7 @@ export class DataClient {
15191512

15201513
export class ListDataPipelineRunsPage {
15211514
constructor(
1522-
private readonly dataPipelinesClient: PromiseClient<
1523-
typeof DataPipelinesService
1524-
>,
1515+
private readonly dataPipelinesClient: Client<typeof DataPipelinesService>,
15251516
private readonly pipelineId: string,
15261517
public readonly runs: DataPipelineRun[] = [],
15271518
private readonly pageSize?: number,

src/app/ml-training-client.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import {
2-
createPromiseClient,
3-
type PromiseClient,
4-
type Transport,
5-
} from '@connectrpc/connect';
1+
import { createClient, type Client, type Transport } from '@connectrpc/connect';
62
import { MLTrainingService } from '../gen/app/mltraining/v1/ml_training_connect';
73

84
import {
@@ -11,10 +7,10 @@ import {
117
} from '../gen/app/mltraining/v1/ml_training_pb';
128

139
export class MlTrainingClient {
14-
private client: PromiseClient<typeof MLTrainingService>;
10+
private client: Client<typeof MLTrainingService>;
1511

1612
constructor(transport: Transport) {
17-
this.client = createPromiseClient(MLTrainingService, transport);
13+
this.client = createClient(MLTrainingService, transport);
1814
}
1915

2016
/**

src/app/provisioning-client.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
import {
2-
createPromiseClient,
3-
type PromiseClient,
4-
type Transport,
5-
} from '@connectrpc/connect';
1+
import { createClient, type Client, type Transport } from '@connectrpc/connect';
62
import { ProvisioningService } from '../gen/provisioning/v1/provisioning_connect';
73
import type { CloudConfig } from '../gen/provisioning/v1/provisioning_pb';
84

95
export class ProvisioningClient {
10-
private client: PromiseClient<typeof ProvisioningService>;
6+
private client: Client<typeof ProvisioningService>;
117

128
constructor(transport: Transport) {
13-
this.client = createPromiseClient(ProvisioningService, transport);
9+
this.client = createClient(ProvisioningService, transport);
1410
}
1511

1612
/**

src/components/arm/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Struct, type JsonValue } from '@bufbuild/protobuf';
2-
import type { CallOptions, PromiseClient } from '@connectrpc/connect';
2+
import type { CallOptions, Client } from '@connectrpc/connect';
33
import { ArmService } from '../../gen/component/arm/v1/arm_connect';
44
import {
55
GetEndPositionRequest,
@@ -22,7 +22,7 @@ import { GetGeometriesRequest } from '../../gen/common/v1/common_pb';
2222
* @group Clients
2323
*/
2424
export class ArmClient implements Arm {
25-
private client: PromiseClient<typeof ArmService>;
25+
private client: Client<typeof ArmService>;
2626
public readonly name: string;
2727
private readonly options: Options;
2828
public callOptions: CallOptions = { headers: {} as Record<string, string> };

src/components/base/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Struct, type JsonValue } from '@bufbuild/protobuf';
2-
import type { CallOptions, PromiseClient } from '@connectrpc/connect';
2+
import type { CallOptions, Client } from '@connectrpc/connect';
33
import { BaseService } from '../../gen/component/base/v1/base_connect';
44
import {
55
GetPropertiesRequest,
@@ -22,7 +22,7 @@ import { GetGeometriesRequest } from '../../gen/common/v1/common_pb';
2222
* @group Clients
2323
*/
2424
export class BaseClient implements Base {
25-
private client: PromiseClient<typeof BaseService>;
25+
private client: Client<typeof BaseService>;
2626
public readonly name: string;
2727
private readonly options: Options;
2828
public callOptions: CallOptions = { headers: {} as Record<string, string> };

src/components/board/client.spec.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ import { BoardClient } from './client';
88
vi.mock('../../robot');
99

1010
import type { PartialMessage } from '@bufbuild/protobuf';
11-
import {
12-
createPromiseClient,
13-
createRouterTransport,
14-
} from '@connectrpc/connect';
11+
import { createClient, createRouterTransport } from '@connectrpc/connect';
1512
import {
1613
createWritableIterable,
1714
type WritableIterable,
@@ -49,9 +46,7 @@ describe('BoardClient tests', () => {
4946

5047
RobotClient.prototype.createServiceClient = vi
5148
.fn()
52-
.mockImplementation(() =>
53-
createPromiseClient(BoardService, mockTransport)
54-
);
49+
.mockImplementation(() => createClient(BoardService, mockTransport));
5550

5651
board = new BoardClient(new RobotClient('host'), 'test-board');
5752
});

src/components/board/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { RobotClient } from '../../robot';
22
import type { Options } from '../../types';
33

44
import { Duration, Struct, type JsonValue } from '@bufbuild/protobuf';
5-
import type { CallOptions, PromiseClient } from '@connectrpc/connect';
5+
import type { CallOptions, Client } from '@connectrpc/connect';
66
import { BoardService } from '../../gen/component/board/v1/board_connect';
77
import {
88
GetDigitalInterruptValueRequest,
@@ -26,7 +26,7 @@ import { type Board, type PowerMode, type Tick } from './board';
2626
* @group Clients
2727
*/
2828
export class BoardClient implements Board {
29-
private client: PromiseClient<typeof BoardService>;
29+
private client: Client<typeof BoardService>;
3030
public readonly name: string;
3131
private readonly options: Options;
3232
public callOptions: CallOptions = { headers: {} as Record<string, string> };

src/components/button/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Struct, type JsonValue } from '@bufbuild/protobuf';
2-
import type { CallOptions, PromiseClient } from '@connectrpc/connect';
2+
import type { CallOptions, Client } from '@connectrpc/connect';
33
import { ButtonService } from '../../gen/component/button/v1/button_connect';
44
import { PushRequest } from '../../gen/component/button/v1/button_pb';
55
import type { RobotClient } from '../../robot';
@@ -13,7 +13,7 @@ import type { Button } from './button';
1313
* @group Clients
1414
*/
1515
export class ButtonClient implements Button {
16-
private client: PromiseClient<typeof ButtonService>;
16+
private client: Client<typeof ButtonService>;
1717
public readonly name: string;
1818
private readonly options: Options;
1919
public callOptions: CallOptions = { headers: {} as Record<string, string> };

src/components/camera/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { type JsonValue, Struct, Timestamp } from '@bufbuild/protobuf';
2-
import type { CallOptions, PromiseClient } from '@connectrpc/connect';
2+
import type { CallOptions, Client } from '@connectrpc/connect';
33
import { GetPropertiesRequest } from '../../gen/component/base/v1/base_pb';
44
import { CameraService } from '../../gen/component/camera/v1/camera_connect';
55
import {
@@ -44,7 +44,7 @@ const formatToMimeType = (format: Format): MimeType => {
4444
* @group Clients
4545
*/
4646
export class CameraClient implements Camera {
47-
private client: PromiseClient<typeof CameraService>;
47+
private client: Client<typeof CameraService>;
4848
public readonly name: string;
4949
private readonly options: Options;
5050
public callOptions: CallOptions = { headers: {} as Record<string, string> };

0 commit comments

Comments
 (0)