Skip to content

Commit b5afea8

Browse files
committed
Use @bufbuild/buf package
1 parent 3f1dea6 commit b5afea8

File tree

7 files changed

+229
-45
lines changed

7 files changed

+229
-45
lines changed

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Gitpod Support",
55
"publisher": "gitpod",
66
"version": "0.0.104",
7-
"daemonVersion": "0.0.4",
7+
"daemonVersion": "0.0.5",
88
"license": "MIT",
99
"icon": "resources/gitpod.png",
1010
"repository": {
@@ -151,7 +151,7 @@
151151
"package": "vsce package --yarn",
152152
"lint": "eslint . --ext .ts",
153153
"test": "mocha -u tdd",
154-
"proto-gen": "bash ./src/proto/generate.sh"
154+
"proto-gen": "cd ./src/proto && buf lint && buf generate"
155155
},
156156
"devDependencies": {
157157
"@types/google-protobuf": "^3.7.4",
@@ -181,7 +181,8 @@
181181
"ts-proto": "^1.140.0",
182182
"typescript": "^4.6.3",
183183
"webpack": "^5.42.0",
184-
"webpack-cli": "^4.7.2"
184+
"webpack-cli": "^4.7.2",
185+
"@bufbuild/buf": "^1.15.0-1"
185186
},
186187
"dependencies": {
187188
"@bufbuild/connect-node": "^0.8.4",

src/local-ssh/ipc/extension.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as vscode from 'vscode';
7-
import { ExtensionServiceDefinition, ExtensionServiceImplementation, GetWorkspaceAuthInfoRequest, GetWorkspaceAuthInfoResponse, LocalSSHServiceDefinition, PingRequest, SendErrorReportRequest, SendLocalSSHUserFlowStatusRequest, SendLocalSSHUserFlowStatusRequest_Code, SendLocalSSHUserFlowStatusRequest_ConnType, SendLocalSSHUserFlowStatusRequest_Status } from '../../proto/typescript/ipc/v1/ipc';
7+
import { ExtensionServiceDefinition, ExtensionServiceImplementation, GetWorkspaceAuthInfoRequest, GetWorkspaceAuthInfoResponse, LocalSSHServiceDefinition, ExtensionServicePingRequest, SendErrorReportRequest, SendLocalSSHUserFlowStatusRequest, SendLocalSSHUserFlowStatusRequest_Code, SendLocalSSHUserFlowStatusRequest_ConnType, SendLocalSSHUserFlowStatusRequest_Status } from '../../proto/typescript/ipc/v1/ipc';
88
import { Disposable } from '../../common/dispose';
99
import { retry, timeout } from '../../common/async';
1010
export { ExtensionServiceDefinition } from '../../proto/typescript/ipc/v1/ipc';
@@ -57,7 +57,7 @@ export class ExtensionServiceImpl implements ExtensionServiceImplementation {
5757
return true;
5858
}
5959

60-
async ping(_request: PingRequest, _context: CallContext): Promise<{}> {
60+
async ping(_request: ExtensionServicePingRequest, _context: CallContext): Promise<{}> {
6161
return {};
6262
}
6363

src/local-ssh/ipc/localssh.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { ActiveRequest, ExtensionServiceDefinition, GetDaemonInfoRequest, GetDaemonVersionRequest, InactiveRequest, KillDaemonRequest, LocalSSHServiceDefinition, LocalSSHServiceImplementation, PingRequest, SendErrorReportRequest, SendLocalSSHUserFlowStatusRequest } from '../../proto/typescript/ipc/v1/ipc';
6+
import { ActiveRequest, ExtensionServiceDefinition, GetDaemonInfoRequest, GetDaemonVersionRequest, InactiveRequest, KillDaemonRequest, LocalSSHServiceDefinition, LocalSSHServiceImplementation, LocalSSHServicePingRequest, SendErrorReportRequest, SendLocalSSHUserFlowStatusRequest } from '../../proto/typescript/ipc/v1/ipc';
77
import { CallContext, Client, ServerError, Status, createChannel, createClient, createServer } from 'nice-grpc';
88
import { ExitCode, exitProcess, getDaemonVersion, getRunningExtensionVersion } from '../common';
99
import { retryWithStop } from '../../common/async';
@@ -33,7 +33,7 @@ export class LocalSSHServiceImpl implements LocalSSHServiceImplementation {
3333
return {};
3434
}
3535

36-
async ping(_request: PingRequest, _context: CallContext): Promise<{}> {
36+
async ping(_request: LocalSSHServicePingRequest, _context: CallContext): Promise<{}> {
3737
return {};
3838
}
3939

src/proto/generate.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/proto/ipc/v1/ipc.proto

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ service LocalSSHService {
99
// Inactive is called when extension is deactivated
1010
rpc Inactive(InactiveRequest) returns (InactiveResponse) {}
1111

12-
rpc Ping (PingRequest) returns (PingResponse) {}
12+
rpc Ping (LocalSSHServicePingRequest) returns (LocalSSHServicePingResponse) {}
1313

1414
// GetDaemonVersion returns the version of the daemon
1515
rpc GetDaemonVersion(GetDaemonVersionRequest) returns (GetDaemonVersionResponse) {}
@@ -22,7 +22,7 @@ service LocalSSHService {
2222
}
2323

2424
service ExtensionService {
25-
rpc Ping (PingRequest) returns (PingResponse) {}
25+
rpc Ping (ExtensionServicePingRequest) returns (ExtensionServicePingResponse) {}
2626
rpc GetWorkspaceAuthInfo (GetWorkspaceAuthInfoRequest) returns (GetWorkspaceAuthInfoResponse) {}
2727
rpc SendLocalSSHUserFlowStatus (SendLocalSSHUserFlowStatusRequest) returns (SendLocalSSHUserFlowStatusResponse) {}
2828
rpc SendErrorReport (SendErrorReportRequest) returns (SendErrorReportResponse) {}
@@ -113,7 +113,13 @@ message InactiveRequest {
113113

114114
message InactiveResponse {}
115115

116-
message PingRequest {}
116+
message LocalSSHServicePingRequest {}
117+
118+
message LocalSSHServicePingResponse {}
119+
120+
message ExtensionServicePingRequest {}
121+
122+
message ExtensionServicePingResponse {}
117123

118124
message PingResponse {}
119125

src/proto/typescript/ipc/v1/ipc.ts

Lines changed: 170 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,16 @@ export interface InactiveRequest {
224224
export interface InactiveResponse {
225225
}
226226

227-
export interface PingRequest {
227+
export interface LocalSSHServicePingRequest {
228+
}
229+
230+
export interface LocalSSHServicePingResponse {
231+
}
232+
233+
export interface ExtensionServicePingRequest {
234+
}
235+
236+
export interface ExtensionServicePingResponse {
228237
}
229238

230239
export interface PingResponse {
@@ -1025,19 +1034,105 @@ export const InactiveResponse = {
10251034
},
10261035
};
10271036

1028-
function createBasePingRequest(): PingRequest {
1037+
function createBaseLocalSSHServicePingRequest(): LocalSSHServicePingRequest {
1038+
return {};
1039+
}
1040+
1041+
export const LocalSSHServicePingRequest = {
1042+
encode(_: LocalSSHServicePingRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
1043+
return writer;
1044+
},
1045+
1046+
decode(input: _m0.Reader | Uint8Array, length?: number): LocalSSHServicePingRequest {
1047+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1048+
let end = length === undefined ? reader.len : reader.pos + length;
1049+
const message = createBaseLocalSSHServicePingRequest();
1050+
while (reader.pos < end) {
1051+
const tag = reader.uint32();
1052+
switch (tag >>> 3) {
1053+
default:
1054+
reader.skipType(tag & 7);
1055+
break;
1056+
}
1057+
}
1058+
return message;
1059+
},
1060+
1061+
fromJSON(_: any): LocalSSHServicePingRequest {
1062+
return {};
1063+
},
1064+
1065+
toJSON(_: LocalSSHServicePingRequest): unknown {
1066+
const obj: any = {};
1067+
return obj;
1068+
},
1069+
1070+
create(base?: DeepPartial<LocalSSHServicePingRequest>): LocalSSHServicePingRequest {
1071+
return LocalSSHServicePingRequest.fromPartial(base ?? {});
1072+
},
1073+
1074+
fromPartial(_: DeepPartial<LocalSSHServicePingRequest>): LocalSSHServicePingRequest {
1075+
const message = createBaseLocalSSHServicePingRequest();
1076+
return message;
1077+
},
1078+
};
1079+
1080+
function createBaseLocalSSHServicePingResponse(): LocalSSHServicePingResponse {
1081+
return {};
1082+
}
1083+
1084+
export const LocalSSHServicePingResponse = {
1085+
encode(_: LocalSSHServicePingResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
1086+
return writer;
1087+
},
1088+
1089+
decode(input: _m0.Reader | Uint8Array, length?: number): LocalSSHServicePingResponse {
1090+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1091+
let end = length === undefined ? reader.len : reader.pos + length;
1092+
const message = createBaseLocalSSHServicePingResponse();
1093+
while (reader.pos < end) {
1094+
const tag = reader.uint32();
1095+
switch (tag >>> 3) {
1096+
default:
1097+
reader.skipType(tag & 7);
1098+
break;
1099+
}
1100+
}
1101+
return message;
1102+
},
1103+
1104+
fromJSON(_: any): LocalSSHServicePingResponse {
1105+
return {};
1106+
},
1107+
1108+
toJSON(_: LocalSSHServicePingResponse): unknown {
1109+
const obj: any = {};
1110+
return obj;
1111+
},
1112+
1113+
create(base?: DeepPartial<LocalSSHServicePingResponse>): LocalSSHServicePingResponse {
1114+
return LocalSSHServicePingResponse.fromPartial(base ?? {});
1115+
},
1116+
1117+
fromPartial(_: DeepPartial<LocalSSHServicePingResponse>): LocalSSHServicePingResponse {
1118+
const message = createBaseLocalSSHServicePingResponse();
1119+
return message;
1120+
},
1121+
};
1122+
1123+
function createBaseExtensionServicePingRequest(): ExtensionServicePingRequest {
10291124
return {};
10301125
}
10311126

1032-
export const PingRequest = {
1033-
encode(_: PingRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
1127+
export const ExtensionServicePingRequest = {
1128+
encode(_: ExtensionServicePingRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
10341129
return writer;
10351130
},
10361131

1037-
decode(input: _m0.Reader | Uint8Array, length?: number): PingRequest {
1132+
decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionServicePingRequest {
10381133
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
10391134
let end = length === undefined ? reader.len : reader.pos + length;
1040-
const message = createBasePingRequest();
1135+
const message = createBaseExtensionServicePingRequest();
10411136
while (reader.pos < end) {
10421137
const tag = reader.uint32();
10431138
switch (tag >>> 3) {
@@ -1049,21 +1144,64 @@ export const PingRequest = {
10491144
return message;
10501145
},
10511146

1052-
fromJSON(_: any): PingRequest {
1147+
fromJSON(_: any): ExtensionServicePingRequest {
10531148
return {};
10541149
},
10551150

1056-
toJSON(_: PingRequest): unknown {
1151+
toJSON(_: ExtensionServicePingRequest): unknown {
10571152
const obj: any = {};
10581153
return obj;
10591154
},
10601155

1061-
create(base?: DeepPartial<PingRequest>): PingRequest {
1062-
return PingRequest.fromPartial(base ?? {});
1156+
create(base?: DeepPartial<ExtensionServicePingRequest>): ExtensionServicePingRequest {
1157+
return ExtensionServicePingRequest.fromPartial(base ?? {});
10631158
},
10641159

1065-
fromPartial(_: DeepPartial<PingRequest>): PingRequest {
1066-
const message = createBasePingRequest();
1160+
fromPartial(_: DeepPartial<ExtensionServicePingRequest>): ExtensionServicePingRequest {
1161+
const message = createBaseExtensionServicePingRequest();
1162+
return message;
1163+
},
1164+
};
1165+
1166+
function createBaseExtensionServicePingResponse(): ExtensionServicePingResponse {
1167+
return {};
1168+
}
1169+
1170+
export const ExtensionServicePingResponse = {
1171+
encode(_: ExtensionServicePingResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
1172+
return writer;
1173+
},
1174+
1175+
decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionServicePingResponse {
1176+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1177+
let end = length === undefined ? reader.len : reader.pos + length;
1178+
const message = createBaseExtensionServicePingResponse();
1179+
while (reader.pos < end) {
1180+
const tag = reader.uint32();
1181+
switch (tag >>> 3) {
1182+
default:
1183+
reader.skipType(tag & 7);
1184+
break;
1185+
}
1186+
}
1187+
return message;
1188+
},
1189+
1190+
fromJSON(_: any): ExtensionServicePingResponse {
1191+
return {};
1192+
},
1193+
1194+
toJSON(_: ExtensionServicePingResponse): unknown {
1195+
const obj: any = {};
1196+
return obj;
1197+
},
1198+
1199+
create(base?: DeepPartial<ExtensionServicePingResponse>): ExtensionServicePingResponse {
1200+
return ExtensionServicePingResponse.fromPartial(base ?? {});
1201+
},
1202+
1203+
fromPartial(_: DeepPartial<ExtensionServicePingResponse>): ExtensionServicePingResponse {
1204+
const message = createBaseExtensionServicePingResponse();
10671205
return message;
10681206
},
10691207
};
@@ -1379,9 +1517,9 @@ export const LocalSSHServiceDefinition = {
13791517
},
13801518
ping: {
13811519
name: "Ping",
1382-
requestType: PingRequest,
1520+
requestType: LocalSSHServicePingRequest,
13831521
requestStream: false,
1384-
responseType: PingResponse,
1522+
responseType: LocalSSHServicePingResponse,
13851523
responseStream: false,
13861524
options: {},
13871525
},
@@ -1420,7 +1558,10 @@ export interface LocalSSHServiceImplementation<CallContextExt = {}> {
14201558
active(request: ActiveRequest, context: CallContext & CallContextExt): Promise<DeepPartial<ActiveResponse>>;
14211559
/** Inactive is called when extension is deactivated */
14221560
inactive(request: InactiveRequest, context: CallContext & CallContextExt): Promise<DeepPartial<InactiveResponse>>;
1423-
ping(request: PingRequest, context: CallContext & CallContextExt): Promise<DeepPartial<PingResponse>>;
1561+
ping(
1562+
request: LocalSSHServicePingRequest,
1563+
context: CallContext & CallContextExt,
1564+
): Promise<DeepPartial<LocalSSHServicePingResponse>>;
14241565
/** GetDaemonVersion returns the version of the daemon */
14251566
getDaemonVersion(
14261567
request: GetDaemonVersionRequest,
@@ -1443,7 +1584,10 @@ export interface LocalSSHServiceClient<CallOptionsExt = {}> {
14431584
active(request: DeepPartial<ActiveRequest>, options?: CallOptions & CallOptionsExt): Promise<ActiveResponse>;
14441585
/** Inactive is called when extension is deactivated */
14451586
inactive(request: DeepPartial<InactiveRequest>, options?: CallOptions & CallOptionsExt): Promise<InactiveResponse>;
1446-
ping(request: DeepPartial<PingRequest>, options?: CallOptions & CallOptionsExt): Promise<PingResponse>;
1587+
ping(
1588+
request: DeepPartial<LocalSSHServicePingRequest>,
1589+
options?: CallOptions & CallOptionsExt,
1590+
): Promise<LocalSSHServicePingResponse>;
14471591
/** GetDaemonVersion returns the version of the daemon */
14481592
getDaemonVersion(
14491593
request: DeepPartial<GetDaemonVersionRequest>,
@@ -1468,9 +1612,9 @@ export const ExtensionServiceDefinition = {
14681612
methods: {
14691613
ping: {
14701614
name: "Ping",
1471-
requestType: PingRequest,
1615+
requestType: ExtensionServicePingRequest,
14721616
requestStream: false,
1473-
responseType: PingResponse,
1617+
responseType: ExtensionServicePingResponse,
14741618
responseStream: false,
14751619
options: {},
14761620
},
@@ -1502,7 +1646,10 @@ export const ExtensionServiceDefinition = {
15021646
} as const;
15031647

15041648
export interface ExtensionServiceImplementation<CallContextExt = {}> {
1505-
ping(request: PingRequest, context: CallContext & CallContextExt): Promise<DeepPartial<PingResponse>>;
1649+
ping(
1650+
request: ExtensionServicePingRequest,
1651+
context: CallContext & CallContextExt,
1652+
): Promise<DeepPartial<ExtensionServicePingResponse>>;
15061653
getWorkspaceAuthInfo(
15071654
request: GetWorkspaceAuthInfoRequest,
15081655
context: CallContext & CallContextExt,
@@ -1518,7 +1665,10 @@ export interface ExtensionServiceImplementation<CallContextExt = {}> {
15181665
}
15191666

15201667
export interface ExtensionServiceClient<CallOptionsExt = {}> {
1521-
ping(request: DeepPartial<PingRequest>, options?: CallOptions & CallOptionsExt): Promise<PingResponse>;
1668+
ping(
1669+
request: DeepPartial<ExtensionServicePingRequest>,
1670+
options?: CallOptions & CallOptionsExt,
1671+
): Promise<ExtensionServicePingResponse>;
15221672
getWorkspaceAuthInfo(
15231673
request: DeepPartial<GetWorkspaceAuthInfoRequest>,
15241674
options?: CallOptions & CallOptionsExt,

0 commit comments

Comments
 (0)