Skip to content

Commit b7dc0e0

Browse files
committed
feat: ✨ improve message creation
1 parent eddfa94 commit b7dc0e0

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

protobuf-ts/src/client.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ import {
1515
} from "./proto/test";
1616

1717
export const readInputsCall = (client: TestServiceClient) => {
18-
const request = TestServiceReadInputsRequest.create({
18+
const request: TestServiceReadInputsRequest = {
1919
userId: faker.string.uuid(),
2020
taxYear: faker.number.int({ min: 2018, max: 2023 }).toString(),
2121
formName: faker.helpers.arrayElement(MOCK_FORM_NAMES),
2222
inputNames: MOCK_INPUT_NAMES,
23-
});
23+
};
2424

2525
const metadata = new Metadata();
2626

@@ -37,7 +37,7 @@ export const readInputsCall = (client: TestServiceClient) => {
3737
};
3838

3939
export const updateInputsCall = (client: TestServiceClient) => {
40-
const request = TestServiceUpdateInputsRequest.create({
40+
const request: TestServiceUpdateInputsRequest = {
4141
userId: faker.string.uuid(),
4242
taxYear: faker.number.int({ min: 2018, max: 2023 }).toString(),
4343
formName: faker.helpers.arrayElement(MOCK_FORM_NAMES),
@@ -47,7 +47,7 @@ export const updateInputsCall = (client: TestServiceClient) => {
4747
type: faker.helpers.arrayElement(MOCK_INPUT_TYPES),
4848
source: faker.helpers.arrayElement(MOCK_INPUT_SOURCES),
4949
})),
50-
});
50+
};
5151

5252
const metadata = new Metadata();
5353

protobuf-ts/src/server.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ const readInputs: handleUnaryCall<
3333
});
3434
});
3535

36-
const response = TestServiceReadInputsResponse.create({
36+
const response: TestServiceReadInputsResponse = {
3737
inputs,
38-
});
38+
};
3939

4040
callback(null, response);
4141
};
@@ -53,7 +53,7 @@ const updateInputs: handleUnaryCall<
5353

5454
inputs.forEach(() => {});
5555

56-
const response = TestServiceUpdateInputsResponse.create();
56+
const response: TestServiceUpdateInputsResponse = {};
5757

5858
callback(null, response);
5959
};

ts-proto/gen_grpc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ echo "\t└> $SRC_DEST_DIR"
6262
$GRPC_TOOLS_NODE_PROTOC_PATH \
6363
--plugin=$PROTOC_GEN_TS_PROTO_PATH \
6464
--ts_proto_out=$SRC_DEST_DIR \
65-
--ts_proto_opt=outputServices=grpc-js \
65+
--ts_proto_opt=removeEnumPrefix=true,outputServices=grpc-js \
6666
-I $PROTO_DIR $PROTO_FILES

ts-proto/src/client.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ import {
1414
} from "./proto/test";
1515

1616
export const readInputsCall = (client: TestServiceClient) => {
17-
const request = TestServiceReadInputsRequest.fromPartial({
17+
const request: TestServiceReadInputsRequest = {
1818
userId: faker.string.uuid(),
1919
taxYear: faker.number.int({ min: 2018, max: 2023 }).toString(),
2020
formName: faker.helpers.arrayElement(MOCK_FORM_NAMES),
2121
inputNames: MOCK_INPUT_NAMES,
22-
});
22+
};
2323

2424
const metadata = new Metadata();
2525

@@ -36,7 +36,7 @@ export const readInputsCall = (client: TestServiceClient) => {
3636
};
3737

3838
export const updateInputsCall = (client: TestServiceClient) => {
39-
const request = TestServiceUpdateInputsRequest.fromPartial({
39+
const request: TestServiceUpdateInputsRequest = {
4040
userId: faker.string.uuid(),
4141
taxYear: faker.number.int({ min: 2018, max: 2023 }).toString(),
4242
formName: faker.helpers.arrayElement(MOCK_FORM_NAMES),
@@ -46,7 +46,7 @@ export const updateInputsCall = (client: TestServiceClient) => {
4646
type: faker.helpers.arrayElement(MOCK_INPUT_TYPES),
4747
source: faker.helpers.arrayElement(MOCK_INPUT_SOURCES),
4848
})),
49-
});
49+
};
5050

5151
const metadata = new Metadata();
5252

ts-proto/src/server.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ const readInputs: handleUnaryCall<
3232
});
3333
});
3434

35-
const response = TestServiceReadInputsResponse.fromPartial({
35+
const response: TestServiceReadInputsResponse = {
3636
inputs,
37-
});
37+
};
3838

3939
callback(null, response);
4040
};
@@ -52,7 +52,7 @@ const updateInputs: handleUnaryCall<
5252

5353
inputs.forEach(() => {});
5454

55-
const response = TestServiceUpdateInputsResponse.fromPartial({});
55+
const response: TestServiceUpdateInputsResponse = {};
5656

5757
callback(null, response);
5858
};

0 commit comments

Comments
 (0)