From f4e4cb7a8b2d9d8af03422afb39ef57142d9ed18 Mon Sep 17 00:00:00 2001 From: Timo Stamm Date: Tue, 1 Aug 2023 20:55:47 +0200 Subject: [PATCH 1/4] Update testees --- .../gen/conformance/conformance_pb.ts | 2 +- .../protobuf/test_messages_proto2_pb.ts | 2 +- .../protobuf/test_messages_proto3_pb.ts | 2 +- impl/baseline/package-lock.json | 62 +- impl/baseline/package.json | 4 +- .../gen/conformance/conformance_pb.ts | 2 +- .../protobuf/test_messages_proto2_pb.ts | 2 +- .../protobuf/test_messages_proto3_pb.ts | 2 +- impl/protobuf-es/package-lock.json | 62 +- impl/protobuf-es/package.json | 4 +- impl/ts-proto/gen/conformance/conformance.ts | 116 ++- impl/ts-proto/gen/google/protobuf/any.ts | 20 +- impl/ts-proto/gen/google/protobuf/duration.ts | 19 +- .../gen/google/protobuf/field_mask.ts | 3 +- impl/ts-proto/gen/google/protobuf/struct.ts | 66 +- .../google/protobuf/test_messages_proto3.ts | 982 +++++++++--------- .../ts-proto/gen/google/protobuf/timestamp.ts | 19 +- impl/ts-proto/gen/google/protobuf/wrappers.ts | 72 +- impl/ts-proto/package-lock.json | 158 +-- impl/ts-proto/package.json | 2 +- 20 files changed, 816 insertions(+), 785 deletions(-) diff --git a/impl/baseline/gen/conformance/conformance_pb.ts b/impl/baseline/gen/conformance/conformance_pb.ts index ec92a1cb..935ca8b3 100644 --- a/impl/baseline/gen/conformance/conformance_pb.ts +++ b/impl/baseline/gen/conformance/conformance_pb.ts @@ -28,7 +28,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// @generated by protoc-gen-es v1.2.1 with parameter "target=ts" +// @generated by protoc-gen-es v1.3.0 with parameter "target=ts" // @generated from file conformance/conformance.proto (package conformance, syntax proto3) /* eslint-disable */ // @ts-nocheck diff --git a/impl/baseline/gen/google/protobuf/test_messages_proto2_pb.ts b/impl/baseline/gen/google/protobuf/test_messages_proto2_pb.ts index c11eadc3..4a95a07a 100644 --- a/impl/baseline/gen/google/protobuf/test_messages_proto2_pb.ts +++ b/impl/baseline/gen/google/protobuf/test_messages_proto2_pb.ts @@ -35,7 +35,7 @@ // LINT: ALLOW_GROUPS -// @generated by protoc-gen-es v1.2.1 with parameter "target=ts" +// @generated by protoc-gen-es v1.3.0 with parameter "target=ts" // @generated from file google/protobuf/test_messages_proto2.proto (package protobuf_test_messages.proto2, syntax proto2) /* eslint-disable */ // @ts-nocheck diff --git a/impl/baseline/gen/google/protobuf/test_messages_proto3_pb.ts b/impl/baseline/gen/google/protobuf/test_messages_proto3_pb.ts index 5e5adad1..2770390a 100644 --- a/impl/baseline/gen/google/protobuf/test_messages_proto3_pb.ts +++ b/impl/baseline/gen/google/protobuf/test_messages_proto3_pb.ts @@ -35,7 +35,7 @@ // - conformance tests // -// @generated by protoc-gen-es v1.2.1 with parameter "target=ts" +// @generated by protoc-gen-es v1.3.0 with parameter "target=ts" // @generated from file google/protobuf/test_messages_proto3.proto (package protobuf_test_messages.proto3, syntax proto3) /* eslint-disable */ // @ts-nocheck diff --git a/impl/baseline/package-lock.json b/impl/baseline/package-lock.json index 811a137f..b98da38d 100644 --- a/impl/baseline/package-lock.json +++ b/impl/baseline/package-lock.json @@ -6,8 +6,8 @@ "": { "name": "baseline", "dependencies": { - "@bufbuild/protobuf": "1.2.1", - "@bufbuild/protoc-gen-es": "^1.2.1" + "@bufbuild/protobuf": "^1.3.0", + "@bufbuild/protoc-gen-es": "^1.3.0" }, "devDependencies": { "@bufbuild/buf": "^1.25.0", @@ -136,16 +136,16 @@ } }, "node_modules/@bufbuild/protobuf": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-1.2.1.tgz", - "integrity": "sha512-cwwGvLGqvoaOZmoP5+i4v/rbW+rHkguvTehuZyM2p/xpmaNSdT2h3B7kHw33aiffv35t1XrYHIkdJSEkSEMJuA==" + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-1.3.0.tgz", + "integrity": "sha512-G372ods0pLt46yxVRsnP/e2btVPuuzArcMPFpIDeIwiGPuuglEs9y75iG0HMvZgncsj5TvbYRWqbVyOe3PLCWQ==" }, "node_modules/@bufbuild/protoc-gen-es": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@bufbuild/protoc-gen-es/-/protoc-gen-es-1.2.1.tgz", - "integrity": "sha512-Nfg4ZTYciAgzqrbuGtRHR2TV4tueP10cRSD/joe57EeT0hfiXT0oQzH4OO3CzqqZvMxfkxpO4jgJgtwdQd941g==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@bufbuild/protoc-gen-es/-/protoc-gen-es-1.3.0.tgz", + "integrity": "sha512-XxGZwpXMYlwoSyJwCTFb7SZ2xKmv2iCRM022t1wszhY3kNL7rjpyj+3GbpCOjaM1T7NAoLnW0Hyb/M0b0XDb3Q==", "dependencies": { - "@bufbuild/protoplugin": "1.2.1" + "@bufbuild/protoplugin": "1.3.0" }, "bin": { "protoc-gen-es": "bin/protoc-gen-es" @@ -154,7 +154,7 @@ "node": ">=14" }, "peerDependencies": { - "@bufbuild/protobuf": "1.2.1" + "@bufbuild/protobuf": "1.3.0" }, "peerDependenciesMeta": { "@bufbuild/protobuf": { @@ -163,11 +163,11 @@ } }, "node_modules/@bufbuild/protoplugin": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@bufbuild/protoplugin/-/protoplugin-1.2.1.tgz", - "integrity": "sha512-7VtPgJGXcOszidMpQRQK9wm8QlKqC80Uc5XR9+Ej+DN4Ur64dAW1djZ7kLZ3ij6Z9IY4FteGQT+ubUNxzcW2NA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@bufbuild/protoplugin/-/protoplugin-1.3.0.tgz", + "integrity": "sha512-zye8CfJb9VWzaHR/f1qcEkddaRh9De+u6fORsj92Ten8EJUcyhiY5BivET+RMTissAKXKrp/f2zSBCV0dlFxPw==", "dependencies": { - "@bufbuild/protobuf": "1.2.1", + "@bufbuild/protobuf": "1.3.0", "@typescript/vfs": "^1.4.0", "typescript": "4.5.2" } @@ -573,9 +573,9 @@ "dev": true }, "node_modules/@typescript/vfs": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@typescript/vfs/-/vfs-1.4.0.tgz", - "integrity": "sha512-Pood7yv5YWMIX+yCHo176OnF8WUlKGImFG7XlsuH14Zb1YN5+dYD3uUtS7lqZtsH7tAveNUi2NzdpQCN0yRbaw==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@typescript/vfs/-/vfs-1.5.0.tgz", + "integrity": "sha512-AJS307bPgbsZZ9ggCT3wwpg3VbTKMFNHfaY/uF0ahSkYYrPF2dSSKDNIDIQAHm9qJqbLvCsSJH7yN4Vs/CsMMg==", "dependencies": { "debug": "^4.1.1" } @@ -775,24 +775,24 @@ "optional": true }, "@bufbuild/protobuf": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-1.2.1.tgz", - "integrity": "sha512-cwwGvLGqvoaOZmoP5+i4v/rbW+rHkguvTehuZyM2p/xpmaNSdT2h3B7kHw33aiffv35t1XrYHIkdJSEkSEMJuA==" + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-1.3.0.tgz", + "integrity": "sha512-G372ods0pLt46yxVRsnP/e2btVPuuzArcMPFpIDeIwiGPuuglEs9y75iG0HMvZgncsj5TvbYRWqbVyOe3PLCWQ==" }, "@bufbuild/protoc-gen-es": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@bufbuild/protoc-gen-es/-/protoc-gen-es-1.2.1.tgz", - "integrity": "sha512-Nfg4ZTYciAgzqrbuGtRHR2TV4tueP10cRSD/joe57EeT0hfiXT0oQzH4OO3CzqqZvMxfkxpO4jgJgtwdQd941g==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@bufbuild/protoc-gen-es/-/protoc-gen-es-1.3.0.tgz", + "integrity": "sha512-XxGZwpXMYlwoSyJwCTFb7SZ2xKmv2iCRM022t1wszhY3kNL7rjpyj+3GbpCOjaM1T7NAoLnW0Hyb/M0b0XDb3Q==", "requires": { - "@bufbuild/protoplugin": "1.2.1" + "@bufbuild/protoplugin": "1.3.0" } }, "@bufbuild/protoplugin": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@bufbuild/protoplugin/-/protoplugin-1.2.1.tgz", - "integrity": "sha512-7VtPgJGXcOszidMpQRQK9wm8QlKqC80Uc5XR9+Ej+DN4Ur64dAW1djZ7kLZ3ij6Z9IY4FteGQT+ubUNxzcW2NA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@bufbuild/protoplugin/-/protoplugin-1.3.0.tgz", + "integrity": "sha512-zye8CfJb9VWzaHR/f1qcEkddaRh9De+u6fORsj92Ten8EJUcyhiY5BivET+RMTissAKXKrp/f2zSBCV0dlFxPw==", "requires": { - "@bufbuild/protobuf": "1.2.1", + "@bufbuild/protobuf": "1.3.0", "@typescript/vfs": "^1.4.0", "typescript": "4.5.2" }, @@ -995,9 +995,9 @@ "dev": true }, "@typescript/vfs": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@typescript/vfs/-/vfs-1.4.0.tgz", - "integrity": "sha512-Pood7yv5YWMIX+yCHo176OnF8WUlKGImFG7XlsuH14Zb1YN5+dYD3uUtS7lqZtsH7tAveNUi2NzdpQCN0yRbaw==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@typescript/vfs/-/vfs-1.5.0.tgz", + "integrity": "sha512-AJS307bPgbsZZ9ggCT3wwpg3VbTKMFNHfaY/uF0ahSkYYrPF2dSSKDNIDIQAHm9qJqbLvCsSJH7yN4Vs/CsMMg==", "requires": { "debug": "^4.1.1" } diff --git a/impl/baseline/package.json b/impl/baseline/package.json index 0c0c24b4..844d4372 100644 --- a/impl/baseline/package.json +++ b/impl/baseline/package.json @@ -3,8 +3,8 @@ "private": true, "type": "module", "dependencies": { - "@bufbuild/protobuf": "1.2.1", - "@bufbuild/protoc-gen-es": "^1.2.1" + "@bufbuild/protobuf": "^1.3.0", + "@bufbuild/protoc-gen-es": "^1.3.0" }, "devDependencies": { "@bufbuild/buf": "^1.25.0", diff --git a/impl/protobuf-es/gen/conformance/conformance_pb.ts b/impl/protobuf-es/gen/conformance/conformance_pb.ts index ec92a1cb..935ca8b3 100644 --- a/impl/protobuf-es/gen/conformance/conformance_pb.ts +++ b/impl/protobuf-es/gen/conformance/conformance_pb.ts @@ -28,7 +28,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// @generated by protoc-gen-es v1.2.1 with parameter "target=ts" +// @generated by protoc-gen-es v1.3.0 with parameter "target=ts" // @generated from file conformance/conformance.proto (package conformance, syntax proto3) /* eslint-disable */ // @ts-nocheck diff --git a/impl/protobuf-es/gen/google/protobuf/test_messages_proto2_pb.ts b/impl/protobuf-es/gen/google/protobuf/test_messages_proto2_pb.ts index c11eadc3..4a95a07a 100644 --- a/impl/protobuf-es/gen/google/protobuf/test_messages_proto2_pb.ts +++ b/impl/protobuf-es/gen/google/protobuf/test_messages_proto2_pb.ts @@ -35,7 +35,7 @@ // LINT: ALLOW_GROUPS -// @generated by protoc-gen-es v1.2.1 with parameter "target=ts" +// @generated by protoc-gen-es v1.3.0 with parameter "target=ts" // @generated from file google/protobuf/test_messages_proto2.proto (package protobuf_test_messages.proto2, syntax proto2) /* eslint-disable */ // @ts-nocheck diff --git a/impl/protobuf-es/gen/google/protobuf/test_messages_proto3_pb.ts b/impl/protobuf-es/gen/google/protobuf/test_messages_proto3_pb.ts index 5e5adad1..2770390a 100644 --- a/impl/protobuf-es/gen/google/protobuf/test_messages_proto3_pb.ts +++ b/impl/protobuf-es/gen/google/protobuf/test_messages_proto3_pb.ts @@ -35,7 +35,7 @@ // - conformance tests // -// @generated by protoc-gen-es v1.2.1 with parameter "target=ts" +// @generated by protoc-gen-es v1.3.0 with parameter "target=ts" // @generated from file google/protobuf/test_messages_proto3.proto (package protobuf_test_messages.proto3, syntax proto3) /* eslint-disable */ // @ts-nocheck diff --git a/impl/protobuf-es/package-lock.json b/impl/protobuf-es/package-lock.json index bc1d99a6..7bcf7d72 100644 --- a/impl/protobuf-es/package-lock.json +++ b/impl/protobuf-es/package-lock.json @@ -6,8 +6,8 @@ "": { "name": "protobuf-es-conformance", "dependencies": { - "@bufbuild/protobuf": "1.2.1", - "@bufbuild/protoc-gen-es": "^1.2.1" + "@bufbuild/protobuf": "^1.3.0", + "@bufbuild/protoc-gen-es": "^1.3.0" }, "devDependencies": { "@bufbuild/buf": "^1.25.0", @@ -136,16 +136,16 @@ } }, "node_modules/@bufbuild/protobuf": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-1.2.1.tgz", - "integrity": "sha512-cwwGvLGqvoaOZmoP5+i4v/rbW+rHkguvTehuZyM2p/xpmaNSdT2h3B7kHw33aiffv35t1XrYHIkdJSEkSEMJuA==" + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-1.3.0.tgz", + "integrity": "sha512-G372ods0pLt46yxVRsnP/e2btVPuuzArcMPFpIDeIwiGPuuglEs9y75iG0HMvZgncsj5TvbYRWqbVyOe3PLCWQ==" }, "node_modules/@bufbuild/protoc-gen-es": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@bufbuild/protoc-gen-es/-/protoc-gen-es-1.2.1.tgz", - "integrity": "sha512-Nfg4ZTYciAgzqrbuGtRHR2TV4tueP10cRSD/joe57EeT0hfiXT0oQzH4OO3CzqqZvMxfkxpO4jgJgtwdQd941g==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@bufbuild/protoc-gen-es/-/protoc-gen-es-1.3.0.tgz", + "integrity": "sha512-XxGZwpXMYlwoSyJwCTFb7SZ2xKmv2iCRM022t1wszhY3kNL7rjpyj+3GbpCOjaM1T7NAoLnW0Hyb/M0b0XDb3Q==", "dependencies": { - "@bufbuild/protoplugin": "1.2.1" + "@bufbuild/protoplugin": "1.3.0" }, "bin": { "protoc-gen-es": "bin/protoc-gen-es" @@ -154,7 +154,7 @@ "node": ">=14" }, "peerDependencies": { - "@bufbuild/protobuf": "1.2.1" + "@bufbuild/protobuf": "1.3.0" }, "peerDependenciesMeta": { "@bufbuild/protobuf": { @@ -163,11 +163,11 @@ } }, "node_modules/@bufbuild/protoplugin": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@bufbuild/protoplugin/-/protoplugin-1.2.1.tgz", - "integrity": "sha512-7VtPgJGXcOszidMpQRQK9wm8QlKqC80Uc5XR9+Ej+DN4Ur64dAW1djZ7kLZ3ij6Z9IY4FteGQT+ubUNxzcW2NA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@bufbuild/protoplugin/-/protoplugin-1.3.0.tgz", + "integrity": "sha512-zye8CfJb9VWzaHR/f1qcEkddaRh9De+u6fORsj92Ten8EJUcyhiY5BivET+RMTissAKXKrp/f2zSBCV0dlFxPw==", "dependencies": { - "@bufbuild/protobuf": "1.2.1", + "@bufbuild/protobuf": "1.3.0", "@typescript/vfs": "^1.4.0", "typescript": "4.5.2" } @@ -573,9 +573,9 @@ "dev": true }, "node_modules/@typescript/vfs": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@typescript/vfs/-/vfs-1.4.0.tgz", - "integrity": "sha512-Pood7yv5YWMIX+yCHo176OnF8WUlKGImFG7XlsuH14Zb1YN5+dYD3uUtS7lqZtsH7tAveNUi2NzdpQCN0yRbaw==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@typescript/vfs/-/vfs-1.5.0.tgz", + "integrity": "sha512-AJS307bPgbsZZ9ggCT3wwpg3VbTKMFNHfaY/uF0ahSkYYrPF2dSSKDNIDIQAHm9qJqbLvCsSJH7yN4Vs/CsMMg==", "dependencies": { "debug": "^4.1.1" } @@ -775,24 +775,24 @@ "optional": true }, "@bufbuild/protobuf": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-1.2.1.tgz", - "integrity": "sha512-cwwGvLGqvoaOZmoP5+i4v/rbW+rHkguvTehuZyM2p/xpmaNSdT2h3B7kHw33aiffv35t1XrYHIkdJSEkSEMJuA==" + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-1.3.0.tgz", + "integrity": "sha512-G372ods0pLt46yxVRsnP/e2btVPuuzArcMPFpIDeIwiGPuuglEs9y75iG0HMvZgncsj5TvbYRWqbVyOe3PLCWQ==" }, "@bufbuild/protoc-gen-es": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@bufbuild/protoc-gen-es/-/protoc-gen-es-1.2.1.tgz", - "integrity": "sha512-Nfg4ZTYciAgzqrbuGtRHR2TV4tueP10cRSD/joe57EeT0hfiXT0oQzH4OO3CzqqZvMxfkxpO4jgJgtwdQd941g==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@bufbuild/protoc-gen-es/-/protoc-gen-es-1.3.0.tgz", + "integrity": "sha512-XxGZwpXMYlwoSyJwCTFb7SZ2xKmv2iCRM022t1wszhY3kNL7rjpyj+3GbpCOjaM1T7NAoLnW0Hyb/M0b0XDb3Q==", "requires": { - "@bufbuild/protoplugin": "1.2.1" + "@bufbuild/protoplugin": "1.3.0" } }, "@bufbuild/protoplugin": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@bufbuild/protoplugin/-/protoplugin-1.2.1.tgz", - "integrity": "sha512-7VtPgJGXcOszidMpQRQK9wm8QlKqC80Uc5XR9+Ej+DN4Ur64dAW1djZ7kLZ3ij6Z9IY4FteGQT+ubUNxzcW2NA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@bufbuild/protoplugin/-/protoplugin-1.3.0.tgz", + "integrity": "sha512-zye8CfJb9VWzaHR/f1qcEkddaRh9De+u6fORsj92Ten8EJUcyhiY5BivET+RMTissAKXKrp/f2zSBCV0dlFxPw==", "requires": { - "@bufbuild/protobuf": "1.2.1", + "@bufbuild/protobuf": "1.3.0", "@typescript/vfs": "^1.4.0", "typescript": "4.5.2" }, @@ -995,9 +995,9 @@ "dev": true }, "@typescript/vfs": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@typescript/vfs/-/vfs-1.4.0.tgz", - "integrity": "sha512-Pood7yv5YWMIX+yCHo176OnF8WUlKGImFG7XlsuH14Zb1YN5+dYD3uUtS7lqZtsH7tAveNUi2NzdpQCN0yRbaw==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@typescript/vfs/-/vfs-1.5.0.tgz", + "integrity": "sha512-AJS307bPgbsZZ9ggCT3wwpg3VbTKMFNHfaY/uF0ahSkYYrPF2dSSKDNIDIQAHm9qJqbLvCsSJH7yN4Vs/CsMMg==", "requires": { "debug": "^4.1.1" } diff --git a/impl/protobuf-es/package.json b/impl/protobuf-es/package.json index 1bf414cb..245d48b3 100644 --- a/impl/protobuf-es/package.json +++ b/impl/protobuf-es/package.json @@ -3,8 +3,8 @@ "private": true, "type": "module", "dependencies": { - "@bufbuild/protobuf": "1.2.1", - "@bufbuild/protoc-gen-es": "^1.2.1" + "@bufbuild/protobuf": "^1.3.0", + "@bufbuild/protoc-gen-es": "^1.3.0" }, "devDependencies": { "@bufbuild/buf": "^1.25.0", diff --git a/impl/ts-proto/gen/conformance/conformance.ts b/impl/ts-proto/gen/conformance/conformance.ts index cca1a906..39d5bb42 100644 --- a/impl/ts-proto/gen/conformance/conformance.ts +++ b/impl/ts-proto/gen/conformance/conformance.ts @@ -142,7 +142,8 @@ export interface ConformanceRequest { | { $case: "protobufPayload"; protobufPayload: Uint8Array } | { $case: "jsonPayload"; jsonPayload: string } | { $case: "jspbPayload"; jspbPayload: string } - | { $case: "textPayload"; textPayload: string }; + | { $case: "textPayload"; textPayload: string } + | undefined; /** Which format should the testee serialize its message to? */ requestedOutputFormat: WireFormat; /** @@ -179,7 +180,8 @@ export interface ConformanceResponse { | { $case: "jsonPayload"; jsonPayload: string } | { $case: "skipped"; skipped: string } | { $case: "jspbPayload"; jspbPayload: string } - | { $case: "textPayload"; textPayload: string }; + | { $case: "textPayload"; textPayload: string } + | undefined; } /** Encoding options for jspb format. */ @@ -229,18 +231,15 @@ export const FailureSet = { toJSON(message: FailureSet): unknown { const obj: any = {}; - if (message.failure) { - obj.failure = message.failure.map((e) => e); - } else { - obj.failure = []; + if (message.failure?.length) { + obj.failure = message.failure; } return obj; }, create, I>>(base?: I): FailureSet { - return FailureSet.fromPartial(base ?? {}); + return FailureSet.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): FailureSet { const message = createBaseFailureSet(); message.failure = object.failure?.map((e) => e) || []; @@ -395,28 +394,39 @@ export const ConformanceRequest = { toJSON(message: ConformanceRequest): unknown { const obj: any = {}; - message.payload?.$case === "protobufPayload" && - (obj.protobufPayload = message.payload?.protobufPayload !== undefined - ? base64FromBytes(message.payload?.protobufPayload) - : undefined); - message.payload?.$case === "jsonPayload" && (obj.jsonPayload = message.payload?.jsonPayload); - message.payload?.$case === "jspbPayload" && (obj.jspbPayload = message.payload?.jspbPayload); - message.payload?.$case === "textPayload" && (obj.textPayload = message.payload?.textPayload); - message.requestedOutputFormat !== undefined && - (obj.requestedOutputFormat = wireFormatToJSON(message.requestedOutputFormat)); - message.messageType !== undefined && (obj.messageType = message.messageType); - message.testCategory !== undefined && (obj.testCategory = testCategoryToJSON(message.testCategory)); - message.jspbEncodingOptions !== undefined && (obj.jspbEncodingOptions = message.jspbEncodingOptions - ? JspbEncodingConfig.toJSON(message.jspbEncodingOptions) - : undefined); - message.printUnknownFields !== undefined && (obj.printUnknownFields = message.printUnknownFields); + if (message.payload?.$case === "protobufPayload") { + obj.protobufPayload = base64FromBytes(message.payload.protobufPayload); + } + if (message.payload?.$case === "jsonPayload") { + obj.jsonPayload = message.payload.jsonPayload; + } + if (message.payload?.$case === "jspbPayload") { + obj.jspbPayload = message.payload.jspbPayload; + } + if (message.payload?.$case === "textPayload") { + obj.textPayload = message.payload.textPayload; + } + if (message.requestedOutputFormat !== 0) { + obj.requestedOutputFormat = wireFormatToJSON(message.requestedOutputFormat); + } + if (message.messageType !== "") { + obj.messageType = message.messageType; + } + if (message.testCategory !== 0) { + obj.testCategory = testCategoryToJSON(message.testCategory); + } + if (message.jspbEncodingOptions !== undefined) { + obj.jspbEncodingOptions = JspbEncodingConfig.toJSON(message.jspbEncodingOptions); + } + if (message.printUnknownFields === true) { + obj.printUnknownFields = message.printUnknownFields; + } return obj; }, create, I>>(base?: I): ConformanceRequest { - return ConformanceRequest.fromPartial(base ?? {}); + return ConformanceRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ConformanceRequest { const message = createBaseConformanceRequest(); if ( @@ -601,24 +611,39 @@ export const ConformanceResponse = { toJSON(message: ConformanceResponse): unknown { const obj: any = {}; - message.result?.$case === "parseError" && (obj.parseError = message.result?.parseError); - message.result?.$case === "serializeError" && (obj.serializeError = message.result?.serializeError); - message.result?.$case === "timeoutError" && (obj.timeoutError = message.result?.timeoutError); - message.result?.$case === "runtimeError" && (obj.runtimeError = message.result?.runtimeError); - message.result?.$case === "protobufPayload" && (obj.protobufPayload = message.result?.protobufPayload !== undefined - ? base64FromBytes(message.result?.protobufPayload) - : undefined); - message.result?.$case === "jsonPayload" && (obj.jsonPayload = message.result?.jsonPayload); - message.result?.$case === "skipped" && (obj.skipped = message.result?.skipped); - message.result?.$case === "jspbPayload" && (obj.jspbPayload = message.result?.jspbPayload); - message.result?.$case === "textPayload" && (obj.textPayload = message.result?.textPayload); + if (message.result?.$case === "parseError") { + obj.parseError = message.result.parseError; + } + if (message.result?.$case === "serializeError") { + obj.serializeError = message.result.serializeError; + } + if (message.result?.$case === "timeoutError") { + obj.timeoutError = message.result.timeoutError; + } + if (message.result?.$case === "runtimeError") { + obj.runtimeError = message.result.runtimeError; + } + if (message.result?.$case === "protobufPayload") { + obj.protobufPayload = base64FromBytes(message.result.protobufPayload); + } + if (message.result?.$case === "jsonPayload") { + obj.jsonPayload = message.result.jsonPayload; + } + if (message.result?.$case === "skipped") { + obj.skipped = message.result.skipped; + } + if (message.result?.$case === "jspbPayload") { + obj.jspbPayload = message.result.jspbPayload; + } + if (message.result?.$case === "textPayload") { + obj.textPayload = message.result.textPayload; + } return obj; }, create, I>>(base?: I): ConformanceResponse { - return ConformanceResponse.fromPartial(base ?? {}); + return ConformanceResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ConformanceResponse { const message = createBaseConformanceResponse(); if ( @@ -727,14 +752,15 @@ export const JspbEncodingConfig = { toJSON(message: JspbEncodingConfig): unknown { const obj: any = {}; - message.useJspbArrayAnyFormat !== undefined && (obj.useJspbArrayAnyFormat = message.useJspbArrayAnyFormat); + if (message.useJspbArrayAnyFormat === true) { + obj.useJspbArrayAnyFormat = message.useJspbArrayAnyFormat; + } return obj; }, create, I>>(base?: I): JspbEncodingConfig { - return JspbEncodingConfig.fromPartial(base ?? {}); + return JspbEncodingConfig.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): JspbEncodingConfig { const message = createBaseJspbEncodingConfig(); message.useJspbArrayAnyFormat = object.useJspbArrayAnyFormat ?? false; @@ -742,10 +768,10 @@ export const JspbEncodingConfig = { }, }; -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var tsProtoGlobalThis: any = (() => { +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: any = (() => { if (typeof globalThis !== "undefined") { return globalThis; } diff --git a/impl/ts-proto/gen/google/protobuf/any.ts b/impl/ts-proto/gen/google/protobuf/any.ts index 589dbbb6..6409ccb2 100644 --- a/impl/ts-proto/gen/google/protobuf/any.ts +++ b/impl/ts-proto/gen/google/protobuf/any.ts @@ -179,16 +179,18 @@ export const Any = { toJSON(message: Any): unknown { const obj: any = {}; - message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); - message.value !== undefined && - (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array(0))); + if (message.typeUrl !== "") { + obj.typeUrl = message.typeUrl; + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } return obj; }, create, I>>(base?: I): Any { - return Any.fromPartial(base ?? {}); + return Any.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Any { const message = createBaseAny(); message.typeUrl = object.typeUrl ?? ""; @@ -197,10 +199,10 @@ export const Any = { }, }; -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var tsProtoGlobalThis: any = (() => { +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: any = (() => { if (typeof globalThis !== "undefined") { return globalThis; } diff --git a/impl/ts-proto/gen/google/protobuf/duration.ts b/impl/ts-proto/gen/google/protobuf/duration.ts index 0448cbf5..730d3096 100644 --- a/impl/ts-proto/gen/google/protobuf/duration.ts +++ b/impl/ts-proto/gen/google/protobuf/duration.ts @@ -136,15 +136,18 @@ export const Duration = { toJSON(message: Duration): unknown { const obj: any = {}; - message.seconds !== undefined && (obj.seconds = Math.round(message.seconds)); - message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); + if (message.seconds !== 0) { + obj.seconds = Math.round(message.seconds); + } + if (message.nanos !== 0) { + obj.nanos = Math.round(message.nanos); + } return obj; }, create, I>>(base?: I): Duration { - return Duration.fromPartial(base ?? {}); + return Duration.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Duration { const message = createBaseDuration(); message.seconds = object.seconds ?? 0; @@ -153,10 +156,10 @@ export const Duration = { }, }; -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var tsProtoGlobalThis: any = (() => { +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: any = (() => { if (typeof globalThis !== "undefined") { return globalThis; } diff --git a/impl/ts-proto/gen/google/protobuf/field_mask.ts b/impl/ts-proto/gen/google/protobuf/field_mask.ts index dfe74290..4c473d8e 100644 --- a/impl/ts-proto/gen/google/protobuf/field_mask.ts +++ b/impl/ts-proto/gen/google/protobuf/field_mask.ts @@ -258,9 +258,8 @@ export const FieldMask = { }, create, I>>(base?: I): FieldMask { - return FieldMask.fromPartial(base ?? {}); + return FieldMask.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): FieldMask { const message = createBaseFieldMask(); message.paths = object.paths?.map((e) => e) || []; diff --git a/impl/ts-proto/gen/google/protobuf/struct.ts b/impl/ts-proto/gen/google/protobuf/struct.ts index f407a531..5325f1b1 100644 --- a/impl/ts-proto/gen/google/protobuf/struct.ts +++ b/impl/ts-proto/gen/google/protobuf/struct.ts @@ -68,7 +68,8 @@ export interface Value { | { $case: "stringValue"; stringValue: string } | { $case: "boolValue"; boolValue: boolean } | { $case: "structValue"; structValue: { [key: string]: any } | undefined } - | { $case: "listValue"; listValue: Array | undefined }; + | { $case: "listValue"; listValue: Array | undefined } + | undefined; } /** @@ -134,8 +135,8 @@ export const Struct = { toJSON(message: Struct): unknown { const obj: any = {}; - obj.fields = {}; - if (message.fields) { + if (message.fields?.size) { + obj.fields = {}; message.fields.forEach((v, k) => { obj.fields[k] = v; }); @@ -144,9 +145,8 @@ export const Struct = { }, create, I>>(base?: I): Struct { - return Struct.fromPartial(base ?? {}); + return Struct.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct { const message = createBaseStruct(); message.fields = (() => { @@ -231,15 +231,18 @@ export const Struct_FieldsEntry = { toJSON(message: Struct_FieldsEntry): unknown { const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = message.value; + } return obj; }, create, I>>(base?: I): Struct_FieldsEntry { - return Struct_FieldsEntry.fromPartial(base ?? {}); + return Struct_FieldsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct_FieldsEntry { const message = createBaseStruct_FieldsEntry(); message.key = object.key ?? ""; @@ -355,20 +358,30 @@ export const Value = { toJSON(message: Value): unknown { const obj: any = {}; - message.kind?.$case === "nullValue" && - (obj.nullValue = message.kind?.nullValue !== undefined ? nullValueToJSON(message.kind?.nullValue) : undefined); - message.kind?.$case === "numberValue" && (obj.numberValue = message.kind?.numberValue); - message.kind?.$case === "stringValue" && (obj.stringValue = message.kind?.stringValue); - message.kind?.$case === "boolValue" && (obj.boolValue = message.kind?.boolValue); - message.kind?.$case === "structValue" && (obj.structValue = message.kind?.structValue); - message.kind?.$case === "listValue" && (obj.listValue = message.kind?.listValue); + if (message.kind?.$case === "nullValue") { + obj.nullValue = nullValueToJSON(message.kind.nullValue); + } + if (message.kind?.$case === "numberValue") { + obj.numberValue = message.kind.numberValue; + } + if (message.kind?.$case === "stringValue") { + obj.stringValue = message.kind.stringValue; + } + if (message.kind?.$case === "boolValue") { + obj.boolValue = message.kind.boolValue; + } + if (message.kind?.$case === "structValue") { + obj.structValue = message.kind.structValue; + } + if (message.kind?.$case === "listValue") { + obj.listValue = message.kind.listValue; + } return obj; }, create, I>>(base?: I): Value { - return Value.fromPartial(base ?? {}); + return Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Value { const message = createBaseValue(); if (object.kind?.$case === "nullValue" && object.kind?.nullValue !== undefined && object.kind?.nullValue !== null) { @@ -484,18 +497,15 @@ export const ListValue = { toJSON(message: ListValue): unknown { const obj: any = {}; - if (message.values) { - obj.values = message.values.map((e) => e); - } else { - obj.values = []; + if (message.values?.length) { + obj.values = message.values; } return obj; }, create, I>>(base?: I): ListValue { - return ListValue.fromPartial(base ?? {}); + return ListValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ListValue { const message = createBaseListValue(); message.values = object.values?.map((e) => e) || []; @@ -517,10 +527,10 @@ export const ListValue = { }, }; -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var tsProtoGlobalThis: any = (() => { +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: any = (() => { if (typeof globalThis !== "undefined") { return globalThis; } diff --git a/impl/ts-proto/gen/google/protobuf/test_messages_proto3.ts b/impl/ts-proto/gen/google/protobuf/test_messages_proto3.ts index d22ad134..15ecad0d 100644 --- a/impl/ts-proto/gen/google/protobuf/test_messages_proto3.ts +++ b/impl/ts-proto/gen/google/protobuf/test_messages_proto3.ts @@ -173,7 +173,8 @@ export interface TestAllTypesProto3 { | { $case: "oneofFloat"; oneofFloat: number } | { $case: "oneofDouble"; oneofDouble: number } | { $case: "oneofEnum"; oneofEnum: TestAllTypesProto3_NestedEnum } - | { $case: "oneofNullValue"; oneofNullValue: NullValue }; + | { $case: "oneofNullValue"; oneofNullValue: NullValue } + | undefined; /** Well-known types */ optionalBoolWrapper: boolean | undefined; optionalInt32Wrapper: number | undefined; @@ -3073,547 +3074,522 @@ export const TestAllTypesProto3 = { toJSON(message: TestAllTypesProto3): unknown { const obj: any = {}; - message.optionalInt32 !== undefined && (obj.optionalInt32 = Math.round(message.optionalInt32)); - message.optionalInt64 !== undefined && (obj.optionalInt64 = Math.round(message.optionalInt64)); - message.optionalUint32 !== undefined && (obj.optionalUint32 = Math.round(message.optionalUint32)); - message.optionalUint64 !== undefined && (obj.optionalUint64 = Math.round(message.optionalUint64)); - message.optionalSint32 !== undefined && (obj.optionalSint32 = Math.round(message.optionalSint32)); - message.optionalSint64 !== undefined && (obj.optionalSint64 = Math.round(message.optionalSint64)); - message.optionalFixed32 !== undefined && (obj.optionalFixed32 = Math.round(message.optionalFixed32)); - message.optionalFixed64 !== undefined && (obj.optionalFixed64 = Math.round(message.optionalFixed64)); - message.optionalSfixed32 !== undefined && (obj.optionalSfixed32 = Math.round(message.optionalSfixed32)); - message.optionalSfixed64 !== undefined && (obj.optionalSfixed64 = Math.round(message.optionalSfixed64)); - message.optionalFloat !== undefined && (obj.optionalFloat = message.optionalFloat); - message.optionalDouble !== undefined && (obj.optionalDouble = message.optionalDouble); - message.optionalBool !== undefined && (obj.optionalBool = message.optionalBool); - message.optionalString !== undefined && (obj.optionalString = message.optionalString); - message.optionalBytes !== undefined && - (obj.optionalBytes = base64FromBytes( - message.optionalBytes !== undefined ? message.optionalBytes : new Uint8Array(0), - )); - message.optionalNestedMessage !== undefined && (obj.optionalNestedMessage = message.optionalNestedMessage - ? TestAllTypesProto3_NestedMessage.toJSON(message.optionalNestedMessage) - : undefined); - message.optionalForeignMessage !== undefined && (obj.optionalForeignMessage = message.optionalForeignMessage - ? ForeignMessage.toJSON(message.optionalForeignMessage) - : undefined); - message.optionalNestedEnum !== undefined && - (obj.optionalNestedEnum = testAllTypesProto3_NestedEnumToJSON(message.optionalNestedEnum)); - message.optionalForeignEnum !== undefined && - (obj.optionalForeignEnum = foreignEnumToJSON(message.optionalForeignEnum)); - message.optionalAliasedEnum !== undefined && - (obj.optionalAliasedEnum = testAllTypesProto3_AliasedEnumToJSON(message.optionalAliasedEnum)); - message.optionalStringPiece !== undefined && (obj.optionalStringPiece = message.optionalStringPiece); - message.optionalCord !== undefined && (obj.optionalCord = message.optionalCord); - message.recursiveMessage !== undefined && - (obj.recursiveMessage = message.recursiveMessage - ? TestAllTypesProto3.toJSON(message.recursiveMessage) - : undefined); - if (message.repeatedInt32) { + if (message.optionalInt32 !== 0) { + obj.optionalInt32 = Math.round(message.optionalInt32); + } + if (message.optionalInt64 !== 0) { + obj.optionalInt64 = Math.round(message.optionalInt64); + } + if (message.optionalUint32 !== 0) { + obj.optionalUint32 = Math.round(message.optionalUint32); + } + if (message.optionalUint64 !== 0) { + obj.optionalUint64 = Math.round(message.optionalUint64); + } + if (message.optionalSint32 !== 0) { + obj.optionalSint32 = Math.round(message.optionalSint32); + } + if (message.optionalSint64 !== 0) { + obj.optionalSint64 = Math.round(message.optionalSint64); + } + if (message.optionalFixed32 !== 0) { + obj.optionalFixed32 = Math.round(message.optionalFixed32); + } + if (message.optionalFixed64 !== 0) { + obj.optionalFixed64 = Math.round(message.optionalFixed64); + } + if (message.optionalSfixed32 !== 0) { + obj.optionalSfixed32 = Math.round(message.optionalSfixed32); + } + if (message.optionalSfixed64 !== 0) { + obj.optionalSfixed64 = Math.round(message.optionalSfixed64); + } + if (message.optionalFloat !== 0) { + obj.optionalFloat = message.optionalFloat; + } + if (message.optionalDouble !== 0) { + obj.optionalDouble = message.optionalDouble; + } + if (message.optionalBool === true) { + obj.optionalBool = message.optionalBool; + } + if (message.optionalString !== "") { + obj.optionalString = message.optionalString; + } + if (message.optionalBytes.length !== 0) { + obj.optionalBytes = base64FromBytes(message.optionalBytes); + } + if (message.optionalNestedMessage !== undefined) { + obj.optionalNestedMessage = TestAllTypesProto3_NestedMessage.toJSON(message.optionalNestedMessage); + } + if (message.optionalForeignMessage !== undefined) { + obj.optionalForeignMessage = ForeignMessage.toJSON(message.optionalForeignMessage); + } + if (message.optionalNestedEnum !== 0) { + obj.optionalNestedEnum = testAllTypesProto3_NestedEnumToJSON(message.optionalNestedEnum); + } + if (message.optionalForeignEnum !== 0) { + obj.optionalForeignEnum = foreignEnumToJSON(message.optionalForeignEnum); + } + if (message.optionalAliasedEnum !== 0) { + obj.optionalAliasedEnum = testAllTypesProto3_AliasedEnumToJSON(message.optionalAliasedEnum); + } + if (message.optionalStringPiece !== "") { + obj.optionalStringPiece = message.optionalStringPiece; + } + if (message.optionalCord !== "") { + obj.optionalCord = message.optionalCord; + } + if (message.recursiveMessage !== undefined) { + obj.recursiveMessage = TestAllTypesProto3.toJSON(message.recursiveMessage); + } + if (message.repeatedInt32?.length) { obj.repeatedInt32 = message.repeatedInt32.map((e) => Math.round(e)); - } else { - obj.repeatedInt32 = []; } - if (message.repeatedInt64) { + if (message.repeatedInt64?.length) { obj.repeatedInt64 = message.repeatedInt64.map((e) => Math.round(e)); - } else { - obj.repeatedInt64 = []; } - if (message.repeatedUint32) { + if (message.repeatedUint32?.length) { obj.repeatedUint32 = message.repeatedUint32.map((e) => Math.round(e)); - } else { - obj.repeatedUint32 = []; } - if (message.repeatedUint64) { + if (message.repeatedUint64?.length) { obj.repeatedUint64 = message.repeatedUint64.map((e) => Math.round(e)); - } else { - obj.repeatedUint64 = []; } - if (message.repeatedSint32) { + if (message.repeatedSint32?.length) { obj.repeatedSint32 = message.repeatedSint32.map((e) => Math.round(e)); - } else { - obj.repeatedSint32 = []; } - if (message.repeatedSint64) { + if (message.repeatedSint64?.length) { obj.repeatedSint64 = message.repeatedSint64.map((e) => Math.round(e)); - } else { - obj.repeatedSint64 = []; } - if (message.repeatedFixed32) { + if (message.repeatedFixed32?.length) { obj.repeatedFixed32 = message.repeatedFixed32.map((e) => Math.round(e)); - } else { - obj.repeatedFixed32 = []; } - if (message.repeatedFixed64) { + if (message.repeatedFixed64?.length) { obj.repeatedFixed64 = message.repeatedFixed64.map((e) => Math.round(e)); - } else { - obj.repeatedFixed64 = []; } - if (message.repeatedSfixed32) { + if (message.repeatedSfixed32?.length) { obj.repeatedSfixed32 = message.repeatedSfixed32.map((e) => Math.round(e)); - } else { - obj.repeatedSfixed32 = []; } - if (message.repeatedSfixed64) { + if (message.repeatedSfixed64?.length) { obj.repeatedSfixed64 = message.repeatedSfixed64.map((e) => Math.round(e)); - } else { - obj.repeatedSfixed64 = []; - } - if (message.repeatedFloat) { - obj.repeatedFloat = message.repeatedFloat.map((e) => e); - } else { - obj.repeatedFloat = []; - } - if (message.repeatedDouble) { - obj.repeatedDouble = message.repeatedDouble.map((e) => e); - } else { - obj.repeatedDouble = []; - } - if (message.repeatedBool) { - obj.repeatedBool = message.repeatedBool.map((e) => e); - } else { - obj.repeatedBool = []; - } - if (message.repeatedString) { - obj.repeatedString = message.repeatedString.map((e) => e); - } else { - obj.repeatedString = []; - } - if (message.repeatedBytes) { - obj.repeatedBytes = message.repeatedBytes.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array(0))); - } else { - obj.repeatedBytes = []; - } - if (message.repeatedNestedMessage) { - obj.repeatedNestedMessage = message.repeatedNestedMessage.map((e) => - e ? TestAllTypesProto3_NestedMessage.toJSON(e) : undefined - ); - } else { - obj.repeatedNestedMessage = []; } - if (message.repeatedForeignMessage) { - obj.repeatedForeignMessage = message.repeatedForeignMessage.map((e) => e ? ForeignMessage.toJSON(e) : undefined); - } else { - obj.repeatedForeignMessage = []; + if (message.repeatedFloat?.length) { + obj.repeatedFloat = message.repeatedFloat; } - if (message.repeatedNestedEnum) { + if (message.repeatedDouble?.length) { + obj.repeatedDouble = message.repeatedDouble; + } + if (message.repeatedBool?.length) { + obj.repeatedBool = message.repeatedBool; + } + if (message.repeatedString?.length) { + obj.repeatedString = message.repeatedString; + } + if (message.repeatedBytes?.length) { + obj.repeatedBytes = message.repeatedBytes.map((e) => base64FromBytes(e)); + } + if (message.repeatedNestedMessage?.length) { + obj.repeatedNestedMessage = message.repeatedNestedMessage.map((e) => TestAllTypesProto3_NestedMessage.toJSON(e)); + } + if (message.repeatedForeignMessage?.length) { + obj.repeatedForeignMessage = message.repeatedForeignMessage.map((e) => ForeignMessage.toJSON(e)); + } + if (message.repeatedNestedEnum?.length) { obj.repeatedNestedEnum = message.repeatedNestedEnum.map((e) => testAllTypesProto3_NestedEnumToJSON(e)); - } else { - obj.repeatedNestedEnum = []; } - if (message.repeatedForeignEnum) { + if (message.repeatedForeignEnum?.length) { obj.repeatedForeignEnum = message.repeatedForeignEnum.map((e) => foreignEnumToJSON(e)); - } else { - obj.repeatedForeignEnum = []; } - if (message.repeatedStringPiece) { - obj.repeatedStringPiece = message.repeatedStringPiece.map((e) => e); - } else { - obj.repeatedStringPiece = []; + if (message.repeatedStringPiece?.length) { + obj.repeatedStringPiece = message.repeatedStringPiece; } - if (message.repeatedCord) { - obj.repeatedCord = message.repeatedCord.map((e) => e); - } else { - obj.repeatedCord = []; + if (message.repeatedCord?.length) { + obj.repeatedCord = message.repeatedCord; } - if (message.packedInt32) { + if (message.packedInt32?.length) { obj.packedInt32 = message.packedInt32.map((e) => Math.round(e)); - } else { - obj.packedInt32 = []; } - if (message.packedInt64) { + if (message.packedInt64?.length) { obj.packedInt64 = message.packedInt64.map((e) => Math.round(e)); - } else { - obj.packedInt64 = []; } - if (message.packedUint32) { + if (message.packedUint32?.length) { obj.packedUint32 = message.packedUint32.map((e) => Math.round(e)); - } else { - obj.packedUint32 = []; } - if (message.packedUint64) { + if (message.packedUint64?.length) { obj.packedUint64 = message.packedUint64.map((e) => Math.round(e)); - } else { - obj.packedUint64 = []; } - if (message.packedSint32) { + if (message.packedSint32?.length) { obj.packedSint32 = message.packedSint32.map((e) => Math.round(e)); - } else { - obj.packedSint32 = []; } - if (message.packedSint64) { + if (message.packedSint64?.length) { obj.packedSint64 = message.packedSint64.map((e) => Math.round(e)); - } else { - obj.packedSint64 = []; } - if (message.packedFixed32) { + if (message.packedFixed32?.length) { obj.packedFixed32 = message.packedFixed32.map((e) => Math.round(e)); - } else { - obj.packedFixed32 = []; } - if (message.packedFixed64) { + if (message.packedFixed64?.length) { obj.packedFixed64 = message.packedFixed64.map((e) => Math.round(e)); - } else { - obj.packedFixed64 = []; } - if (message.packedSfixed32) { + if (message.packedSfixed32?.length) { obj.packedSfixed32 = message.packedSfixed32.map((e) => Math.round(e)); - } else { - obj.packedSfixed32 = []; } - if (message.packedSfixed64) { + if (message.packedSfixed64?.length) { obj.packedSfixed64 = message.packedSfixed64.map((e) => Math.round(e)); - } else { - obj.packedSfixed64 = []; } - if (message.packedFloat) { - obj.packedFloat = message.packedFloat.map((e) => e); - } else { - obj.packedFloat = []; + if (message.packedFloat?.length) { + obj.packedFloat = message.packedFloat; } - if (message.packedDouble) { - obj.packedDouble = message.packedDouble.map((e) => e); - } else { - obj.packedDouble = []; + if (message.packedDouble?.length) { + obj.packedDouble = message.packedDouble; } - if (message.packedBool) { - obj.packedBool = message.packedBool.map((e) => e); - } else { - obj.packedBool = []; + if (message.packedBool?.length) { + obj.packedBool = message.packedBool; } - if (message.packedNestedEnum) { + if (message.packedNestedEnum?.length) { obj.packedNestedEnum = message.packedNestedEnum.map((e) => testAllTypesProto3_NestedEnumToJSON(e)); - } else { - obj.packedNestedEnum = []; } - if (message.unpackedInt32) { + if (message.unpackedInt32?.length) { obj.unpackedInt32 = message.unpackedInt32.map((e) => Math.round(e)); - } else { - obj.unpackedInt32 = []; } - if (message.unpackedInt64) { + if (message.unpackedInt64?.length) { obj.unpackedInt64 = message.unpackedInt64.map((e) => Math.round(e)); - } else { - obj.unpackedInt64 = []; } - if (message.unpackedUint32) { + if (message.unpackedUint32?.length) { obj.unpackedUint32 = message.unpackedUint32.map((e) => Math.round(e)); - } else { - obj.unpackedUint32 = []; } - if (message.unpackedUint64) { + if (message.unpackedUint64?.length) { obj.unpackedUint64 = message.unpackedUint64.map((e) => Math.round(e)); - } else { - obj.unpackedUint64 = []; } - if (message.unpackedSint32) { + if (message.unpackedSint32?.length) { obj.unpackedSint32 = message.unpackedSint32.map((e) => Math.round(e)); - } else { - obj.unpackedSint32 = []; } - if (message.unpackedSint64) { + if (message.unpackedSint64?.length) { obj.unpackedSint64 = message.unpackedSint64.map((e) => Math.round(e)); - } else { - obj.unpackedSint64 = []; } - if (message.unpackedFixed32) { + if (message.unpackedFixed32?.length) { obj.unpackedFixed32 = message.unpackedFixed32.map((e) => Math.round(e)); - } else { - obj.unpackedFixed32 = []; } - if (message.unpackedFixed64) { + if (message.unpackedFixed64?.length) { obj.unpackedFixed64 = message.unpackedFixed64.map((e) => Math.round(e)); - } else { - obj.unpackedFixed64 = []; } - if (message.unpackedSfixed32) { + if (message.unpackedSfixed32?.length) { obj.unpackedSfixed32 = message.unpackedSfixed32.map((e) => Math.round(e)); - } else { - obj.unpackedSfixed32 = []; } - if (message.unpackedSfixed64) { + if (message.unpackedSfixed64?.length) { obj.unpackedSfixed64 = message.unpackedSfixed64.map((e) => Math.round(e)); - } else { - obj.unpackedSfixed64 = []; } - if (message.unpackedFloat) { - obj.unpackedFloat = message.unpackedFloat.map((e) => e); - } else { - obj.unpackedFloat = []; + if (message.unpackedFloat?.length) { + obj.unpackedFloat = message.unpackedFloat; } - if (message.unpackedDouble) { - obj.unpackedDouble = message.unpackedDouble.map((e) => e); - } else { - obj.unpackedDouble = []; + if (message.unpackedDouble?.length) { + obj.unpackedDouble = message.unpackedDouble; } - if (message.unpackedBool) { - obj.unpackedBool = message.unpackedBool.map((e) => e); - } else { - obj.unpackedBool = []; + if (message.unpackedBool?.length) { + obj.unpackedBool = message.unpackedBool; } - if (message.unpackedNestedEnum) { + if (message.unpackedNestedEnum?.length) { obj.unpackedNestedEnum = message.unpackedNestedEnum.map((e) => testAllTypesProto3_NestedEnumToJSON(e)); - } else { - obj.unpackedNestedEnum = []; } - obj.mapInt32Int32 = {}; - if (message.mapInt32Int32) { + if (message.mapInt32Int32?.size) { + obj.mapInt32Int32 = {}; message.mapInt32Int32.forEach((v, k) => { obj.mapInt32Int32[k] = Math.round(v); }); } - obj.mapInt64Int64 = {}; - if (message.mapInt64Int64) { + if (message.mapInt64Int64?.size) { + obj.mapInt64Int64 = {}; message.mapInt64Int64.forEach((v, k) => { obj.mapInt64Int64[k] = Math.round(v); }); } - obj.mapUint32Uint32 = {}; - if (message.mapUint32Uint32) { + if (message.mapUint32Uint32?.size) { + obj.mapUint32Uint32 = {}; message.mapUint32Uint32.forEach((v, k) => { obj.mapUint32Uint32[k] = Math.round(v); }); } - obj.mapUint64Uint64 = {}; - if (message.mapUint64Uint64) { + if (message.mapUint64Uint64?.size) { + obj.mapUint64Uint64 = {}; message.mapUint64Uint64.forEach((v, k) => { obj.mapUint64Uint64[k] = Math.round(v); }); } - obj.mapSint32Sint32 = {}; - if (message.mapSint32Sint32) { + if (message.mapSint32Sint32?.size) { + obj.mapSint32Sint32 = {}; message.mapSint32Sint32.forEach((v, k) => { obj.mapSint32Sint32[k] = Math.round(v); }); } - obj.mapSint64Sint64 = {}; - if (message.mapSint64Sint64) { + if (message.mapSint64Sint64?.size) { + obj.mapSint64Sint64 = {}; message.mapSint64Sint64.forEach((v, k) => { obj.mapSint64Sint64[k] = Math.round(v); }); } - obj.mapFixed32Fixed32 = {}; - if (message.mapFixed32Fixed32) { + if (message.mapFixed32Fixed32?.size) { + obj.mapFixed32Fixed32 = {}; message.mapFixed32Fixed32.forEach((v, k) => { obj.mapFixed32Fixed32[k] = Math.round(v); }); } - obj.mapFixed64Fixed64 = {}; - if (message.mapFixed64Fixed64) { + if (message.mapFixed64Fixed64?.size) { + obj.mapFixed64Fixed64 = {}; message.mapFixed64Fixed64.forEach((v, k) => { obj.mapFixed64Fixed64[k] = Math.round(v); }); } - obj.mapSfixed32Sfixed32 = {}; - if (message.mapSfixed32Sfixed32) { + if (message.mapSfixed32Sfixed32?.size) { + obj.mapSfixed32Sfixed32 = {}; message.mapSfixed32Sfixed32.forEach((v, k) => { obj.mapSfixed32Sfixed32[k] = Math.round(v); }); } - obj.mapSfixed64Sfixed64 = {}; - if (message.mapSfixed64Sfixed64) { + if (message.mapSfixed64Sfixed64?.size) { + obj.mapSfixed64Sfixed64 = {}; message.mapSfixed64Sfixed64.forEach((v, k) => { obj.mapSfixed64Sfixed64[k] = Math.round(v); }); } - obj.mapInt32Float = {}; - if (message.mapInt32Float) { + if (message.mapInt32Float?.size) { + obj.mapInt32Float = {}; message.mapInt32Float.forEach((v, k) => { obj.mapInt32Float[k] = v; }); } - obj.mapInt32Double = {}; - if (message.mapInt32Double) { + if (message.mapInt32Double?.size) { + obj.mapInt32Double = {}; message.mapInt32Double.forEach((v, k) => { obj.mapInt32Double[k] = v; }); } - obj.mapBoolBool = {}; - if (message.mapBoolBool) { + if (message.mapBoolBool?.size) { + obj.mapBoolBool = {}; message.mapBoolBool.forEach((v, k) => { obj.mapBoolBool[k] = v; }); } - obj.mapStringString = {}; - if (message.mapStringString) { + if (message.mapStringString?.size) { + obj.mapStringString = {}; message.mapStringString.forEach((v, k) => { obj.mapStringString[k] = v; }); } - obj.mapStringBytes = {}; - if (message.mapStringBytes) { + if (message.mapStringBytes?.size) { + obj.mapStringBytes = {}; message.mapStringBytes.forEach((v, k) => { obj.mapStringBytes[k] = base64FromBytes(v); }); } - obj.mapStringNestedMessage = {}; - if (message.mapStringNestedMessage) { + if (message.mapStringNestedMessage?.size) { + obj.mapStringNestedMessage = {}; message.mapStringNestedMessage.forEach((v, k) => { obj.mapStringNestedMessage[k] = TestAllTypesProto3_NestedMessage.toJSON(v); }); } - obj.mapStringForeignMessage = {}; - if (message.mapStringForeignMessage) { + if (message.mapStringForeignMessage?.size) { + obj.mapStringForeignMessage = {}; message.mapStringForeignMessage.forEach((v, k) => { obj.mapStringForeignMessage[k] = ForeignMessage.toJSON(v); }); } - obj.mapStringNestedEnum = {}; - if (message.mapStringNestedEnum) { + if (message.mapStringNestedEnum?.size) { + obj.mapStringNestedEnum = {}; message.mapStringNestedEnum.forEach((v, k) => { obj.mapStringNestedEnum[k] = testAllTypesProto3_NestedEnumToJSON(v); }); } - obj.mapStringForeignEnum = {}; - if (message.mapStringForeignEnum) { + if (message.mapStringForeignEnum?.size) { + obj.mapStringForeignEnum = {}; message.mapStringForeignEnum.forEach((v, k) => { obj.mapStringForeignEnum[k] = foreignEnumToJSON(v); }); } - message.oneofField?.$case === "oneofUint32" && (obj.oneofUint32 = Math.round(message.oneofField?.oneofUint32)); - message.oneofField?.$case === "oneofNestedMessage" && - (obj.oneofNestedMessage = message.oneofField?.oneofNestedMessage - ? TestAllTypesProto3_NestedMessage.toJSON(message.oneofField?.oneofNestedMessage) - : undefined); - message.oneofField?.$case === "oneofString" && (obj.oneofString = message.oneofField?.oneofString); - message.oneofField?.$case === "oneofBytes" && (obj.oneofBytes = message.oneofField?.oneofBytes !== undefined - ? base64FromBytes(message.oneofField?.oneofBytes) - : undefined); - message.oneofField?.$case === "oneofBool" && (obj.oneofBool = message.oneofField?.oneofBool); - message.oneofField?.$case === "oneofUint64" && (obj.oneofUint64 = Math.round(message.oneofField?.oneofUint64)); - message.oneofField?.$case === "oneofFloat" && (obj.oneofFloat = message.oneofField?.oneofFloat); - message.oneofField?.$case === "oneofDouble" && (obj.oneofDouble = message.oneofField?.oneofDouble); - message.oneofField?.$case === "oneofEnum" && (obj.oneofEnum = message.oneofField?.oneofEnum !== undefined - ? testAllTypesProto3_NestedEnumToJSON(message.oneofField?.oneofEnum) - : undefined); - message.oneofField?.$case === "oneofNullValue" && - (obj.oneofNullValue = message.oneofField?.oneofNullValue !== undefined - ? nullValueToJSON(message.oneofField?.oneofNullValue) - : undefined); - message.optionalBoolWrapper !== undefined && (obj.optionalBoolWrapper = message.optionalBoolWrapper); - message.optionalInt32Wrapper !== undefined && (obj.optionalInt32Wrapper = message.optionalInt32Wrapper); - message.optionalInt64Wrapper !== undefined && (obj.optionalInt64Wrapper = message.optionalInt64Wrapper); - message.optionalUint32Wrapper !== undefined && (obj.optionalUint32Wrapper = message.optionalUint32Wrapper); - message.optionalUint64Wrapper !== undefined && (obj.optionalUint64Wrapper = message.optionalUint64Wrapper); - message.optionalFloatWrapper !== undefined && (obj.optionalFloatWrapper = message.optionalFloatWrapper); - message.optionalDoubleWrapper !== undefined && (obj.optionalDoubleWrapper = message.optionalDoubleWrapper); - message.optionalStringWrapper !== undefined && (obj.optionalStringWrapper = message.optionalStringWrapper); - message.optionalBytesWrapper !== undefined && (obj.optionalBytesWrapper = message.optionalBytesWrapper); - if (message.repeatedBoolWrapper) { - obj.repeatedBoolWrapper = message.repeatedBoolWrapper.map((e) => e); - } else { - obj.repeatedBoolWrapper = []; - } - if (message.repeatedInt32Wrapper) { - obj.repeatedInt32Wrapper = message.repeatedInt32Wrapper.map((e) => e); - } else { - obj.repeatedInt32Wrapper = []; - } - if (message.repeatedInt64Wrapper) { - obj.repeatedInt64Wrapper = message.repeatedInt64Wrapper.map((e) => e); - } else { - obj.repeatedInt64Wrapper = []; - } - if (message.repeatedUint32Wrapper) { - obj.repeatedUint32Wrapper = message.repeatedUint32Wrapper.map((e) => e); - } else { - obj.repeatedUint32Wrapper = []; - } - if (message.repeatedUint64Wrapper) { - obj.repeatedUint64Wrapper = message.repeatedUint64Wrapper.map((e) => e); - } else { - obj.repeatedUint64Wrapper = []; - } - if (message.repeatedFloatWrapper) { - obj.repeatedFloatWrapper = message.repeatedFloatWrapper.map((e) => e); - } else { - obj.repeatedFloatWrapper = []; - } - if (message.repeatedDoubleWrapper) { - obj.repeatedDoubleWrapper = message.repeatedDoubleWrapper.map((e) => e); - } else { - obj.repeatedDoubleWrapper = []; - } - if (message.repeatedStringWrapper) { - obj.repeatedStringWrapper = message.repeatedStringWrapper.map((e) => e); - } else { - obj.repeatedStringWrapper = []; - } - if (message.repeatedBytesWrapper) { - obj.repeatedBytesWrapper = message.repeatedBytesWrapper.map((e) => e); - } else { - obj.repeatedBytesWrapper = []; - } - message.optionalDuration !== undefined && - (obj.optionalDuration = message.optionalDuration ? Duration.toJSON(message.optionalDuration) : undefined); - message.optionalTimestamp !== undefined && (obj.optionalTimestamp = message.optionalTimestamp.toISOString()); - message.optionalFieldMask !== undefined && - (obj.optionalFieldMask = FieldMask.toJSON(FieldMask.wrap(message.optionalFieldMask))); - message.optionalStruct !== undefined && (obj.optionalStruct = message.optionalStruct); - message.optionalAny !== undefined && - (obj.optionalAny = message.optionalAny ? Any.toJSON(message.optionalAny) : undefined); - message.optionalValue !== undefined && (obj.optionalValue = message.optionalValue); - message.optionalNullValue !== undefined && (obj.optionalNullValue = nullValueToJSON(message.optionalNullValue)); - if (message.repeatedDuration) { - obj.repeatedDuration = message.repeatedDuration.map((e) => e ? Duration.toJSON(e) : undefined); - } else { - obj.repeatedDuration = []; - } - if (message.repeatedTimestamp) { + if (message.oneofField?.$case === "oneofUint32") { + obj.oneofUint32 = Math.round(message.oneofField.oneofUint32); + } + if (message.oneofField?.$case === "oneofNestedMessage") { + obj.oneofNestedMessage = TestAllTypesProto3_NestedMessage.toJSON(message.oneofField.oneofNestedMessage); + } + if (message.oneofField?.$case === "oneofString") { + obj.oneofString = message.oneofField.oneofString; + } + if (message.oneofField?.$case === "oneofBytes") { + obj.oneofBytes = base64FromBytes(message.oneofField.oneofBytes); + } + if (message.oneofField?.$case === "oneofBool") { + obj.oneofBool = message.oneofField.oneofBool; + } + if (message.oneofField?.$case === "oneofUint64") { + obj.oneofUint64 = Math.round(message.oneofField.oneofUint64); + } + if (message.oneofField?.$case === "oneofFloat") { + obj.oneofFloat = message.oneofField.oneofFloat; + } + if (message.oneofField?.$case === "oneofDouble") { + obj.oneofDouble = message.oneofField.oneofDouble; + } + if (message.oneofField?.$case === "oneofEnum") { + obj.oneofEnum = testAllTypesProto3_NestedEnumToJSON(message.oneofField.oneofEnum); + } + if (message.oneofField?.$case === "oneofNullValue") { + obj.oneofNullValue = nullValueToJSON(message.oneofField.oneofNullValue); + } + if (message.optionalBoolWrapper !== undefined) { + obj.optionalBoolWrapper = message.optionalBoolWrapper; + } + if (message.optionalInt32Wrapper !== undefined) { + obj.optionalInt32Wrapper = message.optionalInt32Wrapper; + } + if (message.optionalInt64Wrapper !== undefined) { + obj.optionalInt64Wrapper = message.optionalInt64Wrapper; + } + if (message.optionalUint32Wrapper !== undefined) { + obj.optionalUint32Wrapper = message.optionalUint32Wrapper; + } + if (message.optionalUint64Wrapper !== undefined) { + obj.optionalUint64Wrapper = message.optionalUint64Wrapper; + } + if (message.optionalFloatWrapper !== undefined) { + obj.optionalFloatWrapper = message.optionalFloatWrapper; + } + if (message.optionalDoubleWrapper !== undefined) { + obj.optionalDoubleWrapper = message.optionalDoubleWrapper; + } + if (message.optionalStringWrapper !== undefined) { + obj.optionalStringWrapper = message.optionalStringWrapper; + } + if (message.optionalBytesWrapper !== undefined) { + obj.optionalBytesWrapper = message.optionalBytesWrapper; + } + if (message.repeatedBoolWrapper?.length) { + obj.repeatedBoolWrapper = message.repeatedBoolWrapper; + } + if (message.repeatedInt32Wrapper?.length) { + obj.repeatedInt32Wrapper = message.repeatedInt32Wrapper; + } + if (message.repeatedInt64Wrapper?.length) { + obj.repeatedInt64Wrapper = message.repeatedInt64Wrapper; + } + if (message.repeatedUint32Wrapper?.length) { + obj.repeatedUint32Wrapper = message.repeatedUint32Wrapper; + } + if (message.repeatedUint64Wrapper?.length) { + obj.repeatedUint64Wrapper = message.repeatedUint64Wrapper; + } + if (message.repeatedFloatWrapper?.length) { + obj.repeatedFloatWrapper = message.repeatedFloatWrapper; + } + if (message.repeatedDoubleWrapper?.length) { + obj.repeatedDoubleWrapper = message.repeatedDoubleWrapper; + } + if (message.repeatedStringWrapper?.length) { + obj.repeatedStringWrapper = message.repeatedStringWrapper; + } + if (message.repeatedBytesWrapper?.length) { + obj.repeatedBytesWrapper = message.repeatedBytesWrapper; + } + if (message.optionalDuration !== undefined) { + obj.optionalDuration = Duration.toJSON(message.optionalDuration); + } + if (message.optionalTimestamp !== undefined) { + obj.optionalTimestamp = message.optionalTimestamp.toISOString(); + } + if (message.optionalFieldMask !== undefined) { + obj.optionalFieldMask = FieldMask.toJSON(FieldMask.wrap(message.optionalFieldMask)); + } + if (message.optionalStruct !== undefined) { + obj.optionalStruct = message.optionalStruct; + } + if (message.optionalAny !== undefined) { + obj.optionalAny = Any.toJSON(message.optionalAny); + } + if (message.optionalValue !== undefined) { + obj.optionalValue = message.optionalValue; + } + if (message.optionalNullValue !== 0) { + obj.optionalNullValue = nullValueToJSON(message.optionalNullValue); + } + if (message.repeatedDuration?.length) { + obj.repeatedDuration = message.repeatedDuration.map((e) => Duration.toJSON(e)); + } + if (message.repeatedTimestamp?.length) { obj.repeatedTimestamp = message.repeatedTimestamp.map((e) => e.toISOString()); - } else { - obj.repeatedTimestamp = []; } - if (message.repeatedFieldmask) { + if (message.repeatedFieldmask?.length) { obj.repeatedFieldmask = message.repeatedFieldmask.map((e) => FieldMask.toJSON(FieldMask.wrap(e))); - } else { - obj.repeatedFieldmask = []; - } - if (message.repeatedStruct) { - obj.repeatedStruct = message.repeatedStruct.map((e) => e); - } else { - obj.repeatedStruct = []; - } - if (message.repeatedAny) { - obj.repeatedAny = message.repeatedAny.map((e) => e ? Any.toJSON(e) : undefined); - } else { - obj.repeatedAny = []; - } - if (message.repeatedValue) { - obj.repeatedValue = message.repeatedValue.map((e) => e); - } else { - obj.repeatedValue = []; - } - if (message.repeatedListValue) { - obj.repeatedListValue = message.repeatedListValue.map((e) => e); - } else { - obj.repeatedListValue = []; - } - message.fieldname1 !== undefined && (obj.fieldname1 = Math.round(message.fieldname1)); - message.fieldName2 !== undefined && (obj.fieldName2 = Math.round(message.fieldName2)); - message.FieldName3 !== undefined && (obj.FieldName3 = Math.round(message.FieldName3)); - message.fieldName4 !== undefined && (obj.fieldName4 = Math.round(message.fieldName4)); - message.field0name5 !== undefined && (obj.field0name5 = Math.round(message.field0name5)); - message.field0Name6 !== undefined && (obj.field0Name6 = Math.round(message.field0Name6)); - message.fieldName7 !== undefined && (obj.fieldName7 = Math.round(message.fieldName7)); - message.FieldName8 !== undefined && (obj.FieldName8 = Math.round(message.FieldName8)); - message.fieldName9 !== undefined && (obj.fieldName9 = Math.round(message.fieldName9)); - message.FieldName10 !== undefined && (obj.FieldName10 = Math.round(message.FieldName10)); - message.fieldName11 !== undefined && (obj.FIELDNAME11 = Math.round(message.fieldName11)); - message.FIELDName12 !== undefined && (obj.FIELDName12 = Math.round(message.FIELDName12)); - message.FieldName13 !== undefined && (obj.FieldName13 = Math.round(message.FieldName13)); - message.FieldName14 !== undefined && (obj.FieldName14 = Math.round(message.FieldName14)); - message.fieldName15 !== undefined && (obj.fieldName15 = Math.round(message.fieldName15)); - message.fieldName16 !== undefined && (obj.fieldName16 = Math.round(message.fieldName16)); - message.fieldName17 !== undefined && (obj.fieldName17 = Math.round(message.fieldName17)); - message.FieldName18 !== undefined && (obj.FieldName18 = Math.round(message.FieldName18)); + } + if (message.repeatedStruct?.length) { + obj.repeatedStruct = message.repeatedStruct; + } + if (message.repeatedAny?.length) { + obj.repeatedAny = message.repeatedAny.map((e) => Any.toJSON(e)); + } + if (message.repeatedValue?.length) { + obj.repeatedValue = message.repeatedValue; + } + if (message.repeatedListValue?.length) { + obj.repeatedListValue = message.repeatedListValue; + } + if (message.fieldname1 !== 0) { + obj.fieldname1 = Math.round(message.fieldname1); + } + if (message.fieldName2 !== 0) { + obj.fieldName2 = Math.round(message.fieldName2); + } + if (message.FieldName3 !== 0) { + obj.FieldName3 = Math.round(message.FieldName3); + } + if (message.fieldName4 !== 0) { + obj.fieldName4 = Math.round(message.fieldName4); + } + if (message.field0name5 !== 0) { + obj.field0name5 = Math.round(message.field0name5); + } + if (message.field0Name6 !== 0) { + obj.field0Name6 = Math.round(message.field0Name6); + } + if (message.fieldName7 !== 0) { + obj.fieldName7 = Math.round(message.fieldName7); + } + if (message.FieldName8 !== 0) { + obj.FieldName8 = Math.round(message.FieldName8); + } + if (message.fieldName9 !== 0) { + obj.fieldName9 = Math.round(message.fieldName9); + } + if (message.FieldName10 !== 0) { + obj.FieldName10 = Math.round(message.FieldName10); + } + if (message.fieldName11 !== 0) { + obj.FIELDNAME11 = Math.round(message.fieldName11); + } + if (message.FIELDName12 !== 0) { + obj.FIELDName12 = Math.round(message.FIELDName12); + } + if (message.FieldName13 !== 0) { + obj.FieldName13 = Math.round(message.FieldName13); + } + if (message.FieldName14 !== 0) { + obj.FieldName14 = Math.round(message.FieldName14); + } + if (message.fieldName15 !== 0) { + obj.fieldName15 = Math.round(message.fieldName15); + } + if (message.fieldName16 !== 0) { + obj.fieldName16 = Math.round(message.fieldName16); + } + if (message.fieldName17 !== 0) { + obj.fieldName17 = Math.round(message.fieldName17); + } + if (message.FieldName18 !== 0) { + obj.FieldName18 = Math.round(message.FieldName18); + } return obj; }, create, I>>(base?: I): TestAllTypesProto3 { - return TestAllTypesProto3.fromPartial(base ?? {}); + return TestAllTypesProto3.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): TestAllTypesProto3 { const message = createBaseTestAllTypesProto3(); message.optionalInt32 = object.optionalInt32 ?? 0; @@ -4055,18 +4031,20 @@ export const TestAllTypesProto3_NestedMessage = { toJSON(message: TestAllTypesProto3_NestedMessage): unknown { const obj: any = {}; - message.a !== undefined && (obj.a = Math.round(message.a)); - message.corecursive !== undefined && - (obj.corecursive = message.corecursive ? TestAllTypesProto3.toJSON(message.corecursive) : undefined); + if (message.a !== 0) { + obj.a = Math.round(message.a); + } + if (message.corecursive !== undefined) { + obj.corecursive = TestAllTypesProto3.toJSON(message.corecursive); + } return obj; }, create, I>>( base?: I, ): TestAllTypesProto3_NestedMessage { - return TestAllTypesProto3_NestedMessage.fromPartial(base ?? {}); + return TestAllTypesProto3_NestedMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): TestAllTypesProto3_NestedMessage { @@ -4130,17 +4108,20 @@ export const TestAllTypesProto3_MapInt32Int32Entry = { toJSON(message: TestAllTypesProto3_MapInt32Int32Entry): unknown { const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = Math.round(message.value)); + if (message.key !== 0) { + obj.key = Math.round(message.key); + } + if (message.value !== 0) { + obj.value = Math.round(message.value); + } return obj; }, create, I>>( base?: I, ): TestAllTypesProto3_MapInt32Int32Entry { - return TestAllTypesProto3_MapInt32Int32Entry.fromPartial(base ?? {}); + return TestAllTypesProto3_MapInt32Int32Entry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): TestAllTypesProto3_MapInt32Int32Entry { @@ -4202,17 +4183,20 @@ export const TestAllTypesProto3_MapInt64Int64Entry = { toJSON(message: TestAllTypesProto3_MapInt64Int64Entry): unknown { const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = Math.round(message.value)); + if (message.key !== 0) { + obj.key = Math.round(message.key); + } + if (message.value !== 0) { + obj.value = Math.round(message.value); + } return obj; }, create, I>>( base?: I, ): TestAllTypesProto3_MapInt64Int64Entry { - return TestAllTypesProto3_MapInt64Int64Entry.fromPartial(base ?? {}); + return TestAllTypesProto3_MapInt64Int64Entry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): TestAllTypesProto3_MapInt64Int64Entry { @@ -4274,17 +4258,20 @@ export const TestAllTypesProto3_MapUint32Uint32Entry = { toJSON(message: TestAllTypesProto3_MapUint32Uint32Entry): unknown { const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = Math.round(message.value)); + if (message.key !== 0) { + obj.key = Math.round(message.key); + } + if (message.value !== 0) { + obj.value = Math.round(message.value); + } return obj; }, create, I>>( base?: I, ): TestAllTypesProto3_MapUint32Uint32Entry { - return TestAllTypesProto3_MapUint32Uint32Entry.fromPartial(base ?? {}); + return TestAllTypesProto3_MapUint32Uint32Entry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): TestAllTypesProto3_MapUint32Uint32Entry { @@ -4346,17 +4333,20 @@ export const TestAllTypesProto3_MapUint64Uint64Entry = { toJSON(message: TestAllTypesProto3_MapUint64Uint64Entry): unknown { const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = Math.round(message.value)); + if (message.key !== 0) { + obj.key = Math.round(message.key); + } + if (message.value !== 0) { + obj.value = Math.round(message.value); + } return obj; }, create, I>>( base?: I, ): TestAllTypesProto3_MapUint64Uint64Entry { - return TestAllTypesProto3_MapUint64Uint64Entry.fromPartial(base ?? {}); + return TestAllTypesProto3_MapUint64Uint64Entry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): TestAllTypesProto3_MapUint64Uint64Entry { @@ -4418,17 +4408,20 @@ export const TestAllTypesProto3_MapSint32Sint32Entry = { toJSON(message: TestAllTypesProto3_MapSint32Sint32Entry): unknown { const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = Math.round(message.value)); + if (message.key !== 0) { + obj.key = Math.round(message.key); + } + if (message.value !== 0) { + obj.value = Math.round(message.value); + } return obj; }, create, I>>( base?: I, ): TestAllTypesProto3_MapSint32Sint32Entry { - return TestAllTypesProto3_MapSint32Sint32Entry.fromPartial(base ?? {}); + return TestAllTypesProto3_MapSint32Sint32Entry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): TestAllTypesProto3_MapSint32Sint32Entry { @@ -4490,17 +4483,20 @@ export const TestAllTypesProto3_MapSint64Sint64Entry = { toJSON(message: TestAllTypesProto3_MapSint64Sint64Entry): unknown { const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = Math.round(message.value)); + if (message.key !== 0) { + obj.key = Math.round(message.key); + } + if (message.value !== 0) { + obj.value = Math.round(message.value); + } return obj; }, create, I>>( base?: I, ): TestAllTypesProto3_MapSint64Sint64Entry { - return TestAllTypesProto3_MapSint64Sint64Entry.fromPartial(base ?? {}); + return TestAllTypesProto3_MapSint64Sint64Entry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): TestAllTypesProto3_MapSint64Sint64Entry { @@ -4562,17 +4558,20 @@ export const TestAllTypesProto3_MapFixed32Fixed32Entry = { toJSON(message: TestAllTypesProto3_MapFixed32Fixed32Entry): unknown { const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = Math.round(message.value)); + if (message.key !== 0) { + obj.key = Math.round(message.key); + } + if (message.value !== 0) { + obj.value = Math.round(message.value); + } return obj; }, create, I>>( base?: I, ): TestAllTypesProto3_MapFixed32Fixed32Entry { - return TestAllTypesProto3_MapFixed32Fixed32Entry.fromPartial(base ?? {}); + return TestAllTypesProto3_MapFixed32Fixed32Entry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): TestAllTypesProto3_MapFixed32Fixed32Entry { @@ -4634,17 +4633,20 @@ export const TestAllTypesProto3_MapFixed64Fixed64Entry = { toJSON(message: TestAllTypesProto3_MapFixed64Fixed64Entry): unknown { const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = Math.round(message.value)); + if (message.key !== 0) { + obj.key = Math.round(message.key); + } + if (message.value !== 0) { + obj.value = Math.round(message.value); + } return obj; }, create, I>>( base?: I, ): TestAllTypesProto3_MapFixed64Fixed64Entry { - return TestAllTypesProto3_MapFixed64Fixed64Entry.fromPartial(base ?? {}); + return TestAllTypesProto3_MapFixed64Fixed64Entry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): TestAllTypesProto3_MapFixed64Fixed64Entry { @@ -4706,17 +4708,20 @@ export const TestAllTypesProto3_MapSfixed32Sfixed32Entry = { toJSON(message: TestAllTypesProto3_MapSfixed32Sfixed32Entry): unknown { const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = Math.round(message.value)); + if (message.key !== 0) { + obj.key = Math.round(message.key); + } + if (message.value !== 0) { + obj.value = Math.round(message.value); + } return obj; }, create, I>>( base?: I, ): TestAllTypesProto3_MapSfixed32Sfixed32Entry { - return TestAllTypesProto3_MapSfixed32Sfixed32Entry.fromPartial(base ?? {}); + return TestAllTypesProto3_MapSfixed32Sfixed32Entry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): TestAllTypesProto3_MapSfixed32Sfixed32Entry { @@ -4778,17 +4783,20 @@ export const TestAllTypesProto3_MapSfixed64Sfixed64Entry = { toJSON(message: TestAllTypesProto3_MapSfixed64Sfixed64Entry): unknown { const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = Math.round(message.value)); + if (message.key !== 0) { + obj.key = Math.round(message.key); + } + if (message.value !== 0) { + obj.value = Math.round(message.value); + } return obj; }, create, I>>( base?: I, ): TestAllTypesProto3_MapSfixed64Sfixed64Entry { - return TestAllTypesProto3_MapSfixed64Sfixed64Entry.fromPartial(base ?? {}); + return TestAllTypesProto3_MapSfixed64Sfixed64Entry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): TestAllTypesProto3_MapSfixed64Sfixed64Entry { @@ -4850,17 +4858,20 @@ export const TestAllTypesProto3_MapInt32FloatEntry = { toJSON(message: TestAllTypesProto3_MapInt32FloatEntry): unknown { const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value); + if (message.key !== 0) { + obj.key = Math.round(message.key); + } + if (message.value !== 0) { + obj.value = message.value; + } return obj; }, create, I>>( base?: I, ): TestAllTypesProto3_MapInt32FloatEntry { - return TestAllTypesProto3_MapInt32FloatEntry.fromPartial(base ?? {}); + return TestAllTypesProto3_MapInt32FloatEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): TestAllTypesProto3_MapInt32FloatEntry { @@ -4922,17 +4933,20 @@ export const TestAllTypesProto3_MapInt32DoubleEntry = { toJSON(message: TestAllTypesProto3_MapInt32DoubleEntry): unknown { const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value); + if (message.key !== 0) { + obj.key = Math.round(message.key); + } + if (message.value !== 0) { + obj.value = message.value; + } return obj; }, create, I>>( base?: I, ): TestAllTypesProto3_MapInt32DoubleEntry { - return TestAllTypesProto3_MapInt32DoubleEntry.fromPartial(base ?? {}); + return TestAllTypesProto3_MapInt32DoubleEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): TestAllTypesProto3_MapInt32DoubleEntry { @@ -4997,17 +5011,20 @@ export const TestAllTypesProto3_MapBoolBoolEntry = { toJSON(message: TestAllTypesProto3_MapBoolBoolEntry): unknown { const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); + if (message.key === true) { + obj.key = message.key; + } + if (message.value === true) { + obj.value = message.value; + } return obj; }, create, I>>( base?: I, ): TestAllTypesProto3_MapBoolBoolEntry { - return TestAllTypesProto3_MapBoolBoolEntry.fromPartial(base ?? {}); + return TestAllTypesProto3_MapBoolBoolEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): TestAllTypesProto3_MapBoolBoolEntry { @@ -5069,17 +5086,20 @@ export const TestAllTypesProto3_MapStringStringEntry = { toJSON(message: TestAllTypesProto3_MapStringStringEntry): unknown { const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } return obj; }, create, I>>( base?: I, ): TestAllTypesProto3_MapStringStringEntry { - return TestAllTypesProto3_MapStringStringEntry.fromPartial(base ?? {}); + return TestAllTypesProto3_MapStringStringEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): TestAllTypesProto3_MapStringStringEntry { @@ -5144,18 +5164,20 @@ export const TestAllTypesProto3_MapStringBytesEntry = { toJSON(message: TestAllTypesProto3_MapStringBytesEntry): unknown { const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && - (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array(0))); + if (message.key !== "") { + obj.key = message.key; + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } return obj; }, create, I>>( base?: I, ): TestAllTypesProto3_MapStringBytesEntry { - return TestAllTypesProto3_MapStringBytesEntry.fromPartial(base ?? {}); + return TestAllTypesProto3_MapStringBytesEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): TestAllTypesProto3_MapStringBytesEntry { @@ -5223,18 +5245,20 @@ export const TestAllTypesProto3_MapStringNestedMessageEntry = { toJSON(message: TestAllTypesProto3_MapStringNestedMessageEntry): unknown { const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && - (obj.value = message.value ? TestAllTypesProto3_NestedMessage.toJSON(message.value) : undefined); + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = TestAllTypesProto3_NestedMessage.toJSON(message.value); + } return obj; }, create, I>>( base?: I, ): TestAllTypesProto3_MapStringNestedMessageEntry { - return TestAllTypesProto3_MapStringNestedMessageEntry.fromPartial(base ?? {}); + return TestAllTypesProto3_MapStringNestedMessageEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): TestAllTypesProto3_MapStringNestedMessageEntry { @@ -5304,17 +5328,20 @@ export const TestAllTypesProto3_MapStringForeignMessageEntry = { toJSON(message: TestAllTypesProto3_MapStringForeignMessageEntry): unknown { const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value ? ForeignMessage.toJSON(message.value) : undefined); + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = ForeignMessage.toJSON(message.value); + } return obj; }, create, I>>( base?: I, ): TestAllTypesProto3_MapStringForeignMessageEntry { - return TestAllTypesProto3_MapStringForeignMessageEntry.fromPartial(base ?? {}); + return TestAllTypesProto3_MapStringForeignMessageEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): TestAllTypesProto3_MapStringForeignMessageEntry { @@ -5381,17 +5408,20 @@ export const TestAllTypesProto3_MapStringNestedEnumEntry = { toJSON(message: TestAllTypesProto3_MapStringNestedEnumEntry): unknown { const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = testAllTypesProto3_NestedEnumToJSON(message.value)); + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== 0) { + obj.value = testAllTypesProto3_NestedEnumToJSON(message.value); + } return obj; }, create, I>>( base?: I, ): TestAllTypesProto3_MapStringNestedEnumEntry { - return TestAllTypesProto3_MapStringNestedEnumEntry.fromPartial(base ?? {}); + return TestAllTypesProto3_MapStringNestedEnumEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): TestAllTypesProto3_MapStringNestedEnumEntry { @@ -5456,17 +5486,20 @@ export const TestAllTypesProto3_MapStringForeignEnumEntry = { toJSON(message: TestAllTypesProto3_MapStringForeignEnumEntry): unknown { const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = foreignEnumToJSON(message.value)); + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== 0) { + obj.value = foreignEnumToJSON(message.value); + } return obj; }, create, I>>( base?: I, ): TestAllTypesProto3_MapStringForeignEnumEntry { - return TestAllTypesProto3_MapStringForeignEnumEntry.fromPartial(base ?? {}); + return TestAllTypesProto3_MapStringForeignEnumEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): TestAllTypesProto3_MapStringForeignEnumEntry { @@ -5518,14 +5551,15 @@ export const ForeignMessage = { toJSON(message: ForeignMessage): unknown { const obj: any = {}; - message.c !== undefined && (obj.c = Math.round(message.c)); + if (message.c !== 0) { + obj.c = Math.round(message.c); + } return obj; }, create, I>>(base?: I): ForeignMessage { - return ForeignMessage.fromPartial(base ?? {}); + return ForeignMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ForeignMessage { const message = createBaseForeignMessage(); message.c = object.c ?? 0; @@ -5568,9 +5602,8 @@ export const NullHypothesisProto3 = { }, create, I>>(base?: I): NullHypothesisProto3 { - return NullHypothesisProto3.fromPartial(base ?? {}); + return NullHypothesisProto3.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): NullHypothesisProto3 { const message = createBaseNullHypothesisProto3(); return message; @@ -5612,19 +5645,18 @@ export const EnumOnlyProto3 = { }, create, I>>(base?: I): EnumOnlyProto3 { - return EnumOnlyProto3.fromPartial(base ?? {}); + return EnumOnlyProto3.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): EnumOnlyProto3 { const message = createBaseEnumOnlyProto3(); return message; }, }; -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var tsProtoGlobalThis: any = (() => { +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: any = (() => { if (typeof globalThis !== "undefined") { return globalThis; } diff --git a/impl/ts-proto/gen/google/protobuf/timestamp.ts b/impl/ts-proto/gen/google/protobuf/timestamp.ts index 7b8d95cd..080935cd 100644 --- a/impl/ts-proto/gen/google/protobuf/timestamp.ts +++ b/impl/ts-proto/gen/google/protobuf/timestamp.ts @@ -165,15 +165,18 @@ export const Timestamp = { toJSON(message: Timestamp): unknown { const obj: any = {}; - message.seconds !== undefined && (obj.seconds = Math.round(message.seconds)); - message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); + if (message.seconds !== 0) { + obj.seconds = Math.round(message.seconds); + } + if (message.nanos !== 0) { + obj.nanos = Math.round(message.nanos); + } return obj; }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? 0; @@ -182,10 +185,10 @@ export const Timestamp = { }, }; -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var tsProtoGlobalThis: any = (() => { +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: any = (() => { if (typeof globalThis !== "undefined") { return globalThis; } diff --git a/impl/ts-proto/gen/google/protobuf/wrappers.ts b/impl/ts-proto/gen/google/protobuf/wrappers.ts index 45d1eeb6..ed3487e9 100644 --- a/impl/ts-proto/gen/google/protobuf/wrappers.ts +++ b/impl/ts-proto/gen/google/protobuf/wrappers.ts @@ -135,14 +135,15 @@ export const DoubleValue = { toJSON(message: DoubleValue): unknown { const obj: any = {}; - message.value !== undefined && (obj.value = message.value); + if (message.value !== 0) { + obj.value = message.value; + } return obj; }, create, I>>(base?: I): DoubleValue { - return DoubleValue.fromPartial(base ?? {}); + return DoubleValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DoubleValue { const message = createBaseDoubleValue(); message.value = object.value ?? 0; @@ -191,14 +192,15 @@ export const FloatValue = { toJSON(message: FloatValue): unknown { const obj: any = {}; - message.value !== undefined && (obj.value = message.value); + if (message.value !== 0) { + obj.value = message.value; + } return obj; }, create, I>>(base?: I): FloatValue { - return FloatValue.fromPartial(base ?? {}); + return FloatValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): FloatValue { const message = createBaseFloatValue(); message.value = object.value ?? 0; @@ -247,14 +249,15 @@ export const Int64Value = { toJSON(message: Int64Value): unknown { const obj: any = {}; - message.value !== undefined && (obj.value = Math.round(message.value)); + if (message.value !== 0) { + obj.value = Math.round(message.value); + } return obj; }, create, I>>(base?: I): Int64Value { - return Int64Value.fromPartial(base ?? {}); + return Int64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int64Value { const message = createBaseInt64Value(); message.value = object.value ?? 0; @@ -303,14 +306,15 @@ export const UInt64Value = { toJSON(message: UInt64Value): unknown { const obj: any = {}; - message.value !== undefined && (obj.value = Math.round(message.value)); + if (message.value !== 0) { + obj.value = Math.round(message.value); + } return obj; }, create, I>>(base?: I): UInt64Value { - return UInt64Value.fromPartial(base ?? {}); + return UInt64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt64Value { const message = createBaseUInt64Value(); message.value = object.value ?? 0; @@ -359,14 +363,15 @@ export const Int32Value = { toJSON(message: Int32Value): unknown { const obj: any = {}; - message.value !== undefined && (obj.value = Math.round(message.value)); + if (message.value !== 0) { + obj.value = Math.round(message.value); + } return obj; }, create, I>>(base?: I): Int32Value { - return Int32Value.fromPartial(base ?? {}); + return Int32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int32Value { const message = createBaseInt32Value(); message.value = object.value ?? 0; @@ -415,14 +420,15 @@ export const UInt32Value = { toJSON(message: UInt32Value): unknown { const obj: any = {}; - message.value !== undefined && (obj.value = Math.round(message.value)); + if (message.value !== 0) { + obj.value = Math.round(message.value); + } return obj; }, create, I>>(base?: I): UInt32Value { - return UInt32Value.fromPartial(base ?? {}); + return UInt32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt32Value { const message = createBaseUInt32Value(); message.value = object.value ?? 0; @@ -471,14 +477,15 @@ export const BoolValue = { toJSON(message: BoolValue): unknown { const obj: any = {}; - message.value !== undefined && (obj.value = message.value); + if (message.value === true) { + obj.value = message.value; + } return obj; }, create, I>>(base?: I): BoolValue { - return BoolValue.fromPartial(base ?? {}); + return BoolValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BoolValue { const message = createBaseBoolValue(); message.value = object.value ?? false; @@ -527,14 +534,15 @@ export const StringValue = { toJSON(message: StringValue): unknown { const obj: any = {}; - message.value !== undefined && (obj.value = message.value); + if (message.value !== "") { + obj.value = message.value; + } return obj; }, create, I>>(base?: I): StringValue { - return StringValue.fromPartial(base ?? {}); + return StringValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): StringValue { const message = createBaseStringValue(); message.value = object.value ?? ""; @@ -583,15 +591,15 @@ export const BytesValue = { toJSON(message: BytesValue): unknown { const obj: any = {}; - message.value !== undefined && - (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array(0))); + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } return obj; }, create, I>>(base?: I): BytesValue { - return BytesValue.fromPartial(base ?? {}); + return BytesValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BytesValue { const message = createBaseBytesValue(); message.value = object.value ?? new Uint8Array(0); @@ -599,10 +607,10 @@ export const BytesValue = { }, }; -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var tsProtoGlobalThis: any = (() => { +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: any = (() => { if (typeof globalThis !== "undefined") { return globalThis; } diff --git a/impl/ts-proto/package-lock.json b/impl/ts-proto/package-lock.json index 1d19f360..82467084 100644 --- a/impl/ts-proto/package-lock.json +++ b/impl/ts-proto/package-lock.json @@ -6,7 +6,7 @@ "": { "name": "ts-proto-conformance", "dependencies": { - "ts-proto": "^1.150.1" + "ts-proto": "^1.156.2" }, "devDependencies": { "@bufbuild/buf": "^1.25.0", @@ -540,25 +540,15 @@ "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" }, - "node_modules/@types/long": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz", - "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==" - }, "node_modules/@types/node": { "version": "20.4.5", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.5.tgz", "integrity": "sha512-rt40Nk13II9JwQBdeYqmbn2Q6IVTA5uPhvSO+JVqdXw/6/4glI6oR9ezty/A9Hg5u7JH4OmYmuQ+XvjKm0Datg==" }, - "node_modules/@types/object-hash": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@types/object-hash/-/object-hash-3.0.2.tgz", - "integrity": "sha512-tfyXl1JPCf2hzIDK29gO7qGqJjThKBzg/Cn3bA68R9NmWdOx+f7k5mm4to/n43BHspCwcoUC6FU4NpUoK/h9bQ==" - }, "node_modules/case-anything": { - "version": "2.1.10", - "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.10.tgz", - "integrity": "sha512-JczJwVrCP0jPKh05McyVsuOg6AYosrB9XWZKbQzXeDAm2ClE/PJE/BcrrQrVyGYH7Jg8V/LDupmyL4kFlVsVFQ==", + "version": "2.1.13", + "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.13.tgz", + "integrity": "sha512-zlOQ80VrQ2Ue+ymH5OuM/DlDq64mEm+B9UTdHULv5osUMD6HalNTblf2b1u/m6QecjsnOkBpqVZ+XPwIVsy7Ng==", "engines": { "node": ">=12.13" }, @@ -566,11 +556,6 @@ "url": "https://github.com/sponsors/mesqueeb" } }, - "node_modules/dataloader": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/dataloader/-/dataloader-1.4.0.tgz", - "integrity": "sha512-68s5jYdlvasItOJnCuI2Q9s4q98g0pCyL3HrcKJu8KNugUl8ahgmZYg38ysLTgQjjXX3H8CJLkAvWrclWfcalw==" - }, "node_modules/detect-libc": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", @@ -628,22 +613,14 @@ } }, "node_modules/long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - }, - "node_modules/object-hash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz", - "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==", - "engines": { - "node": ">= 6" - } + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" }, "node_modules/protobufjs": { - "version": "6.11.3", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.3.tgz", - "integrity": "sha512-xL96WDdCZYdU7Slin569tFX712BxsxslWwAfAhCYjQKGTq7dAU91Lomy6nLLhh/dyGhk/YH4TwTSRxTzhuHyZg==", + "version": "7.2.4", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.4.tgz", + "integrity": "sha512-AT+RJgD2sH8phPmCf7OUZR8xGdcJRga4+1cOaXJ64hvcSkVhNcRHOwIxUatPH15+nj59WAGTDv3LSGZPEQbJaQ==", "hasInstallScript": true, "dependencies": { "@protobufjs/aspromise": "^1.1.2", @@ -656,47 +633,42 @@ "@protobufjs/path": "^1.1.2", "@protobufjs/pool": "^1.1.0", "@protobufjs/utf8": "^1.1.0", - "@types/long": "^4.0.1", "@types/node": ">=13.7.0", - "long": "^4.0.0" + "long": "^5.0.0" }, - "bin": { - "pbjs": "bin/pbjs", - "pbts": "bin/pbts" + "engines": { + "node": ">=12.0.0" } }, "node_modules/ts-poet": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/ts-poet/-/ts-poet-6.4.1.tgz", - "integrity": "sha512-AjZEs4h2w4sDfwpHMxQKHrTlNh2wRbM5NRXmLz0RiH+yPGtSQFbe9hBpNocU8vqVNgfh0BIOiXR80xDz3kKxUQ==", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/ts-poet/-/ts-poet-6.5.0.tgz", + "integrity": "sha512-44jURLT1HG6+NsDcadM826V6Ekux+wk07Go+MX5Gfx+8zcPKfUiFEtnjL9imuRVGSCRtloRLqw4bDGZVJYGZMQ==", "dependencies": { "dprint-node": "^1.0.7" } }, "node_modules/ts-proto": { - "version": "1.150.1", - "resolved": "https://registry.npmjs.org/ts-proto/-/ts-proto-1.150.1.tgz", - "integrity": "sha512-8g6zaegwqRZNbLUQxTRPhNj3yygKjVVtA9GO2EwPiJrnh9e1yUPSEPLc2tCRwf5d11D0cSlZhuRxddXkReIbxg==", + "version": "1.156.2", + "resolved": "https://registry.npmjs.org/ts-proto/-/ts-proto-1.156.2.tgz", + "integrity": "sha512-0ZAbGmfvB2R79QJfpTIk56T8xM4k9ZS+z77517HDpuFZFizCMceCIE3IhdYQWbmP1oSYLzw0AeVbVHi2PIigKQ==", "dependencies": { - "@types/object-hash": "^3.0.2", - "case-anything": "^2.1.10", - "dataloader": "^1.4.0", - "object-hash": "^3.0.0", - "protobufjs": "^6.11.3", - "ts-poet": "^6.4.1", - "ts-proto-descriptors": "1.9.0" + "case-anything": "^2.1.13", + "protobufjs": "^7.2.4", + "ts-poet": "^6.5.0", + "ts-proto-descriptors": "1.15.0" }, "bin": { "protoc-gen-ts_proto": "protoc-gen-ts_proto" } }, "node_modules/ts-proto-descriptors": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/ts-proto-descriptors/-/ts-proto-descriptors-1.9.0.tgz", - "integrity": "sha512-Ui8zA5Q4Jnq6JIGRraUWvECrqixxtwwin8GkhIkvwCpR+JcSPsxWe8HfTj5eHfyruGYI6Zjf96XlC87hTakHfQ==", + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/ts-proto-descriptors/-/ts-proto-descriptors-1.15.0.tgz", + "integrity": "sha512-TYyJ7+H+7Jsqawdv+mfsEpZPTIj9siDHS6EMCzG/z3b/PZiphsX+mWtqFfFVe5/N0Th6V3elK9lQqjnrgTOfrg==", "dependencies": { - "long": "^4.0.0", - "protobufjs": "^6.8.8" + "long": "^5.2.3", + "protobufjs": "^7.2.4" } }, "node_modules/typescript": { @@ -978,30 +950,15 @@ "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" }, - "@types/long": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz", - "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==" - }, "@types/node": { "version": "20.4.5", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.5.tgz", "integrity": "sha512-rt40Nk13II9JwQBdeYqmbn2Q6IVTA5uPhvSO+JVqdXw/6/4glI6oR9ezty/A9Hg5u7JH4OmYmuQ+XvjKm0Datg==" }, - "@types/object-hash": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@types/object-hash/-/object-hash-3.0.2.tgz", - "integrity": "sha512-tfyXl1JPCf2hzIDK29gO7qGqJjThKBzg/Cn3bA68R9NmWdOx+f7k5mm4to/n43BHspCwcoUC6FU4NpUoK/h9bQ==" - }, "case-anything": { - "version": "2.1.10", - "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.10.tgz", - "integrity": "sha512-JczJwVrCP0jPKh05McyVsuOg6AYosrB9XWZKbQzXeDAm2ClE/PJE/BcrrQrVyGYH7Jg8V/LDupmyL4kFlVsVFQ==" - }, - "dataloader": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/dataloader/-/dataloader-1.4.0.tgz", - "integrity": "sha512-68s5jYdlvasItOJnCuI2Q9s4q98g0pCyL3HrcKJu8KNugUl8ahgmZYg38ysLTgQjjXX3H8CJLkAvWrclWfcalw==" + "version": "2.1.13", + "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.13.tgz", + "integrity": "sha512-zlOQ80VrQ2Ue+ymH5OuM/DlDq64mEm+B9UTdHULv5osUMD6HalNTblf2b1u/m6QecjsnOkBpqVZ+XPwIVsy7Ng==" }, "detect-libc": { "version": "1.0.3", @@ -1047,19 +1004,14 @@ } }, "long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - }, - "object-hash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz", - "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==" + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" }, "protobufjs": { - "version": "6.11.3", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.3.tgz", - "integrity": "sha512-xL96WDdCZYdU7Slin569tFX712BxsxslWwAfAhCYjQKGTq7dAU91Lomy6nLLhh/dyGhk/YH4TwTSRxTzhuHyZg==", + "version": "7.2.4", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.4.tgz", + "integrity": "sha512-AT+RJgD2sH8phPmCf7OUZR8xGdcJRga4+1cOaXJ64hvcSkVhNcRHOwIxUatPH15+nj59WAGTDv3LSGZPEQbJaQ==", "requires": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", @@ -1071,40 +1023,36 @@ "@protobufjs/path": "^1.1.2", "@protobufjs/pool": "^1.1.0", "@protobufjs/utf8": "^1.1.0", - "@types/long": "^4.0.1", "@types/node": ">=13.7.0", - "long": "^4.0.0" + "long": "^5.0.0" } }, "ts-poet": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/ts-poet/-/ts-poet-6.4.1.tgz", - "integrity": "sha512-AjZEs4h2w4sDfwpHMxQKHrTlNh2wRbM5NRXmLz0RiH+yPGtSQFbe9hBpNocU8vqVNgfh0BIOiXR80xDz3kKxUQ==", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/ts-poet/-/ts-poet-6.5.0.tgz", + "integrity": "sha512-44jURLT1HG6+NsDcadM826V6Ekux+wk07Go+MX5Gfx+8zcPKfUiFEtnjL9imuRVGSCRtloRLqw4bDGZVJYGZMQ==", "requires": { "dprint-node": "^1.0.7" } }, "ts-proto": { - "version": "1.150.1", - "resolved": "https://registry.npmjs.org/ts-proto/-/ts-proto-1.150.1.tgz", - "integrity": "sha512-8g6zaegwqRZNbLUQxTRPhNj3yygKjVVtA9GO2EwPiJrnh9e1yUPSEPLc2tCRwf5d11D0cSlZhuRxddXkReIbxg==", + "version": "1.156.2", + "resolved": "https://registry.npmjs.org/ts-proto/-/ts-proto-1.156.2.tgz", + "integrity": "sha512-0ZAbGmfvB2R79QJfpTIk56T8xM4k9ZS+z77517HDpuFZFizCMceCIE3IhdYQWbmP1oSYLzw0AeVbVHi2PIigKQ==", "requires": { - "@types/object-hash": "^3.0.2", - "case-anything": "^2.1.10", - "dataloader": "^1.4.0", - "object-hash": "^3.0.0", - "protobufjs": "^6.11.3", - "ts-poet": "^6.4.1", - "ts-proto-descriptors": "1.9.0" + "case-anything": "^2.1.13", + "protobufjs": "^7.2.4", + "ts-poet": "^6.5.0", + "ts-proto-descriptors": "1.15.0" } }, "ts-proto-descriptors": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/ts-proto-descriptors/-/ts-proto-descriptors-1.9.0.tgz", - "integrity": "sha512-Ui8zA5Q4Jnq6JIGRraUWvECrqixxtwwin8GkhIkvwCpR+JcSPsxWe8HfTj5eHfyruGYI6Zjf96XlC87hTakHfQ==", + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/ts-proto-descriptors/-/ts-proto-descriptors-1.15.0.tgz", + "integrity": "sha512-TYyJ7+H+7Jsqawdv+mfsEpZPTIj9siDHS6EMCzG/z3b/PZiphsX+mWtqFfFVe5/N0Th6V3elK9lQqjnrgTOfrg==", "requires": { - "long": "^4.0.0", - "protobufjs": "^6.8.8" + "long": "^5.2.3", + "protobufjs": "^7.2.4" } }, "typescript": { diff --git a/impl/ts-proto/package.json b/impl/ts-proto/package.json index 4422f70d..c86d9bc4 100644 --- a/impl/ts-proto/package.json +++ b/impl/ts-proto/package.json @@ -9,6 +9,6 @@ "typescript": "^5.1.6" }, "dependencies": { - "ts-proto": "^1.150.1" + "ts-proto": "^1.156.2" } } From d588c28729c9391acd3ba044d21f61ee3d04dc8d Mon Sep 17 00:00:00 2001 From: Timo Stamm Date: Tue, 1 Aug 2023 20:58:51 +0200 Subject: [PATCH 2/4] Test revert Makefile --- Makefile | 180 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 118 insertions(+), 62 deletions(-) diff --git a/Makefile b/Makefile index add2ac28..dd1ab321 100644 --- a/Makefile +++ b/Makefile @@ -6,70 +6,126 @@ SHELL := bash MAKEFLAGS += --warn-undefined-variables MAKEFLAGS += --no-builtin-rules MAKEFLAGS += --no-print-directory -TMP = .tmp -BIN = .tmp/bin -PB = .tmp/protobuf-$(GOOGLE_PROTOBUF_VERSION) -LICENSE_HEADER_YEAR_RANGE := 2023 -GOOGLE_PROTOBUF_VERSION = 23.4 -BAZEL_VERSION = 5.4.0 - -$(PB): Makefile - echo $(PB) - @mkdir -p $(TMP) - curl -L https://github.com/protocolbuffers/protobuf/releases/download/v$(GOOGLE_PROTOBUF_VERSION)/protobuf-$(GOOGLE_PROTOBUF_VERSION).tar.gz \ - > $(TMP)/protobuf-$(GOOGLE_PROTOBUF_VERSION).tar.gz - tar -xzf $(TMP)/protobuf-$(GOOGLE_PROTOBUF_VERSION).tar.gz -C $(TMP)/ - -$(BIN)/conformance_test_runner: $(PB) Makefile - @mkdir -p $(@D) - cd $(PB) && USE_BAZEL_VERSION=$(BAZEL_VERSION) bazel build test_messages_proto3_cc_proto conformance:conformance_proto conformance:conformance_test conformance:conformance_test_runner - cp -f $(PB)/bazel-bin/conformance/conformance_test_runner $(@D) - @cp $(PB)/conformance/conformance.proto proto/conformance - @cp $(PB)/src/google/protobuf/test_messages*.proto proto/google/protobuf/ - @touch $(@) +CONNECT := @bufbuild/connect@latest +CONNECT_WEB := @bufbuild/connect-web@latest +CONNECT_NODE := @bufbuild/connect-node@latest +CONNECT_FASTIFY := @bufbuild/connect-fastify@latest +CONNECT_EXPRESS := @bufbuild/connect-express@latest +PROTOC_GEN_CONNECT_ES := @bufbuild/protoc-gen-connect-es@latest +PROTOBUF := @bufbuild/protobuf@latest +PROTOC_GEN_ES := @bufbuild/protoc-gen-es@latest +BUF := @bufbuild/buf@latest -.PHONY: all -all: test license ## Run conformance tests and update license headers +# All project directories that use npm +NPM_PROJS = angular \ + astro \ + express \ + fastify \ + nextjs \ + plain \ + react/cra \ + react/esbuild \ + react/parcel \ + react/rollup \ + react/vite \ + react/webpack \ + react/webpack-cjs \ + react-native \ + svelte \ + vanilla-node \ + vue + +# All project directories that use yarn +YARN_PROJS = react/yarn-pnp \ + react/yarn-unplugged +# All project directories that use pnpm +PNPM_PROJS = remix -.PHONY: help -help: ## Describe useful make targets - @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "%-30s %s\n", $$1, $$2}' +.PHONY: update +update:: ## Update all projects .PHONY: test -test: $(BIN)/conformance_test_runner ## Run conformance tests - cd impl/ts-proto; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh - cd impl/protobuf.js; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh - cd impl/google-protobuf; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh - cd impl/protobuf-es; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh - cd impl/protobuf-ts; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh - cd impl/protoc-gen-ts; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh - cd impl/protoscript; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh - cd impl/baseline; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh - node report.js - -.PHONY: testci -testci: ## Run conformance tests in CI - cd impl/ts-proto; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh - cd impl/protobuf.js; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh - cd impl/google-protobuf; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh - cd impl/protobuf-es; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh - cd impl/protobuf-ts; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh - cd impl/protoc-gen-ts; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh - cd impl/protoscript; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh - cd impl/baseline; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh - node report.js - -.PHONY: license -license: Makefile ## Updates license headers - GOBIN=$(abspath $(BIN)) go install github.com/bufbuild/buf/private/pkg/licenseheader/cmd/license-header@v1.1.0 - $(BIN)/license-header \ - --license-type "apache" \ - --copyright-holder "Buf Technologies, Inc." \ - --year-range "$(LICENSE_HEADER_YEAR_RANGE)" \ - report.js - -.PHONY: checkdiff -checkdiff: - @# Used in CI to verify that `make` doesn't produce a diff - test -z "$$(git status --porcelain | tee /dev/stderr)" +test:: ## Test all projects + +define updatenpmfunc +.PHONY: update$(notdir $(1)) +update$(notdir $(1)): + @echo $(1) ---------- ;\ + npm --prefix $(1) i -D $(CONNECT) $(CONNECT_WEB) $(PROTOC_GEN_CONNECT_ES) $(PROTOBUF) $(PROTOC_GEN_ES) $(BUF) ;\ + if [ "$(1)" == "fastify" ]; then \ + npm --prefix $(1) i -D $(CONNECT_NODE) $(CONNECT_FASTIFY) ;\ + elif [ "$(1)" == "express" ]; then \ + npm --prefix $(1) i -D $(CONNECT_NODE) $(CONNECT_EXPRESS) ;\ + elif [ "$(1)" == "vanilla-node" ]; then \ + npm --prefix $(1) i -D $(CONNECT_NODE) ;\ + fi ;\ + npm --prefix $(1) run buf:generate || exit 1 ;\ + +update:: update$(notdir $(1)) +endef + +define testnpmfunc +.PHONY: test$(notdir $(1)) +test$(notdir $(1)): + @echo $(1) ---------- ;\ + npm --prefix $(1) install || exit 1 ;\ + npm --prefix $(1) run build || exit 1 ;\ + npm --prefix $(1) run buf:generate || exit 1 ;\ + npm --prefix $(1) run test || exit 1 ;\ + +test:: test$(notdir $(1)) +endef + +define updateyarnfunc +.PHONY: update$(notdir $(1)) +update$(notdir $(1)): + @echo $(1) ---------- ;\ + yarn --cwd $(1) add $(CONNECT) $(CONNECT_WEB) $(PROTOC_GEN_CONNECT_ES) $(PROTOBUF) $(PROTOC_GEN_ES) $(BUF) ;\ + yarn --cwd $(1) buf:generate || exit 1 ;\ + +update:: update$(notdir $(1)) +endef +define testyarnfunc +.PHONY: test$(notdir $(1)) +test$(notdir $(1)): + @echo $(1) ---------- ;\ + yarn --cwd $(1) install || exit 1 ;\ + yarn --cwd $(1) build || exit 1 ;\ + yarn --cwd $(1) buf:generate || exit 1 ;\ + yarn --cwd $(1) test || exit 1 ;\ + +test:: test$(notdir $(1)) +endef + +define updatepnpmfunc +.PHONY: update$(notdir $(1)) +update$(notdir $(1)): + @echo $(1) ---------- ;\ + pnpm --prefix $(1) i -D $(CONNECT) $(CONNECT_WEB) $(PROTOC_GEN_CONNECT_ES) $(PROTOBUF) $(PROTOC_GEN_ES) $(BUF) ;\ + pnpm --prefix $(1) run buf:generate || exit 1 ;\ + +update:: update$(notdir $(1)) +endef + +define testpnpmfunc +.PHONY: test$(notdir $(1)) +test$(notdir $(1)): + @echo $(1) ---------- ;\ + pnpm --prefix $(1) install || exit 1 ;\ + pnpm --prefix $(1) run build || exit 1 ;\ + pnpm --prefix $(1) run buf:generate || exit 1 ;\ + pnpm --prefix $(1) run test || exit 1 ;\ + +test:: test$(notdir $(1)) +endef + +$(foreach npmproj,$(sort $(NPM_PROJS)),$(eval $(call updatenpmfunc,$(npmproj)))) +$(foreach npmproj,$(sort $(NPM_PROJS)),$(eval $(call testnpmfunc,$(npmproj)))) +$(foreach yarnproj,$(sort $(YARN_PROJS)),$(eval $(call updateyarnfunc,$(yarnproj)))) +$(foreach yarnproj,$(sort $(YARN_PROJS)),$(eval $(call testyarnfunc,$(yarnproj)))) +$(foreach pnpmproj,$(sort $(PNPM_PROJS)),$(eval $(call updatepnpmfunc,$(pnpmproj)))) +$(foreach pnpmproj,$(sort $(PNPM_PROJS)),$(eval $(call testpnpmfunc,$(pnpmproj)))) + +.PHONY: all +all: test From 77e422dc089455d315fa4c4bc01d67081751db5b Mon Sep 17 00:00:00 2001 From: Timo Stamm Date: Tue, 1 Aug 2023 20:59:49 +0200 Subject: [PATCH 3/4] Revert "Test revert Makefile" This reverts commit d588c28729c9391acd3ba044d21f61ee3d04dc8d. --- Makefile | 180 +++++++++++++++++++------------------------------------ 1 file changed, 62 insertions(+), 118 deletions(-) diff --git a/Makefile b/Makefile index dd1ab321..add2ac28 100644 --- a/Makefile +++ b/Makefile @@ -6,126 +6,70 @@ SHELL := bash MAKEFLAGS += --warn-undefined-variables MAKEFLAGS += --no-builtin-rules MAKEFLAGS += --no-print-directory -CONNECT := @bufbuild/connect@latest -CONNECT_WEB := @bufbuild/connect-web@latest -CONNECT_NODE := @bufbuild/connect-node@latest -CONNECT_FASTIFY := @bufbuild/connect-fastify@latest -CONNECT_EXPRESS := @bufbuild/connect-express@latest -PROTOC_GEN_CONNECT_ES := @bufbuild/protoc-gen-connect-es@latest -PROTOBUF := @bufbuild/protobuf@latest -PROTOC_GEN_ES := @bufbuild/protoc-gen-es@latest -BUF := @bufbuild/buf@latest +TMP = .tmp +BIN = .tmp/bin +PB = .tmp/protobuf-$(GOOGLE_PROTOBUF_VERSION) +LICENSE_HEADER_YEAR_RANGE := 2023 +GOOGLE_PROTOBUF_VERSION = 23.4 +BAZEL_VERSION = 5.4.0 + +$(PB): Makefile + echo $(PB) + @mkdir -p $(TMP) + curl -L https://github.com/protocolbuffers/protobuf/releases/download/v$(GOOGLE_PROTOBUF_VERSION)/protobuf-$(GOOGLE_PROTOBUF_VERSION).tar.gz \ + > $(TMP)/protobuf-$(GOOGLE_PROTOBUF_VERSION).tar.gz + tar -xzf $(TMP)/protobuf-$(GOOGLE_PROTOBUF_VERSION).tar.gz -C $(TMP)/ + +$(BIN)/conformance_test_runner: $(PB) Makefile + @mkdir -p $(@D) + cd $(PB) && USE_BAZEL_VERSION=$(BAZEL_VERSION) bazel build test_messages_proto3_cc_proto conformance:conformance_proto conformance:conformance_test conformance:conformance_test_runner + cp -f $(PB)/bazel-bin/conformance/conformance_test_runner $(@D) + @cp $(PB)/conformance/conformance.proto proto/conformance + @cp $(PB)/src/google/protobuf/test_messages*.proto proto/google/protobuf/ + @touch $(@) -# All project directories that use npm -NPM_PROJS = angular \ - astro \ - express \ - fastify \ - nextjs \ - plain \ - react/cra \ - react/esbuild \ - react/parcel \ - react/rollup \ - react/vite \ - react/webpack \ - react/webpack-cjs \ - react-native \ - svelte \ - vanilla-node \ - vue - -# All project directories that use yarn -YARN_PROJS = react/yarn-pnp \ - react/yarn-unplugged -# All project directories that use pnpm -PNPM_PROJS = remix +.PHONY: all +all: test license ## Run conformance tests and update license headers -.PHONY: update -update:: ## Update all projects +.PHONY: help +help: ## Describe useful make targets + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "%-30s %s\n", $$1, $$2}' .PHONY: test -test:: ## Test all projects - -define updatenpmfunc -.PHONY: update$(notdir $(1)) -update$(notdir $(1)): - @echo $(1) ---------- ;\ - npm --prefix $(1) i -D $(CONNECT) $(CONNECT_WEB) $(PROTOC_GEN_CONNECT_ES) $(PROTOBUF) $(PROTOC_GEN_ES) $(BUF) ;\ - if [ "$(1)" == "fastify" ]; then \ - npm --prefix $(1) i -D $(CONNECT_NODE) $(CONNECT_FASTIFY) ;\ - elif [ "$(1)" == "express" ]; then \ - npm --prefix $(1) i -D $(CONNECT_NODE) $(CONNECT_EXPRESS) ;\ - elif [ "$(1)" == "vanilla-node" ]; then \ - npm --prefix $(1) i -D $(CONNECT_NODE) ;\ - fi ;\ - npm --prefix $(1) run buf:generate || exit 1 ;\ - -update:: update$(notdir $(1)) -endef - -define testnpmfunc -.PHONY: test$(notdir $(1)) -test$(notdir $(1)): - @echo $(1) ---------- ;\ - npm --prefix $(1) install || exit 1 ;\ - npm --prefix $(1) run build || exit 1 ;\ - npm --prefix $(1) run buf:generate || exit 1 ;\ - npm --prefix $(1) run test || exit 1 ;\ - -test:: test$(notdir $(1)) -endef - -define updateyarnfunc -.PHONY: update$(notdir $(1)) -update$(notdir $(1)): - @echo $(1) ---------- ;\ - yarn --cwd $(1) add $(CONNECT) $(CONNECT_WEB) $(PROTOC_GEN_CONNECT_ES) $(PROTOBUF) $(PROTOC_GEN_ES) $(BUF) ;\ - yarn --cwd $(1) buf:generate || exit 1 ;\ - -update:: update$(notdir $(1)) -endef +test: $(BIN)/conformance_test_runner ## Run conformance tests + cd impl/ts-proto; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh + cd impl/protobuf.js; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh + cd impl/google-protobuf; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh + cd impl/protobuf-es; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh + cd impl/protobuf-ts; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh + cd impl/protoc-gen-ts; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh + cd impl/protoscript; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh + cd impl/baseline; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh + node report.js + +.PHONY: testci +testci: ## Run conformance tests in CI + cd impl/ts-proto; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh + cd impl/protobuf.js; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh + cd impl/google-protobuf; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh + cd impl/protobuf-es; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh + cd impl/protobuf-ts; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh + cd impl/protoc-gen-ts; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh + cd impl/protoscript; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh + cd impl/baseline; PATH="$(abspath $(BIN)):$(PATH)" ./test.sh + node report.js + +.PHONY: license +license: Makefile ## Updates license headers + GOBIN=$(abspath $(BIN)) go install github.com/bufbuild/buf/private/pkg/licenseheader/cmd/license-header@v1.1.0 + $(BIN)/license-header \ + --license-type "apache" \ + --copyright-holder "Buf Technologies, Inc." \ + --year-range "$(LICENSE_HEADER_YEAR_RANGE)" \ + report.js + +.PHONY: checkdiff +checkdiff: + @# Used in CI to verify that `make` doesn't produce a diff + test -z "$$(git status --porcelain | tee /dev/stderr)" -define testyarnfunc -.PHONY: test$(notdir $(1)) -test$(notdir $(1)): - @echo $(1) ---------- ;\ - yarn --cwd $(1) install || exit 1 ;\ - yarn --cwd $(1) build || exit 1 ;\ - yarn --cwd $(1) buf:generate || exit 1 ;\ - yarn --cwd $(1) test || exit 1 ;\ - -test:: test$(notdir $(1)) -endef - -define updatepnpmfunc -.PHONY: update$(notdir $(1)) -update$(notdir $(1)): - @echo $(1) ---------- ;\ - pnpm --prefix $(1) i -D $(CONNECT) $(CONNECT_WEB) $(PROTOC_GEN_CONNECT_ES) $(PROTOBUF) $(PROTOC_GEN_ES) $(BUF) ;\ - pnpm --prefix $(1) run buf:generate || exit 1 ;\ - -update:: update$(notdir $(1)) -endef - -define testpnpmfunc -.PHONY: test$(notdir $(1)) -test$(notdir $(1)): - @echo $(1) ---------- ;\ - pnpm --prefix $(1) install || exit 1 ;\ - pnpm --prefix $(1) run build || exit 1 ;\ - pnpm --prefix $(1) run buf:generate || exit 1 ;\ - pnpm --prefix $(1) run test || exit 1 ;\ - -test:: test$(notdir $(1)) -endef - -$(foreach npmproj,$(sort $(NPM_PROJS)),$(eval $(call updatenpmfunc,$(npmproj)))) -$(foreach npmproj,$(sort $(NPM_PROJS)),$(eval $(call testnpmfunc,$(npmproj)))) -$(foreach yarnproj,$(sort $(YARN_PROJS)),$(eval $(call updateyarnfunc,$(yarnproj)))) -$(foreach yarnproj,$(sort $(YARN_PROJS)),$(eval $(call testyarnfunc,$(yarnproj)))) -$(foreach pnpmproj,$(sort $(PNPM_PROJS)),$(eval $(call updatepnpmfunc,$(pnpmproj)))) -$(foreach pnpmproj,$(sort $(PNPM_PROJS)),$(eval $(call testpnpmfunc,$(pnpmproj)))) - -.PHONY: all -all: test From 3b7a5aa0268cd3e868707a70a073b27c640ce498 Mon Sep 17 00:00:00 2001 From: Timo Stamm Date: Tue, 1 Aug 2023 23:29:41 +0200 Subject: [PATCH 4/4] Update dependabot.yaml --- .github/dependabot.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index 38a49404..c7ab9f24 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -47,3 +47,11 @@ updates: timezone: UTC time: "07:00" open-pull-requests-limit: 50 + - package-ecosystem: "npm" + directory: "/impl/protobuf-ts" + schedule: + interval: "monthly" + day: "monday" + timezone: UTC + time: "07:00" + open-pull-requests-limit: 50