@bufbuild/protobuf 2.2.3 → 2.2.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.
Files changed (127) hide show
  1. package/dist/cjs/clone.js +1 -1
  2. package/dist/cjs/codegenv1/boot.js +1 -1
  3. package/dist/cjs/codegenv1/embed.js +1 -1
  4. package/dist/cjs/codegenv1/enum.js +1 -1
  5. package/dist/cjs/codegenv1/extension.js +1 -1
  6. package/dist/cjs/codegenv1/file.js +1 -1
  7. package/dist/cjs/codegenv1/index.js +1 -1
  8. package/dist/cjs/codegenv1/message.js +1 -1
  9. package/dist/cjs/codegenv1/restore-json-names.js +1 -1
  10. package/dist/cjs/codegenv1/scalar.js +1 -1
  11. package/dist/cjs/codegenv1/service.js +1 -1
  12. package/dist/cjs/codegenv1/symbols.js +1 -1
  13. package/dist/cjs/codegenv1/types.js +1 -1
  14. package/dist/cjs/create.js +1 -1
  15. package/dist/cjs/descriptors.js +1 -1
  16. package/dist/cjs/equals.js +1 -1
  17. package/dist/cjs/extensions.js +1 -1
  18. package/dist/cjs/fields.js +1 -1
  19. package/dist/cjs/from-binary.js +1 -1
  20. package/dist/cjs/from-json.js +2 -2
  21. package/dist/cjs/index.js +1 -1
  22. package/dist/cjs/is-message.js +1 -1
  23. package/dist/cjs/json-value.js +1 -1
  24. package/dist/cjs/proto-int64.js +1 -1
  25. package/dist/cjs/reflect/error.js +1 -1
  26. package/dist/cjs/reflect/guard.js +1 -1
  27. package/dist/cjs/reflect/index.js +1 -1
  28. package/dist/cjs/reflect/names.js +1 -1
  29. package/dist/cjs/reflect/nested-types.js +1 -1
  30. package/dist/cjs/reflect/reflect-check.js +23 -23
  31. package/dist/cjs/reflect/reflect-types.js +1 -1
  32. package/dist/cjs/reflect/reflect.js +1 -1
  33. package/dist/cjs/reflect/scalar.js +1 -1
  34. package/dist/cjs/reflect/unsafe.js +1 -1
  35. package/dist/cjs/registry.js +5 -2
  36. package/dist/cjs/to-binary.js +63 -55
  37. package/dist/cjs/to-json.js +1 -1
  38. package/dist/cjs/types.js +1 -1
  39. package/dist/cjs/wire/base64-encoding.js +1 -1
  40. package/dist/cjs/wire/binary-encoding.js +1 -1
  41. package/dist/cjs/wire/index.js +1 -1
  42. package/dist/cjs/wire/size-delimited.js +1 -1
  43. package/dist/cjs/wire/text-encoding.js +1 -1
  44. package/dist/cjs/wire/text-format.js +1 -1
  45. package/dist/cjs/wkt/any.js +1 -1
  46. package/dist/cjs/wkt/gen/google/protobuf/any_pb.js +1 -1
  47. package/dist/cjs/wkt/gen/google/protobuf/api_pb.d.ts +2 -2
  48. package/dist/cjs/wkt/gen/google/protobuf/api_pb.js +1 -1
  49. package/dist/cjs/wkt/gen/google/protobuf/compiler/plugin_pb.js +1 -1
  50. package/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.d.ts +96 -9
  51. package/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.js +27 -8
  52. package/dist/cjs/wkt/gen/google/protobuf/duration_pb.js +1 -1
  53. package/dist/cjs/wkt/gen/google/protobuf/empty_pb.js +1 -1
  54. package/dist/cjs/wkt/gen/google/protobuf/field_mask_pb.js +1 -1
  55. package/dist/cjs/wkt/gen/google/protobuf/source_context_pb.js +1 -1
  56. package/dist/cjs/wkt/gen/google/protobuf/struct_pb.js +1 -1
  57. package/dist/cjs/wkt/gen/google/protobuf/timestamp_pb.js +1 -1
  58. package/dist/cjs/wkt/gen/google/protobuf/type_pb.js +1 -1
  59. package/dist/cjs/wkt/gen/google/protobuf/wrappers_pb.d.ts +54 -0
  60. package/dist/cjs/wkt/gen/google/protobuf/wrappers_pb.js +1 -1
  61. package/dist/cjs/wkt/index.js +1 -1
  62. package/dist/cjs/wkt/timestamp.js +1 -1
  63. package/dist/cjs/wkt/wrappers.js +1 -1
  64. package/dist/esm/clone.js +1 -1
  65. package/dist/esm/codegenv1/boot.js +1 -1
  66. package/dist/esm/codegenv1/embed.js +1 -1
  67. package/dist/esm/codegenv1/enum.js +1 -1
  68. package/dist/esm/codegenv1/extension.js +1 -1
  69. package/dist/esm/codegenv1/file.js +1 -1
  70. package/dist/esm/codegenv1/index.js +1 -1
  71. package/dist/esm/codegenv1/message.js +1 -1
  72. package/dist/esm/codegenv1/restore-json-names.js +1 -1
  73. package/dist/esm/codegenv1/scalar.js +1 -1
  74. package/dist/esm/codegenv1/service.js +1 -1
  75. package/dist/esm/codegenv1/symbols.js +1 -1
  76. package/dist/esm/codegenv1/types.js +1 -1
  77. package/dist/esm/create.js +1 -1
  78. package/dist/esm/descriptors.js +1 -1
  79. package/dist/esm/equals.js +1 -1
  80. package/dist/esm/extensions.js +1 -1
  81. package/dist/esm/fields.js +1 -1
  82. package/dist/esm/from-binary.js +1 -1
  83. package/dist/esm/from-json.js +2 -2
  84. package/dist/esm/index.js +1 -1
  85. package/dist/esm/is-message.js +1 -1
  86. package/dist/esm/json-value.js +1 -1
  87. package/dist/esm/proto-int64.js +1 -1
  88. package/dist/esm/reflect/error.js +1 -1
  89. package/dist/esm/reflect/guard.js +1 -1
  90. package/dist/esm/reflect/index.js +1 -1
  91. package/dist/esm/reflect/names.js +1 -1
  92. package/dist/esm/reflect/nested-types.js +1 -1
  93. package/dist/esm/reflect/reflect-check.js +23 -23
  94. package/dist/esm/reflect/reflect-types.js +1 -1
  95. package/dist/esm/reflect/reflect.js +1 -1
  96. package/dist/esm/reflect/scalar.js +1 -1
  97. package/dist/esm/reflect/unsafe.js +1 -1
  98. package/dist/esm/registry.js +5 -2
  99. package/dist/esm/to-binary.js +63 -55
  100. package/dist/esm/to-json.js +1 -1
  101. package/dist/esm/types.js +1 -1
  102. package/dist/esm/wire/base64-encoding.js +1 -1
  103. package/dist/esm/wire/binary-encoding.js +1 -1
  104. package/dist/esm/wire/index.js +1 -1
  105. package/dist/esm/wire/size-delimited.js +1 -1
  106. package/dist/esm/wire/text-encoding.js +1 -1
  107. package/dist/esm/wire/text-format.js +1 -1
  108. package/dist/esm/wkt/any.js +1 -1
  109. package/dist/esm/wkt/gen/google/protobuf/any_pb.js +1 -1
  110. package/dist/esm/wkt/gen/google/protobuf/api_pb.d.ts +2 -2
  111. package/dist/esm/wkt/gen/google/protobuf/api_pb.js +1 -1
  112. package/dist/esm/wkt/gen/google/protobuf/compiler/plugin_pb.js +1 -1
  113. package/dist/esm/wkt/gen/google/protobuf/descriptor_pb.d.ts +96 -9
  114. package/dist/esm/wkt/gen/google/protobuf/descriptor_pb.js +26 -7
  115. package/dist/esm/wkt/gen/google/protobuf/duration_pb.js +1 -1
  116. package/dist/esm/wkt/gen/google/protobuf/empty_pb.js +1 -1
  117. package/dist/esm/wkt/gen/google/protobuf/field_mask_pb.js +1 -1
  118. package/dist/esm/wkt/gen/google/protobuf/source_context_pb.js +1 -1
  119. package/dist/esm/wkt/gen/google/protobuf/struct_pb.js +1 -1
  120. package/dist/esm/wkt/gen/google/protobuf/timestamp_pb.js +1 -1
  121. package/dist/esm/wkt/gen/google/protobuf/type_pb.js +1 -1
  122. package/dist/esm/wkt/gen/google/protobuf/wrappers_pb.d.ts +54 -0
  123. package/dist/esm/wkt/gen/google/protobuf/wrappers_pb.js +1 -1
  124. package/dist/esm/wkt/index.js +1 -1
  125. package/dist/esm/wkt/timestamp.js +1 -1
  126. package/dist/esm/wkt/wrappers.js +1 -1
  127. package/package.json +1 -1
package/dist/cjs/clone.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -511,7 +511,7 @@ function timestampFromJson(timestamp, json) {
511
511
  if (typeof json !== "string") {
512
512
  throw new Error(`cannot decode message ${timestamp.$typeName} from JSON: ${(0, reflect_check_js_1.formatVal)(json)}`);
513
513
  }
514
- const matches = json.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);
514
+ const matches = json.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\.([0-9]{1,9}))?(?:Z|([+-][0-9][0-9]:[0-9][0-9]))$/);
515
515
  if (!matches) {
516
516
  throw new Error(`cannot decode message ${timestamp.$typeName} from JSON: invalid RFC 3339 string`);
517
517
  }
package/dist/cjs/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -135,33 +135,33 @@ function checkScalarValue(value, scalar) {
135
135
  case descriptors_js_1.ScalarType.SFIXED64:
136
136
  case descriptors_js_1.ScalarType.SINT64:
137
137
  // signed
138
- if (typeof value != "string" &&
139
- typeof value !== "bigint" &&
140
- typeof value !== "number") {
141
- return false;
142
- }
143
- try {
144
- proto_int64_js_1.protoInt64.parse(value);
138
+ if (typeof value == "bigint" ||
139
+ typeof value == "number" ||
140
+ (typeof value == "string" && value.length > 0)) {
141
+ try {
142
+ proto_int64_js_1.protoInt64.parse(value);
143
+ return true;
144
+ }
145
+ catch (e) {
146
+ return `${value} out of range`;
147
+ }
145
148
  }
146
- catch (e) {
147
- return `${value} out of range`;
148
- }
149
- return true;
149
+ return false;
150
150
  case descriptors_js_1.ScalarType.FIXED64:
151
151
  case descriptors_js_1.ScalarType.UINT64:
152
152
  // unsigned
153
- if (typeof value != "string" &&
154
- typeof value !== "bigint" &&
155
- typeof value !== "number") {
156
- return false;
157
- }
158
- try {
159
- proto_int64_js_1.protoInt64.uParse(value);
153
+ if (typeof value == "bigint" ||
154
+ typeof value == "number" ||
155
+ (typeof value == "string" && value.length > 0)) {
156
+ try {
157
+ proto_int64_js_1.protoInt64.uParse(value);
158
+ return true;
159
+ }
160
+ catch (e) {
161
+ return `${value} out of range`;
162
+ }
160
163
  }
161
- catch (e) {
162
- return `${value} out of range`;
163
- }
164
- return true;
164
+ return false;
165
165
  }
166
166
  }
167
167
  function reasonSingular(field, val, details) {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -230,7 +230,7 @@ const DELIMITED = 2;
230
230
  const OPEN = 1;
231
231
  // prettier-ignore
232
232
  // bootstrap-inject defaults: EDITION_PROTO2 to EDITION_2023: export const minimumEdition: SupportedEdition = $minimumEdition, maximumEdition: SupportedEdition = $maximumEdition;
233
- // generated from protoc v28.3
233
+ // generated from protoc v30.0
234
234
  exports.minimumEdition = 998, exports.maximumEdition = 1000;
235
235
  const featureDefaults = {
236
236
  // EDITION_PROTO2
@@ -241,6 +241,7 @@ const featureDefaults = {
241
241
  utf8Validation: 3, // NONE,
242
242
  messageEncoding: 1, // LENGTH_PREFIXED,
243
243
  jsonFormat: 2, // LEGACY_BEST_EFFORT,
244
+ enforceNamingStyle: 2, // STYLE_LEGACY,
244
245
  },
245
246
  // EDITION_PROTO3
246
247
  999: {
@@ -250,6 +251,7 @@ const featureDefaults = {
250
251
  utf8Validation: 2, // VERIFY,
251
252
  messageEncoding: 1, // LENGTH_PREFIXED,
252
253
  jsonFormat: 1, // ALLOW,
254
+ enforceNamingStyle: 2, // STYLE_LEGACY,
253
255
  },
254
256
  // EDITION_2023
255
257
  1000: {
@@ -259,6 +261,7 @@ const featureDefaults = {
259
261
  utf8Validation: 2, // VERIFY,
260
262
  messageEncoding: 1, // LENGTH_PREFIXED,
261
263
  jsonFormat: 1, // ALLOW,
264
+ enforceNamingStyle: 2, // STYLE_LEGACY,
262
265
  },
263
266
  };
264
267
  /**
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -56,7 +56,7 @@ function writeField(writer, opts, msg, field) {
56
56
  switch (field.fieldKind) {
57
57
  case "scalar":
58
58
  case "enum":
59
- writeScalar(writer, (_a = field.scalar) !== null && _a !== void 0 ? _a : descriptors_js_1.ScalarType.INT32, field.number, msg.get(field));
59
+ writeScalar(writer, msg.desc.typeName, field.name, (_a = field.scalar) !== null && _a !== void 0 ? _a : descriptors_js_1.ScalarType.INT32, field.number, msg.get(field));
60
60
  break;
61
61
  case "list":
62
62
  writeListField(writer, opts, field, msg.get(field));
@@ -71,8 +71,8 @@ function writeField(writer, opts, msg, field) {
71
71
  break;
72
72
  }
73
73
  }
74
- function writeScalar(writer, scalarType, fieldNo, value) {
75
- writeScalarValue(writer.tag(fieldNo, writeTypeOfScalar(scalarType)), scalarType, value);
74
+ function writeScalar(writer, msgName, fieldName, scalarType, fieldNo, value) {
75
+ writeScalarValue(writer.tag(fieldNo, writeTypeOfScalar(scalarType)), msgName, fieldName, scalarType, value);
76
76
  }
77
77
  function writeMessageField(writer, opts, field, message) {
78
78
  if (field.delimitedEncoding) {
@@ -97,25 +97,25 @@ function writeListField(writer, opts, field, list) {
97
97
  }
98
98
  writer.tag(field.number, binary_encoding_js_1.WireType.LengthDelimited).fork();
99
99
  for (const item of list) {
100
- writeScalarValue(writer, scalarType, item);
100
+ writeScalarValue(writer, field.parent.typeName, field.name, scalarType, item);
101
101
  }
102
102
  writer.join();
103
103
  return;
104
104
  }
105
105
  for (const item of list) {
106
- writeScalar(writer, scalarType, field.number, item);
106
+ writeScalar(writer, field.parent.typeName, field.name, scalarType, field.number, item);
107
107
  }
108
108
  }
109
109
  function writeMapEntry(writer, opts, field, key, value) {
110
110
  var _a;
111
111
  writer.tag(field.number, binary_encoding_js_1.WireType.LengthDelimited).fork();
112
112
  // write key, expecting key field number = 1
113
- writeScalar(writer, field.mapKey, 1, key);
113
+ writeScalar(writer, field.parent.typeName, field.name, field.mapKey, 1, key);
114
114
  // write value, expecting value field number = 2
115
115
  switch (field.mapKind) {
116
116
  case "scalar":
117
117
  case "enum":
118
- writeScalar(writer, (_a = field.scalar) !== null && _a !== void 0 ? _a : descriptors_js_1.ScalarType.INT32, 2, value);
118
+ writeScalar(writer, field.parent.typeName, field.name, (_a = field.scalar) !== null && _a !== void 0 ? _a : descriptors_js_1.ScalarType.INT32, 2, value);
119
119
  break;
120
120
  case "message":
121
121
  writeFields(writer.tag(2, binary_encoding_js_1.WireType.LengthDelimited).fork(), opts, value).join();
@@ -123,53 +123,61 @@ function writeMapEntry(writer, opts, field, key, value) {
123
123
  }
124
124
  writer.join();
125
125
  }
126
- function writeScalarValue(writer, type, value) {
127
- switch (type) {
128
- case descriptors_js_1.ScalarType.STRING:
129
- writer.string(value);
130
- break;
131
- case descriptors_js_1.ScalarType.BOOL:
132
- writer.bool(value);
133
- break;
134
- case descriptors_js_1.ScalarType.DOUBLE:
135
- writer.double(value);
136
- break;
137
- case descriptors_js_1.ScalarType.FLOAT:
138
- writer.float(value);
139
- break;
140
- case descriptors_js_1.ScalarType.INT32:
141
- writer.int32(value);
142
- break;
143
- case descriptors_js_1.ScalarType.INT64:
144
- writer.int64(value);
145
- break;
146
- case descriptors_js_1.ScalarType.UINT64:
147
- writer.uint64(value);
148
- break;
149
- case descriptors_js_1.ScalarType.FIXED64:
150
- writer.fixed64(value);
151
- break;
152
- case descriptors_js_1.ScalarType.BYTES:
153
- writer.bytes(value);
154
- break;
155
- case descriptors_js_1.ScalarType.FIXED32:
156
- writer.fixed32(value);
157
- break;
158
- case descriptors_js_1.ScalarType.SFIXED32:
159
- writer.sfixed32(value);
160
- break;
161
- case descriptors_js_1.ScalarType.SFIXED64:
162
- writer.sfixed64(value);
163
- break;
164
- case descriptors_js_1.ScalarType.SINT64:
165
- writer.sint64(value);
166
- break;
167
- case descriptors_js_1.ScalarType.UINT32:
168
- writer.uint32(value);
169
- break;
170
- case descriptors_js_1.ScalarType.SINT32:
171
- writer.sint32(value);
172
- break;
126
+ function writeScalarValue(writer, msgName, fieldName, type, value) {
127
+ try {
128
+ switch (type) {
129
+ case descriptors_js_1.ScalarType.STRING:
130
+ writer.string(value);
131
+ break;
132
+ case descriptors_js_1.ScalarType.BOOL:
133
+ writer.bool(value);
134
+ break;
135
+ case descriptors_js_1.ScalarType.DOUBLE:
136
+ writer.double(value);
137
+ break;
138
+ case descriptors_js_1.ScalarType.FLOAT:
139
+ writer.float(value);
140
+ break;
141
+ case descriptors_js_1.ScalarType.INT32:
142
+ writer.int32(value);
143
+ break;
144
+ case descriptors_js_1.ScalarType.INT64:
145
+ writer.int64(value);
146
+ break;
147
+ case descriptors_js_1.ScalarType.UINT64:
148
+ writer.uint64(value);
149
+ break;
150
+ case descriptors_js_1.ScalarType.FIXED64:
151
+ writer.fixed64(value);
152
+ break;
153
+ case descriptors_js_1.ScalarType.BYTES:
154
+ writer.bytes(value);
155
+ break;
156
+ case descriptors_js_1.ScalarType.FIXED32:
157
+ writer.fixed32(value);
158
+ break;
159
+ case descriptors_js_1.ScalarType.SFIXED32:
160
+ writer.sfixed32(value);
161
+ break;
162
+ case descriptors_js_1.ScalarType.SFIXED64:
163
+ writer.sfixed64(value);
164
+ break;
165
+ case descriptors_js_1.ScalarType.SINT64:
166
+ writer.sint64(value);
167
+ break;
168
+ case descriptors_js_1.ScalarType.UINT32:
169
+ writer.uint32(value);
170
+ break;
171
+ case descriptors_js_1.ScalarType.SINT32:
172
+ writer.sint32(value);
173
+ break;
174
+ }
175
+ }
176
+ catch (e) {
177
+ if (e instanceof Error) {
178
+ throw new Error(`cannot encode field ${msgName}.${fieldName} to binary: ${e.message}`);
179
+ }
180
+ throw e;
173
181
  }
174
182
  }
175
183
  function writeTypeOfScalar(type) {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
package/dist/cjs/types.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021-2024 Buf Technologies, Inc.
2
+ // Copyright 2021-2025 Buf Technologies, Inc.
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.