@bufbuild/protobuf 2.2.2 → 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 (129) 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.d.ts +34 -2
  17. package/dist/cjs/equals.js +104 -26
  18. package/dist/cjs/extensions.js +1 -1
  19. package/dist/cjs/fields.js +1 -1
  20. package/dist/cjs/from-binary.js +1 -1
  21. package/dist/cjs/from-json.js +2 -2
  22. package/dist/cjs/index.js +1 -1
  23. package/dist/cjs/is-message.js +1 -1
  24. package/dist/cjs/json-value.js +1 -1
  25. package/dist/cjs/proto-int64.js +1 -1
  26. package/dist/cjs/reflect/error.js +1 -1
  27. package/dist/cjs/reflect/guard.js +1 -1
  28. package/dist/cjs/reflect/index.js +1 -1
  29. package/dist/cjs/reflect/names.js +1 -1
  30. package/dist/cjs/reflect/nested-types.js +1 -1
  31. package/dist/cjs/reflect/reflect-check.js +23 -23
  32. package/dist/cjs/reflect/reflect-types.js +1 -1
  33. package/dist/cjs/reflect/reflect.js +1 -1
  34. package/dist/cjs/reflect/scalar.js +1 -1
  35. package/dist/cjs/reflect/unsafe.js +1 -1
  36. package/dist/cjs/registry.js +5 -2
  37. package/dist/cjs/to-binary.js +63 -55
  38. package/dist/cjs/to-json.js +1 -1
  39. package/dist/cjs/types.js +1 -1
  40. package/dist/cjs/wire/base64-encoding.js +1 -1
  41. package/dist/cjs/wire/binary-encoding.js +1 -1
  42. package/dist/cjs/wire/index.js +1 -1
  43. package/dist/cjs/wire/size-delimited.js +2 -2
  44. package/dist/cjs/wire/text-encoding.js +1 -1
  45. package/dist/cjs/wire/text-format.js +1 -1
  46. package/dist/cjs/wkt/any.js +3 -3
  47. package/dist/cjs/wkt/gen/google/protobuf/any_pb.js +1 -1
  48. package/dist/cjs/wkt/gen/google/protobuf/api_pb.d.ts +2 -2
  49. package/dist/cjs/wkt/gen/google/protobuf/api_pb.js +1 -1
  50. package/dist/cjs/wkt/gen/google/protobuf/compiler/plugin_pb.js +1 -1
  51. package/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.d.ts +96 -9
  52. package/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.js +27 -8
  53. package/dist/cjs/wkt/gen/google/protobuf/duration_pb.js +1 -1
  54. package/dist/cjs/wkt/gen/google/protobuf/empty_pb.js +1 -1
  55. package/dist/cjs/wkt/gen/google/protobuf/field_mask_pb.js +1 -1
  56. package/dist/cjs/wkt/gen/google/protobuf/source_context_pb.js +1 -1
  57. package/dist/cjs/wkt/gen/google/protobuf/struct_pb.js +1 -1
  58. package/dist/cjs/wkt/gen/google/protobuf/timestamp_pb.js +1 -1
  59. package/dist/cjs/wkt/gen/google/protobuf/type_pb.js +1 -1
  60. package/dist/cjs/wkt/gen/google/protobuf/wrappers_pb.d.ts +54 -0
  61. package/dist/cjs/wkt/gen/google/protobuf/wrappers_pb.js +1 -1
  62. package/dist/cjs/wkt/index.js +1 -1
  63. package/dist/cjs/wkt/timestamp.js +1 -1
  64. package/dist/cjs/wkt/wrappers.js +1 -1
  65. package/dist/esm/clone.js +1 -1
  66. package/dist/esm/codegenv1/boot.js +1 -1
  67. package/dist/esm/codegenv1/embed.js +1 -1
  68. package/dist/esm/codegenv1/enum.js +1 -1
  69. package/dist/esm/codegenv1/extension.js +1 -1
  70. package/dist/esm/codegenv1/file.js +1 -1
  71. package/dist/esm/codegenv1/index.js +1 -1
  72. package/dist/esm/codegenv1/message.js +1 -1
  73. package/dist/esm/codegenv1/restore-json-names.js +1 -1
  74. package/dist/esm/codegenv1/scalar.js +1 -1
  75. package/dist/esm/codegenv1/service.js +1 -1
  76. package/dist/esm/codegenv1/symbols.js +1 -1
  77. package/dist/esm/codegenv1/types.js +1 -1
  78. package/dist/esm/create.js +1 -1
  79. package/dist/esm/descriptors.js +1 -1
  80. package/dist/esm/equals.d.ts +34 -2
  81. package/dist/esm/equals.js +104 -26
  82. package/dist/esm/extensions.js +1 -1
  83. package/dist/esm/fields.js +1 -1
  84. package/dist/esm/from-binary.js +1 -1
  85. package/dist/esm/from-json.js +2 -2
  86. package/dist/esm/index.js +1 -1
  87. package/dist/esm/is-message.js +1 -1
  88. package/dist/esm/json-value.js +1 -1
  89. package/dist/esm/proto-int64.js +1 -1
  90. package/dist/esm/reflect/error.js +1 -1
  91. package/dist/esm/reflect/guard.js +1 -1
  92. package/dist/esm/reflect/index.js +1 -1
  93. package/dist/esm/reflect/names.js +1 -1
  94. package/dist/esm/reflect/nested-types.js +1 -1
  95. package/dist/esm/reflect/reflect-check.js +23 -23
  96. package/dist/esm/reflect/reflect-types.js +1 -1
  97. package/dist/esm/reflect/reflect.js +1 -1
  98. package/dist/esm/reflect/scalar.js +1 -1
  99. package/dist/esm/reflect/unsafe.js +1 -1
  100. package/dist/esm/registry.js +5 -2
  101. package/dist/esm/to-binary.js +63 -55
  102. package/dist/esm/to-json.js +1 -1
  103. package/dist/esm/types.js +1 -1
  104. package/dist/esm/wire/base64-encoding.js +1 -1
  105. package/dist/esm/wire/binary-encoding.js +1 -1
  106. package/dist/esm/wire/index.js +1 -1
  107. package/dist/esm/wire/size-delimited.js +2 -2
  108. package/dist/esm/wire/text-encoding.js +1 -1
  109. package/dist/esm/wire/text-format.js +1 -1
  110. package/dist/esm/wkt/any.js +3 -3
  111. package/dist/esm/wkt/gen/google/protobuf/any_pb.js +1 -1
  112. package/dist/esm/wkt/gen/google/protobuf/api_pb.d.ts +2 -2
  113. package/dist/esm/wkt/gen/google/protobuf/api_pb.js +1 -1
  114. package/dist/esm/wkt/gen/google/protobuf/compiler/plugin_pb.js +1 -1
  115. package/dist/esm/wkt/gen/google/protobuf/descriptor_pb.d.ts +96 -9
  116. package/dist/esm/wkt/gen/google/protobuf/descriptor_pb.js +26 -7
  117. package/dist/esm/wkt/gen/google/protobuf/duration_pb.js +1 -1
  118. package/dist/esm/wkt/gen/google/protobuf/empty_pb.js +1 -1
  119. package/dist/esm/wkt/gen/google/protobuf/field_mask_pb.js +1 -1
  120. package/dist/esm/wkt/gen/google/protobuf/source_context_pb.js +1 -1
  121. package/dist/esm/wkt/gen/google/protobuf/struct_pb.js +1 -1
  122. package/dist/esm/wkt/gen/google/protobuf/timestamp_pb.js +1 -1
  123. package/dist/esm/wkt/gen/google/protobuf/type_pb.js +1 -1
  124. package/dist/esm/wkt/gen/google/protobuf/wrappers_pb.d.ts +54 -0
  125. package/dist/esm/wkt/gen/google/protobuf/wrappers_pb.js +1 -1
  126. package/dist/esm/wkt/index.js +1 -1
  127. package/dist/esm/wkt/timestamp.js +1 -1
  128. package/dist/esm/wkt/wrappers.js +1 -1
  129. 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,9 +1,41 @@
1
1
  import type { MessageShape } from "./types.js";
2
- import type { DescMessage } from "./descriptors.js";
2
+ import { type DescMessage } from "./descriptors.js";
3
+ import type { Registry } from "./registry.js";
4
+ interface EqualsOptions {
5
+ /**
6
+ * A registry to look up extensions, and messages packed in Any.
7
+ *
8
+ * @private Experimental API, does not follow semantic versioning.
9
+ */
10
+ registry: Registry;
11
+ /**
12
+ * Unpack google.protobuf.Any before comparing.
13
+ * If a type is not in the registry, comparison falls back to comparing the
14
+ * fields of Any.
15
+ *
16
+ * @private Experimental API, does not follow semantic versioning.
17
+ */
18
+ unpackAny?: boolean;
19
+ /**
20
+ * Consider extensions when comparing.
21
+ *
22
+ * @private Experimental API, does not follow semantic versioning.
23
+ */
24
+ extensions?: boolean;
25
+ /**
26
+ * Consider unknown fields when comparing.
27
+ * The registry is used to distinguish between extensions, and unknown fields
28
+ * caused by schema changes.
29
+ *
30
+ * @private Experimental API, does not follow semantic versioning.
31
+ */
32
+ unknown?: boolean;
33
+ }
3
34
  /**
4
35
  * Compare two messages of the same type.
5
36
  *
6
37
  * Note that this function disregards extensions and unknown fields, and that
7
38
  * NaN is not equal NaN, following the IEEE standard.
8
39
  */
9
- export declare function equals<Desc extends DescMessage>(schema: Desc, a: MessageShape<Desc>, b: MessageShape<Desc>): boolean;
40
+ export declare function equals<Desc extends DescMessage>(schema: Desc, a: MessageShape<Desc>, b: MessageShape<Desc>, options?: EqualsOptions): boolean;
41
+ export {};
@@ -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.
@@ -16,30 +16,43 @@ Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.equals = equals;
17
17
  const scalar_js_1 = require("./reflect/scalar.js");
18
18
  const reflect_js_1 = require("./reflect/reflect.js");
19
+ const descriptors_js_1 = require("./descriptors.js");
20
+ const index_js_1 = require("./wkt/index.js");
21
+ const extensions_js_1 = require("./extensions.js");
19
22
  /**
20
23
  * Compare two messages of the same type.
21
24
  *
22
25
  * Note that this function disregards extensions and unknown fields, and that
23
26
  * NaN is not equal NaN, following the IEEE standard.
24
27
  */
25
- function equals(schema, a, b) {
28
+ function equals(schema, a, b, options) {
26
29
  if (a.$typeName != schema.typeName || b.$typeName != schema.typeName) {
27
30
  return false;
28
31
  }
29
32
  if (a === b) {
30
33
  return true;
31
34
  }
32
- return reflectEquals((0, reflect_js_1.reflect)(schema, a), (0, reflect_js_1.reflect)(schema, b));
35
+ return reflectEquals((0, reflect_js_1.reflect)(schema, a), (0, reflect_js_1.reflect)(schema, b), options);
33
36
  }
34
- function reflectEquals(a, b) {
37
+ function reflectEquals(a, b, opts) {
38
+ if (a.desc.typeName === "google.protobuf.Any" && (opts === null || opts === void 0 ? void 0 : opts.unpackAny) == true) {
39
+ return anyUnpackedEquals(a.message, b.message, opts);
40
+ }
35
41
  for (const f of a.fields) {
36
- if (!fieldEquals(f, a, b)) {
42
+ if (!fieldEquals(f, a, b, opts)) {
37
43
  return false;
38
44
  }
39
45
  }
46
+ if ((opts === null || opts === void 0 ? void 0 : opts.unknown) == true && !unknownEquals(a, b, opts.registry)) {
47
+ return false;
48
+ }
49
+ if ((opts === null || opts === void 0 ? void 0 : opts.extensions) == true && !extensionsEquals(a, b, opts)) {
50
+ return false;
51
+ }
40
52
  return true;
41
53
  }
42
- function fieldEquals(f, a, b) {
54
+ // TODO(tstamm) add an option to consider NaN equal to NaN?
55
+ function fieldEquals(f, a, b, opts) {
43
56
  if (!a.isSet(f) && !b.isSet(f)) {
44
57
  return true;
45
58
  }
@@ -52,25 +65,26 @@ function fieldEquals(f, a, b) {
52
65
  case "enum":
53
66
  return a.get(f) === b.get(f);
54
67
  case "message":
55
- return reflectEquals(a.get(f), b.get(f));
68
+ return reflectEquals(a.get(f), b.get(f), opts);
56
69
  case "map": {
57
- const ma = a.get(f);
58
- const mb = b.get(f);
59
- const keysA = [];
60
- for (const k of ma.keys()) {
61
- if (!mb.has(k)) {
70
+ // TODO(tstamm) can't we compare sizes first?
71
+ const mapA = a.get(f);
72
+ const mapB = b.get(f);
73
+ const keys = [];
74
+ for (const k of mapA.keys()) {
75
+ if (!mapB.has(k)) {
62
76
  return false;
63
77
  }
64
- keysA.push(k);
78
+ keys.push(k);
65
79
  }
66
- for (const k of mb.keys()) {
67
- if (!ma.has(k)) {
80
+ for (const k of mapB.keys()) {
81
+ if (!mapA.has(k)) {
68
82
  return false;
69
83
  }
70
84
  }
71
- for (const key of keysA) {
72
- const va = ma.get(key);
73
- const vb = mb.get(key);
85
+ for (const key of keys) {
86
+ const va = mapA.get(key);
87
+ const vb = mapB.get(key);
74
88
  if (va === vb) {
75
89
  continue;
76
90
  }
@@ -78,7 +92,7 @@ function fieldEquals(f, a, b) {
78
92
  case "enum":
79
93
  return false;
80
94
  case "message":
81
- if (!reflectEquals(va, vb)) {
95
+ if (!reflectEquals(va, vb, opts)) {
82
96
  return false;
83
97
  }
84
98
  break;
@@ -92,14 +106,14 @@ function fieldEquals(f, a, b) {
92
106
  break;
93
107
  }
94
108
  case "list": {
95
- const la = a.get(f);
96
- const lb = b.get(f);
97
- if (la.size != lb.size) {
109
+ const listA = a.get(f);
110
+ const listB = b.get(f);
111
+ if (listA.size != listB.size) {
98
112
  return false;
99
113
  }
100
- for (let i = 0; i < la.size; i++) {
101
- const va = la.get(i);
102
- const vb = lb.get(i);
114
+ for (let i = 0; i < listA.size; i++) {
115
+ const va = listA.get(i);
116
+ const vb = listB.get(i);
103
117
  if (va === vb) {
104
118
  continue;
105
119
  }
@@ -107,7 +121,7 @@ function fieldEquals(f, a, b) {
107
121
  case "enum":
108
122
  return false;
109
123
  case "message":
110
- if (!reflectEquals(va, vb)) {
124
+ if (!reflectEquals(va, vb, opts)) {
111
125
  return false;
112
126
  }
113
127
  break;
@@ -123,3 +137,67 @@ function fieldEquals(f, a, b) {
123
137
  }
124
138
  return true;
125
139
  }
140
+ function anyUnpackedEquals(a, b, opts) {
141
+ if (a.typeUrl !== b.typeUrl) {
142
+ return false;
143
+ }
144
+ const unpackedA = (0, index_js_1.anyUnpack)(a, opts.registry);
145
+ const unpackedB = (0, index_js_1.anyUnpack)(b, opts.registry);
146
+ if (unpackedA && unpackedB) {
147
+ const schema = opts.registry.getMessage(unpackedA.$typeName);
148
+ if (schema) {
149
+ return equals(schema, unpackedA, unpackedB, opts);
150
+ }
151
+ }
152
+ return (0, scalar_js_1.scalarEquals)(descriptors_js_1.ScalarType.BYTES, a.value, b.value);
153
+ }
154
+ function unknownEquals(a, b, registry) {
155
+ function getTrulyUnknown(msg, registry) {
156
+ var _a;
157
+ const u = (_a = msg.getUnknown()) !== null && _a !== void 0 ? _a : [];
158
+ return registry
159
+ ? u.filter((uf) => !registry.getExtensionFor(msg.desc, uf.no))
160
+ : u;
161
+ }
162
+ const unknownA = getTrulyUnknown(a, registry);
163
+ const unknownB = getTrulyUnknown(b, registry);
164
+ if (unknownA.length != unknownB.length) {
165
+ return false;
166
+ }
167
+ for (let i = 0; i < unknownA.length; i++) {
168
+ const a = unknownA[i], b = unknownB[i];
169
+ if (a.no != b.no) {
170
+ return false;
171
+ }
172
+ if (a.wireType != b.wireType) {
173
+ return false;
174
+ }
175
+ if (!(0, scalar_js_1.scalarEquals)(descriptors_js_1.ScalarType.BYTES, a.data, b.data)) {
176
+ return false;
177
+ }
178
+ }
179
+ return true;
180
+ }
181
+ function extensionsEquals(a, b, opts) {
182
+ function getSetExtensions(msg, registry) {
183
+ var _a;
184
+ return ((_a = msg.getUnknown()) !== null && _a !== void 0 ? _a : [])
185
+ .map((uf) => registry.getExtensionFor(msg.desc, uf.no))
186
+ .filter((e) => e != undefined)
187
+ .filter((e, index, arr) => arr.indexOf(e) === index);
188
+ }
189
+ const extensionsA = getSetExtensions(a, opts.registry);
190
+ const extensionsB = getSetExtensions(b, opts.registry);
191
+ if (extensionsA.length != extensionsB.length ||
192
+ extensionsA.some((e) => !extensionsB.includes(e))) {
193
+ return false;
194
+ }
195
+ for (const extension of extensionsA) {
196
+ const [containerA, field] = (0, extensions_js_1.createExtensionContainer)(extension, (0, extensions_js_1.getExtension)(a.message, extension));
197
+ const [containerB] = (0, extensions_js_1.createExtensionContainer)(extension, (0, extensions_js_1.getExtension)(b.message, extension));
198
+ if (!fieldEquals(field, containerA, containerB, opts)) {
199
+ return false;
200
+ }
201
+ }
202
+ return true;
203
+ }
@@ -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
  /**