@bufbuild/protobuf 0.0.1-alpha.1 → 0.0.2-alpha.2

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.
Files changed (138) hide show
  1. package/dist/cjs/binary-encoding.js +414 -409
  2. package/dist/cjs/binary-format.js +13 -0
  3. package/dist/cjs/descriptor-registry.js +420 -449
  4. package/dist/cjs/descriptor-set.js +429 -513
  5. package/dist/cjs/enum.js +13 -0
  6. package/dist/cjs/field-list.js +13 -0
  7. package/dist/cjs/field.js +43 -30
  8. package/dist/cjs/google/protobuf/any_pb.js +122 -140
  9. package/dist/cjs/google/protobuf/api_pb.js +177 -224
  10. package/dist/cjs/google/protobuf/compiler/plugin_pb.js +125 -227
  11. package/dist/cjs/google/protobuf/descriptor_pb.js +1029 -1888
  12. package/dist/cjs/google/protobuf/duration_pb.js +72 -88
  13. package/dist/cjs/google/protobuf/empty_pb.js +17 -17
  14. package/dist/cjs/google/protobuf/field_mask_pb.js +77 -94
  15. package/dist/cjs/google/protobuf/source_context_pb.js +25 -25
  16. package/dist/cjs/google/protobuf/struct_pb.js +144 -181
  17. package/dist/cjs/google/protobuf/timestamp_pb.js +86 -123
  18. package/dist/cjs/google/protobuf/type_pb.js +406 -462
  19. package/dist/cjs/google/protobuf/wrappers_pb.js +407 -470
  20. package/dist/cjs/google/varint.js +166 -171
  21. package/dist/cjs/index.js +41 -122
  22. package/dist/cjs/json-format.js +13 -0
  23. package/dist/cjs/message-type.js +13 -0
  24. package/dist/cjs/message.js +89 -85
  25. package/dist/cjs/private/assert.js +33 -26
  26. package/dist/cjs/private/base64.js +93 -79
  27. package/dist/cjs/private/binary-format-common.js +208 -208
  28. package/dist/cjs/private/binary-format-proto2.js +88 -109
  29. package/dist/cjs/private/binary-format-proto3.js +70 -90
  30. package/dist/cjs/private/enum.js +77 -44
  31. package/dist/cjs/private/field-list.js +64 -50
  32. package/dist/cjs/private/field-wrapper.js +21 -10
  33. package/dist/cjs/private/field.js +35 -25
  34. package/dist/cjs/private/json-format-common.js +427 -440
  35. package/dist/cjs/private/json-format-proto2.js +91 -89
  36. package/dist/cjs/private/json-format-proto3.js +82 -93
  37. package/dist/cjs/private/message-type.js +39 -27
  38. package/dist/cjs/private/names.js +71 -62
  39. package/dist/cjs/private/options-map.js +13 -0
  40. package/dist/cjs/private/proto-runtime.js +25 -16
  41. package/dist/cjs/private/scalars.js +113 -103
  42. package/dist/cjs/private/util-common.js +193 -210
  43. package/dist/cjs/private/util.js +13 -0
  44. package/dist/cjs/proto-int64.js +123 -111
  45. package/dist/cjs/proto2.js +63 -63
  46. package/dist/cjs/proto3.js +74 -74
  47. package/dist/cjs/service-type.js +27 -17
  48. package/dist/cjs/type-registry.js +46 -31
  49. package/dist/esm/binary-encoding.js +414 -414
  50. package/dist/esm/binary-format.js +13 -0
  51. package/dist/esm/descriptor-registry.js +422 -458
  52. package/dist/esm/descriptor-set.js +430 -478
  53. package/dist/esm/enum.js +13 -0
  54. package/dist/esm/field-list.js +13 -0
  55. package/dist/esm/field.js +42 -29
  56. package/dist/esm/google/protobuf/any_pb.js +122 -140
  57. package/dist/esm/google/protobuf/api_pb.js +177 -197
  58. package/dist/esm/google/protobuf/compiler/plugin_pb.js +123 -216
  59. package/dist/esm/google/protobuf/descriptor_pb.js +1013 -1804
  60. package/dist/esm/google/protobuf/duration_pb.js +72 -88
  61. package/dist/esm/google/protobuf/empty_pb.js +17 -17
  62. package/dist/esm/google/protobuf/field_mask_pb.js +77 -94
  63. package/dist/esm/google/protobuf/source_context_pb.js +25 -25
  64. package/dist/esm/google/protobuf/struct_pb.js +143 -180
  65. package/dist/esm/google/protobuf/timestamp_pb.js +86 -123
  66. package/dist/esm/google/protobuf/type_pb.js +401 -421
  67. package/dist/esm/google/protobuf/wrappers_pb.js +406 -397
  68. package/dist/esm/google/varint.js +165 -164
  69. package/dist/esm/index.js +14 -1
  70. package/dist/esm/json-format.js +13 -0
  71. package/dist/esm/message-type.js +13 -0
  72. package/dist/esm/message.js +89 -85
  73. package/dist/esm/private/assert.js +32 -21
  74. package/dist/esm/private/base64.js +92 -78
  75. package/dist/esm/private/binary-format-common.js +209 -207
  76. package/dist/esm/private/binary-format-proto2.js +89 -81
  77. package/dist/esm/private/binary-format-proto3.js +71 -67
  78. package/dist/esm/private/enum.js +75 -43
  79. package/dist/esm/private/field-list.js +64 -50
  80. package/dist/esm/private/field-wrapper.js +21 -10
  81. package/dist/esm/private/field.js +35 -22
  82. package/dist/esm/private/json-format-common.js +427 -435
  83. package/dist/esm/private/json-format-proto2.js +89 -81
  84. package/dist/esm/private/json-format-proto3.js +79 -80
  85. package/dist/esm/private/message-type.js +40 -28
  86. package/dist/esm/private/names.js +70 -57
  87. package/dist/esm/private/options-map.js +13 -0
  88. package/dist/esm/private/proto-runtime.js +26 -12
  89. package/dist/esm/private/scalars.js +112 -99
  90. package/dist/esm/private/util-common.js +193 -192
  91. package/dist/esm/private/util.js +13 -0
  92. package/dist/esm/proto-int64.js +123 -111
  93. package/dist/esm/proto2.js +63 -57
  94. package/dist/esm/proto3.js +74 -68
  95. package/dist/esm/service-type.js +25 -12
  96. package/dist/esm/type-registry.js +46 -31
  97. package/dist/types/binary-encoding.d.ts +398 -398
  98. package/dist/types/binary-format.d.ts +69 -91
  99. package/dist/types/descriptor-registry.d.ts +23 -29
  100. package/dist/types/descriptor-set.d.ts +107 -128
  101. package/dist/types/enum.d.ts +21 -21
  102. package/dist/types/field-list.d.ts +21 -21
  103. package/dist/types/field.d.ts +191 -231
  104. package/dist/types/google/protobuf/any_pb.d.ts +56 -77
  105. package/dist/types/google/protobuf/api_pb.d.ts +144 -187
  106. package/dist/types/google/protobuf/compiler/plugin_pb.d.ts +195 -257
  107. package/dist/types/google/protobuf/descriptor_pb.d.ts +1360 -1737
  108. package/dist/types/google/protobuf/duration_pb.d.ts +30 -50
  109. package/dist/types/google/protobuf/empty_pb.d.ts +9 -28
  110. package/dist/types/google/protobuf/field_mask_pb.d.ts +17 -37
  111. package/dist/types/google/protobuf/source_context_pb.d.ts +16 -35
  112. package/dist/types/google/protobuf/struct_pb.d.ts +64 -115
  113. package/dist/types/google/protobuf/timestamp_pb.d.ts +31 -51
  114. package/dist/types/google/protobuf/type_pb.d.ts +355 -422
  115. package/dist/types/google/protobuf/wrappers_pb.d.ts +181 -297
  116. package/dist/types/google/varint.d.ts +6 -13
  117. package/dist/types/index.d.ts +4 -27
  118. package/dist/types/json-format.d.ts +70 -89
  119. package/dist/types/message-type.d.ts +37 -45
  120. package/dist/types/message.d.ts +62 -87
  121. package/dist/types/private/assert.d.ts +1 -4
  122. package/dist/types/private/binary-format-common.d.ts +6 -32
  123. package/dist/types/private/enum.d.ts +13 -11
  124. package/dist/types/private/field-list.d.ts +14 -21
  125. package/dist/types/private/field-wrapper.d.ts +4 -10
  126. package/dist/types/private/field.d.ts +12 -12
  127. package/dist/types/private/json-format-common.d.ts +5 -27
  128. package/dist/types/private/message-type.d.ts +12 -7
  129. package/dist/types/private/names.d.ts +1 -4
  130. package/dist/types/private/options-map.d.ts +1 -1
  131. package/dist/types/private/proto-runtime.d.ts +34 -42
  132. package/dist/types/private/scalars.d.ts +5 -12
  133. package/dist/types/private/util-common.d.ts +1 -4
  134. package/dist/types/private/util.d.ts +29 -41
  135. package/dist/types/proto-int64.d.ts +42 -42
  136. package/dist/types/service-type.d.ts +36 -56
  137. package/dist/types/type-registry.d.ts +13 -15
  138. package/package.json +2 -3
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /* eslint-disable */
3
- // @generated by protoc-gen-es v0.0.1-alpha.1 with parameter "bootstrap_wkt=true,ts_nocheck=false"
3
+ // @generated by protoc-gen-es v0.0.2-alpha.2 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
4
4
  // @generated from file google/protobuf/duration.proto (package google.protobuf, syntax proto3)
5
5
  //
6
6
  // Protocol Buffers - Google's data interchange format
@@ -100,102 +100,86 @@ const index_js_1 = require("../../index.js");
100
100
  * @generated from message google.protobuf.Duration
101
101
  */
102
102
  class Duration extends index_js_1.Message {
103
- constructor(data) {
104
- super();
105
- /**
106
- * Signed seconds of the span of time. Must be from -315,576,000,000
107
- * to +315,576,000,000 inclusive. Note: these bounds are computed from:
108
- * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
109
- *
110
- * @generated from field: int64 seconds = 1;
111
- */
112
- this.seconds = index_js_1.protoInt64.zero;
113
- /**
114
- * Signed fractions of a second at nanosecond resolution of the span
115
- * of time. Durations less than one second are represented with a 0
116
- * `seconds` field and a positive or negative `nanos` field. For durations
117
- * of one second or more, a non-zero value for the `nanos` field must be
118
- * of the same sign as the `seconds` field. Must be from -999,999,999
119
- * to +999,999,999 inclusive.
120
- *
121
- * @generated from field: int32 nanos = 2;
122
- */
123
- this.nanos = 0;
124
- index_js_1.proto3.util.initPartial(data, this);
125
- }
126
- fromJson(json, options) {
127
- if (typeof json !== "string") {
128
- throw new Error(
129
- `cannot decode google.protobuf.Duration from JSON: ${index_js_1.proto3.json.debug(
130
- json
131
- )}`
132
- );
103
+ constructor(data) {
104
+ super();
105
+ /**
106
+ * Signed seconds of the span of time. Must be from -315,576,000,000
107
+ * to +315,576,000,000 inclusive. Note: these bounds are computed from:
108
+ * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
109
+ *
110
+ * @generated from field: int64 seconds = 1;
111
+ */
112
+ this.seconds = index_js_1.protoInt64.zero;
113
+ /**
114
+ * Signed fractions of a second at nanosecond resolution of the span
115
+ * of time. Durations less than one second are represented with a 0
116
+ * `seconds` field and a positive or negative `nanos` field. For durations
117
+ * of one second or more, a non-zero value for the `nanos` field must be
118
+ * of the same sign as the `seconds` field. Must be from -999,999,999
119
+ * to +999,999,999 inclusive.
120
+ *
121
+ * @generated from field: int32 nanos = 2;
122
+ */
123
+ this.nanos = 0;
124
+ index_js_1.proto3.util.initPartial(data, this);
133
125
  }
134
- const match = json.match(/^(-?[0-9]+)(?:\.([0-9]+))?s/);
135
- if (match === null) {
136
- throw new Error(
137
- `cannot decode google.protobuf.Duration from JSON: ${index_js_1.proto3.json.debug(
138
- json
139
- )}`
140
- );
126
+ fromJson(json, options) {
127
+ if (typeof json !== "string") {
128
+ throw new Error(`cannot decode google.protobuf.Duration from JSON: ${index_js_1.proto3.json.debug(json)}`);
129
+ }
130
+ const match = json.match(/^(-?[0-9]+)(?:\.([0-9]+))?s/);
131
+ if (match === null) {
132
+ throw new Error(`cannot decode google.protobuf.Duration from JSON: ${index_js_1.proto3.json.debug(json)}`);
133
+ }
134
+ const longSeconds = Number(match[1]);
135
+ if (longSeconds > 315576000000 || longSeconds < -315576000000) {
136
+ throw new Error(`cannot decode google.protobuf.Duration from JSON: ${index_js_1.proto3.json.debug(json)}`);
137
+ }
138
+ this.seconds = index_js_1.protoInt64.parse(longSeconds);
139
+ if (typeof match[2] == "string") {
140
+ const nanosStr = match[2] + "0".repeat(9 - match[2].length);
141
+ this.nanos = parseInt(nanosStr);
142
+ if (longSeconds < 0n) {
143
+ this.nanos = -this.nanos;
144
+ }
145
+ }
146
+ return this;
141
147
  }
142
- const longSeconds = Number(match[1]);
143
- if (longSeconds > 315576000000 || longSeconds < -315576000000) {
144
- throw new Error(
145
- `cannot decode google.protobuf.Duration from JSON: ${index_js_1.proto3.json.debug(
146
- json
147
- )}`
148
- );
148
+ toJson(options) {
149
+ if (Number(this.seconds) > 315576000000 || Number(this.seconds) < -315576000000) {
150
+ throw new Error(`cannot encode google.protobuf.Duration to JSON: value out of range`);
151
+ }
152
+ let text = this.seconds.toString();
153
+ if (this.nanos !== 0) {
154
+ let nanosStr = Math.abs(this.nanos).toString();
155
+ nanosStr = "0".repeat(9 - nanosStr.length) + nanosStr;
156
+ if (nanosStr.substring(3) === "000000") {
157
+ nanosStr = nanosStr.substring(0, 3);
158
+ }
159
+ else if (nanosStr.substring(6) === "000") {
160
+ nanosStr = nanosStr.substring(0, 6);
161
+ }
162
+ text += "." + nanosStr;
163
+ }
164
+ return text + "s";
149
165
  }
150
- this.seconds = index_js_1.protoInt64.parse(longSeconds);
151
- if (typeof match[2] == "string") {
152
- const nanosStr = match[2] + "0".repeat(9 - match[2].length);
153
- this.nanos = parseInt(nanosStr);
154
- if (longSeconds < 0n) {
155
- this.nanos = -this.nanos;
156
- }
166
+ static fromBinary(bytes, options) {
167
+ return new Duration().fromBinary(bytes, options);
157
168
  }
158
- return this;
159
- }
160
- toJson(options) {
161
- if (
162
- Number(this.seconds) > 315576000000 ||
163
- Number(this.seconds) < -315576000000
164
- ) {
165
- throw new Error(
166
- `cannot encode google.protobuf.Duration to JSON: value out of range`
167
- );
169
+ static fromJson(jsonValue, options) {
170
+ return new Duration().fromJson(jsonValue, options);
168
171
  }
169
- let text = this.seconds.toString();
170
- if (this.nanos !== 0) {
171
- let nanosStr = Math.abs(this.nanos).toString();
172
- nanosStr = "0".repeat(9 - nanosStr.length) + nanosStr;
173
- if (nanosStr.substring(3) === "000000") {
174
- nanosStr = nanosStr.substring(0, 3);
175
- } else if (nanosStr.substring(6) === "000") {
176
- nanosStr = nanosStr.substring(0, 6);
177
- }
178
- text += "." + nanosStr;
172
+ static fromJsonString(jsonString, options) {
173
+ return new Duration().fromJsonString(jsonString, options);
174
+ }
175
+ static equals(a, b) {
176
+ return index_js_1.proto3.util.equals(Duration, a, b);
179
177
  }
180
- return text + "s";
181
- }
182
- static fromBinary(bytes, options) {
183
- return new Duration().fromBinary(bytes, options);
184
- }
185
- static fromJson(jsonValue, options) {
186
- return new Duration().fromJson(jsonValue, options);
187
- }
188
- static fromJsonString(jsonString, options) {
189
- return new Duration().fromJsonString(jsonString, options);
190
- }
191
- static equals(a, b) {
192
- return index_js_1.proto3.util.equals(Duration, a, b);
193
- }
194
178
  }
195
179
  exports.Duration = Duration;
196
180
  Duration.runtime = index_js_1.proto3;
197
181
  Duration.typeName = "google.protobuf.Duration";
198
182
  Duration.fields = index_js_1.proto3.util.newFieldList(() => [
199
- { no: 1, name: "seconds", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
200
- { no: 2, name: "nanos", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
183
+ { no: 1, name: "seconds", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
184
+ { no: 2, name: "nanos", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
201
185
  ]);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /* eslint-disable */
3
- // @generated by protoc-gen-es v0.0.1-alpha.1 with parameter "bootstrap_wkt=true,ts_nocheck=false"
3
+ // @generated by protoc-gen-es v0.0.2-alpha.2 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
4
4
  // @generated from file google/protobuf/empty.proto (package google.protobuf, syntax proto3)
5
5
  //
6
6
  // Protocol Buffers - Google's data interchange format
@@ -49,22 +49,22 @@ const index_js_1 = require("../../index.js");
49
49
  * @generated from message google.protobuf.Empty
50
50
  */
51
51
  class Empty extends index_js_1.Message {
52
- constructor(data) {
53
- super();
54
- index_js_1.proto3.util.initPartial(data, this);
55
- }
56
- static fromBinary(bytes, options) {
57
- return new Empty().fromBinary(bytes, options);
58
- }
59
- static fromJson(jsonValue, options) {
60
- return new Empty().fromJson(jsonValue, options);
61
- }
62
- static fromJsonString(jsonString, options) {
63
- return new Empty().fromJsonString(jsonString, options);
64
- }
65
- static equals(a, b) {
66
- return index_js_1.proto3.util.equals(Empty, a, b);
67
- }
52
+ constructor(data) {
53
+ super();
54
+ index_js_1.proto3.util.initPartial(data, this);
55
+ }
56
+ static fromBinary(bytes, options) {
57
+ return new Empty().fromBinary(bytes, options);
58
+ }
59
+ static fromJson(jsonValue, options) {
60
+ return new Empty().fromJson(jsonValue, options);
61
+ }
62
+ static fromJsonString(jsonString, options) {
63
+ return new Empty().fromJsonString(jsonString, options);
64
+ }
65
+ static equals(a, b) {
66
+ return index_js_1.proto3.util.equals(Empty, a, b);
67
+ }
68
68
  }
69
69
  exports.Empty = Empty;
70
70
  Empty.runtime = index_js_1.proto3;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /* eslint-disable */
3
- // @generated by protoc-gen-es v0.0.1-alpha.1 with parameter "bootstrap_wkt=true,ts_nocheck=false"
3
+ // @generated by protoc-gen-es v0.0.2-alpha.2 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
4
4
  // @generated from file google/protobuf/field_mask.proto (package google.protobuf, syntax proto3)
5
5
  //
6
6
  // Protocol Buffers - Google's data interchange format
@@ -239,109 +239,92 @@ const index_js_1 = require("../../index.js");
239
239
  * @generated from message google.protobuf.FieldMask
240
240
  */
241
241
  class FieldMask extends index_js_1.Message {
242
- constructor(data) {
243
- super();
244
- /**
245
- * The set of field mask paths.
246
- *
247
- * @generated from field: repeated string paths = 1;
248
- */
249
- this.paths = [];
250
- index_js_1.proto3.util.initPartial(data, this);
251
- }
252
- toJson(options) {
253
- // Converts snake_case to protoCamelCase according to the convention
254
- // used by protoc to convert a field name to a JSON name.
255
- function protoCamelCase(snakeCase) {
256
- let capNext = false;
257
- const b = [];
258
- for (let i = 0; i < snakeCase.length; i++) {
259
- let c = snakeCase.charAt(i);
260
- switch (c) {
261
- case "_":
262
- capNext = true;
263
- break;
264
- case "0":
265
- case "1":
266
- case "2":
267
- case "3":
268
- case "4":
269
- case "5":
270
- case "6":
271
- case "7":
272
- case "8":
273
- case "9":
274
- b.push(c);
275
- capNext = false;
276
- break;
277
- default:
278
- if (capNext) {
279
- capNext = false;
280
- c = c.toUpperCase();
242
+ constructor(data) {
243
+ super();
244
+ /**
245
+ * The set of field mask paths.
246
+ *
247
+ * @generated from field: repeated string paths = 1;
248
+ */
249
+ this.paths = [];
250
+ index_js_1.proto3.util.initPartial(data, this);
251
+ }
252
+ toJson(options) {
253
+ // Converts snake_case to protoCamelCase according to the convention
254
+ // used by protoc to convert a field name to a JSON name.
255
+ function protoCamelCase(snakeCase) {
256
+ let capNext = false;
257
+ const b = [];
258
+ for (let i = 0; i < snakeCase.length; i++) {
259
+ let c = snakeCase.charAt(i);
260
+ switch (c) {
261
+ case '_':
262
+ capNext = true;
263
+ break;
264
+ case '0':
265
+ case '1':
266
+ case '2':
267
+ case '3':
268
+ case '4':
269
+ case '5':
270
+ case '6':
271
+ case '7':
272
+ case '8':
273
+ case '9':
274
+ b.push(c);
275
+ capNext = false;
276
+ break;
277
+ default:
278
+ if (capNext) {
279
+ capNext = false;
280
+ c = c.toUpperCase();
281
+ }
282
+ b.push(c);
283
+ break;
284
+ }
281
285
  }
282
- b.push(c);
283
- break;
286
+ return b.join('');
284
287
  }
285
- }
286
- return b.join("");
288
+ return this.paths.map(p => {
289
+ if (p.match(/_[0-9]?_/g) || p.match(/[A-Z]/g)) {
290
+ throw new Error("cannot decode google.protobuf.FieldMask from JSON: lowerCamelCase of path name \"" + p + "\" is irreversible");
291
+ }
292
+ return protoCamelCase(p);
293
+ }).join(",");
287
294
  }
288
- return this.paths
289
- .map((p) => {
290
- if (p.match(/_[0-9]?_/g) || p.match(/[A-Z]/g)) {
291
- throw new Error(
292
- 'cannot decode google.protobuf.FieldMask from JSON: lowerCamelCase of path name "' +
293
- p +
294
- '" is irreversible'
295
- );
295
+ fromJson(json, options) {
296
+ if (typeof json !== "string") {
297
+ throw new Error("cannot decode google.protobuf.FieldMask from JSON: " + index_js_1.proto3.json.debug(json));
296
298
  }
297
- return protoCamelCase(p);
298
- })
299
- .join(",");
300
- }
301
- fromJson(json, options) {
302
- if (typeof json !== "string") {
303
- throw new Error(
304
- "cannot decode google.protobuf.FieldMask from JSON: " +
305
- index_js_1.proto3.json.debug(json)
306
- );
299
+ if (json === "") {
300
+ return this;
301
+ }
302
+ function camelToSnake(str) {
303
+ if (str.includes("_")) {
304
+ throw new Error("cannot decode google.protobuf.FieldMask from JSON: path names must be lowerCamelCase");
305
+ }
306
+ const sc = str.replace(/[A-Z]/g, letter => "_" + letter.toLowerCase());
307
+ return (sc[0] === "_") ? sc.substring(1) : sc;
308
+ }
309
+ this.paths = json.split(",").map(camelToSnake);
310
+ return this;
311
+ }
312
+ static fromBinary(bytes, options) {
313
+ return new FieldMask().fromBinary(bytes, options);
314
+ }
315
+ static fromJson(jsonValue, options) {
316
+ return new FieldMask().fromJson(jsonValue, options);
307
317
  }
308
- if (json === "") {
309
- return this;
318
+ static fromJsonString(jsonString, options) {
319
+ return new FieldMask().fromJsonString(jsonString, options);
310
320
  }
311
- function camelToSnake(str) {
312
- if (str.includes("_")) {
313
- throw new Error(
314
- "cannot decode google.protobuf.FieldMask from JSON: path names must be lowerCamelCase"
315
- );
316
- }
317
- const sc = str.replace(/[A-Z]/g, (letter) => "_" + letter.toLowerCase());
318
- return sc[0] === "_" ? sc.substring(1) : sc;
321
+ static equals(a, b) {
322
+ return index_js_1.proto3.util.equals(FieldMask, a, b);
319
323
  }
320
- this.paths = json.split(",").map(camelToSnake);
321
- return this;
322
- }
323
- static fromBinary(bytes, options) {
324
- return new FieldMask().fromBinary(bytes, options);
325
- }
326
- static fromJson(jsonValue, options) {
327
- return new FieldMask().fromJson(jsonValue, options);
328
- }
329
- static fromJsonString(jsonString, options) {
330
- return new FieldMask().fromJsonString(jsonString, options);
331
- }
332
- static equals(a, b) {
333
- return index_js_1.proto3.util.equals(FieldMask, a, b);
334
- }
335
324
  }
336
325
  exports.FieldMask = FieldMask;
337
326
  FieldMask.runtime = index_js_1.proto3;
338
327
  FieldMask.typeName = "google.protobuf.FieldMask";
339
328
  FieldMask.fields = index_js_1.proto3.util.newFieldList(() => [
340
- {
341
- no: 1,
342
- name: "paths",
343
- kind: "scalar",
344
- T: 9 /* ScalarType.STRING */,
345
- repeated: true,
346
- },
329
+ { no: 1, name: "paths", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
347
330
  ]);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /* eslint-disable */
3
- // @generated by protoc-gen-es v0.0.1-alpha.1 with parameter "bootstrap_wkt=true,ts_nocheck=false"
3
+ // @generated by protoc-gen-es v0.0.2-alpha.2 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
4
4
  // @generated from file google/protobuf/source_context.proto (package google.protobuf, syntax proto3)
5
5
  //
6
6
  // Protocol Buffers - Google's data interchange format
@@ -42,33 +42,33 @@ const index_js_1 = require("../../index.js");
42
42
  * @generated from message google.protobuf.SourceContext
43
43
  */
44
44
  class SourceContext extends index_js_1.Message {
45
- constructor(data) {
46
- super();
47
- /**
48
- * The path-qualified name of the .proto file that contained the associated
49
- * protobuf element. For example: `"google/protobuf/source_context.proto"`.
50
- *
51
- * @generated from field: string file_name = 1;
52
- */
53
- this.fileName = "";
54
- index_js_1.proto3.util.initPartial(data, this);
55
- }
56
- static fromBinary(bytes, options) {
57
- return new SourceContext().fromBinary(bytes, options);
58
- }
59
- static fromJson(jsonValue, options) {
60
- return new SourceContext().fromJson(jsonValue, options);
61
- }
62
- static fromJsonString(jsonString, options) {
63
- return new SourceContext().fromJsonString(jsonString, options);
64
- }
65
- static equals(a, b) {
66
- return index_js_1.proto3.util.equals(SourceContext, a, b);
67
- }
45
+ constructor(data) {
46
+ super();
47
+ /**
48
+ * The path-qualified name of the .proto file that contained the associated
49
+ * protobuf element. For example: `"google/protobuf/source_context.proto"`.
50
+ *
51
+ * @generated from field: string file_name = 1;
52
+ */
53
+ this.fileName = "";
54
+ index_js_1.proto3.util.initPartial(data, this);
55
+ }
56
+ static fromBinary(bytes, options) {
57
+ return new SourceContext().fromBinary(bytes, options);
58
+ }
59
+ static fromJson(jsonValue, options) {
60
+ return new SourceContext().fromJson(jsonValue, options);
61
+ }
62
+ static fromJsonString(jsonString, options) {
63
+ return new SourceContext().fromJsonString(jsonString, options);
64
+ }
65
+ static equals(a, b) {
66
+ return index_js_1.proto3.util.equals(SourceContext, a, b);
67
+ }
68
68
  }
69
69
  exports.SourceContext = SourceContext;
70
70
  SourceContext.runtime = index_js_1.proto3;
71
71
  SourceContext.typeName = "google.protobuf.SourceContext";
72
72
  SourceContext.fields = index_js_1.proto3.util.newFieldList(() => [
73
- { no: 1, name: "file_name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
73
+ { no: 1, name: "file_name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
74
74
  ]);