diff --git a/dev/client.js b/dev/client.js index a22f9a4ba..4fdb5886b 100644 --- a/dev/client.js +++ b/dev/client.js @@ -21,9 +21,9 @@ const broker = new ServiceBroker({ } }, */ - //transporter: "kafka://192.168.0.181:9092", + transporter: "kafka://127.0.0.1:9093", //transporter: "amqp://192.168.0.181:5672", - transporter: "NATS", + //transporter: "NATS", //serializer: "MsgPack", //requestTimeout: 1000, @@ -34,7 +34,7 @@ const broker = new ServiceBroker({ //discoverer: "Etcd3" }, - cacher: true, + //cacher: true, metrics: { enabled: false, @@ -80,8 +80,8 @@ const broker = new ServiceBroker({ logger: console, logLevel: "info", middlewares: [ - //Middlewares.Transmit.Encryption("moleculer", "aes-256-cbc"), - //Middlewares.Transmit.Compression(), + // Middlewares.Transmit.Encryption("moleculer", "aes-256-cbc"), + // Middlewares.Transmit.Compression() //Middlewares.Debugging.TransitLogger({ logPacketData: false, /*folder: null, colors: { send: "magenta", receive: "blue"}*/ }), //Middlewares.Debugging.ActionLogger({ logParams: true, logResponse: true, /*folder: null, colors: { send: "magenta", receive: "blue"}*/ }), //require("./RedisHeartbeat") diff --git a/dev/server.js b/dev/server.js index ada95fe4b..690b14758 100644 --- a/dev/server.js +++ b/dev/server.js @@ -20,10 +20,10 @@ const broker = new ServiceBroker({ } }, */ - //transporter: "kafka://localhost:9093", + transporter: "kafka://localhost:9093", //transporter: "amqp://192.168.0.181:5672", //transporter: "AMQP10", - transporter: "NATS", + //transporter: "NATS", //serializer: "MsgPack", //disableBalancer: true, @@ -63,8 +63,8 @@ const broker = new ServiceBroker({ logLevel: "info", middlewares: [ - //Middlewares.Transmit.Encryption("moleculer", "aes-256-cbc"), - //Middlewares.Transmit.Compression(), + // Middlewares.Transmit.Encryption("moleculer", "aes-256-cbc"), + // Middlewares.Transmit.Compression() //Middlewares.Debugging.TransitLogger({ logPacketData: false, /*folder: null, colors: { send: "magenta", receive: "blue"}*/ }), //Middlewares.Debugging.ActionLogger({ logPacketData: false, /*folder: null, colors: { send: "magenta", receive: "blue"}*/ }), //require("./RedisHeartbeat") diff --git a/examples/.eslintrc.js b/examples/.eslintrc.js index ed25d7aae..8bb657cf8 100644 --- a/examples/.eslintrc.js +++ b/examples/.eslintrc.js @@ -13,6 +13,7 @@ module.exports = { "no-var": ["warn"], "no-console": ["off"], "no-unused-vars": ["off"], + "no-mixed-spaces-and-tabs": ["off"], "security/detect-possible-timing-attacks": ["off"] } }; diff --git a/examples/opentelemetry/opentelemetry.middleware.js b/examples/opentelemetry/opentelemetry.middleware.js index b70298cd9..8eef28edd 100644 --- a/examples/opentelemetry/opentelemetry.middleware.js +++ b/examples/opentelemetry/opentelemetry.middleware.js @@ -40,14 +40,15 @@ module.exports = { delete ctx.meta.$otel; } + const actionObj = ctx.action + ? { + name: ctx.action.name, + rawName: ctx.action.rawName + } + : null; let tags = { callingLevel: ctx.level, - action: ctx.action - ? { - name: ctx.action.name, - rawName: ctx.action.rawName - } - : null, + action: actionObj, remoteCall: ctx.nodeID !== ctx.broker.nodeID, callerNodeID: ctx.nodeID, nodeID: ctx.broker.nodeID, diff --git a/package-lock.json b/package-lock.json index b4325f17b..1e3c9deef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -60,7 +60,7 @@ "jest-cli": "^27.5.1", "jest-diff": "^27.5.1", "joi": "^17.7.0", - "kafka-node": "^5.0.0", + "kafkajs": "^2.2.4", "lockfile-lint": "^4.10.0", "log4js": "^6.7.1", "moleculer-repl": "^0.7.3", @@ -98,7 +98,6 @@ "etcd3": "^1.0.0", "ioredis": "^4.0.0 || ^5.0.0", "jaeger-client": "^3.0.0", - "kafka-node": "^5.0.0", "log4js": "^6.0.0", "mqtt": "^4.0.0", "msgpack5": "^5.0.0 || ^6.0.0", @@ -5705,16 +5704,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true, - "optional": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -5739,57 +5728,6 @@ "node": ">= 8" } }, - "node_modules/aproba": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", - "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", - "dev": true, - "optional": true - }, - "node_modules/are-we-there-yet": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", - "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", - "dev": true, - "optional": true, - "dependencies": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - } - }, - "node_modules/are-we-there-yet/node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true, - "optional": true - }, - "node_modules/are-we-there-yet/node_modules/readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "optional": true, - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/are-we-there-yet/node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "optional": true, - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, "node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", @@ -5889,15 +5827,6 @@ "node": ">=8" } }, - "node_modules/async": { - "version": "2.6.4", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", - "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", - "dev": true, - "dependencies": { - "lodash": "^4.17.14" - } - }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -6163,19 +6092,6 @@ "node": "*" } }, - "node_modules/binary": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/binary/-/binary-0.3.0.tgz", - "integrity": "sha1-n2BVO8XOjDOG87VTz/R0Yq3sqnk=", - "dev": true, - "dependencies": { - "buffers": "~0.1.1", - "chainsaw": "~0.1.0" - }, - "engines": { - "node": "*" - } - }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -6185,16 +6101,6 @@ "node": ">=8" } }, - "node_modules/bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "dev": true, - "optional": true, - "dependencies": { - "file-uri-to-path": "1.0.0" - } - }, "node_modules/bl": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/bl/-/bl-4.0.3.tgz", @@ -6427,15 +6333,6 @@ "ieee754": "^1.1.4" } }, - "node_modules/buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", - "dev": true, - "engines": { - "node": "*" - } - }, "node_modules/buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", @@ -6448,33 +6345,6 @@ "integrity": "sha512-EMetuGFz5SLsT0QTnXzINh4Ksr+oo4i+UGTXEshiGCQWnsgSs7ZhJ8fzlwQ+OzEMs0MpDAMr1hxnblp5a4vcHg==", "dev": true }, - "node_modules/buffermaker": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/buffermaker/-/buffermaker-1.2.1.tgz", - "integrity": "sha512-IdnyU2jDHU65U63JuVQNTHiWjPRH0CS3aYd/WPaEwyX84rFdukhOduAVb1jwUScmb5X0JWPw8NZOrhoLMiyAHQ==", - "dev": true, - "dependencies": { - "long": "1.1.2" - } - }, - "node_modules/buffermaker/node_modules/long": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/long/-/long-1.1.2.tgz", - "integrity": "sha1-6u9ZUcp1UdlpJrgtokLbnWso+1M=", - "dev": true, - "engines": { - "node": ">=0.6" - } - }, - "node_modules/buffers": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz", - "integrity": "sha1-skV5w77U1tOWru5tmorn9Ugqt7s=", - "dev": true, - "engines": { - "node": ">=0.2.0" - } - }, "node_modules/bufrw": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/bufrw/-/bufrw-1.3.0.tgz", @@ -6696,18 +6566,6 @@ "cbor-extract": "^2.1.1" } }, - "node_modules/chainsaw": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz", - "integrity": "sha1-XqtQsor+WAdNDVgpE4iCi15fvJg=", - "dev": true, - "dependencies": { - "traverse": ">=0.3.0 <0.4" - }, - "engines": { - "node": "*" - } - }, "node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -6769,13 +6627,6 @@ "node": ">= 6" } }, - "node_modules/chownr": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.3.tgz", - "integrity": "sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw==", - "dev": true, - "optional": true - }, "node_modules/ci-info": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", @@ -6947,16 +6798,6 @@ "node": ">=10 <11 || >=12" } }, - "node_modules/code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true, - "optional": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/collect-v8-coverage": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz", @@ -7065,13 +6906,6 @@ "node": ">=8" } }, - "node_modules/console-control-strings": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "dev": true, - "optional": true - }, "node_modules/convert-source-map": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", @@ -7394,19 +7228,6 @@ "node": ">=0.10" } }, - "node_modules/decompress-response": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz", - "integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==", - "dev": true, - "optional": true, - "dependencies": { - "mimic-response": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/dedent": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", @@ -7461,13 +7282,6 @@ "node": ">=0.4.0" } }, - "node_modules/delegates": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", - "dev": true, - "optional": true - }, "node_modules/denque": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/denque/-/denque-1.4.1.tgz", @@ -7572,19 +7386,6 @@ "integrity": "sha512-3tzwGYogSJi8HoG93R5x9NrdefZQOXgHgGih/7eivloOq6yC6O+yoFxZnkgP661twvfILONfoKRdF9GQOGx2RA==", "dev": true }, - "node_modules/detect-libc": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", - "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", - "dev": true, - "optional": true, - "bin": { - "detect-libc": "bin/detect-libc.js" - }, - "engines": { - "node": ">=0.10" - } - }, "node_modules/detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -8651,16 +8452,6 @@ "node": ">= 0.8.0" } }, - "node_modules/expand-template": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", - "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", - "dev": true, - "optional": true, - "engines": { - "node": ">=6" - } - }, "node_modules/expect": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/expect/-/expect-27.5.1.tgz", @@ -8849,13 +8640,6 @@ "node": "^10.12.0 || >=12.0.0" } }, - "node_modules/file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "dev": true, - "optional": true - }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -8993,13 +8777,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/fs-constants": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", - "dev": true, - "optional": true - }, "node_modules/fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", @@ -9039,51 +8816,6 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, - "node_modules/gauge": { - "version": "2.7.4", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", - "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", - "dev": true, - "optional": true, - "dependencies": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - } - }, - "node_modules/gauge/node_modules/is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "optional": true, - "dependencies": { - "number-is-nan": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/gauge/node_modules/string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "optional": true, - "dependencies": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/gaxios": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-5.1.0.tgz", @@ -9195,13 +8927,6 @@ "assert-plus": "^1.0.0" } }, - "node_modules/github-from-package": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", - "integrity": "sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=", - "dev": true, - "optional": true - }, "node_modules/giturl": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/giturl/-/giturl-1.0.1.tgz", @@ -9470,13 +9195,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/has-unicode": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", - "dev": true, - "optional": true - }, "node_modules/has-yarn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", @@ -12188,80 +11906,13 @@ "node": ">=0.6.0" } }, - "node_modules/kafka-node": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/kafka-node/-/kafka-node-5.0.0.tgz", - "integrity": "sha512-dD2ga5gLcQhsq1yNoQdy1MU4x4z7YnXM5bcG9SdQuiNr5KKuAmXixH1Mggwdah5o7EfholFbcNDPSVA6BIfaug==", - "dev": true, - "dependencies": { - "async": "^2.6.2", - "binary": "~0.3.0", - "bl": "^2.2.0", - "buffer-crc32": "~0.2.5", - "buffermaker": "~1.2.0", - "debug": "^2.1.3", - "denque": "^1.3.0", - "lodash": "^4.17.4", - "minimatch": "^3.0.2", - "nested-error-stacks": "^2.0.0", - "optional": "^0.1.3", - "retry": "^0.10.1", - "uuid": "^3.0.0" - }, - "engines": { - "node": ">=8.5.1" - }, - "optionalDependencies": { - "snappy": "^6.0.1" - } - }, - "node_modules/kafka-node/node_modules/bl": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/bl/-/bl-2.2.1.tgz", - "integrity": "sha512-6Pesp1w0DEX1N550i/uGV/TqucVL4AM/pgThFSN/Qq9si1/DF9aIHs1BxD8V/QU0HoeHO6cQRTAuYnLPKq1e4g==", - "dev": true, - "dependencies": { - "readable-stream": "^2.3.5", - "safe-buffer": "^5.1.1" - } - }, - "node_modules/kafka-node/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/kafka-node/node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "node_modules/kafka-node/node_modules/readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/kafka-node/node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "node_modules/kafkajs": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/kafkajs/-/kafkajs-2.2.4.tgz", + "integrity": "sha512-j/YeapB1vfPT2iOIUn/vxdyKEuhuY2PxMBvf5JWux6iSaukAccrMtXEY/Lb7OvavDhOWME589bpLrEdnVHjfjA==", "dev": true, - "dependencies": { - "safe-buffer": "~5.1.0" + "engines": { + "node": ">=14.0.0" } }, "node_modules/keyv": { @@ -12865,16 +12516,6 @@ "node": ">=6" } }, - "node_modules/mimic-response": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.0.0.tgz", - "integrity": "sha512-8ilDoEapqA4uQ3TwS0jakGONKXVJqpy+RpM+3b7pLdOjghCrEiGp9SRkFbUHAmZW9vdnrENWHjaweIoTIJExSQ==", - "dev": true, - "optional": true, - "engines": { - "node": ">=8" - } - }, "node_modules/min-indent": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", @@ -12931,13 +12572,6 @@ "mkdirp": "bin/cmd.js" } }, - "node_modules/mkdirp-classic": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.2.tgz", - "integrity": "sha512-ejdnDQcR75gwknmMw/tx02AuRs8jCtqFoFqDZMjiNxsu85sRIJVXDKHuLYvUUPRBUtV2FpSZa9bL1BUa3BdR2g==", - "dev": true, - "optional": true - }, "node_modules/module-details-from-path": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/module-details-from-path/-/module-details-from-path-1.0.3.tgz", @@ -13101,12 +12735,6 @@ "node": ">=4" } }, - "node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, "node_modules/msgpack5": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/msgpack5/-/msgpack5-6.0.2.tgz", @@ -13264,13 +12892,6 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "node_modules/napi-build-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.1.tgz", - "integrity": "sha512-boQj1WFgQH3v4clhu3mTNfP+vOBxorDlE8EKiMjUlLG3C4qAESnn9AxIOkFgTR2c9LtzNjPrjS60cT27ZKBhaA==", - "dev": true, - "optional": true - }, "node_modules/nats": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/nats/-/nats-2.7.1.tgz", @@ -13299,12 +12920,6 @@ "ncp": "bin/ncp" } }, - "node_modules/nested-error-stacks": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/nested-error-stacks/-/nested-error-stacks-2.1.0.tgz", - "integrity": "sha512-AO81vsIO1k1sM4Zrd6Hu7regmJN1NSiAja10gc4bX3F0wd+9rQmcuHQaHVQCYIEC8iFXnE+mavh23GOt7wBgug==", - "dev": true - }, "node_modules/next-tick": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", @@ -13329,16 +12944,6 @@ "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==", "dev": true }, - "node_modules/node-abi": { - "version": "2.12.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.12.0.tgz", - "integrity": "sha512-VhPBXCIcvmo/5K8HPmnWJyyhvgKxnHTUMXR/XwGHV68+wrgkzST4UmQrY/XszSWA5dtnXpNp528zkcyJ/pzVcw==", - "dev": true, - "optional": true, - "dependencies": { - "semver": "^5.4.1" - } - }, "node_modules/node-emoji": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.10.0.tgz", @@ -13511,13 +13116,6 @@ "node": ">=4" } }, - "node_modules/noop-logger": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/noop-logger/-/noop-logger-0.1.1.tgz", - "integrity": "sha1-lKKxYzxPExdVMAfYlm/Q6EG2pMI=", - "dev": true, - "optional": true - }, "node_modules/nopt": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", @@ -13764,19 +13362,6 @@ "node": ">=8" } }, - "node_modules/npmlog": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", - "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", - "dev": true, - "optional": true, - "dependencies": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, "node_modules/nuid": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/nuid/-/nuid-1.1.6.tgz", @@ -13796,16 +13381,6 @@ "js-sdsl": "^2.1.2" } }, - "node_modules/number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true, - "optional": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/nwsapi": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.2.tgz", @@ -13889,12 +13464,6 @@ "node": ">=0.10" } }, - "node_modules/optional": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/optional/-/optional-0.1.4.tgz", - "integrity": "sha512-gtvrrCfkE08wKcgXaVwQVgwEQ8vel2dc5DDBn9RLQZ3YtmtkBss6A2HY6BnJH4N/4Ku97Ri/SF8sNWE2225WJw==", - "dev": true - }, "node_modules/optionator": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", @@ -14514,36 +14083,6 @@ "node": ">=0.10.0" } }, - "node_modules/prebuild-install": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-5.3.3.tgz", - "integrity": "sha512-GV+nsUXuPW2p8Zy7SarF/2W/oiK8bFQgJcncoJ0d7kRpekEA0ftChjfEaF9/Y+QJEc/wFR7RAEa8lYByuUIe2g==", - "dev": true, - "optional": true, - "dependencies": { - "detect-libc": "^1.0.3", - "expand-template": "^2.0.3", - "github-from-package": "0.0.0", - "minimist": "^1.2.0", - "mkdirp": "^0.5.1", - "napi-build-utils": "^1.0.1", - "node-abi": "^2.7.0", - "noop-logger": "^0.1.1", - "npmlog": "^4.0.1", - "pump": "^3.0.0", - "rc": "^1.2.7", - "simple-get": "^3.0.3", - "tar-fs": "^2.0.0", - "tunnel-agent": "^0.6.0", - "which-pm-runs": "^1.0.0" - }, - "bin": { - "prebuild-install": "bin.js" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/preferred-pm": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/preferred-pm/-/preferred-pm-3.0.3.tgz", @@ -14660,12 +14199,6 @@ "node": ">= 0.6.0" } }, - "node_modules/process-nextick-args": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", - "dev": true - }, "node_modules/process-warning": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-1.0.0.tgz", @@ -15285,15 +14818,6 @@ "node": ">=8" } }, - "node_modules/retry": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.10.1.tgz", - "integrity": "sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q=", - "dev": true, - "engines": { - "node": "*" - } - }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -15554,13 +15078,6 @@ "semver": "bin/semver.js" } }, - "node_modules/set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true, - "optional": true - }, "node_modules/shimmer": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/shimmer/-/shimmer-1.2.1.tgz", @@ -15587,25 +15104,6 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, - "node_modules/simple-concat": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", - "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=", - "dev": true, - "optional": true - }, - "node_modules/simple-get": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.1.1.tgz", - "integrity": "sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA==", - "dev": true, - "optional": true, - "dependencies": { - "decompress-response": "^4.2.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" - } - }, "node_modules/simple-swizzle": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", @@ -15710,19 +15208,6 @@ "node": ">=8" } }, - "node_modules/snappy": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/snappy/-/snappy-6.2.3.tgz", - "integrity": "sha512-HZpVoIxMfQ4fL3iDuMdI1R5xycw1o9YDCAndTKZCY/EHRoKFvzwplttuBBVGeEg2fd1hYiwAXos/sM24W7N1LA==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "dependencies": { - "bindings": "^1.3.1", - "nan": "^2.14.0", - "prebuild-install": "^5.2.2" - } - }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -16050,19 +15535,6 @@ "node": ">=8" } }, - "node_modules/strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "optional": true, - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", @@ -16302,65 +15774,6 @@ "node": ">=8" } }, - "node_modules/tar-fs": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.0.1.tgz", - "integrity": "sha512-6tzWDMeroL87uF/+lin46k+Q+46rAJ0SyPGz7OW7wTgblI273hsBqk2C1j0/xNadNLKDTUL9BukSjB7cwgmlPA==", - "dev": true, - "optional": true, - "dependencies": { - "chownr": "^1.1.1", - "mkdirp-classic": "^0.5.2", - "pump": "^3.0.0", - "tar-stream": "^2.0.0" - } - }, - "node_modules/tar-stream": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.2.tgz", - "integrity": "sha512-UaF6FoJ32WqALZGOIAApXx+OdxhekNMChu6axLJR85zMMjXKWFGjbIRe+J6P4UnRGg9rAwWvbTT0oI7hD/Un7Q==", - "dev": true, - "optional": true, - "dependencies": { - "bl": "^4.0.1", - "end-of-stream": "^1.4.1", - "fs-constants": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1" - } - }, - "node_modules/tar-stream/node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, - "optional": true, - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/tar-stream/node_modules/safe-buffer": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", - "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==", - "dev": true, - "optional": true - }, - "node_modules/tar-stream/node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dev": true, - "optional": true, - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, "node_modules/terminal-link": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz", @@ -16527,15 +15940,6 @@ "node": ">=8" } }, - "node_modules/traverse": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz", - "integrity": "sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk=", - "dev": true, - "engines": { - "node": "*" - } - }, "node_modules/trim-newlines": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", @@ -17121,23 +16525,6 @@ "node": ">=8.15" } }, - "node_modules/which-pm-runs": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.0.0.tgz", - "integrity": "sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs=", - "dev": true, - "optional": true - }, - "node_modules/wide-align": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", - "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", - "dev": true, - "optional": true, - "dependencies": { - "string-width": "^1.0.2 || 2 || 3 || 4" - } - }, "node_modules/widest-line": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", @@ -21670,13 +21057,6 @@ } } }, - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true, - "optional": true - }, "ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -21695,59 +21075,6 @@ "picomatch": "^2.0.4" } }, - "aproba": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", - "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", - "dev": true, - "optional": true - }, - "are-we-there-yet": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", - "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", - "dev": true, - "optional": true, - "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true, - "optional": true - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "optional": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "optional": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, "arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", @@ -21829,15 +21156,6 @@ "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", "dev": true }, - "async": { - "version": "2.6.4", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", - "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", - "dev": true, - "requires": { - "lodash": "^4.17.14" - } - }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -22028,32 +21346,12 @@ "integrity": "sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==", "dev": true }, - "binary": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/binary/-/binary-0.3.0.tgz", - "integrity": "sha1-n2BVO8XOjDOG87VTz/R0Yq3sqnk=", - "dev": true, - "requires": { - "buffers": "~0.1.1", - "chainsaw": "~0.1.0" - } - }, "binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true }, - "bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "dev": true, - "optional": true, - "requires": { - "file-uri-to-path": "1.0.0" - } - }, "bl": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/bl/-/bl-4.0.3.tgz", @@ -22221,12 +21519,6 @@ "ieee754": "^1.1.4" } }, - "buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", - "dev": true - }, "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", @@ -22239,29 +21531,6 @@ "integrity": "sha512-EMetuGFz5SLsT0QTnXzINh4Ksr+oo4i+UGTXEshiGCQWnsgSs7ZhJ8fzlwQ+OzEMs0MpDAMr1hxnblp5a4vcHg==", "dev": true }, - "buffermaker": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/buffermaker/-/buffermaker-1.2.1.tgz", - "integrity": "sha512-IdnyU2jDHU65U63JuVQNTHiWjPRH0CS3aYd/WPaEwyX84rFdukhOduAVb1jwUScmb5X0JWPw8NZOrhoLMiyAHQ==", - "dev": true, - "requires": { - "long": "1.1.2" - }, - "dependencies": { - "long": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/long/-/long-1.1.2.tgz", - "integrity": "sha1-6u9ZUcp1UdlpJrgtokLbnWso+1M=", - "dev": true - } - } - }, - "buffers": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz", - "integrity": "sha1-skV5w77U1tOWru5tmorn9Ugqt7s=", - "dev": true - }, "bufrw": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/bufrw/-/bufrw-1.3.0.tgz", @@ -22423,15 +21692,6 @@ "cbor-extract": "^2.1.1" } }, - "chainsaw": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz", - "integrity": "sha1-XqtQsor+WAdNDVgpE4iCi15fvJg=", - "dev": true, - "requires": { - "traverse": ">=0.3.0 <0.4" - } - }, "chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -22481,13 +21741,6 @@ } } }, - "chownr": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.3.tgz", - "integrity": "sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw==", - "dev": true, - "optional": true - }, "ci-info": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", @@ -22617,13 +21870,6 @@ "integrity": "sha512-YO02ZhTcK2HOZodksWfg4tS1GYYt1j7R6U1unAkwcQf1uoIYKSBqPrfqXlLNbsyMvkDXMwa2nuwZDHbUkB1VbQ==", "dev": true }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true, - "optional": true - }, "collect-v8-coverage": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz", @@ -22723,13 +21969,6 @@ "xdg-basedir": "^4.0.0" } }, - "console-control-strings": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "dev": true, - "optional": true - }, "convert-source-map": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", @@ -22986,16 +22225,6 @@ "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==", "dev": true }, - "decompress-response": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz", - "integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==", - "dev": true, - "optional": true, - "requires": { - "mimic-response": "^2.0.0" - } - }, "dedent": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", @@ -23041,13 +22270,6 @@ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", "dev": true }, - "delegates": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", - "dev": true, - "optional": true - }, "denque": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/denque/-/denque-1.4.1.tgz", @@ -23124,13 +22346,6 @@ "integrity": "sha512-3tzwGYogSJi8HoG93R5x9NrdefZQOXgHgGih/7eivloOq6yC6O+yoFxZnkgP661twvfILONfoKRdF9GQOGx2RA==", "dev": true }, - "detect-libc": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", - "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", - "dev": true, - "optional": true - }, "detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -23954,13 +23169,6 @@ "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", "dev": true }, - "expand-template": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", - "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", - "dev": true, - "optional": true - }, "expect": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/expect/-/expect-27.5.1.tgz", @@ -24126,13 +23334,6 @@ "flat-cache": "^3.0.4" } }, - "file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "dev": true, - "optional": true - }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -24241,13 +23442,6 @@ } } }, - "fs-constants": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", - "dev": true, - "optional": true - }, "fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", @@ -24277,47 +23471,6 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, - "gauge": { - "version": "2.7.4", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", - "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", - "dev": true, - "optional": true, - "requires": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - }, - "dependencies": { - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "optional": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "optional": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - } - } - }, "gaxios": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-5.1.0.tgz", @@ -24399,13 +23552,6 @@ "assert-plus": "^1.0.0" } }, - "github-from-package": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", - "integrity": "sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=", - "dev": true, - "optional": true - }, "giturl": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/giturl/-/giturl-1.0.1.tgz", @@ -24607,13 +23753,6 @@ "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", "dev": true }, - "has-unicode": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", - "dev": true, - "optional": true - }, "has-yarn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", @@ -26633,78 +25772,11 @@ "verror": "1.10.0" } }, - "kafka-node": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/kafka-node/-/kafka-node-5.0.0.tgz", - "integrity": "sha512-dD2ga5gLcQhsq1yNoQdy1MU4x4z7YnXM5bcG9SdQuiNr5KKuAmXixH1Mggwdah5o7EfholFbcNDPSVA6BIfaug==", - "dev": true, - "requires": { - "async": "^2.6.2", - "binary": "~0.3.0", - "bl": "^2.2.0", - "buffer-crc32": "~0.2.5", - "buffermaker": "~1.2.0", - "debug": "^2.1.3", - "denque": "^1.3.0", - "lodash": "^4.17.4", - "minimatch": "^3.0.2", - "nested-error-stacks": "^2.0.0", - "optional": "^0.1.3", - "retry": "^0.10.1", - "snappy": "^6.0.1", - "uuid": "^3.0.0" - }, - "dependencies": { - "bl": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/bl/-/bl-2.2.1.tgz", - "integrity": "sha512-6Pesp1w0DEX1N550i/uGV/TqucVL4AM/pgThFSN/Qq9si1/DF9aIHs1BxD8V/QU0HoeHO6cQRTAuYnLPKq1e4g==", - "dev": true, - "requires": { - "readable-stream": "^2.3.5", - "safe-buffer": "^5.1.1" - } - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } + "kafkajs": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/kafkajs/-/kafkajs-2.2.4.tgz", + "integrity": "sha512-j/YeapB1vfPT2iOIUn/vxdyKEuhuY2PxMBvf5JWux6iSaukAccrMtXEY/Lb7OvavDhOWME589bpLrEdnVHjfjA==", + "dev": true }, "keyv": { "version": "3.1.0", @@ -27187,13 +26259,6 @@ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true }, - "mimic-response": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.0.0.tgz", - "integrity": "sha512-8ilDoEapqA4uQ3TwS0jakGONKXVJqpy+RpM+3b7pLdOjghCrEiGp9SRkFbUHAmZW9vdnrENWHjaweIoTIJExSQ==", - "dev": true, - "optional": true - }, "min-indent": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", @@ -27235,13 +26300,6 @@ "minimist": "^1.2.5" } }, - "mkdirp-classic": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.2.tgz", - "integrity": "sha512-ejdnDQcR75gwknmMw/tx02AuRs8jCtqFoFqDZMjiNxsu85sRIJVXDKHuLYvUUPRBUtV2FpSZa9bL1BUa3BdR2g==", - "dev": true, - "optional": true - }, "module-details-from-path": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/module-details-from-path/-/module-details-from-path-1.0.3.tgz", @@ -27371,12 +26429,6 @@ "resolved": "https://registry.npmjs.org/mri/-/mri-1.1.4.tgz", "integrity": "sha512-6y7IjGPm8AzlvoUrwAaw1tLnUBudaS3752vcd8JtrpGGQn+rXIe63LFVHm/YMwtqAuh+LJPCFdlLYPWM1nYn6w==" }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, "msgpack5": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/msgpack5/-/msgpack5-6.0.2.tgz", @@ -27491,13 +26543,6 @@ "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", "dev": true }, - "napi-build-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.1.tgz", - "integrity": "sha512-boQj1WFgQH3v4clhu3mTNfP+vOBxorDlE8EKiMjUlLG3C4qAESnn9AxIOkFgTR2c9LtzNjPrjS60cT27ZKBhaA==", - "dev": true, - "optional": true - }, "nats": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/nats/-/nats-2.7.1.tgz", @@ -27520,12 +26565,6 @@ "dev": true, "optional": true }, - "nested-error-stacks": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/nested-error-stacks/-/nested-error-stacks-2.1.0.tgz", - "integrity": "sha512-AO81vsIO1k1sM4Zrd6Hu7regmJN1NSiAja10gc4bX3F0wd+9rQmcuHQaHVQCYIEC8iFXnE+mavh23GOt7wBgug==", - "dev": true - }, "next-tick": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", @@ -27549,16 +26588,6 @@ } } }, - "node-abi": { - "version": "2.12.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.12.0.tgz", - "integrity": "sha512-VhPBXCIcvmo/5K8HPmnWJyyhvgKxnHTUMXR/XwGHV68+wrgkzST4UmQrY/XszSWA5dtnXpNp528zkcyJ/pzVcw==", - "dev": true, - "optional": true, - "requires": { - "semver": "^5.4.1" - } - }, "node-emoji": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.10.0.tgz", @@ -27689,13 +26718,6 @@ } } }, - "noop-logger": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/noop-logger/-/noop-logger-0.1.1.tgz", - "integrity": "sha1-lKKxYzxPExdVMAfYlm/Q6EG2pMI=", - "dev": true, - "optional": true - }, "nopt": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", @@ -27877,19 +26899,6 @@ "path-key": "^3.0.0" } }, - "npmlog": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", - "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", - "dev": true, - "optional": true, - "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, "nuid": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/nuid/-/nuid-1.1.6.tgz", @@ -27906,13 +26915,6 @@ "js-sdsl": "^2.1.2" } }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true, - "optional": true - }, "nwsapi": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.2.tgz", @@ -27975,12 +26977,6 @@ "integrity": "sha512-nNnZDkUNExBwEpb7LZaeMeQgvrlO8l4bgY/LvGNZCR0xG/dGWqHqjKrAmR5GUoYo0FIz38kxasvA1aevxWs2CA==", "dev": true }, - "optional": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/optional/-/optional-0.1.4.tgz", - "integrity": "sha512-gtvrrCfkE08wKcgXaVwQVgwEQ8vel2dc5DDBn9RLQZ3YtmtkBss6A2HY6BnJH4N/4Ku97Ri/SF8sNWE2225WJw==", - "dev": true - }, "optionator": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", @@ -28431,30 +27427,6 @@ "xtend": "^4.0.0" } }, - "prebuild-install": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-5.3.3.tgz", - "integrity": "sha512-GV+nsUXuPW2p8Zy7SarF/2W/oiK8bFQgJcncoJ0d7kRpekEA0ftChjfEaF9/Y+QJEc/wFR7RAEa8lYByuUIe2g==", - "dev": true, - "optional": true, - "requires": { - "detect-libc": "^1.0.3", - "expand-template": "^2.0.3", - "github-from-package": "0.0.0", - "minimist": "^1.2.0", - "mkdirp": "^0.5.1", - "napi-build-utils": "^1.0.1", - "node-abi": "^2.7.0", - "noop-logger": "^0.1.1", - "npmlog": "^4.0.1", - "pump": "^3.0.0", - "rc": "^1.2.7", - "simple-get": "^3.0.3", - "tar-fs": "^2.0.0", - "tunnel-agent": "^0.6.0", - "which-pm-runs": "^1.0.0" - } - }, "preferred-pm": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/preferred-pm/-/preferred-pm-3.0.3.tgz", @@ -28531,12 +27503,6 @@ "integrity": "sha1-hCRXzFHP7XLcd1r+6vuMYDQ3JyU=", "dev": true }, - "process-nextick-args": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", - "dev": true - }, "process-warning": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-1.0.0.tgz", @@ -29028,12 +27994,6 @@ "signal-exit": "^3.0.2" } }, - "retry": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.10.1.tgz", - "integrity": "sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q=", - "dev": true - }, "reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -29250,13 +28210,6 @@ } } }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true, - "optional": true - }, "shimmer": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/shimmer/-/shimmer-1.2.1.tgz", @@ -29280,25 +28233,6 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, - "simple-concat": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", - "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=", - "dev": true, - "optional": true - }, - "simple-get": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.1.1.tgz", - "integrity": "sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA==", - "dev": true, - "optional": true, - "requires": { - "decompress-response": "^4.2.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" - } - }, "simple-swizzle": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", @@ -29382,18 +28316,6 @@ } } }, - "snappy": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/snappy/-/snappy-6.2.3.tgz", - "integrity": "sha512-HZpVoIxMfQ4fL3iDuMdI1R5xycw1o9YDCAndTKZCY/EHRoKFvzwplttuBBVGeEg2fd1hYiwAXos/sM24W7N1LA==", - "dev": true, - "optional": true, - "requires": { - "bindings": "^1.3.1", - "nan": "^2.14.0", - "prebuild-install": "^5.2.2" - } - }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -29661,16 +28583,6 @@ } } }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "optional": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, "strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", @@ -29852,64 +28764,6 @@ } } }, - "tar-fs": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.0.1.tgz", - "integrity": "sha512-6tzWDMeroL87uF/+lin46k+Q+46rAJ0SyPGz7OW7wTgblI273hsBqk2C1j0/xNadNLKDTUL9BukSjB7cwgmlPA==", - "dev": true, - "optional": true, - "requires": { - "chownr": "^1.1.1", - "mkdirp-classic": "^0.5.2", - "pump": "^3.0.0", - "tar-stream": "^2.0.0" - } - }, - "tar-stream": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.2.tgz", - "integrity": "sha512-UaF6FoJ32WqALZGOIAApXx+OdxhekNMChu6axLJR85zMMjXKWFGjbIRe+J6P4UnRGg9rAwWvbTT0oI7hD/Un7Q==", - "dev": true, - "optional": true, - "requires": { - "bl": "^4.0.1", - "end-of-stream": "^1.4.1", - "fs-constants": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1" - }, - "dependencies": { - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, - "optional": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "safe-buffer": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", - "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==", - "dev": true, - "optional": true - }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dev": true, - "optional": true, - "requires": { - "safe-buffer": "~5.2.0" - } - } - } - }, "terminal-link": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz", @@ -30040,12 +28894,6 @@ "punycode": "^2.1.1" } }, - "traverse": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz", - "integrity": "sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk=", - "dev": true - }, "trim-newlines": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", @@ -30495,23 +29343,6 @@ "path-exists": "^4.0.0" } }, - "which-pm-runs": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.0.0.tgz", - "integrity": "sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs=", - "dev": true, - "optional": true - }, - "wide-align": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", - "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", - "dev": true, - "optional": true, - "requires": { - "string-width": "^1.0.2 || 2 || 3 || 4" - } - }, "widest-line": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", diff --git a/package.json b/package.json index 35a534060..3f3c45881 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "jest-cli": "^27.5.1", "jest-diff": "^27.5.1", "joi": "^17.7.0", - "kafka-node": "^5.0.0", + "kafkajs": "^2.2.4", "lockfile-lint": "^4.10.0", "log4js": "^6.7.1", "moleculer-repl": "^0.7.3", @@ -140,7 +140,7 @@ "etcd3": "^1.0.0", "ioredis": "^4.0.0 || ^5.0.0", "jaeger-client": "^3.0.0", - "kafka-node": "^5.0.0", + "kafkajs": "^2.2.4", "log4js": "^6.0.0", "mqtt": "^4.0.0", "msgpack5": "^5.0.0 || ^6.0.0", @@ -177,7 +177,7 @@ "jaeger-client": { "optional": true }, - "kafka-node": { + "kafkajs": { "optional": true }, "log4js": { diff --git a/src/transporters/kafka.js b/src/transporters/kafka.js index 6d98081cc..7141d0019 100644 --- a/src/transporters/kafka.js +++ b/src/transporters/kafka.js @@ -1,6 +1,6 @@ /* * moleculer - * Copyright (c) 2019 MoleculerJS (https://github.com/moleculerjs/moleculer) + * Copyright (c) 2023 MoleculerJS (https://github.com/moleculerjs/moleculer) * MIT Licensed */ @@ -10,15 +10,22 @@ const { defaultsDeep } = require("lodash"); const Transporter = require("./base"); const C = require("../constants"); +const toMoleculerLogLevel = level => { + switch (level) { + case 0: + case 1: + return "error"; + case 2: + return "warn"; + case 4: + return "info"; + case 5: + return "debug"; + } +}; + /** - * Lightweight transporter for Kafka - * - * For test: - * 1. clone https://github.com/wurstmeister/kafka-docker.git repo - * 2. follow instructions on https://github.com/wurstmeister/kafka-docker#pre-requisites - * 3. start containers with Docker Compose - * - * docker-compose -f docker-compose-single-broker.yml up -d + * Transporter for Kafka * * @class KafkaTransporter * @extends {Transporter} @@ -33,28 +40,41 @@ class KafkaTransporter extends Transporter { */ constructor(opts) { if (typeof opts === "string") { - opts = { host: opts.replace("kafka://", "") }; + opts = { client: { brokers: [opts.replace("kafka://", "")] } }; } else if (opts == null) { opts = {}; } opts = defaultsDeep(opts, { - // KafkaClient options. More info: https://github.com/SOHU-Co/kafka-node#options + // KafkaClient options. More info: https://kafka.js.org/docs/configuration client: { - kafkaHost: opts.host + brokers: Array.isArray(opts.brokers) + ? opts.brokers + : opts.brokers + ? [opts.brokers] + : null, + logLevel: 1, + logCreator: + logLevel => + ({ level, log }) => { + const { message, ...extra } = log; + if (log.error == "Topic creation errors") return; + this.logger[toMoleculerLogLevel(level)](message, extra); + } }, - // KafkaProducer options. More info: https://github.com/SOHU-Co/kafka-node#producerclient-options-custompartitioner + // KafkaProducer options. More info: https://kafka.js.org/docs/producing#options producer: {}, - customPartitioner: undefined, - // ConsumerGroup options. More info: https://github.com/SOHU-Co/kafka-node#consumergroupoptions-topics + // ConsumerGroup options. More info: https://kafka.js.org/docs/consuming#a-name-options-a-options consumer: {}, - // Advanced options for `send`. More info: https://github.com/SOHU-Co/kafka-node#sendpayloads-cb - publish: { - partition: 0, - attributes: 0 + // Advanced options for `send`. More info: https://kafka.js.org/docs/producing#producing-messages + publish: {}, + + // Advanced message options for `send`. More info: https://kafka.js.org/docs/producing#message-structure + publishMessage: { + partition: 0 } }); @@ -63,6 +83,7 @@ class KafkaTransporter extends Transporter { this.client = null; this.producer = null; this.consumer = null; + this.admin = null; } /** @@ -70,68 +91,41 @@ class KafkaTransporter extends Transporter { * * @memberof KafkaTransporter */ - connect() { - return new this.broker.Promise((resolve, reject) => { - let Kafka; - try { - Kafka = require("kafka-node"); - } catch (err) { - /* istanbul ignore next */ - this.broker.fatal( - "The 'kafka-node' package is missing. Please install it with 'npm install kafka-node --save' command.", - err, - true - ); - } - - this.client = new Kafka.KafkaClient(this.opts.client); - - // Create Producer - this.producer = new Kafka.Producer( - this.client, - this.opts.producer, - this.opts.customPartitioner + async connect() { + let Kafka; + try { + Kafka = require("kafkajs").Kafka; + } catch (err) { + /* istanbul ignore next */ + this.broker.fatal( + "The 'kafkajs' package is missing. Please install it with 'npm install kafkajs --save' command.", + err, + true ); - this.producer.on("ready", () => { - /* Moved to ConsumerGroup - // Create Consumer - - this.consumer = new Kafka.Consumer(this.client, this.opts.consumerPayloads || [], this.opts.consumer); - - this.consumer.on("error", e => { - this.logger.error("Kafka Consumer error", e.message); - this.logger.debug(e); - - if (!this.connected) - reject(e); - }); - - this.consumer.on("message", message => { - const topic = message.topic; - const cmd = topic.split(".")[1]; - console.log(cmd); - this.incomingMessage(cmd, message.value); - });*/ - - this.logger.info("Kafka client is connected."); + } - this.onConnected().then(resolve); + this.client = new Kafka(this.opts.client); + + // Create Producer + this.producer = this.client.producer(this.opts.producer); + this.admin = this.client.admin(); + try { + await this.admin.connect(); + await this.producer.connect(); + this.logger.info("Kafka client is connected."); + await this.onConnected(); + } catch (err) { + this.logger.error("Kafka Producer error", err.message); + this.logger.debug(err); + + this.broker.broadcastLocal("$transporter.error", { + error: err, + module: "transporter", + type: C.FAILED_PUBLISHER_ERROR }); - /* istanbul ignore next */ - this.producer.on("error", e => { - this.logger.error("Kafka Producer error", e.message); - this.logger.debug(e); - - this.broker.broadcastLocal("$transporter.error", { - error: e, - module: "transporter", - type: C.FAILED_PUBLISHER_ERROR - }); - - if (!this.connected) reject(e); - }); - }); + throw err; + } } /** @@ -139,18 +133,18 @@ class KafkaTransporter extends Transporter { * * @memberof KafkaTransporter */ - disconnect() { - if (this.client) { - this.client.close(() => { - this.client = null; - this.producer = null; - - if (this.consumer) { - this.consumer.close(() => { - this.consumer = null; - }); - } - }); + async disconnect() { + if (this.admin) { + await this.admin.disconnect(); + this.admin = null; + } + if (this.producer) { + await this.producer.disconnect(); + this.producer = null; + } + if (this.consumer) { + await this.consumer.disconnect(); + this.consumer = null; } } @@ -161,96 +155,65 @@ class KafkaTransporter extends Transporter { * * @memberof BaseTransporter */ - makeSubscriptions(topics) { - topics = topics.map(({ cmd, nodeID }) => this.getTopicName(cmd, nodeID)); - - return new this.broker.Promise((resolve, reject) => { - this.producer.createTopics(topics, true, err => { - /* istanbul ignore next */ - if (err) { - this.logger.error("Unable to create topics!", topics, err); - - this.broker.broadcastLocal("$transporter.error", { - error: err, - module: "transporter", - type: C.FAILED_TOPIC_CREATION - }); - - return reject(err); - } - - const consumerOptions = Object.assign( - { - id: "default-kafka-consumer", - kafkaHost: this.opts.host, - groupId: this.broker.instanceID, //this.nodeID, - fromOffset: "latest", - encoding: "buffer" - }, - this.opts.consumer - ); - - const Kafka = require("kafka-node"); - this.consumer = new Kafka.ConsumerGroup(consumerOptions, topics); - - /* istanbul ignore next */ - this.consumer.on("error", e => { - this.logger.error("Kafka Consumer error", e.message); - this.logger.debug(e); + async makeSubscriptions(topics) { + // Create topics + topics = topics.map(({ cmd, nodeID }) => ({ topic: this.getTopicName(cmd, nodeID) })); + try { + await this.admin.createTopics({ topics }); + } catch (err) { + this.logger.error("Unable to create topics!", topics, err); + + this.broker.broadcastLocal("$transporter.error", { + error: err, + module: "transporter", + type: C.FAILED_TOPIC_CREATION + }); + throw err; + } - this.broker.broadcastLocal("$transporter.error", { - error: e, - module: "transporter", - type: C.FAILED_CONSUMER_ERROR - }); + // Create Consumer + try { + const consumerOptions = Object.assign( + { + // id: "default-kafka-consumer", + // kafkaHost: this.opts.host, + groupId: this.broker.instanceID + // fromOffset: "latest", + // encoding: "buffer" + }, + this.opts.consumer + ); - if (!this.connected) reject(e); - }); + this.consumer = this.client.consumer(consumerOptions); + await this.consumer.connect(); - this.consumer.on("message", message => { - const topic = message.topic; + this.consumer.subscribe({ topics: topics.map(topic => topic.topic) }); + // Ref: https://kafka.js.org/docs/consuming#a-name-each-message-a-eachmessage + this.consumer.run({ + eachMessage: async ({ topic, message }) => { const cmd = topic.split(".")[1]; - this.receive(cmd, message.value); - }); - - this.consumer.on("connect", () => { - resolve(); - }); - }); - }); - } - - /** - * Subscribe to a command - * - * @param {String} cmd - * @param {String} nodeID - * - * @memberof KafkaTransporter - */ - /* - subscribe(cmd, nodeID) { - const topic = this.getTopicName(cmd, nodeID); - this.topics.push(topic); - - return new this.broker.Promise((resolve, reject) => { - this.producer.createTopics([topic], true, (err, data) => { - if (err) { - this.logger.error("Unable to create topics!", topic, err); - return reject(err); + await this.receive(cmd, message.value); + // console.log({ + // topic, + // key: (message.key ? message.key.toString() : ""), + // value: message.value.toString(), + // headers: message.headers, + // }); } - - this.consumer.addTopics([{ topic, offset: -1 }], (err, added) => { - if (err) { - this.logger.error("Unable to add topic!", topic, err); - return reject(err); - } - - resolve(); - }, false); }); - }); - }*/ + } catch (err) { + this.logger.error("Kafka Consumer error", err.message); + this.logger.debug(err); + + this.broker.broadcastLocal("$transporter.error", { + error: err, + module: "transporter", + type: C.FAILED_CONSUMER_ERROR + }); + + throw err; + } + } /** * Send data buffer. @@ -261,37 +224,32 @@ class KafkaTransporter extends Transporter { * * @returns {Promise} */ - send(topic, data, { packet }) { + async send(topic, data, { packet }) { /* istanbul ignore next*/ - if (!this.client) return this.broker.Promise.resolve(); + if (!this.client) return; - return new this.broker.Promise((resolve, reject) => { - this.producer.send( - [ + try { + await this.producer.send({ + topic: this.getTopicName(packet.type, packet.target), + messages: [ { - topic: this.getTopicName(packet.type, packet.target), - messages: [data], - partition: this.opts.publish.partition, - attributes: this.opts.publish.attributes + value: data, + ...this.opts.publishMessage } ], - err => { - /* istanbul ignore next */ - if (err) { - this.logger.error("Publish error", err); + ...this.opts.publish + }); + } catch (err) { + this.logger.error("Kafka Publish error", err); - this.broker.broadcastLocal("$transporter.error", { - error: err, - module: "transporter", - type: C.FAILED_PUBLISHER_ERROR - }); + this.broker.broadcastLocal("$transporter.error", { + error: err, + module: "transporter", + type: C.FAILED_PUBLISHER_ERROR + }); - reject(err); - } - resolve(); - } - ); - }); + throw err; + } } } diff --git a/test/unit/transporters/index.spec.js b/test/unit/transporters/index.spec.js index 1c4d8215f..8f6b4c1ab 100644 --- a/test/unit/transporters/index.spec.js +++ b/test/unit/transporters/index.spec.js @@ -119,18 +119,18 @@ describe("Test Transporter resolver", () => { }); it("should resolve KafkaTransporter from connection string", () => { - let trans = Transporters.resolve("kafka://localhost:2181"); + let trans = Transporters.resolve("kafka://localhost:9093"); expect(trans).toBeInstanceOf(Transporters.Kafka); expect(trans.opts).toEqual({ - host: "localhost:2181", client: { - kafkaHost: "localhost:2181" + brokers: ["localhost:9093"], + logCreator: expect.any(Function), + logLevel: 1 }, - consumer: {}, - customPartitioner: undefined, producer: {}, - publish: { - attributes: 0, + consumer: {}, + publish: {}, + publishMessage: { partition: 0 } }); @@ -138,23 +138,23 @@ describe("Test Transporter resolver", () => { it("should resolve KafkaTransporter from obj", () => { let options = { - host: "localhost:2181", - publish: { + client: { brokers: ["localhost:9093"] }, + publishMessage: { partition: 2 } }; let trans = Transporters.resolve({ type: "Kafka", options }); expect(trans).toBeInstanceOf(Transporters.Kafka); expect(trans.opts).toEqual({ - host: "localhost:2181", client: { - kafkaHost: "localhost:2181" + brokers: ["localhost:9093"], + logCreator: expect.any(Function), + logLevel: 1 }, - consumer: {}, - customPartitioner: undefined, producer: {}, - publish: { - attributes: 0, + consumer: {}, + publish: {}, + publishMessage: { partition: 2 } }); diff --git a/test/unit/transporters/kafka.spec.js b/test/unit/transporters/kafka.spec.js index 09c8c57e7..bb8115e42 100644 --- a/test/unit/transporters/kafka.spec.js +++ b/test/unit/transporters/kafka.spec.js @@ -3,17 +3,40 @@ const Transit = require("../../../src/transit"); const P = require("../../../src/packets"); const C = require("../../../src/constants"); -jest.mock("kafka-node"); - -let Kafka = require("kafka-node"); -const clientCallbacks = {}; -let clientCloseCB; -Kafka.KafkaClient = jest.fn(() => { - return { - close: jest.fn(cb => (clientCloseCB = cb)), - callbacks: clientCallbacks - }; -}); +jest.mock("kafkajs"); + +let Kafka = require("kafkajs"); + +const FakeKafkaAdmin = { + connect: jest.fn(), + disconnect: jest.fn(), + createTopics: jest.fn() +}; + +const FakeKafkaProducer = { + connect: jest.fn(), + disconnect: jest.fn(), + send: jest.fn() +}; + +let consumerRunOpts = {}; +const FakeKafkaConsumer = { + connect: jest.fn(), + disconnect: jest.fn(), + subscribe: jest.fn(), + run: jest.fn(opts => { + consumerRunOpts = opts; + }) +}; + +const FakeKafkaClient = { + admin: jest.fn(() => FakeKafkaAdmin), + producer: jest.fn(() => FakeKafkaProducer), + consumer: jest.fn(() => FakeKafkaConsumer) +}; + +Kafka.Kafka = jest.fn(() => FakeKafkaClient); +/* const producerCallbacks = {}; Kafka.Producer = jest.fn(() => { return { @@ -33,7 +56,7 @@ Kafka.ConsumerGroup = jest.fn(() => { callbacks: groupCallbacks }; }); - +*/ const KafkaTransporter = require("../../../src/transporters/kafka"); describe("Test KafkaTransporter constructor", () => { @@ -41,17 +64,15 @@ describe("Test KafkaTransporter constructor", () => { let transporter = new KafkaTransporter(); expect(transporter).toBeDefined(); expect(transporter.opts).toEqual({ - host: undefined, client: { - noAckBatchOptions: undefined, - sslOptions: undefined, - zkOptions: undefined + brokers: null, + logCreator: expect.any(Function), + logLevel: 1 }, - customPartitioner: undefined, producer: {}, consumer: {}, - publish: { - attributes: 0, + publish: {}, + publishMessage: { partition: 0 } }); @@ -64,15 +85,15 @@ describe("Test KafkaTransporter constructor", () => { it("check constructor with string param", () => { let transporter = new KafkaTransporter("localhost:9092"); expect(transporter.opts).toEqual({ - host: "localhost:9092", client: { - kafkaHost: "localhost:9092" + brokers: ["localhost:9092"], + logCreator: expect.any(Function), + logLevel: 1 }, - customPartitioner: undefined, producer: {}, consumer: {}, - publish: { - attributes: 0, + publish: {}, + publishMessage: { partition: 0 } }); @@ -80,22 +101,24 @@ describe("Test KafkaTransporter constructor", () => { it("check constructor with options", () => { let opts = { - host: "localhost:9092", - publish: { + client: { + brokers: ["localhost:9092"] + }, + publishMessage: { partition: 1 } }; let transporter = new KafkaTransporter(opts); expect(transporter.opts).toEqual({ - host: "localhost:9092", client: { - kafkaHost: "localhost:9092" + brokers: ["localhost:9092"], + logCreator: expect.any(Function), + logLevel: 1 }, - customPartitioner: undefined, producer: {}, consumer: {}, - publish: { - attributes: 0, + publish: {}, + publishMessage: { partition: 1 } }); @@ -109,43 +132,57 @@ describe("Test KafkaTransporter connect & disconnect", () => { let transporter; beforeEach(() => { - transporter = new KafkaTransporter(); + transporter = new KafkaTransporter({ + client: { + some: "thing" + }, + producer: { + extraProp: 7 + } + }); transporter.init(transit, msgHandler); }); - it("check connect", () => { - let p = transporter.connect().then(() => { - expect(transporter.client).toBeDefined(); - expect(transporter.producer).toBeDefined(); - expect(transporter.producer.on).toHaveBeenCalledTimes(2); - expect(transporter.producer.on).toHaveBeenCalledWith("ready", expect.any(Function)); - expect(transporter.producer.on).toHaveBeenCalledWith("error", expect.any(Function)); + it("check connect", async () => { + await transporter.connect(); + expect(transporter.client).toBeDefined(); + expect(transporter.admin).toBeDefined(); + expect(transporter.producer).toBeDefined(); + + expect(Kafka.Kafka).toHaveBeenCalledTimes(1); + expect(Kafka.Kafka).toHaveBeenCalledWith({ + brokers: null, + logCreator: expect.any(Function), + logLevel: 1, + some: "thing" }); - transporter.producer.callbacks.ready(); - - return p; + expect(FakeKafkaClient.producer).toHaveBeenCalledTimes(1); + expect(FakeKafkaClient.producer).toHaveBeenCalledWith({ + extraProp: 7 + }); }); - it("check connect - should broadcast error", () => { + it("check connect - should broadcast error", async () => { broker.broadcastLocal = jest.fn(); - let p = transporter.connect().catch(() => { + const origErr = new Error("Ups"); + FakeKafkaAdmin.connect = jest.fn(() => Promise.reject(origErr)); + try { + await transporter.connect(); + expect(1).toBe(2); + } catch (err) { + expect(err).toBe(origErr); expect(transporter.producer).toBeDefined(); expect(broker.broadcastLocal).toHaveBeenCalledTimes(1); expect(broker.broadcastLocal).toHaveBeenNthCalledWith(1, "$transporter.error", { - error: new Error("Ups"), + error: origErr, module: "transporter", type: C.FAILED_PUBLISHER_ERROR }); - }); - - // Trigger an error - const error = new Error("Ups"); - transporter.producer.callbacks.error(error); - - return p; + } + FakeKafkaAdmin.connect = jest.fn(); }); it("check onConnected after connect", () => { @@ -155,26 +192,20 @@ describe("Test KafkaTransporter connect & disconnect", () => { expect(transporter.onConnected).toHaveBeenCalledWith(); }); - transporter.producer.callbacks.ready(); - return p; }); - it("check disconnect", () => { - let p = transporter.connect().then(() => { - let close = transporter.client.close; - let close2 = jest.fn(cb => cb()); - transporter.consumer = { - close: close2 - }; - transporter.disconnect(); - expect(close).toHaveBeenCalledTimes(1); - clientCloseCB(); - expect(close2).toHaveBeenCalledTimes(1); - }); + it("check disconnect", async () => { + await transporter.connect(); + await transporter.makeSubscriptions([ + { cmd: "REQ", nodeID: "node" }, + { cmd: "RES", nodeID: "node" } + ]); + await transporter.disconnect(); - transporter.producer.callbacks.ready(); // Trigger the `resolve` - return p; + expect(FakeKafkaAdmin.disconnect).toHaveBeenCalledTimes(1); + expect(FakeKafkaProducer.disconnect).toHaveBeenCalledTimes(1); + expect(FakeKafkaConsumer.disconnect).toHaveBeenCalledTimes(1); }); }); @@ -182,105 +213,108 @@ describe("Test KafkaTransporter makeSubscriptions", () => { let transporter; let msgHandler; - beforeEach(() => { + beforeEach(async () => { msgHandler = jest.fn(); - transporter = new KafkaTransporter("kafka://kafka-server:1234"); + transporter = new KafkaTransporter({ + client: { brokers: ["kafka://kafka-server:1234"] }, + consumer: { extraProp: 5 } + }); transporter.init( new Transit(new ServiceBroker({ logger: false, namespace: "TEST", nodeID: "node-1" })), msgHandler ); - let p = transporter.connect(); - transporter.producer.callbacks.ready(); // Trigger the `resolve` + await transporter.connect(); transporter.incomingMessage = jest.fn(); - return p; + + transporter.admin.createTopics.mockClear(); }); - it("check makeSubscriptions", () => { - transporter.producer.createTopics = jest.fn((topics, a, cb) => cb()); - transporter.makeSubscriptions([ + it("check makeSubscriptions", async () => { + FakeKafkaClient.consumer.mockClear(); + FakeKafkaConsumer.connect.mockClear(); + + await transporter.makeSubscriptions([ { cmd: "REQ", nodeID: "node" }, { cmd: "RES", nodeID: "node" } ]); - expect(transporter.producer.createTopics).toHaveBeenCalledTimes(1); - expect(transporter.producer.createTopics).toHaveBeenCalledWith( - ["MOL-TEST.REQ.node", "MOL-TEST.RES.node"], - true, - expect.any(Function) - ); + expect(transporter.admin.createTopics).toHaveBeenCalledTimes(1); + expect(transporter.admin.createTopics).toHaveBeenCalledWith({ + topics: [{ topic: "MOL-TEST.REQ.node" }, { topic: "MOL-TEST.RES.node" }] + }); - expect(Kafka.ConsumerGroup).toHaveBeenCalledTimes(1); - expect(Kafka.ConsumerGroup).toHaveBeenCalledWith( - { - encoding: "buffer", - fromOffset: "latest", - groupId: transporter.broker.instanceID, - kafkaHost: "kafka-server:1234", - id: "default-kafka-consumer" - }, - ["MOL-TEST.REQ.node", "MOL-TEST.RES.node"] - ); + expect(FakeKafkaClient.consumer).toHaveBeenCalledTimes(1); + expect(FakeKafkaClient.consumer).toHaveBeenCalledWith({ + groupId: transporter.broker.instanceID, + extraProp: 5 + }); + expect(FakeKafkaConsumer.connect).toHaveBeenCalledTimes(1); expect(transporter.consumer).toBeDefined(); - expect(transporter.consumer.on).toHaveBeenCalledTimes(3); - expect(transporter.consumer.on).toHaveBeenCalledWith("error", expect.any(Function)); - expect(transporter.consumer.on).toHaveBeenCalledWith("message", expect.any(Function)); - expect(transporter.consumer.on).toHaveBeenCalledWith("connect", expect.any(Function)); - transporter.consumer.callbacks.connect(); - - transporter.consumer.callbacks.message({ + consumerRunOpts.eachMessage({ topic: "MOL.INFO.node-2", - value: '{ ver: "3" }' + message: { + value: '{ ver: "3" }' + } }); expect(transporter.incomingMessage).toHaveBeenCalledTimes(1); expect(transporter.incomingMessage).toHaveBeenCalledWith("INFO", '{ ver: "3" }'); }); - it("check makeSubscriptions - should broadcast a producer error", () => { + it("check makeSubscriptions - should broadcast an error", async () => { transporter.broker.broadcastLocal = jest.fn(); - transporter.producer.createTopics = jest.fn((topics, a, cb) => cb(new Error("Ups!"))); - const p = transporter - .makeSubscriptions([ + const origErr = new Error("Ups"); + transporter.admin.createTopics = jest.fn(() => Promise.reject(origErr)); + + try { + await transporter.makeSubscriptions([ { cmd: "REQ", nodeID: "node" }, { cmd: "RES", nodeID: "node" } - ]) - .then(() => transporter.consumer.callbacks.connect()) - .catch(() => { - expect(transporter.broker.broadcastLocal).toHaveBeenCalledTimes(1); - expect(transporter.broker.broadcastLocal).toHaveBeenNthCalledWith( - 1, - "$transporter.error", - { - error: new Error("Ups!"), - module: "transporter", - type: C.FAILED_TOPIC_CREATION - } - ); + ]); + expect(1).toBe(2); + } catch (err) { + expect(err).toBe(origErr); + expect(transporter.producer).toBeDefined(); + + expect(transporter.broker.broadcastLocal).toHaveBeenCalledTimes(1); + expect(transporter.broker.broadcastLocal).toHaveBeenCalledWith("$transporter.error", { + error: origErr, + module: "transporter", + type: C.FAILED_TOPIC_CREATION }); + } - return p; + transporter.admin.createTopics = jest.fn(); }); it("check makeSubscriptions - should broadcast a consumer error", async () => { transporter.broker.broadcastLocal = jest.fn(); - transporter.producer.createTopics = jest.fn((topics, a, cb) => cb()); - transporter.makeSubscriptions([ - { cmd: "REQ", nodeID: "node" }, - { cmd: "RES", nodeID: "node" } - ]); + const origErr = new Error("Ups"); + FakeKafkaConsumer.run = jest.fn(() => { + throw origErr; + }); - transporter.consumer.callbacks.error(new Error("Ups!")); + try { + await transporter.makeSubscriptions([ + { cmd: "REQ", nodeID: "node" }, + { cmd: "RES", nodeID: "node" } + ]); + expect(1).toBe(2); + } catch (err) { + expect(err).toBe(origErr); + expect(transporter.broker.broadcastLocal).toHaveBeenCalledTimes(1); + expect(transporter.broker.broadcastLocal).toHaveBeenCalledWith("$transporter.error", { + error: origErr, + module: "transporter", + type: C.FAILED_CONSUMER_ERROR + }); + } - expect(transporter.broker.broadcastLocal).toHaveBeenCalledTimes(1); - expect(transporter.broker.broadcastLocal).toHaveBeenCalledWith("$transporter.error", { - error: new Error("Ups!"), - module: "transporter", - type: C.FAILED_CONSUMER_ERROR - }); + FakeKafkaConsumer.run = jest.fn(); }); }); @@ -288,39 +322,60 @@ describe("Test KafkaTransporter subscribe & publish", () => { let transporter; let msgHandler; - beforeEach(() => { + beforeEach(async () => { msgHandler = jest.fn(); - transporter = new KafkaTransporter(); + transporter = new KafkaTransporter({ + client: { brokers: ["kafka://kafka-server:1234"] }, + publish: { extraProp: 5 }, + publishMessage: { partition: 2 } + }); transporter.init( new Transit(new ServiceBroker({ logger: false, namespace: "TEST", nodeID: "node1" })), msgHandler ); transporter.serialize = jest.fn(() => Buffer.from("json data")); - let p = transporter.connect(); - transporter.producer.callbacks.ready(); // Trigger the `resolve` - return p; + await transporter.connect(); }); - it("check publish", () => { + it("check publish", async () => { transporter.producer.send.mockClear(); const packet = new P.Packet(P.PACKET_INFO, "node2", { services: {} }); - transporter.publish(packet); + await transporter.publish(packet); expect(transporter.producer.send).toHaveBeenCalledTimes(1); - expect(transporter.producer.send).toHaveBeenCalledWith( - [ - { - topic: "MOL-TEST.INFO.node2", - messages: [Buffer.from("json data")], - partition: 0, - attributes: 0 - } - ], - expect.any(Function) - ); + expect(transporter.producer.send).toHaveBeenCalledWith({ + topic: "MOL-TEST.INFO.node2", + messages: [{ value: Buffer.from("json data"), partition: 2 }], + extraProp: 5 + }); expect(transporter.serialize).toHaveBeenCalledTimes(1); expect(transporter.serialize).toHaveBeenCalledWith(packet); }); + + it("check publish - should broadcast a publisher error", async () => { + transporter.broker.broadcastLocal = jest.fn(); + + const origErr = new Error("Ups"); + FakeKafkaProducer.send = jest.fn(() => { + throw origErr; + }); + + try { + const packet = new P.Packet(P.PACKET_INFO, "node2", { services: {} }); + await transporter.publish(packet); + expect(1).toBe(2); + } catch (err) { + expect(err).toBe(origErr); + expect(transporter.broker.broadcastLocal).toHaveBeenCalledTimes(1); + expect(transporter.broker.broadcastLocal).toHaveBeenCalledWith("$transporter.error", { + error: origErr, + module: "transporter", + type: C.FAILED_PUBLISHER_ERROR + }); + } + + FakeKafkaConsumer.run = jest.fn(); + }); });