@bufbuild/protobuf 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -63,11 +63,11 @@ export interface IBinaryReader {
63
63
  */
64
64
  skip(wireType: WireType): Uint8Array;
65
65
  /**
66
- * Read a `int32` field, a signed 32 bit varint.
66
+ * Read a `uint32` field, an unsigned 32 bit varint.
67
67
  */
68
68
  uint32(): number;
69
69
  /**
70
- * Read a `sint32` field, a signed, zigzag-encoded 32-bit varint.
70
+ * Read a `int32` field, a signed 32 bit varint.
71
71
  */
72
72
  int32(): number;
73
73
  /**
@@ -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.8.0 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
24
+ // @generated by protoc-gen-es v1.9.0 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.8.0 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
17
+ // @generated by protoc-gen-es v1.9.0 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.8.0 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
17
+ // @generated by protoc-gen-es v1.9.0 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");
@@ -8,7 +8,7 @@ export { codegenInfo } from "./codegen-info.js";
8
8
  export { Message } from "./message.js";
9
9
  export type { AnyMessage, PartialMessage, PlainMessage } from "./message.js";
10
10
  export { isMessage } from "./is-message.js";
11
- export type { FieldInfo } from "./field.js";
11
+ export type { FieldInfo, OneofInfo } from "./field.js";
12
12
  export type { FieldList } from "./field-list.js";
13
13
  export { LongType, ScalarType } from "./scalar.js";
14
14
  export type { ScalarValue } from "./scalar.js";
@@ -19,6 +19,7 @@ export interface AnyMessage extends Message<AnyMessage> {
19
19
  export declare class Message<T extends Message<T> = AnyMessage> {
20
20
  /**
21
21
  * Compare with a message of the same type.
22
+ * Note that this function disregards extensions and unknown fields.
22
23
  */
23
24
  equals(other: T | PlainMessage<T> | undefined | null): boolean;
24
25
  /**
@@ -24,6 +24,7 @@ exports.Message = void 0;
24
24
  class Message {
25
25
  /**
26
26
  * Compare with a message of the same type.
27
+ * Note that this function disregards extensions and unknown fields.
27
28
  */
28
29
  equals(other) {
29
30
  return this.getType().runtime.util.equals(this.getType(), this, other);
@@ -404,7 +404,7 @@ function readScalar(type, json, longType, nullAsZeroValue) {
404
404
  }
405
405
  if (int32 === undefined)
406
406
  break;
407
- if (type == scalar_js_1.ScalarType.UINT32)
407
+ if (type == scalar_js_1.ScalarType.UINT32 || type == scalar_js_1.ScalarType.FIXED32)
408
408
  (0, assert_js_1.assertUInt32)(int32);
409
409
  else
410
410
  (0, assert_js_1.assertInt32)(int32);
@@ -43,11 +43,11 @@ function localName(desc) {
43
43
  return (0, exports.safeObjectProperty)((0, exports.safeIdentifier)(name));
44
44
  }
45
45
  case "enum_value": {
46
+ let name = desc.name;
46
47
  const sharedPrefix = desc.parent.sharedPrefix;
47
- if (sharedPrefix === undefined) {
48
- return desc.name;
48
+ if (sharedPrefix !== undefined) {
49
+ name = name.substring(sharedPrefix.length);
49
50
  }
50
- const name = desc.name.substring(sharedPrefix.length);
51
51
  return (0, exports.safeObjectProperty)(name);
52
52
  }
53
53
  case "rpc": {
@@ -208,6 +208,9 @@ function makeUtilCommon() {
208
208
  }
209
209
  any[member.localName] = copy;
210
210
  }
211
+ for (const uf of type.runtime.bin.listUnknownFields(message)) {
212
+ type.runtime.bin.onUnknownField(any, uf.no, uf.wireType, uf.data);
213
+ }
211
214
  return target;
212
215
  },
213
216
  };
@@ -63,11 +63,11 @@ export interface IBinaryReader {
63
63
  */
64
64
  skip(wireType: WireType): Uint8Array;
65
65
  /**
66
- * Read a `int32` field, a signed 32 bit varint.
66
+ * Read a `uint32` field, an unsigned 32 bit varint.
67
67
  */
68
68
  uint32(): number;
69
69
  /**
70
- * Read a `sint32` field, a signed, zigzag-encoded 32-bit varint.
70
+ * Read a `int32` field, a signed 32 bit varint.
71
71
  */
72
72
  int32(): number;
73
73
  /**
@@ -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.8.0 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
21
+ // @generated by protoc-gen-es v1.9.0 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.8.0 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
14
+ // @generated by protoc-gen-es v1.9.0 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.8.0 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
14
+ // @generated by protoc-gen-es v1.9.0 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";
@@ -8,7 +8,7 @@ export { codegenInfo } from "./codegen-info.js";
8
8
  export { Message } from "./message.js";
9
9
  export type { AnyMessage, PartialMessage, PlainMessage } from "./message.js";
10
10
  export { isMessage } from "./is-message.js";
11
- export type { FieldInfo } from "./field.js";
11
+ export type { FieldInfo, OneofInfo } from "./field.js";
12
12
  export type { FieldList } from "./field-list.js";
13
13
  export { LongType, ScalarType } from "./scalar.js";
14
14
  export type { ScalarValue } from "./scalar.js";
@@ -19,6 +19,7 @@ export interface AnyMessage extends Message<AnyMessage> {
19
19
  export declare class Message<T extends Message<T> = AnyMessage> {
20
20
  /**
21
21
  * Compare with a message of the same type.
22
+ * Note that this function disregards extensions and unknown fields.
22
23
  */
23
24
  equals(other: T | PlainMessage<T> | undefined | null): boolean;
24
25
  /**
@@ -21,6 +21,7 @@
21
21
  export class Message {
22
22
  /**
23
23
  * Compare with a message of the same type.
24
+ * Note that this function disregards extensions and unknown fields.
24
25
  */
25
26
  equals(other) {
26
27
  return this.getType().runtime.util.equals(this.getType(), this, other);
@@ -401,7 +401,7 @@ function readScalar(type, json, longType, nullAsZeroValue) {
401
401
  }
402
402
  if (int32 === undefined)
403
403
  break;
404
- if (type == ScalarType.UINT32)
404
+ if (type == ScalarType.UINT32 || type == ScalarType.FIXED32)
405
405
  assertUInt32(int32);
406
406
  else
407
407
  assertInt32(int32);
@@ -40,11 +40,11 @@ export function localName(desc) {
40
40
  return safeObjectProperty(safeIdentifier(name));
41
41
  }
42
42
  case "enum_value": {
43
+ let name = desc.name;
43
44
  const sharedPrefix = desc.parent.sharedPrefix;
44
- if (sharedPrefix === undefined) {
45
- return desc.name;
45
+ if (sharedPrefix !== undefined) {
46
+ name = name.substring(sharedPrefix.length);
46
47
  }
47
- const name = desc.name.substring(sharedPrefix.length);
48
48
  return safeObjectProperty(name);
49
49
  }
50
50
  case "rpc": {
@@ -206,6 +206,9 @@ export function makeUtilCommon() {
206
206
  }
207
207
  any[member.localName] = copy;
208
208
  }
209
+ for (const uf of type.runtime.bin.listUnknownFields(message)) {
210
+ type.runtime.bin.onUnknownField(any, uf.no, uf.wireType, uf.data);
211
+ }
209
212
  return target;
210
213
  },
211
214
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bufbuild/protobuf",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
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": {
@@ -11,8 +11,8 @@
11
11
  "scripts": {
12
12
  "clean": "rm -rf ./dist/*",
13
13
  "build": "npm run build:cjs && npm run build:esm",
14
- "build:cjs": "../../node_modules/typescript/bin/tsc --project tsconfig.json --module commonjs --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
15
- "build:esm": "../../node_modules/typescript/bin/tsc --project tsconfig.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm --declaration --declarationDir ./dist/esm",
14
+ "build:cjs": "../../node_modules/typescript/bin/tsc --project tsconfig.json --module commonjs --verbatimModuleSyntax false --moduleResolution node10 --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
15
+ "build:esm": "../../node_modules/typescript/bin/tsc --project tsconfig.json --outDir ./dist/esm --declaration --declarationDir ./dist/esm",
16
16
  "bootstrap:featureset-defaults": "upstream-inject-feature-defaults src/private/feature-set.ts",
17
17
  "prebootstrap:wkt": "rm -rf .tmp && mkdir -p .tmp/google/protobuf && cp -rp src/google/protobuf/* .tmp/google/protobuf",
18
18
  "bootstrap:wkt": "protoc --es_out=src --es_opt=bootstrap_wkt=true,ts_nocheck=false,target=ts --proto_path $(upstream-include wkt) $(upstream-files wkt) && license-header src/google/protobuf",