ts-proto 1.126.0 → 1.127.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 +15 -0
- package/README.markdown +1 -1
- package/build/generate-nice-grpc.js +2 -2
- package/build/generate-services.js +5 -2
- package/build/options.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
# [1.127.0](https://github.com/stephenh/ts-proto/compare/v1.126.1...v1.127.0) (2022-10-12)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **client:** allow overriding the service identifier ([#683](https://github.com/stephenh/ts-proto/issues/683)) ([10c7c99](https://github.com/stephenh/ts-proto/commit/10c7c99b1f43705d640ab1e602a7c1799e31ac08))
|
|
7
|
+
* Import CallContext and CallOptions as type ([#684](https://github.com/stephenh/ts-proto/issues/684)) ([8b388f6](https://github.com/stephenh/ts-proto/commit/8b388f6c9f57dac34ca5836a4313d8247bb0fceb)), closes [#677](https://github.com/stephenh/ts-proto/issues/677)
|
|
8
|
+
|
|
9
|
+
## [1.126.1](https://github.com/stephenh/ts-proto/compare/v1.126.0...v1.126.1) (2022-09-21)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* **options:** initializes M opt to empty object ([#673](https://github.com/stephenh/ts-proto/issues/673)) ([cb76c5e](https://github.com/stephenh/ts-proto/commit/cb76c5ea565081d610be08451e452269c5d3837c))
|
|
15
|
+
|
|
1
16
|
# [1.126.0](https://github.com/stephenh/ts-proto/compare/v1.125.0...v1.126.0) (2022-09-21)
|
|
2
17
|
|
|
3
18
|
|
package/README.markdown
CHANGED
|
@@ -562,7 +562,7 @@ The commands below assume you have **Docker** installed. To use a **local** copy
|
|
|
562
562
|
**Contributing**
|
|
563
563
|
|
|
564
564
|
- Run `yarn build:test` and `yarn test` to make sure everything works.
|
|
565
|
-
- Run `yarn
|
|
565
|
+
- Run `yarn format` to format the typescript files.
|
|
566
566
|
- Commit the changes:
|
|
567
567
|
- Also include the generated `.bin` files for the tests where you added or modified `.proto` files.
|
|
568
568
|
> These are checked into git so that the test suite can run without having to invoke the `protoc` build chain.
|
|
@@ -6,8 +6,8 @@ const case_1 = require("./case");
|
|
|
6
6
|
const sourceInfo_1 = require("./sourceInfo");
|
|
7
7
|
const types_1 = require("./types");
|
|
8
8
|
const utils_1 = require("./utils");
|
|
9
|
-
const CallOptions = (0, ts_poet_1.imp)("CallOptions@nice-grpc-common");
|
|
10
|
-
const CallContext = (0, ts_poet_1.imp)("CallContext@nice-grpc-common");
|
|
9
|
+
const CallOptions = (0, ts_poet_1.imp)("t:CallOptions@nice-grpc-common");
|
|
10
|
+
const CallContext = (0, ts_poet_1.imp)("t:CallContext@nice-grpc-common");
|
|
11
11
|
/**
|
|
12
12
|
* Generates server / client stubs for `nice-grpc` library.
|
|
13
13
|
*/
|
|
@@ -129,7 +129,7 @@ function generateRegularRpcMethod(ctx, fileDesc, serviceDesc, methodDesc) {
|
|
|
129
129
|
const data = ${encode};
|
|
130
130
|
const ${returnVariable} = this.rpc.${rpcMethod}(
|
|
131
131
|
${maybeCtx}
|
|
132
|
-
|
|
132
|
+
this.service,
|
|
133
133
|
"${methodDesc.name}",
|
|
134
134
|
data
|
|
135
135
|
);
|
|
@@ -148,7 +148,10 @@ function generateServiceClientImpl(ctx, fileDesc, serviceDesc) {
|
|
|
148
148
|
// Create the constructor(rpc: Rpc)
|
|
149
149
|
const rpcType = options.context ? "Rpc<Context>" : "Rpc";
|
|
150
150
|
chunks.push((0, ts_poet_1.code) `private readonly rpc: ${rpcType};`);
|
|
151
|
-
chunks.push((0, ts_poet_1.code) `
|
|
151
|
+
chunks.push((0, ts_poet_1.code) `private readonly service: string;`);
|
|
152
|
+
chunks.push((0, ts_poet_1.code) `constructor(rpc: ${rpcType}, opts?: {service?: string}) {`);
|
|
153
|
+
const serviceID = (0, utils_1.maybePrefixPackage)(fileDesc, serviceDesc.name);
|
|
154
|
+
chunks.push((0, ts_poet_1.code) `this.service = opts?.service || "${serviceID}";`);
|
|
152
155
|
chunks.push((0, ts_poet_1.code) `this.rpc = rpc;`);
|
|
153
156
|
// Bind each FooService method to the FooServiceImpl class
|
|
154
157
|
for (const methodDesc of serviceDesc.method) {
|
package/build/options.js
CHANGED
|
@@ -157,7 +157,7 @@ function optionsFromParameter(parameter) {
|
|
|
157
157
|
exports.optionsFromParameter = optionsFromParameter;
|
|
158
158
|
// A very naive parse function, eventually could/should use iots/runtypes
|
|
159
159
|
function parseParameter(parameter) {
|
|
160
|
-
const options = {};
|
|
160
|
+
const options = { M: {} };
|
|
161
161
|
parameter.split(",").forEach((param) => {
|
|
162
162
|
// same as protoc-gen-go https://github.com/protocolbuffers/protobuf-go/blob/bf9455640daabb98c93b5b5e71628f3f813d57bb/compiler/protogen/protogen.go#L168-L171
|
|
163
163
|
const optionSeparatorPos = param.indexOf("=");
|