ts-proto 1.148.2 → 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.
- package/README.markdown +1 -1
- package/build/encode.js +1 -1
- package/build/generate-services.js +7 -3
- package/build/options.js +5 -5
- package/build/types.js +1 -1
- package/package.json +25 -25
package/README.markdown
CHANGED
|
@@ -340,7 +340,7 @@ Generated code will be placed in the Gradle build directory.
|
|
|
340
340
|
|
|
341
341
|
(See [this issue](https://github.com/stephenh/ts-proto/issues/120#issuecomment-678375833) and [this issue](https://github.com/stephenh/ts-proto/issues/397#issuecomment-977259118) for discussions on `useOptional`.)
|
|
342
342
|
|
|
343
|
-
- With `--ts_proto_opt=exportCommonSymbols=false`, utility types like `DeepPartial` won't be `export`d.
|
|
343
|
+
- With `--ts_proto_opt=exportCommonSymbols=false`, utility types like `DeepPartial` and `protobufPackage` won't be `export`d.
|
|
344
344
|
|
|
345
345
|
This should make it possible to use create barrel imports of the generated output, i.e. `import * from ./foo` and `import * from ./bar`.
|
|
346
346
|
|
package/build/encode.js
CHANGED
|
@@ -44,7 +44,7 @@ function generateEncoder(ctx, typeName) {
|
|
|
44
44
|
case "BoolValue":
|
|
45
45
|
return (0, ts_poet_1.code) `${TypeValue}.encode({value: value ?? false}).finish()`;
|
|
46
46
|
case "BytesValue":
|
|
47
|
-
return (0, ts_poet_1.code) `${TypeValue}.encode({value: value ?? new Uint8Array()}).finish()`;
|
|
47
|
+
return (0, ts_poet_1.code) `${TypeValue}.encode({value: value ?? new Uint8Array(0)}).finish()`;
|
|
48
48
|
}
|
|
49
49
|
throw new Error(`unknown wrapper type: ${name}`);
|
|
50
50
|
}
|
|
@@ -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
|
-
//
|
|
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
|
-
|
|
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/build/options.js
CHANGED
|
@@ -7,24 +7,24 @@ var LongOption;
|
|
|
7
7
|
LongOption["LONG"] = "long";
|
|
8
8
|
LongOption["STRING"] = "string";
|
|
9
9
|
LongOption["BIGINT"] = "bigint";
|
|
10
|
-
})(LongOption
|
|
10
|
+
})(LongOption || (exports.LongOption = LongOption = {}));
|
|
11
11
|
var DateOption;
|
|
12
12
|
(function (DateOption) {
|
|
13
13
|
DateOption["DATE"] = "date";
|
|
14
14
|
DateOption["STRING"] = "string";
|
|
15
15
|
DateOption["TIMESTAMP"] = "timestamp";
|
|
16
|
-
})(DateOption
|
|
16
|
+
})(DateOption || (exports.DateOption = DateOption = {}));
|
|
17
17
|
var EnvOption;
|
|
18
18
|
(function (EnvOption) {
|
|
19
19
|
EnvOption["NODE"] = "node";
|
|
20
20
|
EnvOption["BROWSER"] = "browser";
|
|
21
21
|
EnvOption["BOTH"] = "both";
|
|
22
|
-
})(EnvOption
|
|
22
|
+
})(EnvOption || (exports.EnvOption = EnvOption = {}));
|
|
23
23
|
var OneofOption;
|
|
24
24
|
(function (OneofOption) {
|
|
25
25
|
OneofOption["PROPERTIES"] = "properties";
|
|
26
26
|
OneofOption["UNIONS"] = "unions";
|
|
27
|
-
})(OneofOption
|
|
27
|
+
})(OneofOption || (exports.OneofOption = OneofOption = {}));
|
|
28
28
|
var ServiceOption;
|
|
29
29
|
(function (ServiceOption) {
|
|
30
30
|
ServiceOption["GRPC"] = "grpc-js";
|
|
@@ -32,7 +32,7 @@ var ServiceOption;
|
|
|
32
32
|
ServiceOption["GENERIC"] = "generic-definitions";
|
|
33
33
|
ServiceOption["DEFAULT"] = "default";
|
|
34
34
|
ServiceOption["NONE"] = "none";
|
|
35
|
-
})(ServiceOption
|
|
35
|
+
})(ServiceOption || (exports.ServiceOption = ServiceOption = {}));
|
|
36
36
|
function defaultOptions() {
|
|
37
37
|
return {
|
|
38
38
|
context: false,
|
package/build/types.js
CHANGED
|
@@ -226,7 +226,7 @@ function defaultValue(ctx, field) {
|
|
|
226
226
|
return "Buffer.alloc(0)";
|
|
227
227
|
}
|
|
228
228
|
else {
|
|
229
|
-
return "new Uint8Array()";
|
|
229
|
+
return "new Uint8Array(0)";
|
|
230
230
|
}
|
|
231
231
|
case ts_proto_descriptors_1.FieldDescriptorProto_Type.TYPE_MESSAGE:
|
|
232
232
|
case ts_proto_descriptors_1.FieldDescriptorProto_Type.TYPE_GROUP:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-proto",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.150.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/plugin.js",
|
|
6
6
|
"repository": "github:stephenh/ts-proto",
|
|
@@ -28,44 +28,44 @@
|
|
|
28
28
|
"author": "",
|
|
29
29
|
"license": "ISC",
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@grpc/grpc-js": "^1.
|
|
32
|
-
"@grpc/proto-loader": "^0.6.
|
|
31
|
+
"@grpc/grpc-js": "^1.8.14",
|
|
32
|
+
"@grpc/proto-loader": "^0.6.13",
|
|
33
33
|
"@improbable-eng/grpc-web": "^0.14.0",
|
|
34
34
|
"@improbable-eng/grpc-web-node-http-transport": "^0.14.0",
|
|
35
|
-
"@nestjs/common": "^
|
|
36
|
-
"@nestjs/core": "^9.
|
|
37
|
-
"@nestjs/microservices": "^
|
|
38
|
-
"@semantic-release/changelog": "^
|
|
39
|
-
"@semantic-release/commit-analyzer": "^
|
|
35
|
+
"@nestjs/common": "^9.4.2",
|
|
36
|
+
"@nestjs/core": "^9.4.2",
|
|
37
|
+
"@nestjs/microservices": "^9.4.2",
|
|
38
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
39
|
+
"@semantic-release/commit-analyzer": "^10.0.0",
|
|
40
40
|
"@semantic-release/exec": "^6.0.3",
|
|
41
|
-
"@semantic-release/git": "^
|
|
42
|
-
"@semantic-release/github": "^
|
|
43
|
-
"@semantic-release/npm": "^
|
|
44
|
-
"@semantic-release/release-notes-generator": "^
|
|
45
|
-
"@types/jest": "^
|
|
41
|
+
"@semantic-release/git": "^10.0.1",
|
|
42
|
+
"@semantic-release/github": "^9.0.2",
|
|
43
|
+
"@semantic-release/npm": "^10.0.3",
|
|
44
|
+
"@semantic-release/release-notes-generator": "^11.0.2",
|
|
45
|
+
"@types/jest": "^29.5.2",
|
|
46
46
|
"@types/node": "^14.14.37",
|
|
47
|
-
"chokidar": "^3.5.
|
|
48
|
-
"jest": "^
|
|
47
|
+
"chokidar": "^3.5.3",
|
|
48
|
+
"jest": "^29.5.0",
|
|
49
49
|
"jest-ts-webcompat-resolver": "^1.0.0",
|
|
50
50
|
"mongodb": "^4.3.0",
|
|
51
|
-
"nice-grpc": "^
|
|
52
|
-
"prettier": "^2.
|
|
51
|
+
"nice-grpc": "^2.1.4",
|
|
52
|
+
"prettier": "^2.8.8",
|
|
53
53
|
"reflect-metadata": "^0.1.13",
|
|
54
54
|
"rxjs": "^7.4.0",
|
|
55
|
-
"semantic-release": "^
|
|
56
|
-
"ts-jest": "^
|
|
57
|
-
"tsx": "^3.
|
|
58
|
-
"typescript": "^
|
|
59
|
-
"uglify-js": "^3.
|
|
55
|
+
"semantic-release": "^21.0.3",
|
|
56
|
+
"ts-jest": "^29.1.0",
|
|
57
|
+
"tsx": "^3.12.7",
|
|
58
|
+
"typescript": "^5.1.3",
|
|
59
|
+
"uglify-js": "^3.17.4"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@types/object-hash": "^
|
|
62
|
+
"@types/object-hash": "^3.0.2",
|
|
63
63
|
"case-anything": "^2.1.10",
|
|
64
64
|
"dataloader": "^1.4.0",
|
|
65
|
-
"object-hash": "^
|
|
65
|
+
"object-hash": "^3.0.0",
|
|
66
66
|
"protobufjs": "^6.11.3",
|
|
67
67
|
"ts-poet": "^6.4.1",
|
|
68
68
|
"ts-proto-descriptors": "1.9.0"
|
|
69
69
|
},
|
|
70
|
-
"packageManager": "yarn@3.
|
|
70
|
+
"packageManager": "yarn@3.6.0"
|
|
71
71
|
}
|