ts-proto 1.148.1 → 1.149.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 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
  }
@@ -6,8 +6,6 @@ const types_1 = require("./types");
6
6
  const utils_1 = require("./utils");
7
7
  const sourceInfo_1 = require("./sourceInfo");
8
8
  const main_1 = require("./main");
9
- const hash = (0, ts_poet_1.imp)("hash*object-hash");
10
- const dataloader = (0, ts_poet_1.imp)("DataLoader*dataloader");
11
9
  /**
12
10
  * Generates an interface for `serviceDesc`.
13
11
  *
@@ -188,9 +186,12 @@ function generateServiceClientImpl(ctx, fileDesc, serviceDesc) {
188
186
  }
189
187
  exports.generateServiceClientImpl = generateServiceClientImpl;
190
188
  /** We've found a BatchXxx method, create a synthetic GetXxx method that calls it. */
191
- function generateBatchingRpcMethod(_ctx, batchMethod) {
189
+ function generateBatchingRpcMethod(ctx, batchMethod) {
192
190
  const { methodDesc, singleMethodName, inputFieldName, inputType, outputFieldName, outputType, mapType, uniqueIdentifier, } = batchMethod;
193
191
  (0, utils_1.assertInstanceOf)(methodDesc, utils_1.FormattedMethodDescriptor);
192
+ const { options } = ctx;
193
+ const hash = options.esModuleInterop ? (0, ts_poet_1.imp)("hash=object-hash") : (0, ts_poet_1.imp)("hash*object-hash");
194
+ const dataloader = options.esModuleInterop ? (0, ts_poet_1.imp)("DataLoader=dataloader") : (0, ts_poet_1.imp)("DataLoader*dataloader");
194
195
  // Create the `(keys) => ...` lambda we'll pass to the DataLoader constructor
195
196
  const lambda = [];
196
197
  lambda.push((0, ts_poet_1.code) `
@@ -230,6 +231,9 @@ function generateBatchingRpcMethod(_ctx, batchMethod) {
230
231
  /** We're not going to batch, but use DataLoader for per-request caching. */
231
232
  function generateCachingRpcMethod(ctx, fileDesc, serviceDesc, methodDesc) {
232
233
  (0, utils_1.assertInstanceOf)(methodDesc, utils_1.FormattedMethodDescriptor);
234
+ const { options } = ctx;
235
+ const hash = options.esModuleInterop ? (0, ts_poet_1.imp)("hash=object-hash") : (0, ts_poet_1.imp)("hash*object-hash");
236
+ const dataloader = options.esModuleInterop ? (0, ts_poet_1.imp)("DataLoader=dataloader") : (0, ts_poet_1.imp)("DataLoader*dataloader");
233
237
  const inputType = (0, types_1.requestType)(ctx, methodDesc);
234
238
  const outputType = (0, types_1.responseType)(ctx, methodDesc);
235
239
  const uniqueIdentifier = `${(0, utils_1.maybePrefixPackage)(fileDesc, serviceDesc.name)}.${methodDesc.name}`;
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 = exports.LongOption || (exports.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 = exports.DateOption || (exports.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 = exports.EnvOption || (exports.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 = exports.OneofOption || (exports.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 = exports.ServiceOption || (exports.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.148.1",
3
+ "version": "1.149.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.3.0",
32
- "@grpc/proto-loader": "^0.6.0",
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": "^8.2.2",
36
- "@nestjs/core": "^9.0.5",
37
- "@nestjs/microservices": "^8.2.2",
38
- "@semantic-release/changelog": "^5.0.1",
39
- "@semantic-release/commit-analyzer": "^8.0.1",
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": "^9.0.0",
42
- "@semantic-release/github": "^7.2.0",
43
- "@semantic-release/npm": "^7.1.0",
44
- "@semantic-release/release-notes-generator": "^9.0.2",
45
- "@types/jest": "^26.0.22",
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.2",
48
- "jest": "^28.1.2",
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": "^1.1.1",
52
- "prettier": "^2.7.1",
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": "^19.0.3",
56
- "ts-jest": "^28.0.5",
57
- "tsx": "^3.8.2",
58
- "typescript": "^4.9.4",
59
- "uglify-js": "^3.16.1"
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": "^1.3.0",
62
+ "@types/object-hash": "^3.0.2",
63
63
  "case-anything": "^2.1.10",
64
64
  "dataloader": "^1.4.0",
65
- "object-hash": "^1.3.1",
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.3.0"
70
+ "packageManager": "yarn@3.6.0"
71
71
  }