From add630c1b90cec69f60b5b68a5dc204c06536245 Mon Sep 17 00:00:00 2001 From: Andres Correa Casablanca Date: Wed, 28 Apr 2021 09:52:18 +0200 Subject: [PATCH 1/2] fix: add namespace to class names for protobufjs decorators --- internal/generator/runner_generate_class.go | 2 +- tests/__tests__/generated/Flavors.ts | 4 +- tests/__tests__/generated/Test.ts | 10 +- tests/__tests__/generated/common/Common.ts | 2 +- tests/__tests__/generated/common/Extra.ts | 2 +- .../generated/google/protobuf/Timestamp.ts | 2 +- tests/package.json | 2 +- tests/yarn.lock | 270 +++++------------- 8 files changed, 78 insertions(+), 216 deletions(-) diff --git a/internal/generator/runner_generate_class.go b/internal/generator/runner_generate_class.go index b6602ca..9b45186 100644 --- a/internal/generator/runner_generate_class.go +++ b/internal/generator/runner_generate_class.go @@ -132,7 +132,7 @@ func (r *Runner) generateTypescriptMessageClass(generatedFileStream *protogen.Ge } r.P( generatedFileStream, - "@protobufjs.Type.d('"+className+"')", + "@protobufjs.Type.d('"+r.currentPackage+"."+className+"')", "export class "+className+" extends protobufjs.Message<"+className+"> implements "+implementedInterfaces+" {\n", ) r.indentLevel += 2 diff --git a/tests/__tests__/generated/Flavors.ts b/tests/__tests__/generated/Flavors.ts index 91fd554..1fd8dd5 100644 --- a/tests/__tests__/generated/Flavors.ts +++ b/tests/__tests__/generated/Flavors.ts @@ -27,7 +27,7 @@ export namespace Flavors { emails: Email[] } - @protobufjs.Type.d('UserProfile') + @protobufjs.Type.d('flavors.UserProfile') export class UserProfile extends protobufjs.Message implements ConvertibleTo, IUserProfile { @@ -76,7 +76,7 @@ export namespace Flavors { } } - @protobufjs.Type.d('UserRequest') + @protobufjs.Type.d('flavors.UserRequest') export class UserRequest extends protobufjs.Message implements ConvertibleTo, IUserRequest { diff --git a/tests/__tests__/generated/Test.ts b/tests/__tests__/generated/Test.ts index e3fa556..1bc2d53 100644 --- a/tests/__tests__/generated/Test.ts +++ b/tests/__tests__/generated/Test.ts @@ -93,7 +93,7 @@ export namespace Foo { optionalField?: number } - @protobufjs.Type.d('CustomOptionsTest') + @protobufjs.Type.d('foo.CustomOptionsTest') export class CustomOptionsTest extends protobufjs.Message implements ConvertibleTo { @@ -157,7 +157,7 @@ export namespace Foo { /** * @deprecated */ - @protobufjs.Type.d('Nested') + @protobufjs.Type.d('foo.Nested') export class Nested extends protobufjs.Message implements ConvertibleTo, INested { @@ -188,7 +188,7 @@ export namespace Foo { } } - @protobufjs.Type.d('Request') + @protobufjs.Type.d('foo.Request') export class Request extends protobufjs.Message implements ConvertibleTo, IRequest { @@ -219,7 +219,7 @@ export namespace Foo { } } - @protobufjs.Type.d('RequiredPropertiesTest') + @protobufjs.Type.d('foo.RequiredPropertiesTest') export class RequiredPropertiesTest extends protobufjs.Message implements ConvertibleTo, IRequiredPropertiesTest { @@ -270,7 +270,7 @@ export namespace Foo { } } - @protobufjs.Type.d('Test') + @protobufjs.Type.d('foo.Test') export class Test extends protobufjs.Message implements ConvertibleTo { diff --git a/tests/__tests__/generated/common/Common.ts b/tests/__tests__/generated/common/Common.ts index bc16918..cd3a1da 100644 --- a/tests/__tests__/generated/common/Common.ts +++ b/tests/__tests__/generated/common/Common.ts @@ -14,7 +14,7 @@ export namespace Common { latsName?: string } - @protobufjs.Type.d('OtherPkgMessage') + @protobufjs.Type.d('common.OtherPkgMessage') export class OtherPkgMessage extends protobufjs.Message implements ConvertibleTo, IOtherPkgMessage { diff --git a/tests/__tests__/generated/common/Extra.ts b/tests/__tests__/generated/common/Extra.ts index 5bce18d..1b7b953 100644 --- a/tests/__tests__/generated/common/Extra.ts +++ b/tests/__tests__/generated/common/Extra.ts @@ -17,7 +17,7 @@ export namespace Common { birthDate?: Date } - @protobufjs.Type.d('ExtraPkgMessage') + @protobufjs.Type.d('common.ExtraPkgMessage') export class ExtraPkgMessage extends protobufjs.Message implements ConvertibleTo { diff --git a/tests/__tests__/generated/google/protobuf/Timestamp.ts b/tests/__tests__/generated/google/protobuf/Timestamp.ts index aa92f02..97d47b9 100644 --- a/tests/__tests__/generated/google/protobuf/Timestamp.ts +++ b/tests/__tests__/generated/google/protobuf/Timestamp.ts @@ -14,7 +14,7 @@ export namespace GoogleProtobuf { nanos?: number } - @protobufjs.Type.d('Timestamp') + @protobufjs.Type.d('google.protobuf.Timestamp') export class Timestamp extends protobufjs.Message implements ConvertibleTo, ITimestamp { diff --git a/tests/package.json b/tests/package.json index d814503..295b7fd 100644 --- a/tests/package.json +++ b/tests/package.json @@ -17,7 +17,7 @@ "dependencies": { "@coderspirit/nominal": "^3.0.0", "@join-com/gcloud-logger-trace": "^0.1.17", - "@join-com/grpc": "^0.3.7", + "@join-com/grpc": "^0.3.8", "@join-com/grpc-ts": "^2.0.2", "grpc": "^1.24.7", "protobufjs": "^6.10.2" diff --git a/tests/yarn.lock b/tests/yarn.lock index a8f69f3..aa13442 100644 --- a/tests/yarn.lock +++ b/tests/yarn.lock @@ -323,13 +323,11 @@ strip-json-comments "^3.1.1" "@grpc/grpc-js@^1.2.12": - version "1.2.12" - resolved "https://registry.yarnpkg.com/@grpc/grpc-js/-/grpc-js-1.2.12.tgz#0153f27512acf69184bb52c0a1035ca91d6c14b0" - integrity sha512-+gPCklP1eqIgrNPyzddYQdt9+GvZqPlLpIjIo+TveE+gbtp74VV1A2ju8ExeO8ma8f7MbpaGZx/KJPYVWL9eDw== + version "1.3.0" + resolved "https://registry.yarnpkg.com/@grpc/grpc-js/-/grpc-js-1.3.0.tgz#c6febaaf00ce7f53b5ec52c7cf3e2a4725b82bcb" + integrity sha512-fiL7ZaGg2HBiFtmv6m34d5jEgEtNXfctjzB3f7b3iuT7olBX4mHLMOqOBmGTTSOTfNRQJH5+vsyk6mEz3I0Q7Q== dependencies: "@types/node" ">=12.12.47" - google-auth-library "^6.1.1" - semver "^6.2.0" "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" @@ -594,11 +592,12 @@ dependencies: grpc "^1.24.5" -"@join-com/grpc@^0.3.3": - version "0.3.3" - resolved "https://registry.yarnpkg.com/@join-com/grpc/-/grpc-0.3.3.tgz#9efdb8b57d941dc2b9288362b1c21cec3026096d" - integrity sha512-LrkOlKH9iH74CN0kpSZ9efScf+xG9tpXU5+4z1YCIe2fKPLlfnQ9Io/lu8eld2iu2cQGVWB2IoXaKDrv8Y8jYQ== +"@join-com/grpc@^0.3.8": + version "0.3.8" + resolved "https://registry.yarnpkg.com/@join-com/grpc/-/grpc-0.3.8.tgz#9ea21b2c543ade092e780f20d38d77a86a86b8f9" + integrity sha512-SoTVBery5O5IlX2IQ1h0snLQULrmlifZTxAQ54bTMQNWGPhV2zVCtU+E7JDIyFi8tEPaLiql+X5sUvGTBJNjbA== dependencies: + "@coderspirit/nominal" "^3.0.0" "@grpc/grpc-js" "^1.2.12" protobufjs "^6.10.2" @@ -773,9 +772,9 @@ "@types/istanbul-lib-report" "*" "@types/jest@^26.0.22": - version "26.0.22" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.22.tgz#8308a1debdf1b807aa47be2838acdcd91e88fbe6" - integrity sha512-eeWwWjlqxvBxc4oQdkueW5OF/gtfSceKk4OnOAGlUSwS/liBRtZppbJuz1YkgbrbfGOoeBHun9fOvXnjNwrSOw== + version "26.0.23" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.23.tgz#a1b7eab3c503b80451d019efb588ec63522ee4e7" + integrity sha512-ZHLmWMJ9jJ9PTiT58juykZpL7KjwJywFN3Rr2pTSkyQfydf/rk22yS7W8p5DaVUMQ2BQC7oYiU3FjbTM/mYrOA== dependencies: jest-diff "^26.0.0" pretty-format "^26.0.0" @@ -790,20 +789,25 @@ resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.1.tgz#459c65fa1867dafe6a8f322c4c51695663cc55e9" integrity sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w== -"@types/node@*", "@types/node@>=12.12.47", "@types/node@^14.14.41": - version "14.14.41" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.41.tgz#d0b939d94c1d7bd53d04824af45f1139b8c45615" - integrity sha512-dueRKfaJL4RTtSa7bWeTK1M+VH+Gns73oCgzvYfHZywRCoPSd8EkXBL0mZ9unPTveBn+D9phZBaxuzpwjWkW0g== +"@types/node@*", "@types/node@>=12.12.47": + version "15.0.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-15.0.1.tgz#ef34dea0881028d11398be5bf4e856743e3dc35a" + integrity sha512-TMkXt0Ck1y0KKsGr9gJtWGjttxlZnnvDtphxUOSd0bfaR6Q1jle+sPvrzNR1urqYTWMinoKvjKfXUGsumaO1PA== "@types/node@^10.3.4": - version "10.17.58" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.58.tgz#10682f6016fd866725c36d22ce6bbbd029bf4545" - integrity sha512-Dn5RBxLohjdHFj17dVVw3rtrZAeXeWg+LQfvxDIW/fdPkSiuQk7h3frKMYtsQhtIW42wkErDcy9UMVxhGW4O7w== + version "10.17.59" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.59.tgz#03f440ccf746a27f7da6e141e6cbae64681dbd2f" + integrity sha512-7Uc8IRrL8yZz5ti45RaFxpbU8TxlzdC3HvxV+hOWo1EyLsuKv/w7y0n+TwZzwL3vdx3oZ2k3ubxPq131hNtXyg== "@types/node@^13.7.0": - version "13.13.50" - resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.50.tgz#bc8ebf70c392a98ffdba7aab9b46989ea96c1c62" - integrity sha512-y7kkh+hX/0jZNxMyBR/6asG0QMSaPSzgeVK63dhWHl4QAXCQB8lExXmzLL6SzmOgKHydtawpMnNhlDbv7DXPEA== + version "13.13.51" + resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.51.tgz#a424c5282f99fc1ca41f11b727b6aea80668bcba" + integrity sha512-66/xg5I5Te4oGi5Jws11PtNmKkZbOPZWyBZZ/l5AOrWj1Dyw+6Ge/JhYTq/2/Yvdqyhrue8RL+DGI298OJ0xcg== + +"@types/node@^14.14.41": + version "14.14.43" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.43.tgz#26bcbb0595b305400e8ceaf9a127a7f905ae49c8" + integrity sha512-3pwDJjp1PWacPTpH0LcfhgjvurQvrZFBrC6xxjaUEZ7ifUtT32jtjPxEMMblpqd2Mvx+k8haqQJLQxolyGN/cQ== "@types/normalize-package-data@^2.4.0": version "2.4.0" @@ -924,13 +928,6 @@ abbrev@1: resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== -abort-controller@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" - integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== - dependencies: - event-target-shim "^5.0.0" - acorn-globals@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-6.0.0.tgz#46cdd39f0f8ff08a876619b55f5ac8a6dc770b45" @@ -955,16 +952,9 @@ acorn@^7.1.1, acorn@^7.4.0: integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== acorn@^8.1.0: - version "8.1.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.1.1.tgz#fb0026885b9ac9f48bac1e185e4af472971149ff" - integrity sha512-xYiIVjNuqtKXMxlRMDc6mZUhXehod4a3gbZ1qRlM7icK4EbxUFNLhWoPblCvFtB2Y9CIqHP3CF/rdxLItaQv8g== - -agent-base@6: - version "6.0.2" - resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" - integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== - dependencies: - debug "4" + version "8.2.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.2.1.tgz#0d36af126fb6755095879c1dc6fd7edf7d60a5fb" + integrity sha512-z716cpm5TX4uzOzILx8PavOE6C6DKshHDw1aQN52M/yNSqE9s5O8SMfyhCCfCJ3HmTL0NkVOi+8a/55T7YB3bg== ajv@^6.10.0, ajv@^6.12.3, ajv@^6.12.4: version "6.12.6" @@ -977,9 +967,9 @@ ajv@^6.10.0, ajv@^6.12.3, ajv@^6.12.4: uri-js "^4.2.2" ajv@^8.0.1: - version "8.1.0" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.1.0.tgz#45d5d3d36c7cdd808930cc3e603cf6200dbeb736" - integrity sha512-B/Sk2Ix7A36fs/ZkuGLIR86EdjbgR6fsAcbx9lOP/QBSXujDNbVmIS/U4Itz5k8fPFDeVZl/zQ/gJW4Jrq6XjQ== + version "8.2.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.2.0.tgz#c89d3380a784ce81b2085f48811c4c101df4c602" + integrity sha512-WSNGFuyWd//XO8n/m/EaOlNLtO0yL8EXT/74LqT4khdhpZjP7lkj/kT5uwRmGitKEVp/Oj7ZUHeGfPtgHhQ5CA== dependencies: fast-deep-equal "^3.1.1" json-schema-traverse "^1.0.0" @@ -1093,11 +1083,6 @@ array-unique@^0.3.2: resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= -arrify@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa" - integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== - ascli@~1: version "1.0.1" resolved "https://registry.yarnpkg.com/ascli/-/ascli-1.0.1.tgz#bcfa5974a62f18e81cabaeb49732ab4a88f906bc" @@ -1214,11 +1199,6 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== -base64-js@^1.3.0: - version "1.5.1" - resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" - integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== - base@^0.11.1: version "0.11.2" resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" @@ -1239,11 +1219,6 @@ bcrypt-pbkdf@^1.0.0: dependencies: tweetnacl "^0.14.3" -bignumber.js@^9.0.0: - version "9.0.1" - resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.0.1.tgz#8d7ba124c882bfd8e43260c67475518d0689e4e5" - integrity sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA== - brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -1305,11 +1280,6 @@ bser@2.1.1: dependencies: node-int64 "^0.4.0" -buffer-equal-constant-time@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819" - integrity sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk= - buffer-from@1.x, buffer-from@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" @@ -1358,9 +1328,9 @@ camelcase@^6.0.0: integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg== caniuse-lite@^1.0.30001214: - version "1.0.30001214" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001214.tgz#70f153c78223515c6d37a9fde6cd69250da9d872" - integrity sha512-O2/SCpuaU3eASWVaesQirZv1MSjUNOvmugaD8zNSJqw6Vv5SGwoOpA9LJs3pNPfM745nxqPvfZY3MQKY4AKHYg== + version "1.0.30001219" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001219.tgz#5bfa5d0519f41f993618bd318f606a4c4c16156b" + integrity sha512-c0yixVG4v9KBc/tQ2rlbB3A/bgBFRvl8h8M4IeUbqCca4gsiCfvtaheUssbnux/Mb66Vjz7x8yYjDgYcNQOhyQ== capture-exit@^2.0.0: version "2.0.0" @@ -1588,13 +1558,6 @@ data-urls@^2.0.0: whatwg-mimetype "^2.3.0" whatwg-url "^8.0.0" -debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: - version "4.3.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" - integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== - dependencies: - ms "2.1.2" - debug@^2.2.0, debug@^2.3.3: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" @@ -1609,6 +1572,13 @@ debug@^3.2.6: dependencies: ms "^2.1.1" +debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" + integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== + dependencies: + ms "2.1.2" + decamelize@^1.1.1, decamelize@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -1720,22 +1690,15 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" -ecdsa-sig-formatter@1.0.11, ecdsa-sig-formatter@^1.0.11: - version "1.0.11" - resolved "https://registry.yarnpkg.com/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz#ae0f0fa2d85045ef14a817daa3ce9acd0489e5bf" - integrity sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ== - dependencies: - safe-buffer "^5.0.1" - ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= electron-to-chromium@^1.3.719: - version "1.3.720" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.720.tgz#f5d66df8754d993006b7b2ded15ff7738c58bd94" - integrity sha512-B6zLTxxaOFP4WZm6DrvgRk8kLFYWNhQ5TrHMC0l5WtkMXhU5UbnvWoTfeEwqOruUSlNMhVLfYak7REX6oC5Yfw== + version "1.3.723" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.723.tgz#52769a75635342a4db29af5f1e40bd3dad02c877" + integrity sha512-L+WXyXI7c7+G1V8ANzRsPI5giiimLAUDC6Zs1ojHHPhYXb3k/iTABFmWjivEtsWrRQymjnO66/rO2ZTABGdmWg== emittery@^0.7.1: version "0.7.2" @@ -1796,9 +1759,9 @@ escodegen@^2.0.0: source-map "~0.6.1" eslint-config-prettier@^8.2.0: - version "8.2.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.2.0.tgz#78de77d63bca8e9e59dae75a614b5299925bb7b3" - integrity sha512-dWV9EVeSo2qodOPi1iBYU/x6F6diHv8uujxbxr77xExs3zTAlNXvVZKiyLsQGNz7yPV2K49JY5WjPzNIuDc2Bw== + version "8.3.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz#f7471b20b6fe8a9a9254cc684454202886a2dd7a" + integrity sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew== eslint-plugin-es@^3.0.0: version "3.0.1" @@ -1809,9 +1772,9 @@ eslint-plugin-es@^3.0.0: regexpp "^3.0.0" eslint-plugin-jest@^24.3.5: - version "24.3.5" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-24.3.5.tgz#71f0b580f87915695c286c3f0eb88cf23664d044" - integrity sha512-XG4rtxYDuJykuqhsOqokYIR84/C8pRihRtEpVskYLbIIKGwPNW2ySxdctuVzETZE+MbF/e7wmsnbNVpzM0rDug== + version "24.3.6" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-24.3.6.tgz#5f0ca019183c3188c5ad3af8e80b41de6c8e9173" + integrity sha512-WOVH4TIaBLIeCX576rLcOgjNXqP+jNlCiEmRgFTfQtJ52DpwnIQKAVGlGPAN7CZ33bW6eNfHD6s8ZbEUTQubJg== dependencies: "@typescript-eslint/experimental-utils" "^4.0.1" @@ -1853,9 +1816,9 @@ eslint-visitor-keys@^2.0.0: integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== eslint@^7.24.0: - version "7.24.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.24.0.tgz#2e44fa62d93892bfdb100521f17345ba54b8513a" - integrity sha512-k9gaHeHiFmGCDQ2rEfvULlSLruz6tgfA8DEn+rY9/oYPFFTlz55mM/Q/Rij1b2Y42jwZiK3lXvNTw6w6TXzcKQ== + version "7.25.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.25.0.tgz#1309e4404d94e676e3e831b3a3ad2b050031eb67" + integrity sha512-TVpSovpvCNpLURIScDRB6g5CYu/ZFq9GfX2hLNIV4dSBKxIWojeDODvYl3t0k0VtMxYeR8OXPCFE5+oHMlGfhw== dependencies: "@babel/code-frame" "7.12.11" "@eslint/eslintrc" "^0.4.0" @@ -1938,11 +1901,6 @@ esutils@^2.0.2: resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== -event-target-shim@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" - integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== - exec-sh@^0.3.2: version "0.3.6" resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.6.tgz#ff264f9e325519a60cb5e273692943483cca63bc" @@ -2033,7 +1991,7 @@ extend-shallow@^3.0.0, extend-shallow@^3.0.2: assign-symbols "^1.0.0" is-extendable "^1.0.1" -extend@^3.0.2, extend@~3.0.2: +extend@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== @@ -2089,11 +2047,6 @@ fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= -fast-text-encoding@^1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/fast-text-encoding/-/fast-text-encoding-1.0.3.tgz#ec02ac8e01ab8a319af182dae2681213cfe9ce53" - integrity sha512-dtm4QZH9nZtcDt8qJiOH9fcQd1NAgi+K1O2DbE6GG1PPCK/BWfOH3idCTRQ4ImXRUOyopDEgDEnVEE7Y/2Wrig== - fastq@^1.6.0: version "1.11.0" resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.11.0.tgz#bb9fb955a07130a918eb63c1f5161cc32a5d0858" @@ -2220,25 +2173,6 @@ gauge@~2.7.3: strip-ansi "^3.0.1" wide-align "^1.1.0" -gaxios@^4.0.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/gaxios/-/gaxios-4.2.0.tgz#33bdc4fc241fc33b8915a4b8c07cfb368b932e46" - integrity sha512-Ms7fNifGv0XVU+6eIyL9LB7RVESeML9+cMvkwGS70xyD6w2Z80wl6RiqiJ9k1KFlJCUTQqFFc8tXmPQfSKUe8g== - dependencies: - abort-controller "^3.0.0" - extend "^3.0.2" - https-proxy-agent "^5.0.0" - is-stream "^2.0.0" - node-fetch "^2.3.0" - -gcp-metadata@^4.2.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/gcp-metadata/-/gcp-metadata-4.2.1.tgz#31849fbcf9025ef34c2297c32a89a1e7e9f2cd62" - integrity sha512-tSk+REe5iq/N+K+SK1XjZJUrFPuDqGZVzCy2vocIHIGmPlTGsa8owXMJwGkrXr73NO0AzhPW4MF2DEHz7P2AVw== - dependencies: - gaxios "^4.0.0" - json-bigint "^1.0.0" - gensync@^1.0.0-beta.2: version "1.0.0-beta.2" resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" @@ -2330,28 +2264,6 @@ globby@^11.0.1: merge2 "^1.3.0" slash "^3.0.0" -google-auth-library@^6.1.1: - version "6.1.6" - resolved "https://registry.yarnpkg.com/google-auth-library/-/google-auth-library-6.1.6.tgz#deacdcdb883d9ed6bac78bb5d79a078877fdf572" - integrity sha512-Q+ZjUEvLQj/lrVHF/IQwRo6p3s8Nc44Zk/DALsN+ac3T4HY/g/3rrufkgtl+nZ1TW7DNAw5cTChdVp4apUXVgQ== - dependencies: - arrify "^2.0.0" - base64-js "^1.3.0" - ecdsa-sig-formatter "^1.0.11" - fast-text-encoding "^1.0.0" - gaxios "^4.0.0" - gcp-metadata "^4.2.0" - gtoken "^5.0.4" - jws "^4.0.0" - lru-cache "^6.0.0" - -google-p12-pem@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/google-p12-pem/-/google-p12-pem-3.0.3.tgz#673ac3a75d3903a87f05878f3c75e06fc151669e" - integrity sha512-wS0ek4ZtFx/ACKYF3JhyGe5kzH7pgiQ7J5otlumqR9psmWMYc+U9cErKlCYVYHoUaidXHdZ2xbo34kB+S+24hA== - dependencies: - node-forge "^0.10.0" - graceful-fs@^4.1.15, graceful-fs@^4.2.4: version "4.2.6" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.6.tgz#ff040b2b0853b23c3d31027523706f1885d76bee" @@ -2374,15 +2286,6 @@ grpc@^1.24.5, grpc@^1.24.7: node-pre-gyp "^0.16.0" protobufjs "^5.0.3" -gtoken@^5.0.4: - version "5.2.1" - resolved "https://registry.yarnpkg.com/gtoken/-/gtoken-5.2.1.tgz#4dae1fea17270f457954b4a45234bba5fc796d16" - integrity sha512-OY0BfPKe3QnMsY9MzTHTSKn+Vl2l1CcLe6BwDEQj00mbbkl5nyQ/7EUREstg4fQNZ8iYE7br4JJ7TdKeDOPWmw== - dependencies: - gaxios "^4.0.0" - google-p12-pem "^3.0.3" - jws "^4.0.0" - har-schema@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" @@ -2475,14 +2378,6 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" -https-proxy-agent@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz#e2a90542abb68a762e0a0850f6c9edadfd8506b2" - integrity sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA== - dependencies: - agent-base "6" - debug "4" - human-signals@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" @@ -2588,9 +2483,9 @@ is-ci@^2.0.0: ci-info "^2.0.0" is-core-module@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.2.0.tgz#97037ef3d52224d85163f5597b2b63d9afed981a" - integrity sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ== + version "2.3.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.3.0.tgz#d341652e3408bca69c4671b79a0954a3d349f887" + integrity sha512-xSphU2KG9867tsYdLD4RWQ1VqdFl4HTO9Thf3I/3dLEfr0dbPTWKsuCKrgqMljg4nPE+Gq0VCnzT3gr0CyBmsw== dependencies: has "^1.0.3" @@ -3206,9 +3101,9 @@ jest-validate@^26.6.2: pretty-format "^26.6.2" jest-watch-typeahead@^0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/jest-watch-typeahead/-/jest-watch-typeahead-0.6.2.tgz#f3ea6518a2a497baad09a8d39f658140e6778e26" - integrity sha512-JKcDGEKWjhXo+/+RZMhtCsCA7J6KfbRXb7AbnQqoG9SH8AOGAkJFx8dHd80uIbkSxSVGEwI4ub62pET7a5BRPg== + version "0.6.3" + resolved "https://registry.yarnpkg.com/jest-watch-typeahead/-/jest-watch-typeahead-0.6.3.tgz#26efa37da39a46d8ff417b9e4badc8176a698016" + integrity sha512-rM+2m2U/7o4VeXxA3rcEWbbKq8K/aGjAwCgmqsthPV1AqLb5NNACzS+tDCD11bdQ8MrN+H3uN61Y9qFiJgtZPw== dependencies: ansi-escapes "^4.3.1" chalk "^4.0.0" @@ -3304,13 +3199,6 @@ jsesc@^2.5.1: resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== -json-bigint@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/json-bigint/-/json-bigint-1.0.0.tgz#ae547823ac0cad8398667f8cd9ef4730f5b01ff1" - integrity sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ== - dependencies: - bignumber.js "^9.0.0" - json-parse-even-better-errors@^2.3.0: version "2.3.1" resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" @@ -3358,23 +3246,6 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" -jwa@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/jwa/-/jwa-2.0.0.tgz#a7e9c3f29dae94027ebcaf49975c9345593410fc" - integrity sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA== - dependencies: - buffer-equal-constant-time "1.0.1" - ecdsa-sig-formatter "1.0.11" - safe-buffer "^5.0.1" - -jws@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/jws/-/jws-4.0.0.tgz#2d4e8cf6a318ffaa12615e9dec7e86e6c97310f4" - integrity sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg== - dependencies: - jwa "^2.0.0" - safe-buffer "^5.0.1" - kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: version "3.2.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" @@ -3679,16 +3550,6 @@ nice-try@^1.0.4: resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== -node-fetch@^2.3.0: - version "2.6.1" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" - integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== - -node-forge@^0.10.0: - version "0.10.0" - resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.10.0.tgz#32dea2afb3e9926f02ee5ce8794902691a676bf3" - integrity sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA== - node-int64@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" @@ -4422,7 +4283,7 @@ semver@7.x, semver@^7.2.1, semver@^7.3.2: dependencies: lru-cache "^6.0.0" -semver@^6.0.0, semver@^6.1.0, semver@^6.2.0, semver@^6.3.0: +semver@^6.0.0, semver@^6.1.0, semver@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== @@ -4764,9 +4625,9 @@ symbol-tree@^3.2.4: integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== table@^6.0.4: - version "6.3.4" - resolved "https://registry.yarnpkg.com/table/-/table-6.3.4.tgz#5d8a7fa1c887bd1ef08741751ec36246255a80b6" - integrity sha512-fhKcZ3+oAYG/ld3seJEZ9+fGSsy+yeoPzLQUrwbOzNYdhrU+6TzObhJ2Sp76ZfUGIrDTrxsXz5NSCZJIUOJb4Q== + version "6.6.0" + resolved "https://registry.yarnpkg.com/table/-/table-6.6.0.tgz#905654b79df98d9e9a973de1dd58682532c40e8e" + integrity sha512-iZMtp5tUvcnAdtHpZTWLPF0M7AgiQsURR2DwmxnJwSy8I3+cY+ozzVvYha3BOLG2TB+L0CqjIz+91htuj6yCXg== dependencies: ajv "^8.0.1" lodash.clonedeep "^4.5.0" @@ -4774,6 +4635,7 @@ table@^6.0.4: lodash.truncate "^4.4.2" slice-ansi "^4.0.0" string-width "^4.2.0" + strip-ansi "^6.0.0" tar@^4.4.2: version "4.4.13" From f4916360ef2506e29d72f16c1340ab746ea0f467 Mon Sep 17 00:00:00 2001 From: Andres Correa Casablanca Date: Wed, 28 Apr 2021 10:50:43 +0200 Subject: [PATCH 2/2] fix: regression, and simplify generated clients constructors --- internal/generator/runner_generate_class.go | 2 +- internal/generator/runner_generate_client.go | 15 +++++++++----- tests/__tests__/generated/Flavors.ts | 14 +++++++++---- tests/__tests__/generated/Test.ts | 20 ++++++++++++------- tests/__tests__/generated/common/Common.ts | 2 +- tests/__tests__/generated/common/Extra.ts | 2 +- .../generated/google/protobuf/Timestamp.ts | 2 +- tests/package.json | 2 +- tests/yarn.lock | 12 +++++------ 9 files changed, 44 insertions(+), 27 deletions(-) diff --git a/internal/generator/runner_generate_class.go b/internal/generator/runner_generate_class.go index 9b45186..056a16f 100644 --- a/internal/generator/runner_generate_class.go +++ b/internal/generator/runner_generate_class.go @@ -132,7 +132,7 @@ func (r *Runner) generateTypescriptMessageClass(generatedFileStream *protogen.Ge } r.P( generatedFileStream, - "@protobufjs.Type.d('"+r.currentPackage+"."+className+"')", + "@protobufjs.Type.d('"+strings.Replace(r.currentPackage, ".", "_", -1)+"_"+className+"')", "export class "+className+" extends protobufjs.Message<"+className+"> implements "+implementedInterfaces+" {\n", ) r.indentLevel += 2 diff --git a/internal/generator/runner_generate_client.go b/internal/generator/runner_generate_client.go index fff112e..3f1398f 100644 --- a/internal/generator/runner_generate_client.go +++ b/internal/generator/runner_generate_client.go @@ -81,6 +81,8 @@ func (r *Runner) generateTypescriptClientInterfaceMethod(generatedFileStream *pr } func (r *Runner) generateTypescriptClientClass(generatedFileStream *protogen.GeneratedFile, serviceSpec *descriptorpb.ServiceDescriptorProto) { + serviceName := serviceSpec.GetName() + serviceOptions := serviceSpec.GetOptions() if serviceOptions != nil { if serviceOptions.GetDeprecated() { @@ -89,16 +91,19 @@ func (r *Runner) generateTypescriptClientClass(generatedFileStream *protogen.Gen } r.P( generatedFileStream, - "export class "+strcase.ToCamel(serviceSpec.GetName())+"Client", - "extends joinGRPC.Client ", - "implements I"+strcase.ToCamel(serviceSpec.GetName())+"Client {", + "export class "+strcase.ToCamel(serviceName)+"Client", + "extends joinGRPC.Client ", + "implements I"+strcase.ToCamel(serviceName)+"Client {", ) r.indentLevel += 2 - r.P(generatedFileStream, "constructor(public readonly config: joinGRPC.IClientConfig) {") + r.P( + generatedFileStream, + "constructor(config: Omit, 'serviceDefinition'>) {", + ) r.indentLevel += 2 - r.P(generatedFileStream, "super(config, '"+r.currentPackage+"."+serviceSpec.GetName()+"')") + r.P(generatedFileStream, "super({ ...config, serviceDefinition: "+strcase.ToLowerCamel(serviceName)+"ServiceDefinition }, '"+r.currentPackage+"."+serviceName+"')") r.indentLevel -= 2 r.P(generatedFileStream, "}\n") diff --git a/tests/__tests__/generated/Flavors.ts b/tests/__tests__/generated/Flavors.ts index 1fd8dd5..87e16da 100644 --- a/tests/__tests__/generated/Flavors.ts +++ b/tests/__tests__/generated/Flavors.ts @@ -27,7 +27,7 @@ export namespace Flavors { emails: Email[] } - @protobufjs.Type.d('flavors.UserProfile') + @protobufjs.Type.d('flavors_UserProfile') export class UserProfile extends protobufjs.Message implements ConvertibleTo, IUserProfile { @@ -76,7 +76,7 @@ export namespace Flavors { } } - @protobufjs.Type.d('flavors.UserRequest') + @protobufjs.Type.d('flavors_UserRequest') export class UserRequest extends protobufjs.Message implements ConvertibleTo, IUserRequest { @@ -161,9 +161,15 @@ export namespace Flavors { extends joinGRPC.Client implements IUsersClient { constructor( - public readonly config: joinGRPC.IClientConfig + config: Omit< + joinGRPC.IClientConfig, + 'serviceDefinition' + > ) { - super(config, 'flavors.Users') + super( + { ...config, serviceDefinition: usersServiceDefinition }, + 'flavors.Users' + ) } public Find( diff --git a/tests/__tests__/generated/Test.ts b/tests/__tests__/generated/Test.ts index 1bc2d53..f5bfe16 100644 --- a/tests/__tests__/generated/Test.ts +++ b/tests/__tests__/generated/Test.ts @@ -93,7 +93,7 @@ export namespace Foo { optionalField?: number } - @protobufjs.Type.d('foo.CustomOptionsTest') + @protobufjs.Type.d('foo_CustomOptionsTest') export class CustomOptionsTest extends protobufjs.Message implements ConvertibleTo { @@ -157,7 +157,7 @@ export namespace Foo { /** * @deprecated */ - @protobufjs.Type.d('foo.Nested') + @protobufjs.Type.d('foo_Nested') export class Nested extends protobufjs.Message implements ConvertibleTo, INested { @@ -188,7 +188,7 @@ export namespace Foo { } } - @protobufjs.Type.d('foo.Request') + @protobufjs.Type.d('foo_Request') export class Request extends protobufjs.Message implements ConvertibleTo, IRequest { @@ -219,7 +219,7 @@ export namespace Foo { } } - @protobufjs.Type.d('foo.RequiredPropertiesTest') + @protobufjs.Type.d('foo_RequiredPropertiesTest') export class RequiredPropertiesTest extends protobufjs.Message implements ConvertibleTo, IRequiredPropertiesTest { @@ -270,7 +270,7 @@ export namespace Foo { } } - @protobufjs.Type.d('foo.Test') + @protobufjs.Type.d('foo_Test') export class Test extends protobufjs.Message implements ConvertibleTo { @@ -587,9 +587,15 @@ export namespace Foo { extends joinGRPC.Client implements IUsersClient { constructor( - public readonly config: joinGRPC.IClientConfig + config: Omit< + joinGRPC.IClientConfig, + 'serviceDefinition' + > ) { - super(config, 'foo.Users') + super( + { ...config, serviceDefinition: usersServiceDefinition }, + 'foo.Users' + ) } /** diff --git a/tests/__tests__/generated/common/Common.ts b/tests/__tests__/generated/common/Common.ts index cd3a1da..f68e5ae 100644 --- a/tests/__tests__/generated/common/Common.ts +++ b/tests/__tests__/generated/common/Common.ts @@ -14,7 +14,7 @@ export namespace Common { latsName?: string } - @protobufjs.Type.d('common.OtherPkgMessage') + @protobufjs.Type.d('common_OtherPkgMessage') export class OtherPkgMessage extends protobufjs.Message implements ConvertibleTo, IOtherPkgMessage { diff --git a/tests/__tests__/generated/common/Extra.ts b/tests/__tests__/generated/common/Extra.ts index 1b7b953..77e5856 100644 --- a/tests/__tests__/generated/common/Extra.ts +++ b/tests/__tests__/generated/common/Extra.ts @@ -17,7 +17,7 @@ export namespace Common { birthDate?: Date } - @protobufjs.Type.d('common.ExtraPkgMessage') + @protobufjs.Type.d('common_ExtraPkgMessage') export class ExtraPkgMessage extends protobufjs.Message implements ConvertibleTo { diff --git a/tests/__tests__/generated/google/protobuf/Timestamp.ts b/tests/__tests__/generated/google/protobuf/Timestamp.ts index 97d47b9..84a8bf8 100644 --- a/tests/__tests__/generated/google/protobuf/Timestamp.ts +++ b/tests/__tests__/generated/google/protobuf/Timestamp.ts @@ -14,7 +14,7 @@ export namespace GoogleProtobuf { nanos?: number } - @protobufjs.Type.d('google.protobuf.Timestamp') + @protobufjs.Type.d('google_protobuf_Timestamp') export class Timestamp extends protobufjs.Message implements ConvertibleTo, ITimestamp { diff --git a/tests/package.json b/tests/package.json index 295b7fd..7cbe969 100644 --- a/tests/package.json +++ b/tests/package.json @@ -17,7 +17,7 @@ "dependencies": { "@coderspirit/nominal": "^3.0.0", "@join-com/gcloud-logger-trace": "^0.1.17", - "@join-com/grpc": "^0.3.8", + "@join-com/grpc": "^0.3.9", "@join-com/grpc-ts": "^2.0.2", "grpc": "^1.24.7", "protobufjs": "^6.10.2" diff --git a/tests/yarn.lock b/tests/yarn.lock index aa13442..b07bd01 100644 --- a/tests/yarn.lock +++ b/tests/yarn.lock @@ -322,7 +322,7 @@ minimatch "^3.0.4" strip-json-comments "^3.1.1" -"@grpc/grpc-js@^1.2.12": +"@grpc/grpc-js@^1.3.0": version "1.3.0" resolved "https://registry.yarnpkg.com/@grpc/grpc-js/-/grpc-js-1.3.0.tgz#c6febaaf00ce7f53b5ec52c7cf3e2a4725b82bcb" integrity sha512-fiL7ZaGg2HBiFtmv6m34d5jEgEtNXfctjzB3f7b3iuT7olBX4mHLMOqOBmGTTSOTfNRQJH5+vsyk6mEz3I0Q7Q== @@ -592,13 +592,13 @@ dependencies: grpc "^1.24.5" -"@join-com/grpc@^0.3.8": - version "0.3.8" - resolved "https://registry.yarnpkg.com/@join-com/grpc/-/grpc-0.3.8.tgz#9ea21b2c543ade092e780f20d38d77a86a86b8f9" - integrity sha512-SoTVBery5O5IlX2IQ1h0snLQULrmlifZTxAQ54bTMQNWGPhV2zVCtU+E7JDIyFi8tEPaLiql+X5sUvGTBJNjbA== +"@join-com/grpc@^0.3.9": + version "0.3.9" + resolved "https://registry.yarnpkg.com/@join-com/grpc/-/grpc-0.3.9.tgz#47b853adaafa73b86c3d548612403924edc15962" + integrity sha512-1KVsQstRo5BglJ09fqWTRVfbjY2fwHTuXhZcFSpEWNLWZ/FQ21VmCHvV7EY8maZ2M5JqoHi/tLzOx8RqM8AVxQ== dependencies: "@coderspirit/nominal" "^3.0.0" - "@grpc/grpc-js" "^1.2.12" + "@grpc/grpc-js" "^1.3.0" protobufjs "^6.10.2" "@join-com/node-trace@^0.1.8":