ts-proto 2.0.2 → 2.0.4
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/README.markdown
CHANGED
|
@@ -662,6 +662,11 @@ interface Rpc {
|
|
|
662
662
|
If you're working with gRPC, a simple implementation could look like this:
|
|
663
663
|
|
|
664
664
|
```ts
|
|
665
|
+
const conn = new grpc.Client(
|
|
666
|
+
"localhost:8765",
|
|
667
|
+
grpc.credentials.createInsecure()
|
|
668
|
+
);
|
|
669
|
+
|
|
665
670
|
type RpcImpl = (service: string, method: string, data: Uint8Array) => Promise<Uint8Array>;
|
|
666
671
|
|
|
667
672
|
const sendRequest: RpcImpl = (service, method, data) => {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v2.0.3
|
|
5
|
+
// protoc v3.21.12
|
|
3
6
|
// source: google/protobuf/compiler/plugin.proto
|
|
4
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
8
|
exports.CodeGeneratorResponse_File = exports.CodeGeneratorResponse = exports.CodeGeneratorRequest = exports.Version = exports.CodeGeneratorResponse_Feature = void 0;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v2.0.3
|
|
5
|
+
// protoc v3.21.12
|
|
3
6
|
// source: google/protobuf/descriptor.proto
|
|
4
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
8
|
exports.GeneratedCodeInfo_Annotation = exports.GeneratedCodeInfo = exports.SourceCodeInfo_Location = exports.SourceCodeInfo = exports.UninterpretedOption_NamePart = exports.UninterpretedOption = exports.MethodOptions = exports.ServiceOptions = exports.EnumValueOptions = exports.EnumOptions = exports.OneofOptions = exports.FieldOptions = exports.MessageOptions = exports.FileOptions = exports.MethodDescriptorProto = exports.ServiceDescriptorProto = exports.EnumValueDescriptorProto = exports.EnumDescriptorProto_EnumReservedRange = exports.EnumDescriptorProto = exports.OneofDescriptorProto = exports.FieldDescriptorProto = exports.ExtensionRangeOptions = exports.DescriptorProto_ReservedRange = exports.DescriptorProto_ExtensionRange = exports.DescriptorProto = exports.FileDescriptorProto = exports.FileDescriptorSet = exports.MethodOptions_IdempotencyLevel = exports.FieldOptions_JSType = exports.FieldOptions_CType = exports.FileOptions_OptimizeMode = exports.FieldDescriptorProto_Label = exports.FieldDescriptorProto_Type = void 0;
|
package/build/src/utils.js
CHANGED
|
@@ -293,11 +293,17 @@ async function getVersions(request) {
|
|
|
293
293
|
const { major, minor, patch } = request.compilerVersion;
|
|
294
294
|
protocVersion = `v${major}.${minor}.${patch}`;
|
|
295
295
|
}
|
|
296
|
-
const
|
|
297
|
-
const packageJson = await Promise.resolve(`${path}`).then(s => require(s));
|
|
296
|
+
const packageJson = await readPackageJson();
|
|
298
297
|
const tsProtoVersion = `v${packageJson?.version ?? "unknown"}`;
|
|
299
|
-
return {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
298
|
+
return { protocVersion, tsProtoVersion };
|
|
299
|
+
}
|
|
300
|
+
/** Read from the distributed package.json file, or our local package.json when running ts-proto tests locally. */
|
|
301
|
+
async function readPackageJson() {
|
|
302
|
+
try {
|
|
303
|
+
// Use `as string` to disable hints that the path doesn't exist
|
|
304
|
+
return await Promise.resolve(`${"../../package.json"}`).then(s => require(s));
|
|
305
|
+
}
|
|
306
|
+
catch (e) {
|
|
307
|
+
return await Promise.resolve(`${"../package.json"}`).then(s => require(s));
|
|
308
|
+
}
|
|
303
309
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-proto",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/src/plugin.js",
|
|
6
6
|
"repository": "github:stephenh/ts-proto",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@bufbuild/protobuf": "^2.0.0",
|
|
71
71
|
"case-anything": "^2.1.13",
|
|
72
72
|
"ts-poet": "^6.7.0",
|
|
73
|
-
"ts-proto-descriptors": "
|
|
73
|
+
"ts-proto-descriptors": "2.0.0"
|
|
74
74
|
},
|
|
75
75
|
"packageManager": "yarn@4.4.0"
|
|
76
76
|
}
|