ts-proto 1.149.0 → 1.150.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.
@@ -146,8 +146,13 @@ function generateRegularRpcMethod(ctx, methodDesc) {
146
146
  function generateServiceClientImpl(ctx, fileDesc, serviceDesc) {
147
147
  const { options } = ctx;
148
148
  const chunks = [];
149
- // Define the FooServiceImpl class
149
+ // Determine information about the service.
150
150
  const { name } = serviceDesc;
151
+ const serviceName = (0, utils_1.maybePrefixPackage)(fileDesc, serviceDesc.name);
152
+ // Define the service name constant.
153
+ const serviceNameConst = `${name}ServiceName`;
154
+ chunks.push((0, ts_poet_1.code) `export const ${serviceNameConst} = "${serviceName}";`);
155
+ // Define the FooServiceImpl class
151
156
  const i = options.context ? `${name}<Context>` : name;
152
157
  const t = options.context ? `<${main_1.contextTypeVar}>` : "";
153
158
  chunks.push((0, ts_poet_1.code) `export class ${name}ClientImpl${t} implements ${(0, ts_poet_1.def)(i)} {`);
@@ -156,8 +161,7 @@ function generateServiceClientImpl(ctx, fileDesc, serviceDesc) {
156
161
  chunks.push((0, ts_poet_1.code) `private readonly rpc: ${rpcType};`);
157
162
  chunks.push((0, ts_poet_1.code) `private readonly service: string;`);
158
163
  chunks.push((0, ts_poet_1.code) `constructor(rpc: ${rpcType}, opts?: {service?: string}) {`);
159
- const serviceID = (0, utils_1.maybePrefixPackage)(fileDesc, serviceDesc.name);
160
- chunks.push((0, ts_poet_1.code) `this.service = opts?.service || "${serviceID}";`);
164
+ chunks.push((0, ts_poet_1.code) `this.service = opts?.service || ${serviceNameConst};`);
161
165
  chunks.push((0, ts_poet_1.code) `this.rpc = rpc;`);
162
166
  // Bind each FooService method to the FooServiceImpl class
163
167
  for (const methodDesc of serviceDesc.method) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-proto",
3
- "version": "1.149.0",
3
+ "version": "1.150.0",
4
4
  "description": "",
5
5
  "main": "build/plugin.js",
6
6
  "repository": "github:stephenh/ts-proto",