@bufbuild/protobuf 1.7.1 → 1.7.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.
@@ -1,5 +1,5 @@
1
1
  import { reifyWkt } from "./private/reify-wkt.js";
2
- import type { DescEnum, DescEnumValue, DescField, DescExtension, DescMessage, DescMethod, DescOneof, DescService } from "./descriptor-set";
2
+ import type { DescEnum, DescEnumValue, DescField, DescExtension, DescMessage, DescMethod, DescOneof, DescService } from "./descriptor-set.js";
3
3
  import { LongType, ScalarType } from "./field.js";
4
4
  interface CodegenInfo {
5
5
  /**
@@ -64,7 +64,13 @@ function setExtension(message, extension, value, options) {
64
64
  }
65
65
  }
66
66
  const writer = writeOpt.writerFactory();
67
- extension.runtime.bin.writeField(extension.field, value, writer, writeOpt);
67
+ let f = extension.field;
68
+ // Implicit presence does not apply to extensions, see https://github.com/protocolbuffers/protobuf/issues/8234
69
+ // We patch the field info to use explicit presence:
70
+ if (!f.opt && !f.repeated && (f.kind == "enum" || f.kind == "scalar")) {
71
+ f = Object.assign(Object.assign({}, extension.field), { opt: true });
72
+ }
73
+ extension.runtime.bin.writeField(f, value, writer, writeOpt);
68
74
  const reader = readOpt.readerFactory(writer.finish());
69
75
  while (reader.pos < reader.len) {
70
76
  const [no, wireType] = reader.tag();
@@ -21,7 +21,7 @@ exports.GeneratedCodeInfo_Annotation_Semantic = exports.GeneratedCodeInfo_Annota
21
21
  // The messages in this file describe the definitions found in .proto files.
22
22
  // A valid .proto file can be translated directly to a FileDescriptorProto
23
23
  // without any other information (e.g. without reading its imports).
24
- // @generated by protoc-gen-es v1.7.1 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
24
+ // @generated by protoc-gen-es v1.7.2 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
25
25
  // @generated from file google/protobuf/descriptor.proto (package google.protobuf, syntax proto2)
26
26
  /* eslint-disable */
27
27
  const proto2_js_1 = require("../../proto2.js");
@@ -14,7 +14,7 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.ListValue = exports.Value = exports.Struct = exports.NullValue = void 0;
17
- // @generated by protoc-gen-es v1.7.1 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
17
+ // @generated by protoc-gen-es v1.7.2 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
18
18
  // @generated from file google/protobuf/struct.proto (package google.protobuf, syntax proto3)
19
19
  /* eslint-disable */
20
20
  const proto3_js_1 = require("../../proto3.js");
@@ -14,7 +14,7 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.Option = exports.EnumValue = exports.Enum = exports.Field_Cardinality = exports.Field_Kind = exports.Field = exports.Type = exports.Syntax = void 0;
17
- // @generated by protoc-gen-es v1.7.1 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
17
+ // @generated by protoc-gen-es v1.7.2 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
18
18
  // @generated from file google/protobuf/type.proto (package google.protobuf, syntax proto3)
19
19
  /* eslint-disable */
20
20
  const proto3_js_1 = require("../../proto3.js");
@@ -1,5 +1,5 @@
1
1
  import { reifyWkt } from "./private/reify-wkt.js";
2
- import type { DescEnum, DescEnumValue, DescField, DescExtension, DescMessage, DescMethod, DescOneof, DescService } from "./descriptor-set";
2
+ import type { DescEnum, DescEnumValue, DescField, DescExtension, DescMessage, DescMethod, DescOneof, DescService } from "./descriptor-set.js";
3
3
  import { LongType, ScalarType } from "./field.js";
4
4
  interface CodegenInfo {
5
5
  /**
@@ -60,7 +60,13 @@ export function setExtension(message, extension, value, options) {
60
60
  }
61
61
  }
62
62
  const writer = writeOpt.writerFactory();
63
- extension.runtime.bin.writeField(extension.field, value, writer, writeOpt);
63
+ let f = extension.field;
64
+ // Implicit presence does not apply to extensions, see https://github.com/protocolbuffers/protobuf/issues/8234
65
+ // We patch the field info to use explicit presence:
66
+ if (!f.opt && !f.repeated && (f.kind == "enum" || f.kind == "scalar")) {
67
+ f = Object.assign(Object.assign({}, extension.field), { opt: true });
68
+ }
69
+ extension.runtime.bin.writeField(f, value, writer, writeOpt);
64
70
  const reader = readOpt.readerFactory(writer.finish());
65
71
  while (reader.pos < reader.len) {
66
72
  const [no, wireType] = reader.tag();
@@ -18,7 +18,7 @@
18
18
  // The messages in this file describe the definitions found in .proto files.
19
19
  // A valid .proto file can be translated directly to a FileDescriptorProto
20
20
  // without any other information (e.g. without reading its imports).
21
- // @generated by protoc-gen-es v1.7.1 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
21
+ // @generated by protoc-gen-es v1.7.2 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
22
22
  // @generated from file google/protobuf/descriptor.proto (package google.protobuf, syntax proto2)
23
23
  /* eslint-disable */
24
24
  import { proto2 } from "../../proto2.js";
@@ -11,7 +11,7 @@
11
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
- // @generated by protoc-gen-es v1.7.1 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
14
+ // @generated by protoc-gen-es v1.7.2 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
15
15
  // @generated from file google/protobuf/struct.proto (package google.protobuf, syntax proto3)
16
16
  /* eslint-disable */
17
17
  import { proto3 } from "../../proto3.js";
@@ -11,7 +11,7 @@
11
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
- // @generated by protoc-gen-es v1.7.1 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
14
+ // @generated by protoc-gen-es v1.7.2 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
15
15
  // @generated from file google/protobuf/type.proto (package google.protobuf, syntax proto3)
16
16
  /* eslint-disable */
17
17
  import { proto3 } from "../../proto3.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bufbuild/protobuf",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "license": "(Apache-2.0 AND BSD-3-Clause)",
5
5
  "description": "A complete implementation of Protocol Buffers in TypeScript, suitable for web browsers and Node.js.",
6
6
  "repository": {