ts-proto 1.132.1 → 1.134.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/build/generate-nice-grpc.js +2 -1
- package/build/types.js +3 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [1.134.0](https://github.com/stephenh/ts-proto/compare/v1.133.0...v1.134.0) (2022-11-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* conditionally add "Service" to nice-grpc's generated service interface name ([#710](https://github.com/stephenh/ts-proto/issues/710)) ([7c39cc0](https://github.com/stephenh/ts-proto/commit/7c39cc0729403dcb63ef353357fae3548b5a6667))
|
|
7
|
+
|
|
8
|
+
# [1.133.0](https://github.com/stephenh/ts-proto/compare/v1.132.1...v1.133.0) (2022-11-20)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* optional one of properties ([#705](https://github.com/stephenh/ts-proto/issues/705)) ([4c6cbb0](https://github.com/stephenh/ts-proto/commit/4c6cbb0ff71e053c634732e295ed812901d368ae))
|
|
14
|
+
|
|
1
15
|
## [1.132.1](https://github.com/stephenh/ts-proto/compare/v1.132.0...v1.132.1) (2022-11-15)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -21,7 +21,8 @@ exports.generateNiceGrpcService = generateNiceGrpcService;
|
|
|
21
21
|
function generateServerStub(ctx, sourceInfo, serviceDesc) {
|
|
22
22
|
var _a;
|
|
23
23
|
const chunks = [];
|
|
24
|
-
|
|
24
|
+
const maybeSuffix = serviceDesc.name.endsWith("Service") ? "" : "Service";
|
|
25
|
+
chunks.push((0, ts_poet_1.code) `export interface ${(0, ts_poet_1.def)(`${serviceDesc.name}${maybeSuffix}Implementation`)}<CallContextExt = {}> {`);
|
|
25
26
|
for (const [index, methodDesc] of serviceDesc.method.entries()) {
|
|
26
27
|
(0, utils_1.assertInstanceOf)(methodDesc, utils_1.FormattedMethodDescriptor);
|
|
27
28
|
const inputType = (0, types_1.messageToTypeName)(ctx, methodDesc.inputType, { keepValueType: true });
|
package/build/types.js
CHANGED
|
@@ -320,11 +320,14 @@ exports.isScalar = isScalar;
|
|
|
320
320
|
// properties. When useOptionals='all', all fields are translated into
|
|
321
321
|
// optional properties, with the exception of map Entry key/values, which must
|
|
322
322
|
// always be present.
|
|
323
|
+
// OneOf fields are always optional, whenever oneof=unions option not in use.
|
|
323
324
|
function isOptionalProperty(field, messageOptions, options) {
|
|
324
325
|
const optionalMessages = options.useOptionals === true || options.useOptionals === "messages" || options.useOptionals === "all";
|
|
325
326
|
const optionalAll = options.useOptionals === "all";
|
|
326
327
|
return ((optionalMessages && isMessage(field) && !isRepeated(field)) ||
|
|
327
328
|
(optionalAll && !(messageOptions === null || messageOptions === void 0 ? void 0 : messageOptions.mapEntry)) ||
|
|
329
|
+
// don't bother verifying that oneof is not union. union oneofs generate their own properties.
|
|
330
|
+
isWithinOneOf(field) ||
|
|
328
331
|
field.proto3Optional);
|
|
329
332
|
}
|
|
330
333
|
exports.isOptionalProperty = isOptionalProperty;
|