From 5df39a01ba9f22ac19cb6d2b364dec4978c6707b Mon Sep 17 00:00:00 2001 From: Luuk Wullink Date: Fri, 23 Apr 2021 16:00:44 +0200 Subject: [PATCH 001/112] added support for 'U' and 'u' to codec --- lib/codec.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/codec.js b/lib/codec.js index c4bc5b08..817b099d 100644 --- a/lib/codec.js +++ b/lib/codec.js @@ -279,6 +279,10 @@ function decodeFields(slice) { case 'l': val = ints.readInt64BE(slice, offset); offset += 8; break; + case 'u': + val = slice.readUInt16BE(offset); offset += 2; + break; + case 'U': case 's': val = slice.readInt16BE(offset); offset += 2; break; From afca47aa73ae5f89184f139a7090fe0da0f1081d Mon Sep 17 00:00:00 2001 From: xamgore Date: Sat, 3 Apr 2021 22:38:29 +0300 Subject: [PATCH 002/112] Drop support for node.js engines below v10 It's a common practice to drop support for non-LTS Node versions, as it allows to reduce the maintenance burden. See more at: https://nodejs.org/en/about/releases/ --- Makefile | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index cbebe656..e1393322 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ JSON=amqp-rabbitmq-0.9.1.json RABBITMQ_CODEGEN=https://raw.githubusercontent.com/rabbitmq/rabbitmq-codegen AMQP_JSON=$(RABBITMQ_CODEGEN)/$(RABBITMQ_SRC_VERSION)/$(JSON) -NODEJS_VERSIONS='0.8' '0.9' '0.10' '0.11' '0.12' '1.8.4' '2.5' '3.3' '4.9' '5.12' '6.17' '8.17' '9.11' '10.21' '11.15' '12.18' '13.14' '14.5' '15.8' +NODEJS_VERSIONS='10.21' '11.15' '12.18' '13.14' '14.5' '15.8' MOCHA=./node_modules/.bin/mocha _MOCHA=./node_modules/.bin/_mocha diff --git a/package.json b/package.json index 0b204642..2a652356 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "url": "https://github.com/squaremo/amqp.node.git" }, "engines": { - "node": ">=0.8 <=15" + "node": ">=10 <=15" }, "dependencies": { "bitsyntax": "~0.1.0", From 50dac2546dbeb4ae4fa1547994a4a1946317566b Mon Sep 17 00:00:00 2001 From: Igor Strebezhev Date: Thu, 22 Apr 2021 13:53:52 +0300 Subject: [PATCH 003/112] Remove the upper bound of node engines --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2a652356..7126fbd3 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "url": "https://github.com/squaremo/amqp.node.git" }, "engines": { - "node": ">=10 <=15" + "node": ">=10" }, "dependencies": { "bitsyntax": "~0.1.0", From 60aa02ddc8471121c696203802f78d3928e7d4af Mon Sep 17 00:00:00 2001 From: Igor Strebezhev Date: Fri, 14 May 2021 23:19:41 +0300 Subject: [PATCH 004/112] Alter supported nodejs versions in readme --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index dbe09b02..fa3d659d 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,7 @@ * [API reference][gh-pages-apiref] * [Examples from RabbitMQ tutorials][tutes] -A library for making AMQP 0-9-1 clients for Node.JS, and an AMQP 0-9-1 -client for Node.JS v0.8-0.12, v4-v15, and the intervening io.js -releases. +A library for making AMQP 0-9-1 clients for Node.JS, and an AMQP 0-9-1 client for Node.JS v10+. This library does not implement [AMQP 1.0](https://github.com/squaremo/amqp.node/issues/63) or [AMQP From fd8d115ac5884fc8d54fd65c3a907b85795ea16e Mon Sep 17 00:00:00 2001 From: Jonas Kello Date: Mon, 17 May 2021 09:39:00 +0200 Subject: [PATCH 005/112] Fix broken links in readme The links to github pages were broken but I found I could get to working pages by changing github.com to github.io. It was then redirected to squaremobius.net. The changelog and tutes link pointed to master that has been rename to main. --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fa3d659d..a7a11b2b 100644 --- a/README.md +++ b/README.md @@ -146,10 +146,10 @@ really only useful for checking the kind and formatting of the errors. make coverage open file://`pwd`/coverage/lcov-report/index.html -[gh-pages]: http://squaremo.github.com/amqp.node/ -[gh-pages-apiref]: http://squaremo.github.com/amqp.node/channel_api.html +[gh-pages]: http://www.squaremobius.net/amqp.node/ +[gh-pages-apiref]: http://www.squaremobius.net/amqp.node/channel_api.html [nave]: https://github.com/isaacs/nave -[tutes]: https://github.com/squaremo/amqp.node/tree/master/examples/tutorials +[tutes]: https://github.com/squaremo/amqp.node/tree/main/examples/tutorials [rabbitmq-tutes]: http://www.rabbitmq.com/getstarted.html -[changelog]: https://github.com/squaremo/amqp.node/blob/master/CHANGELOG.md +[changelog]: https://github.com/squaremo/amqp.node/blob/main/CHANGELOG.md [docker]: https://www.docker.com/ From 6f99086fd37c2acad5dcf1acc3ddceabc363afb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Ho=CC=88rberg?= Date: Tue, 31 Mar 2020 15:49:19 +0200 Subject: [PATCH 006/112] set SNI hostname for TLS connections --- lib/connect.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/connect.js b/lib/connect.js index 603f1981..27a042ec 100644 --- a/lib/connect.js +++ b/lib/connect.js @@ -106,6 +106,7 @@ function connect(url, socketOptions, openCallback) { if (typeof url === 'object') { protocol = (url.protocol || 'amqp') + ':'; sockopts.host = url.hostname; + sockopts.servername = url.hostname; sockopts.port = url.port || ((protocol === 'amqp:') ? 5672 : 5671); var user, pass; @@ -130,6 +131,7 @@ function connect(url, socketOptions, openCallback) { var parts = URL(url, true); // yes, parse the query string protocol = parts.protocol; sockopts.host = parts.hostname; + sockopts.servername = parts.hostname; sockopts.port = parseInt(parts.port) || ((protocol === 'amqp:') ? 5672 : 5671); var vhost = parts.pathname ? parts.pathname.substr(1) : null; fields = openFrames(vhost, parts.query, sockopts.credentials || credentialsFromUrl(parts), extraClientProperties); From dcce9efb75485945346c2b028ef4f82b92845a9e Mon Sep 17 00:00:00 2001 From: Igor Savin Date: Tue, 18 May 2021 11:36:31 +0300 Subject: [PATCH 007/112] Drop safe-buffer dependency --- .gitignore | 1 + bin/generate-defs.js | 1 - lib/channel.js | 1 - lib/connection.js | 1 - lib/credentials.js | 1 - lib/frame.js | 1 - package-lock.json | 1623 ------------------------------------------ package.json | 1 - test/callback_api.js | 1 - test/channel.js | 1 - test/channel_api.js | 1 - test/codec.js | 1 - test/connect.js | 1 - test/connection.js | 1 - test/data.js | 1 - test/frame.js | 5 +- 16 files changed, 3 insertions(+), 1639 deletions(-) delete mode 100644 package-lock.json diff --git a/.gitignore b/.gitignore index 45c1bf32..17a06292 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ node_modules/ bin/amqp-rabbitmq-0.9.1.json etc/ coverage/ +/.idea/ diff --git a/bin/generate-defs.js b/bin/generate-defs.js index af984a00..ac7c71b5 100644 --- a/bin/generate-defs.js +++ b/bin/generate-defs.js @@ -116,7 +116,6 @@ println( '*/'); println("'use strict';"); nl(); -println('var Buffer = require("safe-buffer").Buffer;'); nl() println('var codec = require("./codec");'); println('var ints = require("buffer-more-ints");'); diff --git a/lib/channel.js b/lib/channel.js index fc8f17d6..c6604fb4 100644 --- a/lib/channel.js +++ b/lib/channel.js @@ -16,7 +16,6 @@ var EventEmitter = require('events').EventEmitter; var fmt = require('util').format; var IllegalOperationError = require('./error').IllegalOperationError; var stackCapture = require('./error').stackCapture; -var Buffer = require('safe-buffer').Buffer function Channel(connection) { EventEmitter.call( this ); this.connection = connection; diff --git a/lib/connection.js b/lib/connection.js index f65138c5..5f3bed3a 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -9,7 +9,6 @@ var constants = defs.constants; var frame = require('./frame'); var HEARTBEAT = frame.HEARTBEAT; var Mux = require('./mux').Mux; -var Buffer = require('safe-buffer').Buffer var Duplex = require('stream').Duplex || diff --git a/lib/credentials.js b/lib/credentials.js index 38a8053b..194659a8 100644 --- a/lib/credentials.js +++ b/lib/credentials.js @@ -8,7 +8,6 @@ // * PLAIN (send username and password in the plain) // * EXTERNAL (assume the server will figure out who you are from // context, i.e., your SSL certificate) -var Buffer = require('safe-buffer').Buffer var codec = require('./codec') module.exports.plain = function(user, passwd) { diff --git a/lib/frame.js b/lib/frame.js index 5ea86fae..f96dfa8e 100644 --- a/lib/frame.js +++ b/lib/frame.js @@ -7,7 +7,6 @@ var defs = require('./defs'); var constants = defs.constants; var decode = defs.decode; -var Buffer = require('safe-buffer').Buffer var Bits = require('bitsyntax'); diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index b73ef341..00000000 --- a/package-lock.json +++ /dev/null @@ -1,1623 +0,0 @@ -{ - "name": "amqplib", - "version": "0.7.1", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "amqplib", - "version": "0.7.1", - "license": "MIT", - "dependencies": { - "bitsyntax": "~0.1.0", - "bluebird": "^3.7.2", - "buffer-more-ints": "~1.0.0", - "readable-stream": "1.x >=1.1.9", - "safe-buffer": "~5.2.1", - "url-parse": "~1.5.1" - }, - "devDependencies": { - "claire": "0.4.1", - "istanbul": "0.1.x", - "mocha": "^3.5.3", - "uglify-js": "2.8.x" - }, - "engines": { - "node": ">=0.8 <=15" - } - }, - "node_modules/abbrev": { - "version": "1.0.9", - "resolved": "http://npm.tescloud.com/abbrev/-/abbrev-1.0.9.tgz", - "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=", - "dev": true - }, - "node_modules/align-text": { - "version": "0.1.4", - "resolved": "http://npm.tescloud.com/align-text/-/align-text-0.1.4.tgz", - "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", - "dev": true, - "dependencies": { - "kind-of": "^3.0.2", - "longest": "^1.0.1", - "repeat-string": "^1.5.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/amdefine": { - "version": "1.0.1", - "resolved": "http://npm.tescloud.com/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", - "dev": true, - "engines": { - "node": ">=0.4.2" - } - }, - "node_modules/async": { - "version": "0.2.10", - "resolved": "http://npm.tescloud.com/async/-/async-0.2.10.tgz", - "integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E=", - "dev": true - }, - "node_modules/balanced-match": { - "version": "1.0.0", - "resolved": "http://npm.tescloud.com/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "node_modules/bitsyntax": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/bitsyntax/-/bitsyntax-0.1.0.tgz", - "integrity": "sha512-ikAdCnrloKmFOugAfxWws89/fPc+nw0OOG1IzIE72uSOg/A3cYptKCjSUhDTuj7fhsJtzkzlv7l3b8PzRHLN0Q==", - "dependencies": { - "buffer-more-ints": "~1.0.0", - "debug": "~2.6.9", - "safe-buffer": "~5.1.2" - }, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/bitsyntax/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/bitsyntax/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "node_modules/bluebird": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", - "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" - }, - "node_modules/boo": { - "version": "1.2.4", - "resolved": "http://npm.tescloud.com/boo/-/boo-1.2.4.tgz", - "integrity": "sha1-szMxw2xK552C9P0ORJBgTLfFE7U=", - "dev": true - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "http://npm.tescloud.com/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/browser-stdout": { - "version": "1.3.0", - "resolved": "http://npm.tescloud.com/browser-stdout/-/browser-stdout-1.3.0.tgz", - "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", - "dev": true - }, - "node_modules/buffer-more-ints": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-more-ints/-/buffer-more-ints-1.0.0.tgz", - "integrity": "sha512-EMetuGFz5SLsT0QTnXzINh4Ksr+oo4i+UGTXEshiGCQWnsgSs7ZhJ8fzlwQ+OzEMs0MpDAMr1hxnblp5a4vcHg==" - }, - "node_modules/camelcase": { - "version": "1.2.1", - "resolved": "http://npm.tescloud.com/camelcase/-/camelcase-1.2.1.tgz", - "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/center-align": { - "version": "0.1.3", - "resolved": "http://npm.tescloud.com/center-align/-/center-align-0.1.3.tgz", - "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", - "dev": true, - "dependencies": { - "align-text": "^0.1.3", - "lazy-cache": "^1.0.3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/claire": { - "version": "0.4.1", - "resolved": "http://npm.tescloud.com/claire/-/claire-0.4.1.tgz", - "integrity": "sha1-ynDcEmHd2PJaGvq604BcOfziY7w=", - "dev": true, - "dependencies": { - "boo": "~1.2.4", - "flaw": "~0.1.0", - "prelude-ls": "~0.6.0" - } - }, - "node_modules/cliui": { - "version": "2.1.0", - "resolved": "http://npm.tescloud.com/cliui/-/cliui-2.1.0.tgz", - "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", - "dev": true, - "dependencies": { - "center-align": "^0.1.1", - "right-align": "^0.1.1", - "wordwrap": "0.0.2" - } - }, - "node_modules/cliui/node_modules/wordwrap": { - "version": "0.0.2", - "resolved": "http://npm.tescloud.com/wordwrap/-/wordwrap-0.0.2.tgz", - "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/commander": { - "version": "2.9.0", - "resolved": "http://npm.tescloud.com/commander/-/commander-2.9.0.tgz", - "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", - "dev": true, - "dependencies": { - "graceful-readlink": ">= 1.0.0" - }, - "engines": { - "node": ">= 0.6.x" - } - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "http://npm.tescloud.com/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "node_modules/core-util-is": { - "version": "1.0.2", - "resolved": "http://npm.tescloud.com/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "node_modules/debug": { - "version": "2.6.8", - "resolved": "http://npm.tescloud.com/debug/-/debug-2.6.8.tgz", - "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", - "dev": true, - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/decamelize": { - "version": "1.2.0", - "resolved": "http://npm.tescloud.com/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/diff": { - "version": "3.2.0", - "resolved": "http://npm.tescloud.com/diff/-/diff-3.2.0.tgz", - "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "http://npm.tescloud.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/escodegen": { - "version": "0.0.23", - "resolved": "http://npm.tescloud.com/escodegen/-/escodegen-0.0.23.tgz", - "integrity": "sha1-ms+XgWQ2jkInZXHxiDnII7OoRN8=", - "dev": true, - "dependencies": { - "esprima": "~1.0.2", - "estraverse": "~0.0.4", - "source-map": ">= 0.1.2" - }, - "bin": { - "escodegen": "bin/escodegen.js", - "esgenerate": "bin/esgenerate.js" - }, - "engines": { - "node": ">=0.4.0" - }, - "optionalDependencies": { - "source-map": ">= 0.1.2" - } - }, - "node_modules/esprima": { - "version": "1.0.4", - "resolved": "http://npm.tescloud.com/esprima/-/esprima-1.0.4.tgz", - "integrity": "sha1-n1V+CPw7TSbs6d00+Pv0drYlha0=", - "dev": true, - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/estraverse": { - "version": "0.0.4", - "resolved": "http://npm.tescloud.com/estraverse/-/estraverse-0.0.4.tgz", - "integrity": "sha1-AaCTLf7ldGhKWYr1pnw7+bZCjbI=", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/fileset": { - "version": "0.1.8", - "resolved": "http://npm.tescloud.com/fileset/-/fileset-0.1.8.tgz", - "integrity": "sha1-UGuRqTluqn4y+0KoQHfHoMc2t0E=", - "dev": true, - "dependencies": { - "glob": "3.x", - "minimatch": "0.x" - } - }, - "node_modules/flaw": { - "version": "0.1.0", - "resolved": "http://npm.tescloud.com/flaw/-/flaw-0.1.0.tgz", - "integrity": "sha1-wMPo+BYWdTh+2tofbOhNZ5sCUn8=", - "dev": true - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "http://npm.tescloud.com/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "node_modules/glob": { - "version": "3.2.11", - "resolved": "http://npm.tescloud.com/glob/-/glob-3.2.11.tgz", - "integrity": "sha1-Spc/Y1uRkPcV0QmH1cAP0oFevj0=", - "dev": true, - "dependencies": { - "inherits": "2", - "minimatch": "0.3" - }, - "engines": { - "node": "*" - } - }, - "node_modules/glob/node_modules/minimatch": { - "version": "0.3.0", - "resolved": "http://npm.tescloud.com/minimatch/-/minimatch-0.3.0.tgz", - "integrity": "sha1-J12O2qxPG7MyZHIInnlJyDlGmd0=", - "dev": true, - "dependencies": { - "lru-cache": "2", - "sigmund": "~1.0.0" - }, - "engines": { - "node": "*" - } - }, - "node_modules/graceful-readlink": { - "version": "1.0.1", - "resolved": "http://npm.tescloud.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz", - "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", - "dev": true - }, - "node_modules/growl": { - "version": "1.9.2", - "resolved": "http://npm.tescloud.com/growl/-/growl-1.9.2.tgz", - "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", - "dev": true - }, - "node_modules/handlebars": { - "version": "1.0.12", - "resolved": "http://npm.tescloud.com/handlebars/-/handlebars-1.0.12.tgz", - "integrity": "sha1-GMbTRAw16RsZs/9YK5FRq0mF1Pw=", - "dev": true, - "dependencies": { - "optimist": "~0.3", - "uglify-js": "~2.3" - }, - "bin": { - "handlebars": "bin/handlebars" - }, - "engines": { - "node": ">=0.4.7" - } - }, - "node_modules/handlebars/node_modules/source-map": { - "version": "0.1.43", - "resolved": "http://npm.tescloud.com/source-map/-/source-map-0.1.43.tgz", - "integrity": "sha1-wkvBRspRfBRx9drL4lcbK3+eM0Y=", - "dev": true, - "dependencies": { - "amdefine": ">=0.0.4" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/handlebars/node_modules/uglify-js": { - "version": "2.3.6", - "resolved": "http://npm.tescloud.com/uglify-js/-/uglify-js-2.3.6.tgz", - "integrity": "sha1-+gmEdwtCi3qbKoBY9GNV0U/vIRo=", - "dev": true, - "dependencies": { - "async": "~0.2.6", - "optimist": "~0.3.5", - "source-map": "~0.1.7" - }, - "bin": { - "uglifyjs": "bin/uglifyjs" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/has-flag": { - "version": "1.0.0", - "resolved": "http://npm.tescloud.com/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/he": { - "version": "1.1.1", - "resolved": "http://npm.tescloud.com/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", - "dev": true, - "bin": { - "he": "bin/he" - } - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "http://npm.tescloud.com/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.3", - "resolved": "http://npm.tescloud.com/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "node_modules/is-buffer": { - "version": "1.1.6", - "resolved": "http://npm.tescloud.com/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true - }, - "node_modules/isarray": { - "version": "0.0.1", - "resolved": "http://npm.tescloud.com/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "node_modules/istanbul": { - "version": "0.1.46", - "resolved": "http://npm.tescloud.com/istanbul/-/istanbul-0.1.46.tgz", - "integrity": "sha1-zv6xx4fRJabbI70PY7Drk5CwtA0=", - "dev": true, - "dependencies": { - "abbrev": "1.0.x", - "async": "0.2.x", - "escodegen": "0.0.23", - "esprima": "1.0.x", - "fileset": "0.1.x", - "handlebars": "1.0.x", - "mkdirp": "0.3.x", - "nopt": "2.1.x", - "resolve": "0.5.x", - "which": "1.0.x", - "wordwrap": "0.0.x" - }, - "bin": { - "istanbul": "lib/cli.js" - } - }, - "node_modules/json3": { - "version": "3.3.2", - "resolved": "http://npm.tescloud.com/json3/-/json3-3.3.2.tgz", - "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", - "dev": true - }, - "node_modules/kind-of": { - "version": "3.2.2", - "resolved": "http://npm.tescloud.com/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/lazy-cache": { - "version": "1.0.4", - "resolved": "http://npm.tescloud.com/lazy-cache/-/lazy-cache-1.0.4.tgz", - "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/lodash._baseassign": { - "version": "3.2.0", - "resolved": "http://npm.tescloud.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", - "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", - "dev": true, - "dependencies": { - "lodash._basecopy": "^3.0.0", - "lodash.keys": "^3.0.0" - } - }, - "node_modules/lodash._basecopy": { - "version": "3.0.1", - "resolved": "http://npm.tescloud.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", - "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", - "dev": true - }, - "node_modules/lodash._basecreate": { - "version": "3.0.3", - "resolved": "http://npm.tescloud.com/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", - "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=", - "dev": true - }, - "node_modules/lodash._getnative": { - "version": "3.9.1", - "resolved": "http://npm.tescloud.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz", - "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", - "dev": true - }, - "node_modules/lodash._isiterateecall": { - "version": "3.0.9", - "resolved": "http://npm.tescloud.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", - "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", - "dev": true - }, - "node_modules/lodash.create": { - "version": "3.1.1", - "resolved": "http://npm.tescloud.com/lodash.create/-/lodash.create-3.1.1.tgz", - "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", - "dev": true, - "dependencies": { - "lodash._baseassign": "^3.0.0", - "lodash._basecreate": "^3.0.0", - "lodash._isiterateecall": "^3.0.0" - } - }, - "node_modules/lodash.isarguments": { - "version": "3.1.0", - "resolved": "http://npm.tescloud.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", - "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", - "dev": true - }, - "node_modules/lodash.isarray": { - "version": "3.0.4", - "resolved": "http://npm.tescloud.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz", - "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", - "dev": true - }, - "node_modules/lodash.keys": { - "version": "3.1.2", - "resolved": "http://npm.tescloud.com/lodash.keys/-/lodash.keys-3.1.2.tgz", - "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", - "dev": true, - "dependencies": { - "lodash._getnative": "^3.0.0", - "lodash.isarguments": "^3.0.0", - "lodash.isarray": "^3.0.0" - } - }, - "node_modules/longest": { - "version": "1.0.1", - "resolved": "http://npm.tescloud.com/longest/-/longest-1.0.1.tgz", - "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/lru-cache": { - "version": "2.7.3", - "resolved": "http://npm.tescloud.com/lru-cache/-/lru-cache-2.7.3.tgz", - "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=", - "dev": true - }, - "node_modules/minimatch": { - "version": "0.4.0", - "resolved": "http://npm.tescloud.com/minimatch/-/minimatch-0.4.0.tgz", - "integrity": "sha1-vSx9Bg0sjI/Xzefx8u0tWycP2xs=", - "dev": true, - "dependencies": { - "lru-cache": "2", - "sigmund": "~1.0.0" - }, - "engines": { - "node": "*" - } - }, - "node_modules/minimist": { - "version": "0.0.8", - "resolved": "http://npm.tescloud.com/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - }, - "node_modules/mkdirp": { - "version": "0.3.5", - "resolved": "http://npm.tescloud.com/mkdirp/-/mkdirp-0.3.5.tgz", - "integrity": "sha1-3j5fiWHIjHh+4TaN+EmsRBPsqNc=", - "dev": true - }, - "node_modules/mocha": { - "version": "3.5.3", - "resolved": "http://npm.tescloud.com/mocha/-/mocha-3.5.3.tgz", - "integrity": "sha512-/6na001MJWEtYxHOV1WLfsmR4YIynkUEhBwzsb+fk2qmQ3iqsi258l/Q2MWHJMImAcNpZ8DEdYAK72NHoIQ9Eg==", - "dev": true, - "dependencies": { - "browser-stdout": "1.3.0", - "commander": "2.9.0", - "debug": "2.6.8", - "diff": "3.2.0", - "escape-string-regexp": "1.0.5", - "glob": "7.1.1", - "growl": "1.9.2", - "he": "1.1.1", - "json3": "3.3.2", - "lodash.create": "3.1.1", - "mkdirp": "0.5.1", - "supports-color": "3.1.2" - }, - "bin": { - "_mocha": "bin/_mocha", - "mocha": "bin/mocha" - }, - "engines": { - "node": ">= 0.10.x", - "npm": ">= 1.4.x" - } - }, - "node_modules/mocha/node_modules/glob": { - "version": "7.1.1", - "resolved": "http://npm.tescloud.com/glob/-/glob-7.1.1.tgz", - "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.2", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - } - }, - "node_modules/mocha/node_modules/minimatch": { - "version": "3.0.4", - "resolved": "http://npm.tescloud.com/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/mocha/node_modules/mkdirp": { - "version": "0.5.1", - "resolved": "http://npm.tescloud.com/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "dependencies": { - "minimist": "0.0.8" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/ms": { - "version": "2.0.0", - "resolved": "http://npm.tescloud.com/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "node_modules/nopt": { - "version": "2.1.2", - "resolved": "http://npm.tescloud.com/nopt/-/nopt-2.1.2.tgz", - "integrity": "sha1-bMzZd7gBMqB3MdbozljCyDA8+a8=", - "dev": true, - "dependencies": { - "abbrev": "1" - }, - "bin": { - "nopt": "bin/nopt.js" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "http://npm.tescloud.com/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/optimist": { - "version": "0.3.7", - "resolved": "http://npm.tescloud.com/optimist/-/optimist-0.3.7.tgz", - "integrity": "sha1-yQlBrVnkJzMokjB00s8ufLxuwNk=", - "dev": true, - "dependencies": { - "wordwrap": "~0.0.2" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "http://npm.tescloud.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/prelude-ls": { - "version": "0.6.0", - "resolved": "http://npm.tescloud.com/prelude-ls/-/prelude-ls-0.6.0.tgz", - "integrity": "sha1-z4JLS0fMc8vZb56YhQc7Q6rqqzs=", - "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/querystringify": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", - "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" - }, - "node_modules/readable-stream": { - "version": "1.1.14", - "resolved": "http://npm.tescloud.com/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "node_modules/repeat-string": { - "version": "1.6.1", - "resolved": "http://npm.tescloud.com/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", - "dev": true, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" - }, - "node_modules/resolve": { - "version": "0.5.1", - "resolved": "http://npm.tescloud.com/resolve/-/resolve-0.5.1.tgz", - "integrity": "sha1-FeSiIsQja81M+FRUQSwtD7ZSRXY=", - "dev": true - }, - "node_modules/right-align": { - "version": "0.1.3", - "resolved": "http://npm.tescloud.com/right-align/-/right-align-0.1.3.tgz", - "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", - "dev": true, - "dependencies": { - "align-text": "^0.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/sigmund": { - "version": "1.0.1", - "resolved": "http://npm.tescloud.com/sigmund/-/sigmund-1.0.1.tgz", - "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=", - "dev": true - }, - "node_modules/source-map": { - "version": "0.7.3", - "resolved": "http://npm.tescloud.com/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", - "dev": true, - "optional": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/string_decoder": { - "version": "0.10.31", - "resolved": "http://npm.tescloud.com/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - }, - "node_modules/supports-color": { - "version": "3.1.2", - "resolved": "http://npm.tescloud.com/supports-color/-/supports-color-3.1.2.tgz", - "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", - "dev": true, - "dependencies": { - "has-flag": "^1.0.0" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/uglify-js": { - "version": "2.8.29", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", - "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", - "dev": true, - "dependencies": { - "source-map": "~0.5.1", - "uglify-to-browserify": "~1.0.0", - "yargs": "~3.10.0" - }, - "bin": { - "uglifyjs": "bin/uglifyjs" - }, - "engines": { - "node": ">=0.8.0" - }, - "optionalDependencies": { - "uglify-to-browserify": "~1.0.0" - } - }, - "node_modules/uglify-js/node_modules/source-map": { - "version": "0.5.7", - "resolved": "http://npm.tescloud.com/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/uglify-to-browserify": { - "version": "1.0.2", - "resolved": "http://npm.tescloud.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", - "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", - "dev": true, - "optional": true - }, - "node_modules/url-parse": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.1.tgz", - "integrity": "sha512-HOfCOUJt7iSYzEx/UqgtwKRMC6EU91NFhsCHMv9oM03VJcVo2Qrp8T8kI9D7amFf1cu+/3CEhgb3rF9zL7k85Q==", - "dependencies": { - "querystringify": "^2.1.1", - "requires-port": "^1.0.0" - } - }, - "node_modules/which": { - "version": "1.0.9", - "resolved": "http://npm.tescloud.com/which/-/which-1.0.9.tgz", - "integrity": "sha1-RgwdoPgQED0DIam2M6+eV15kSG8=", - "dev": true, - "bin": { - "which": "bin/which" - } - }, - "node_modules/window-size": { - "version": "0.1.0", - "resolved": "http://npm.tescloud.com/window-size/-/window-size-0.1.0.tgz", - "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", - "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/wordwrap": { - "version": "0.0.3", - "resolved": "http://npm.tescloud.com/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "http://npm.tescloud.com/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "node_modules/yargs": { - "version": "3.10.0", - "resolved": "http://npm.tescloud.com/yargs/-/yargs-3.10.0.tgz", - "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", - "dev": true, - "dependencies": { - "camelcase": "^1.0.2", - "cliui": "^2.1.0", - "decamelize": "^1.0.0", - "window-size": "0.1.0" - } - } - }, - "dependencies": { - "abbrev": { - "version": "1.0.9", - "resolved": "http://npm.tescloud.com/abbrev/-/abbrev-1.0.9.tgz", - "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=", - "dev": true - }, - "align-text": { - "version": "0.1.4", - "resolved": "http://npm.tescloud.com/align-text/-/align-text-0.1.4.tgz", - "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", - "dev": true, - "requires": { - "kind-of": "^3.0.2", - "longest": "^1.0.1", - "repeat-string": "^1.5.2" - } - }, - "amdefine": { - "version": "1.0.1", - "resolved": "http://npm.tescloud.com/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", - "dev": true - }, - "async": { - "version": "0.2.10", - "resolved": "http://npm.tescloud.com/async/-/async-0.2.10.tgz", - "integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E=", - "dev": true - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "http://npm.tescloud.com/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "bitsyntax": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/bitsyntax/-/bitsyntax-0.1.0.tgz", - "integrity": "sha512-ikAdCnrloKmFOugAfxWws89/fPc+nw0OOG1IzIE72uSOg/A3cYptKCjSUhDTuj7fhsJtzkzlv7l3b8PzRHLN0Q==", - "requires": { - "buffer-more-ints": "~1.0.0", - "debug": "~2.6.9", - "safe-buffer": "~5.1.2" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - } - } - }, - "bluebird": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", - "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" - }, - "boo": { - "version": "1.2.4", - "resolved": "http://npm.tescloud.com/boo/-/boo-1.2.4.tgz", - "integrity": "sha1-szMxw2xK552C9P0ORJBgTLfFE7U=", - "dev": true - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "http://npm.tescloud.com/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "browser-stdout": { - "version": "1.3.0", - "resolved": "http://npm.tescloud.com/browser-stdout/-/browser-stdout-1.3.0.tgz", - "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", - "dev": true - }, - "buffer-more-ints": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-more-ints/-/buffer-more-ints-1.0.0.tgz", - "integrity": "sha512-EMetuGFz5SLsT0QTnXzINh4Ksr+oo4i+UGTXEshiGCQWnsgSs7ZhJ8fzlwQ+OzEMs0MpDAMr1hxnblp5a4vcHg==" - }, - "camelcase": { - "version": "1.2.1", - "resolved": "http://npm.tescloud.com/camelcase/-/camelcase-1.2.1.tgz", - "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", - "dev": true - }, - "center-align": { - "version": "0.1.3", - "resolved": "http://npm.tescloud.com/center-align/-/center-align-0.1.3.tgz", - "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", - "dev": true, - "requires": { - "align-text": "^0.1.3", - "lazy-cache": "^1.0.3" - } - }, - "claire": { - "version": "0.4.1", - "resolved": "http://npm.tescloud.com/claire/-/claire-0.4.1.tgz", - "integrity": "sha1-ynDcEmHd2PJaGvq604BcOfziY7w=", - "dev": true, - "requires": { - "boo": "~1.2.4", - "flaw": "~0.1.0", - "prelude-ls": "~0.6.0" - } - }, - "cliui": { - "version": "2.1.0", - "resolved": "http://npm.tescloud.com/cliui/-/cliui-2.1.0.tgz", - "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", - "dev": true, - "requires": { - "center-align": "^0.1.1", - "right-align": "^0.1.1", - "wordwrap": "0.0.2" - }, - "dependencies": { - "wordwrap": { - "version": "0.0.2", - "resolved": "http://npm.tescloud.com/wordwrap/-/wordwrap-0.0.2.tgz", - "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", - "dev": true - } - } - }, - "commander": { - "version": "2.9.0", - "resolved": "http://npm.tescloud.com/commander/-/commander-2.9.0.tgz", - "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", - "dev": true, - "requires": { - "graceful-readlink": ">= 1.0.0" - } - }, - "concat-map": { - "version": "0.0.1", - "resolved": "http://npm.tescloud.com/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "http://npm.tescloud.com/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "debug": { - "version": "2.6.8", - "resolved": "http://npm.tescloud.com/debug/-/debug-2.6.8.tgz", - "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "decamelize": { - "version": "1.2.0", - "resolved": "http://npm.tescloud.com/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true - }, - "diff": { - "version": "3.2.0", - "resolved": "http://npm.tescloud.com/diff/-/diff-3.2.0.tgz", - "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "http://npm.tescloud.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "escodegen": { - "version": "0.0.23", - "resolved": "http://npm.tescloud.com/escodegen/-/escodegen-0.0.23.tgz", - "integrity": "sha1-ms+XgWQ2jkInZXHxiDnII7OoRN8=", - "dev": true, - "requires": { - "esprima": "~1.0.2", - "estraverse": "~0.0.4", - "source-map": ">= 0.1.2" - } - }, - "esprima": { - "version": "1.0.4", - "resolved": "http://npm.tescloud.com/esprima/-/esprima-1.0.4.tgz", - "integrity": "sha1-n1V+CPw7TSbs6d00+Pv0drYlha0=", - "dev": true - }, - "estraverse": { - "version": "0.0.4", - "resolved": "http://npm.tescloud.com/estraverse/-/estraverse-0.0.4.tgz", - "integrity": "sha1-AaCTLf7ldGhKWYr1pnw7+bZCjbI=", - "dev": true - }, - "fileset": { - "version": "0.1.8", - "resolved": "http://npm.tescloud.com/fileset/-/fileset-0.1.8.tgz", - "integrity": "sha1-UGuRqTluqn4y+0KoQHfHoMc2t0E=", - "dev": true, - "requires": { - "glob": "3.x", - "minimatch": "0.x" - } - }, - "flaw": { - "version": "0.1.0", - "resolved": "http://npm.tescloud.com/flaw/-/flaw-0.1.0.tgz", - "integrity": "sha1-wMPo+BYWdTh+2tofbOhNZ5sCUn8=", - "dev": true - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "http://npm.tescloud.com/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "glob": { - "version": "3.2.11", - "resolved": "http://npm.tescloud.com/glob/-/glob-3.2.11.tgz", - "integrity": "sha1-Spc/Y1uRkPcV0QmH1cAP0oFevj0=", - "dev": true, - "requires": { - "inherits": "2", - "minimatch": "0.3" - }, - "dependencies": { - "minimatch": { - "version": "0.3.0", - "resolved": "http://npm.tescloud.com/minimatch/-/minimatch-0.3.0.tgz", - "integrity": "sha1-J12O2qxPG7MyZHIInnlJyDlGmd0=", - "dev": true, - "requires": { - "lru-cache": "2", - "sigmund": "~1.0.0" - } - } - } - }, - "graceful-readlink": { - "version": "1.0.1", - "resolved": "http://npm.tescloud.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz", - "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", - "dev": true - }, - "growl": { - "version": "1.9.2", - "resolved": "http://npm.tescloud.com/growl/-/growl-1.9.2.tgz", - "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", - "dev": true - }, - "handlebars": { - "version": "1.0.12", - "resolved": "http://npm.tescloud.com/handlebars/-/handlebars-1.0.12.tgz", - "integrity": "sha1-GMbTRAw16RsZs/9YK5FRq0mF1Pw=", - "dev": true, - "requires": { - "optimist": "~0.3", - "uglify-js": "~2.3" - }, - "dependencies": { - "source-map": { - "version": "0.1.43", - "resolved": "http://npm.tescloud.com/source-map/-/source-map-0.1.43.tgz", - "integrity": "sha1-wkvBRspRfBRx9drL4lcbK3+eM0Y=", - "dev": true, - "requires": { - "amdefine": ">=0.0.4" - } - }, - "uglify-js": { - "version": "2.3.6", - "resolved": "http://npm.tescloud.com/uglify-js/-/uglify-js-2.3.6.tgz", - "integrity": "sha1-+gmEdwtCi3qbKoBY9GNV0U/vIRo=", - "dev": true, - "requires": { - "async": "~0.2.6", - "optimist": "~0.3.5", - "source-map": "~0.1.7" - } - } - } - }, - "has-flag": { - "version": "1.0.0", - "resolved": "http://npm.tescloud.com/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", - "dev": true - }, - "he": { - "version": "1.1.1", - "resolved": "http://npm.tescloud.com/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "http://npm.tescloud.com/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "http://npm.tescloud.com/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "is-buffer": { - "version": "1.1.6", - "resolved": "http://npm.tescloud.com/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true - }, - "isarray": { - "version": "0.0.1", - "resolved": "http://npm.tescloud.com/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "istanbul": { - "version": "0.1.46", - "resolved": "http://npm.tescloud.com/istanbul/-/istanbul-0.1.46.tgz", - "integrity": "sha1-zv6xx4fRJabbI70PY7Drk5CwtA0=", - "dev": true, - "requires": { - "abbrev": "1.0.x", - "async": "0.2.x", - "escodegen": "0.0.23", - "esprima": "1.0.x", - "fileset": "0.1.x", - "handlebars": "1.0.x", - "mkdirp": "0.3.x", - "nopt": "2.1.x", - "resolve": "0.5.x", - "which": "1.0.x", - "wordwrap": "0.0.x" - } - }, - "json3": { - "version": "3.3.2", - "resolved": "http://npm.tescloud.com/json3/-/json3-3.3.2.tgz", - "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", - "dev": true - }, - "kind-of": { - "version": "3.2.2", - "resolved": "http://npm.tescloud.com/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - }, - "lazy-cache": { - "version": "1.0.4", - "resolved": "http://npm.tescloud.com/lazy-cache/-/lazy-cache-1.0.4.tgz", - "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", - "dev": true - }, - "lodash._baseassign": { - "version": "3.2.0", - "resolved": "http://npm.tescloud.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", - "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", - "dev": true, - "requires": { - "lodash._basecopy": "^3.0.0", - "lodash.keys": "^3.0.0" - } - }, - "lodash._basecopy": { - "version": "3.0.1", - "resolved": "http://npm.tescloud.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", - "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", - "dev": true - }, - "lodash._basecreate": { - "version": "3.0.3", - "resolved": "http://npm.tescloud.com/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", - "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=", - "dev": true - }, - "lodash._getnative": { - "version": "3.9.1", - "resolved": "http://npm.tescloud.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz", - "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", - "dev": true - }, - "lodash._isiterateecall": { - "version": "3.0.9", - "resolved": "http://npm.tescloud.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", - "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", - "dev": true - }, - "lodash.create": { - "version": "3.1.1", - "resolved": "http://npm.tescloud.com/lodash.create/-/lodash.create-3.1.1.tgz", - "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", - "dev": true, - "requires": { - "lodash._baseassign": "^3.0.0", - "lodash._basecreate": "^3.0.0", - "lodash._isiterateecall": "^3.0.0" - } - }, - "lodash.isarguments": { - "version": "3.1.0", - "resolved": "http://npm.tescloud.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", - "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", - "dev": true - }, - "lodash.isarray": { - "version": "3.0.4", - "resolved": "http://npm.tescloud.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz", - "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", - "dev": true - }, - "lodash.keys": { - "version": "3.1.2", - "resolved": "http://npm.tescloud.com/lodash.keys/-/lodash.keys-3.1.2.tgz", - "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", - "dev": true, - "requires": { - "lodash._getnative": "^3.0.0", - "lodash.isarguments": "^3.0.0", - "lodash.isarray": "^3.0.0" - } - }, - "longest": { - "version": "1.0.1", - "resolved": "http://npm.tescloud.com/longest/-/longest-1.0.1.tgz", - "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", - "dev": true - }, - "lru-cache": { - "version": "2.7.3", - "resolved": "http://npm.tescloud.com/lru-cache/-/lru-cache-2.7.3.tgz", - "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=", - "dev": true - }, - "minimatch": { - "version": "0.4.0", - "resolved": "http://npm.tescloud.com/minimatch/-/minimatch-0.4.0.tgz", - "integrity": "sha1-vSx9Bg0sjI/Xzefx8u0tWycP2xs=", - "dev": true, - "requires": { - "lru-cache": "2", - "sigmund": "~1.0.0" - } - }, - "minimist": { - "version": "0.0.8", - "resolved": "http://npm.tescloud.com/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - }, - "mkdirp": { - "version": "0.3.5", - "resolved": "http://npm.tescloud.com/mkdirp/-/mkdirp-0.3.5.tgz", - "integrity": "sha1-3j5fiWHIjHh+4TaN+EmsRBPsqNc=", - "dev": true - }, - "mocha": { - "version": "3.5.3", - "resolved": "http://npm.tescloud.com/mocha/-/mocha-3.5.3.tgz", - "integrity": "sha512-/6na001MJWEtYxHOV1WLfsmR4YIynkUEhBwzsb+fk2qmQ3iqsi258l/Q2MWHJMImAcNpZ8DEdYAK72NHoIQ9Eg==", - "dev": true, - "requires": { - "browser-stdout": "1.3.0", - "commander": "2.9.0", - "debug": "2.6.8", - "diff": "3.2.0", - "escape-string-regexp": "1.0.5", - "glob": "7.1.1", - "growl": "1.9.2", - "he": "1.1.1", - "json3": "3.3.2", - "lodash.create": "3.1.1", - "mkdirp": "0.5.1", - "supports-color": "3.1.2" - }, - "dependencies": { - "glob": { - "version": "7.1.1", - "resolved": "http://npm.tescloud.com/glob/-/glob-7.1.1.tgz", - "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.2", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "minimatch": { - "version": "3.0.4", - "resolved": "http://npm.tescloud.com/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "http://npm.tescloud.com/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - } - } - } - }, - "ms": { - "version": "2.0.0", - "resolved": "http://npm.tescloud.com/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "nopt": { - "version": "2.1.2", - "resolved": "http://npm.tescloud.com/nopt/-/nopt-2.1.2.tgz", - "integrity": "sha1-bMzZd7gBMqB3MdbozljCyDA8+a8=", - "dev": true, - "requires": { - "abbrev": "1" - } - }, - "once": { - "version": "1.4.0", - "resolved": "http://npm.tescloud.com/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "optimist": { - "version": "0.3.7", - "resolved": "http://npm.tescloud.com/optimist/-/optimist-0.3.7.tgz", - "integrity": "sha1-yQlBrVnkJzMokjB00s8ufLxuwNk=", - "dev": true, - "requires": { - "wordwrap": "~0.0.2" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "http://npm.tescloud.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "prelude-ls": { - "version": "0.6.0", - "resolved": "http://npm.tescloud.com/prelude-ls/-/prelude-ls-0.6.0.tgz", - "integrity": "sha1-z4JLS0fMc8vZb56YhQc7Q6rqqzs=", - "dev": true - }, - "querystringify": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", - "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" - }, - "readable-stream": { - "version": "1.1.14", - "resolved": "http://npm.tescloud.com/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "repeat-string": { - "version": "1.6.1", - "resolved": "http://npm.tescloud.com/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", - "dev": true - }, - "requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" - }, - "resolve": { - "version": "0.5.1", - "resolved": "http://npm.tescloud.com/resolve/-/resolve-0.5.1.tgz", - "integrity": "sha1-FeSiIsQja81M+FRUQSwtD7ZSRXY=", - "dev": true - }, - "right-align": { - "version": "0.1.3", - "resolved": "http://npm.tescloud.com/right-align/-/right-align-0.1.3.tgz", - "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", - "dev": true, - "requires": { - "align-text": "^0.1.1" - } - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" - }, - "sigmund": { - "version": "1.0.1", - "resolved": "http://npm.tescloud.com/sigmund/-/sigmund-1.0.1.tgz", - "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=", - "dev": true - }, - "source-map": { - "version": "0.7.3", - "resolved": "http://npm.tescloud.com/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", - "dev": true, - "optional": true - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "http://npm.tescloud.com/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - }, - "supports-color": { - "version": "3.1.2", - "resolved": "http://npm.tescloud.com/supports-color/-/supports-color-3.1.2.tgz", - "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", - "dev": true, - "requires": { - "has-flag": "^1.0.0" - } - }, - "uglify-js": { - "version": "2.8.29", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", - "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", - "dev": true, - "requires": { - "source-map": "~0.5.1", - "uglify-to-browserify": "~1.0.0", - "yargs": "~3.10.0" - }, - "dependencies": { - "source-map": { - "version": "0.5.7", - "resolved": "http://npm.tescloud.com/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - } - } - }, - "uglify-to-browserify": { - "version": "1.0.2", - "resolved": "http://npm.tescloud.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", - "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", - "dev": true, - "optional": true - }, - "url-parse": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.1.tgz", - "integrity": "sha512-HOfCOUJt7iSYzEx/UqgtwKRMC6EU91NFhsCHMv9oM03VJcVo2Qrp8T8kI9D7amFf1cu+/3CEhgb3rF9zL7k85Q==", - "requires": { - "querystringify": "^2.1.1", - "requires-port": "^1.0.0" - } - }, - "which": { - "version": "1.0.9", - "resolved": "http://npm.tescloud.com/which/-/which-1.0.9.tgz", - "integrity": "sha1-RgwdoPgQED0DIam2M6+eV15kSG8=", - "dev": true - }, - "window-size": { - "version": "0.1.0", - "resolved": "http://npm.tescloud.com/window-size/-/window-size-0.1.0.tgz", - "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", - "dev": true - }, - "wordwrap": { - "version": "0.0.3", - "resolved": "http://npm.tescloud.com/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", - "dev": true - }, - "wrappy": { - "version": "1.0.2", - "resolved": "http://npm.tescloud.com/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "yargs": { - "version": "3.10.0", - "resolved": "http://npm.tescloud.com/yargs/-/yargs-3.10.0.tgz", - "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", - "dev": true, - "requires": { - "camelcase": "^1.0.2", - "cliui": "^2.1.0", - "decamelize": "^1.0.0", - "window-size": "0.1.0" - } - } - } -} diff --git a/package.json b/package.json index 7126fbd3..41a11af3 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,6 @@ "bluebird": "^3.7.2", "buffer-more-ints": "~1.0.0", "readable-stream": "1.x >=1.1.9", - "safe-buffer": "~5.2.1", "url-parse": "~1.5.1" }, "devDependencies": { diff --git a/test/callback_api.js b/test/callback_api.js index 5aea0bfb..21f3a900 100644 --- a/test/callback_api.js +++ b/test/callback_api.js @@ -8,7 +8,6 @@ var schedule = util.schedule; var randomString = util.randomString; var kCallback = util.kCallback; var domain = require('domain'); -var Buffer = require('safe-buffer').Buffer; var URL = process.env.URL || 'amqp://localhost'; diff --git a/test/channel.js b/test/channel.js index 072c3354..47cbc7ba 100644 --- a/test/channel.js +++ b/test/channel.js @@ -12,7 +12,6 @@ var completes = util.completes; var defs = require('../lib/defs'); var conn_handshake = require('./connection').connection_handshake; var OPEN_OPTS = require('./connection').OPEN_OPTS; -var Buffer = require('safe-buffer').Buffer; var LOG_ERRORS = process.env.LOG_ERRORS; diff --git a/test/channel_api.js b/test/channel_api.js index bd5473f0..316070c8 100644 --- a/test/channel_api.js +++ b/test/channel_api.js @@ -7,7 +7,6 @@ var succeed = util.succeed, fail = util.fail; var schedule = util.schedule; var randomString = util.randomString; var Promise = require('bluebird'); -var Buffer = require('safe-buffer').Buffer; var URL = process.env.URL || 'amqp://localhost'; diff --git a/test/codec.js b/test/codec.js index 55a326f7..8a668c42 100644 --- a/test/codec.js +++ b/test/codec.js @@ -4,7 +4,6 @@ var codec = require('../lib/codec'); var defs = require('../lib/defs'); var assert = require('assert'); var ints = require('buffer-more-ints'); -var Buffer = require('safe-buffer').Buffer var C = require('claire'); var forAll = C.forAll; diff --git a/test/connect.js b/test/connect.js index ed4878be..aeba33e8 100644 --- a/test/connect.js +++ b/test/connect.js @@ -1,7 +1,6 @@ 'use strict'; var connect = require('../lib/connect').connect; -var Buffer = require('safe-buffer').Buffer var credentialsFromUrl = require('../lib/connect').credentialsFromUrl; var assert = require('assert'); var util = require('./util'); diff --git a/test/connection.js b/test/connection.js index 8b87c92f..e6d23fb6 100644 --- a/test/connection.js +++ b/test/connection.js @@ -2,7 +2,6 @@ var assert = require('assert'); var defs = require('../lib/defs'); -var Buffer = require('safe-buffer').Buffer; var Connection = require('../lib/connection').Connection; var HEARTBEAT = require('../lib/frame').HEARTBEAT; var HB_BUF = require('../lib/frame').HEARTBEAT_BUF; diff --git a/test/data.js b/test/data.js index 2fa9bf0b..45b10716 100644 --- a/test/data.js +++ b/test/data.js @@ -3,7 +3,6 @@ 'use strict'; var C = require('claire'); -var Buffer = require('safe-buffer').Buffer; var forAll = C.forAll; var arb = C.data; var transform = C.transform; diff --git a/test/frame.js b/test/frame.js index 9b47f95c..602ca3c0 100644 --- a/test/frame.js +++ b/test/frame.js @@ -3,7 +3,6 @@ var assert = require('assert'); var succeed = require('./util').succeed; var fail = require('./util').fail; -var Buffer = require('safe-buffer').Buffer; var connection = require('../lib/connection'); var Frames = connection.Connection; var HEARTBEAT = require('../lib/frame').HEARTBEAT; @@ -27,7 +26,7 @@ var HB = Buffer.from([defs.constants.FRAME_HEARTBEAT, defs.constants.FRAME_END]); suite("Explicit parsing", function() { - + test('Parse heartbeat', function() { var input = inputs(); var frames = new Frames(input); @@ -117,7 +116,7 @@ suite("Parsing", function() { } i++; }; - + t.forEach(function(f) { f.channel = 0; bufs.push(defs.encodeMethod(f.id, 0, f.fields)); From 4ab788590fe202198ce7c637d459002d625feaa9 Mon Sep 17 00:00:00 2001 From: Igor Savin Date: Tue, 18 May 2021 11:45:17 +0300 Subject: [PATCH 008/112] Drop CI for unsupported versions --- .travis.yml | 11 - package-lock.json | 1315 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1315 insertions(+), 11 deletions(-) create mode 100644 package-lock.json diff --git a/.travis.yml b/.travis.yml index 9f1051b2..58dfb9fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,5 @@ language: node_js node_js: -- "0.8" -- "0.10" -- "0.12" -- "iojs-v1" -- "iojs-v2" -- "iojs-v3" -- "4.2" -- "5.5" -- "6.12" -- "8.9" -- "9.11" - "10.10" - "11.1" - "12" diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..638fcc3d --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1315 @@ +{ + "name": "amqplib", + "version": "0.7.1", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "amqplib", + "version": "0.7.1", + "license": "MIT", + "dependencies": { + "bitsyntax": "~0.1.0", + "bluebird": "^3.7.2", + "buffer-more-ints": "~1.0.0", + "readable-stream": "1.x >=1.1.9", + "url-parse": "~1.5.1" + }, + "devDependencies": { + "claire": "0.4.1", + "istanbul": "0.1.x", + "mocha": "^3.5.3", + "uglify-js": "2.8.x" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/abbrev": { + "version": "1.0.9", + "dev": true, + "license": "ISC" + }, + "node_modules/align-text": { + "version": "0.1.4", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^3.0.2", + "longest": "^1.0.1", + "repeat-string": "^1.5.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/amdefine": { + "version": "1.0.1", + "dev": true, + "license": "BSD-3-Clause OR MIT", + "engines": { + "node": ">=0.4.2" + } + }, + "node_modules/async": { + "version": "0.2.10", + "dev": true + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/bitsyntax": { + "version": "0.1.0", + "license": "MIT", + "dependencies": { + "buffer-more-ints": "~1.0.0", + "debug": "~2.6.9", + "safe-buffer": "~5.1.2" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/bitsyntax/node_modules/safe-buffer": { + "version": "5.1.2", + "license": "MIT" + }, + "node_modules/bluebird": { + "version": "3.7.2", + "license": "MIT" + }, + "node_modules/boo": { + "version": "1.2.4", + "dev": true + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/browser-stdout": { + "version": "1.3.0", + "dev": true, + "license": "ISC" + }, + "node_modules/buffer-more-ints": { + "version": "1.0.0", + "license": "MIT" + }, + "node_modules/camelcase": { + "version": "1.2.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/center-align": { + "version": "0.1.3", + "dev": true, + "license": "MIT", + "dependencies": { + "align-text": "^0.1.3", + "lazy-cache": "^1.0.3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/claire": { + "version": "0.4.1", + "dev": true, + "license": "MIT", + "dependencies": { + "boo": "~1.2.4", + "flaw": "~0.1.0", + "prelude-ls": "~0.6.0" + } + }, + "node_modules/cliui": { + "version": "2.1.0", + "dev": true, + "license": "ISC", + "dependencies": { + "center-align": "^0.1.1", + "right-align": "^0.1.1", + "wordwrap": "0.0.2" + } + }, + "node_modules/cliui/node_modules/wordwrap": { + "version": "0.0.2", + "dev": true, + "license": "MIT/X11", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/commander": { + "version": "2.9.0", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-readlink": ">= 1.0.0" + }, + "engines": { + "node": ">= 0.6.x" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/core-util-is": { + "version": "1.0.2", + "license": "MIT" + }, + "node_modules/debug": { + "version": "2.6.9", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/decamelize": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/diff": { + "version": "3.2.0", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/escodegen": { + "version": "0.0.23", + "dev": true, + "dependencies": { + "esprima": "~1.0.2", + "estraverse": "~0.0.4" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=0.4.0" + }, + "optionalDependencies": { + "source-map": ">= 0.1.2" + } + }, + "node_modules/esprima": { + "version": "1.0.4", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/estraverse": { + "version": "0.0.4", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/fileset": { + "version": "0.1.8", + "dev": true, + "dependencies": { + "glob": "3.x", + "minimatch": "0.x" + } + }, + "node_modules/flaw": { + "version": "0.1.0", + "dev": true, + "license": "MIT" + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/glob": { + "version": "3.2.11", + "dev": true, + "license": "BSD", + "dependencies": { + "inherits": "2", + "minimatch": "0.3" + }, + "engines": { + "node": "*" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "0.3.0", + "deprecated": "Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue", + "dev": true, + "license": "MIT", + "dependencies": { + "lru-cache": "2", + "sigmund": "~1.0.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/graceful-readlink": { + "version": "1.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/growl": { + "version": "1.9.2", + "dev": true, + "license": "MIT" + }, + "node_modules/handlebars": { + "version": "1.0.12", + "dev": true, + "dependencies": { + "optimist": "~0.3", + "uglify-js": "~2.3" + }, + "bin": { + "handlebars": "bin/handlebars" + }, + "engines": { + "node": ">=0.4.7" + } + }, + "node_modules/handlebars/node_modules/source-map": { + "version": "0.1.43", + "dev": true, + "dependencies": { + "amdefine": ">=0.0.4" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/handlebars/node_modules/uglify-js": { + "version": "2.3.6", + "dev": true, + "dependencies": { + "async": "~0.2.6", + "optimist": "~0.3.5", + "source-map": "~0.1.7" + }, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/has-flag": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/he": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "bin": { + "he": "bin/he" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "dev": true, + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "license": "ISC" + }, + "node_modules/is-buffer": { + "version": "1.1.6", + "dev": true, + "license": "MIT" + }, + "node_modules/isarray": { + "version": "0.0.1", + "license": "MIT" + }, + "node_modules/istanbul": { + "version": "0.1.46", + "deprecated": "This module is no longer maintained, try this instead:\n npm i nyc\nVisit https://istanbul.js.org/integrations for other alternatives.", + "dev": true, + "dependencies": { + "abbrev": "1.0.x", + "async": "0.2.x", + "escodegen": "0.0.23", + "esprima": "1.0.x", + "fileset": "0.1.x", + "handlebars": "1.0.x", + "mkdirp": "0.3.x", + "nopt": "2.1.x", + "resolve": "0.5.x", + "which": "1.0.x", + "wordwrap": "0.0.x" + }, + "bin": { + "istanbul": "lib/cli.js" + } + }, + "node_modules/json3": { + "version": "3.3.2", + "deprecated": "Please use the native JSON object instead of JSON 3", + "dev": true + }, + "node_modules/kind-of": { + "version": "3.2.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-buffer": "^1.1.5" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/lazy-cache": { + "version": "1.0.4", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/lodash._baseassign": { + "version": "3.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash._basecopy": "^3.0.0", + "lodash.keys": "^3.0.0" + } + }, + "node_modules/lodash._basecopy": { + "version": "3.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash._basecreate": { + "version": "3.0.3", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash._getnative": { + "version": "3.9.1", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash._isiterateecall": { + "version": "3.0.9", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.create": { + "version": "3.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash._baseassign": "^3.0.0", + "lodash._basecreate": "^3.0.0", + "lodash._isiterateecall": "^3.0.0" + } + }, + "node_modules/lodash.isarguments": { + "version": "3.1.0", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.isarray": { + "version": "3.0.4", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.keys": { + "version": "3.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash._getnative": "^3.0.0", + "lodash.isarguments": "^3.0.0", + "lodash.isarray": "^3.0.0" + } + }, + "node_modules/longest": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/lru-cache": { + "version": "2.7.3", + "dev": true, + "license": "ISC" + }, + "node_modules/minimatch": { + "version": "0.4.0", + "deprecated": "Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue", + "dev": true, + "license": "MIT", + "dependencies": { + "lru-cache": "2", + "sigmund": "~1.0.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "0.0.8", + "dev": true, + "license": "MIT" + }, + "node_modules/mkdirp": { + "version": "0.3.5", + "deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)", + "dev": true, + "license": "MIT" + }, + "node_modules/mocha": { + "version": "3.5.3", + "dev": true, + "license": "MIT", + "dependencies": { + "browser-stdout": "1.3.0", + "commander": "2.9.0", + "debug": "2.6.8", + "diff": "3.2.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.1", + "growl": "1.9.2", + "he": "1.1.1", + "json3": "3.3.2", + "lodash.create": "3.1.1", + "mkdirp": "0.5.1", + "supports-color": "3.1.2" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha" + }, + "engines": { + "node": ">= 0.10.x", + "npm": ">= 1.4.x" + } + }, + "node_modules/mocha/node_modules/debug": { + "version": "2.6.8", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/mocha/node_modules/glob": { + "version": "7.1.1", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.2", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mocha/node_modules/minimatch": { + "version": "3.0.4", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mocha/node_modules/mkdirp": { + "version": "0.5.1", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "0.0.8" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "license": "MIT" + }, + "node_modules/nopt": { + "version": "2.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + } + }, + "node_modules/once": { + "version": "1.4.0", + "dev": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/optimist": { + "version": "0.3.7", + "dev": true, + "license": "MIT/X11", + "dependencies": { + "wordwrap": "~0.0.2" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/prelude-ls": { + "version": "0.6.0", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/querystringify": { + "version": "2.2.0", + "license": "MIT" + }, + "node_modules/readable-stream": { + "version": "1.1.14", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "node_modules/repeat-string": { + "version": "1.6.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/requires-port": { + "version": "1.0.0", + "license": "MIT" + }, + "node_modules/resolve": { + "version": "0.5.1", + "dev": true, + "license": "MIT" + }, + "node_modules/right-align": { + "version": "0.1.3", + "dev": true, + "license": "MIT", + "dependencies": { + "align-text": "^0.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sigmund": { + "version": "1.0.1", + "dev": true, + "license": "ISC" + }, + "node_modules/source-map": { + "version": "0.7.3", + "dev": true, + "license": "BSD-3-Clause", + "optional": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/string_decoder": { + "version": "0.10.31", + "license": "MIT" + }, + "node_modules/supports-color": { + "version": "3.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^1.0.0" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/uglify-js": { + "version": "2.8.29", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "source-map": "~0.5.1", + "yargs": "~3.10.0" + }, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + }, + "optionalDependencies": { + "uglify-to-browserify": "~1.0.0" + } + }, + "node_modules/uglify-js/node_modules/source-map": { + "version": "0.5.7", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/uglify-to-browserify": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/url-parse": { + "version": "1.5.1", + "license": "MIT", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "node_modules/which": { + "version": "1.0.9", + "dev": true, + "license": "ISC", + "bin": { + "which": "bin/which" + } + }, + "node_modules/window-size": { + "version": "0.1.0", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/wordwrap": { + "version": "0.0.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "dev": true, + "license": "ISC" + }, + "node_modules/yargs": { + "version": "3.10.0", + "dev": true, + "license": "MIT", + "dependencies": { + "camelcase": "^1.0.2", + "cliui": "^2.1.0", + "decamelize": "^1.0.0", + "window-size": "0.1.0" + } + } + }, + "dependencies": { + "abbrev": { + "version": "1.0.9", + "dev": true + }, + "align-text": { + "version": "0.1.4", + "dev": true, + "requires": { + "kind-of": "^3.0.2", + "longest": "^1.0.1", + "repeat-string": "^1.5.2" + } + }, + "amdefine": { + "version": "1.0.1", + "dev": true + }, + "async": { + "version": "0.2.10", + "dev": true + }, + "balanced-match": { + "version": "1.0.2", + "dev": true + }, + "bitsyntax": { + "version": "0.1.0", + "requires": { + "buffer-more-ints": "~1.0.0", + "debug": "~2.6.9", + "safe-buffer": "~5.1.2" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2" + } + } + }, + "bluebird": { + "version": "3.7.2" + }, + "boo": { + "version": "1.2.4", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "browser-stdout": { + "version": "1.3.0", + "dev": true + }, + "buffer-more-ints": { + "version": "1.0.0" + }, + "camelcase": { + "version": "1.2.1", + "dev": true + }, + "center-align": { + "version": "0.1.3", + "dev": true, + "requires": { + "align-text": "^0.1.3", + "lazy-cache": "^1.0.3" + } + }, + "claire": { + "version": "0.4.1", + "dev": true, + "requires": { + "boo": "~1.2.4", + "flaw": "~0.1.0", + "prelude-ls": "~0.6.0" + } + }, + "cliui": { + "version": "2.1.0", + "dev": true, + "requires": { + "center-align": "^0.1.1", + "right-align": "^0.1.1", + "wordwrap": "0.0.2" + }, + "dependencies": { + "wordwrap": { + "version": "0.0.2", + "dev": true + } + } + }, + "commander": { + "version": "2.9.0", + "dev": true, + "requires": { + "graceful-readlink": ">= 1.0.0" + } + }, + "concat-map": { + "version": "0.0.1", + "dev": true + }, + "core-util-is": { + "version": "1.0.2" + }, + "debug": { + "version": "2.6.9", + "requires": { + "ms": "2.0.0" + } + }, + "decamelize": { + "version": "1.2.0", + "dev": true + }, + "diff": { + "version": "3.2.0", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "dev": true + }, + "escodegen": { + "version": "0.0.23", + "dev": true, + "requires": { + "esprima": "~1.0.2", + "estraverse": "~0.0.4", + "source-map": ">= 0.1.2" + } + }, + "esprima": { + "version": "1.0.4", + "dev": true + }, + "estraverse": { + "version": "0.0.4", + "dev": true + }, + "fileset": { + "version": "0.1.8", + "dev": true, + "requires": { + "glob": "3.x", + "minimatch": "0.x" + } + }, + "flaw": { + "version": "0.1.0", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "dev": true + }, + "glob": { + "version": "3.2.11", + "dev": true, + "requires": { + "inherits": "2", + "minimatch": "0.3" + }, + "dependencies": { + "minimatch": { + "version": "0.3.0", + "dev": true, + "requires": { + "lru-cache": "2", + "sigmund": "~1.0.0" + } + } + } + }, + "graceful-readlink": { + "version": "1.0.1", + "dev": true + }, + "growl": { + "version": "1.9.2", + "dev": true + }, + "handlebars": { + "version": "1.0.12", + "dev": true, + "requires": { + "optimist": "~0.3", + "uglify-js": "~2.3" + }, + "dependencies": { + "source-map": { + "version": "0.1.43", + "dev": true, + "requires": { + "amdefine": ">=0.0.4" + } + }, + "uglify-js": { + "version": "2.3.6", + "dev": true, + "requires": { + "async": "~0.2.6", + "optimist": "~0.3.5", + "source-map": "~0.1.7" + } + } + } + }, + "has-flag": { + "version": "1.0.0", + "dev": true + }, + "he": { + "version": "1.1.1", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4" + }, + "is-buffer": { + "version": "1.1.6", + "dev": true + }, + "isarray": { + "version": "0.0.1" + }, + "istanbul": { + "version": "0.1.46", + "dev": true, + "requires": { + "abbrev": "1.0.x", + "async": "0.2.x", + "escodegen": "0.0.23", + "esprima": "1.0.x", + "fileset": "0.1.x", + "handlebars": "1.0.x", + "mkdirp": "0.3.x", + "nopt": "2.1.x", + "resolve": "0.5.x", + "which": "1.0.x", + "wordwrap": "0.0.x" + } + }, + "json3": { + "version": "3.3.2", + "dev": true + }, + "kind-of": { + "version": "3.2.2", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + }, + "lazy-cache": { + "version": "1.0.4", + "dev": true + }, + "lodash._baseassign": { + "version": "3.2.0", + "dev": true, + "requires": { + "lodash._basecopy": "^3.0.0", + "lodash.keys": "^3.0.0" + } + }, + "lodash._basecopy": { + "version": "3.0.1", + "dev": true + }, + "lodash._basecreate": { + "version": "3.0.3", + "dev": true + }, + "lodash._getnative": { + "version": "3.9.1", + "dev": true + }, + "lodash._isiterateecall": { + "version": "3.0.9", + "dev": true + }, + "lodash.create": { + "version": "3.1.1", + "dev": true, + "requires": { + "lodash._baseassign": "^3.0.0", + "lodash._basecreate": "^3.0.0", + "lodash._isiterateecall": "^3.0.0" + } + }, + "lodash.isarguments": { + "version": "3.1.0", + "dev": true + }, + "lodash.isarray": { + "version": "3.0.4", + "dev": true + }, + "lodash.keys": { + "version": "3.1.2", + "dev": true, + "requires": { + "lodash._getnative": "^3.0.0", + "lodash.isarguments": "^3.0.0", + "lodash.isarray": "^3.0.0" + } + }, + "longest": { + "version": "1.0.1", + "dev": true + }, + "lru-cache": { + "version": "2.7.3", + "dev": true + }, + "minimatch": { + "version": "0.4.0", + "dev": true, + "requires": { + "lru-cache": "2", + "sigmund": "~1.0.0" + } + }, + "minimist": { + "version": "0.0.8", + "dev": true + }, + "mkdirp": { + "version": "0.3.5", + "dev": true + }, + "mocha": { + "version": "3.5.3", + "dev": true, + "requires": { + "browser-stdout": "1.3.0", + "commander": "2.9.0", + "debug": "2.6.8", + "diff": "3.2.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.1", + "growl": "1.9.2", + "he": "1.1.1", + "json3": "3.3.2", + "lodash.create": "3.1.1", + "mkdirp": "0.5.1", + "supports-color": "3.1.2" + }, + "dependencies": { + "debug": { + "version": "2.6.8", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "glob": { + "version": "7.1.1", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.2", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "minimatch": { + "version": "3.0.4", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "mkdirp": { + "version": "0.5.1", + "dev": true, + "requires": { + "minimist": "0.0.8" + } + } + } + }, + "ms": { + "version": "2.0.0" + }, + "nopt": { + "version": "2.1.2", + "dev": true, + "requires": { + "abbrev": "1" + } + }, + "once": { + "version": "1.4.0", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "optimist": { + "version": "0.3.7", + "dev": true, + "requires": { + "wordwrap": "~0.0.2" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "dev": true + }, + "prelude-ls": { + "version": "0.6.0", + "dev": true + }, + "querystringify": { + "version": "2.2.0" + }, + "readable-stream": { + "version": "1.1.14", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "repeat-string": { + "version": "1.6.1", + "dev": true + }, + "requires-port": { + "version": "1.0.0" + }, + "resolve": { + "version": "0.5.1", + "dev": true + }, + "right-align": { + "version": "0.1.3", + "dev": true, + "requires": { + "align-text": "^0.1.1" + } + }, + "sigmund": { + "version": "1.0.1", + "dev": true + }, + "source-map": { + "version": "0.7.3", + "dev": true, + "optional": true + }, + "string_decoder": { + "version": "0.10.31" + }, + "supports-color": { + "version": "3.1.2", + "dev": true, + "requires": { + "has-flag": "^1.0.0" + } + }, + "uglify-js": { + "version": "2.8.29", + "dev": true, + "requires": { + "source-map": "~0.5.1", + "uglify-to-browserify": "~1.0.0", + "yargs": "~3.10.0" + }, + "dependencies": { + "source-map": { + "version": "0.5.7", + "dev": true + } + } + }, + "uglify-to-browserify": { + "version": "1.0.2", + "dev": true, + "optional": true + }, + "url-parse": { + "version": "1.5.1", + "requires": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "which": { + "version": "1.0.9", + "dev": true + }, + "window-size": { + "version": "0.1.0", + "dev": true + }, + "wordwrap": { + "version": "0.0.3", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "dev": true + }, + "yargs": { + "version": "3.10.0", + "dev": true, + "requires": { + "camelcase": "^1.0.2", + "cliui": "^2.1.0", + "decamelize": "^1.0.0", + "window-size": "0.1.0" + } + } + } +} From f8cfb78c1ed982a254e00b845a638648067cb025 Mon Sep 17 00:00:00 2001 From: Michael Bridgen Date: Wed, 19 May 2021 09:28:17 +0100 Subject: [PATCH 009/112] Update package version and changelog for v0.8.0 Signed-off-by: Michael Bridgen --- CHANGELOG.md | 12 ++++++++++++ package-lock.json | 2 +- package.json | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4107d2da..5426d6b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Change log for amqplib +## Changes in v0.8.0 + + git log v0.7.1..v0.8.0 + + * :warning: Support for NodeJS prior to v10 is dropped :warning: ([PR + 615](https://github.com/squaremo/amqp.node/pull/615), thank you + @xamgore and everyone who helped there) + * Use hostname as TLS servername, to help with using servers behind + load balancers ([PR + 567](https://github.com/squaremo/amqp.node/pull/567), thanks to + @carlhoerberg and commenters) + ## Changes in v0.7.1 git log v0.7.0..v0.7.1 diff --git a/package-lock.json b/package-lock.json index 638fcc3d..888994d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "amqplib", - "version": "0.7.1", + "version": "0.8.0", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index 41a11af3..6d82f8f6 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,9 @@ + { "name": "amqplib", "homepage": "http://squaremo.github.io/amqp.node/", "main": "./channel_api.js", - "version": "0.7.1", + "version": "0.8.0", "description": "An AMQP 0-9-1 (e.g., RabbitMQ) library and client.", "repository": { "type": "git", From ce33b1e4592b32c05b833c0f280283e1fe17eb31 Mon Sep 17 00:00:00 2001 From: Michael Bridgen Date: Wed, 19 May 2021 09:56:05 +0100 Subject: [PATCH 010/112] Remove old NodeJS versions from CI matrix Support for Node prior to v10 has been removed. It would be nice to check against older NodeJS versions, but it can't be required by CI. Signed-off-by: Michael Bridgen --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 58dfb9fd..de475131 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ node_js: - "13" - "14" - "15" +- "16" - "node" # Latest stable Node version sudo: false From 5fe1a1bf446278d89c1e8d0be6c8df8ccba1ccbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20Wa=CC=88rting?= Date: Tue, 29 Jun 2021 20:02:13 +0200 Subject: [PATCH 011/112] modernize bitset to use class/const/let --- lib/bitset.js | 136 +++++++++++++++++++++++++------------------------- 1 file changed, 68 insertions(+), 68 deletions(-) diff --git a/lib/bitset.js b/lib/bitset.js index 61f586b6..9e2a6abd 100644 --- a/lib/bitset.js +++ b/lib/bitset.js @@ -8,53 +8,83 @@ 'use strict'; -function BitSet(size) { - if (size) { - var numWords = Math.ceil(size / 32); - this.words = new Array(numWords); +class BitSet { + constructor(size) { + if (size) { + const numWords = Math.ceil(size / 32); + this.words = new Array(numWords); + } + else { + this.words = []; + } + this.wordsInUse = 0; // = number, not index } - else { - this.words = []; + + // Make sure we have at least numWords + ensureSize(numWords) { + const wordsPresent = this.words.length; + if (wordsPresent < numWords) { + this.words = this.words.concat(new Array(numWords - wordsPresent)); + } } - this.wordsInUse = 0; // = number, not index -} -var P = BitSet.prototype; + set(bitIndex) { + const w = wordIndex(bitIndex); + if (w >= this.wordsInUse) { + this.ensureSize(w + 1); + this.wordsInUse = w + 1; + } + const bit = 1 << bitIndex; + this.words[w] |= bit; + } -function wordIndex(bitIndex) { - return Math.floor(bitIndex / 32); -} + clear(bitIndex) { + const w = wordIndex(bitIndex); + if (w >= this.wordsInUse) return; + const mask = ~(1 << bitIndex); + this.words[w] &= mask; + } -// Make sure we have at least numWords -P.ensureSize = function(numWords) { - var wordsPresent = this.words.length; - if (wordsPresent < numWords) { - this.words = this.words.concat(new Array(numWords - wordsPresent)); + get(bitIndex) { + const w = wordIndex(bitIndex); + if (w >= this.wordsInUse) return false; // >= since index vs size + const bit = 1 << bitIndex; + return !!(this.words[w] & bit); } -} -P.set = function(bitIndex) { - var w = wordIndex(bitIndex); - if (w >= this.wordsInUse) { - this.ensureSize(w + 1); - this.wordsInUse = w + 1; + // Give the next bit that's set on or after fromIndex, or -1 if no such + // bit + nextSetBit(fromIndex) { + let w = wordIndex(fromIndex); + if (w >= this.wordsInUse) return -1; + + // the right-hand side is shifted to only test the bits of the first + // word that are > fromIndex + let word = this.words[w] & (0xffffffff << fromIndex); + while (true) { + if (word) return (w * 32) + trailingZeros(word); + w++; + if (w === this.wordsInUse) return -1; + word = this.words[w]; + } } - var bit = 1 << bitIndex; - this.words[w] |= bit; -}; -P.clear = function(bitIndex) { - var w = wordIndex(bitIndex); - if (w >= this.wordsInUse) return; - var mask = ~(1 << bitIndex); - this.words[w] &= mask; -}; + nextClearBit(fromIndex) { + let w = wordIndex(fromIndex); + if (w >= this.wordsInUse) return fromIndex; + + let word = ~(this.words[w]) & (0xffffffff << fromIndex); + while (true) { + if (word) return (w * 32) + trailingZeros(word); + w++; + if (w == this.wordsInUse) return w * 32; + word = ~(this.words[w]); + } + } +} -P.get = function(bitIndex) { - var w = wordIndex(bitIndex); - if (w >= this.wordsInUse) return false; // >= since index vs size - var bit = 1 << bitIndex; - return !!(this.words[w] & bit); +function wordIndex(bitIndex) { + return Math.floor(bitIndex / 32); } function trailingZeros(i) { @@ -62,7 +92,7 @@ function trailingZeros(i) { // since bit ops are not necessarily the quick way to do things in // JS. if (i === 0) return 32; - var y, n = 31; + let y, n = 31; y = i << 16; if (y != 0) { n = n -16; i = y; } y = i << 8; if (y != 0) { n = n - 8; i = y; } y = i << 4; if (y != 0) { n = n - 4; i = y; } @@ -70,34 +100,4 @@ function trailingZeros(i) { return n - ((i << 1) >>> 31); } -// Give the next bit that's set on or after fromIndex, or -1 if no such -// bit -P.nextSetBit = function(fromIndex) { - var w = wordIndex(fromIndex); - if (w >= this.wordsInUse) return -1; - - // the right-hand side is shifted to only test the bits of the first - // word that are > fromIndex - var word = this.words[w] & (0xffffffff << fromIndex); - while (true) { - if (word) return (w * 32) + trailingZeros(word); - w++; - if (w === this.wordsInUse) return -1; - word = this.words[w]; - } -}; - -P.nextClearBit = function(fromIndex) { - var w = wordIndex(fromIndex); - if (w >= this.wordsInUse) return fromIndex; - - var word = ~(this.words[w]) & (0xffffffff << fromIndex); - while (true) { - if (word) return (w * 32) + trailingZeros(word); - w++; - if (w == this.wordsInUse) return w * 32; - word = ~(this.words[w]); - } -}; - module.exports.BitSet = BitSet; From f2da96cecec641042df41b0efd34e42ee449d5ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20Wa=CC=88rting?= Date: Tue, 29 Jun 2021 20:06:42 +0200 Subject: [PATCH 012/112] added jsDoc --- lib/bitset.js | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/lib/bitset.js b/lib/bitset.js index 9e2a6abd..4ab6787b 100644 --- a/lib/bitset.js +++ b/lib/bitset.js @@ -2,13 +2,17 @@ // // -// A bitset implementation, after that in java.util. Yes there -// already exist such things, but none implement next{Clear|Set}Bit or -// equivalent, and none involved me tooling about for an evening. - 'use strict'; +/** + * A bitset implementation, after that in java.util. Yes there + * already exist such things, but none implement next{Clear|Set}Bit or + * equivalent, and none involved me tooling about for an evening. + */ class BitSet { + /** + * @param {number} [size] + */ constructor(size) { if (size) { const numWords = Math.ceil(size / 32); @@ -20,7 +24,9 @@ class BitSet { this.wordsInUse = 0; // = number, not index } - // Make sure we have at least numWords + /** + * @param {number} numWords + */ ensureSize(numWords) { const wordsPresent = this.words.length; if (wordsPresent < numWords) { @@ -28,6 +34,9 @@ class BitSet { } } + /** + * @param {number} bitIndex + */ set(bitIndex) { const w = wordIndex(bitIndex); if (w >= this.wordsInUse) { @@ -38,6 +47,9 @@ class BitSet { this.words[w] |= bit; } + /** + * @param {number} bitIndex + */ clear(bitIndex) { const w = wordIndex(bitIndex); if (w >= this.wordsInUse) return; @@ -45,6 +57,9 @@ class BitSet { this.words[w] &= mask; } + /** + * @param {number} bitIndex + */ get(bitIndex) { const w = wordIndex(bitIndex); if (w >= this.wordsInUse) return false; // >= since index vs size @@ -52,8 +67,11 @@ class BitSet { return !!(this.words[w] & bit); } - // Give the next bit that's set on or after fromIndex, or -1 if no such - // bit + /** + * Give the next bit that is set on or after fromIndex, or -1 if no such bit + * + * @param {number} fromIndex + */ nextSetBit(fromIndex) { let w = wordIndex(fromIndex); if (w >= this.wordsInUse) return -1; @@ -69,6 +87,9 @@ class BitSet { } } + /** + * @param {number} fromIndex + */ nextClearBit(fromIndex) { let w = wordIndex(fromIndex); if (w >= this.wordsInUse) return fromIndex; @@ -83,10 +104,16 @@ class BitSet { } } +/** + * @param {number} bitIndex + */ function wordIndex(bitIndex) { return Math.floor(bitIndex / 32); } +/** + * @param {number} i + */ function trailingZeros(i) { // From Hacker's Delight, via JDK. Probably far less effective here, // since bit ops are not necessarily the quick way to do things in From d2e1d4b2be0e008855bc924ca05178b6f716db2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20Wa=CC=88rting?= Date: Tue, 29 Jun 2021 20:44:46 +0200 Subject: [PATCH 013/112] auto format --- test/bitset.js | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/test/bitset.js b/test/bitset.js index 35e76561..935babcd 100644 --- a/test/bitset.js +++ b/test/bitset.js @@ -1,66 +1,62 @@ 'use strict'; -var claire = require('claire'); +const claire = require('claire'); -var forAll = claire.forAll, - arb = claire.data, - label = claire.label, - choice = claire.choice, - transform = claire.transform; +const forAll = claire.forAll, arb = claire.data, label = claire.label, choice = claire.choice, transform = claire.transform; -var BitSet = require('../lib/bitset').BitSet; -var PosInt = transform(Math.floor, arb.Positive); +const BitSet = require('../lib/bitset').BitSet; +const PosInt = transform(Math.floor, arb.Positive); -var EmptyBitSet = label('bitset', transform( - function(size) { +const EmptyBitSet = label('bitset', transform( + size => { return new BitSet(size); }, choice(arb.Nothing, PosInt))); -suite('BitSet', function() { +suite('BitSet', () => { test('get bit', forAll(EmptyBitSet, PosInt) - .satisfy(function(b, bit) { + .satisfy((b, bit) => { b.set(bit); return b.get(bit); }).asTest()); test('clear bit', forAll(EmptyBitSet, PosInt) - .satisfy(function(b, bit) { + .satisfy((b, bit) => { b.set(bit); b.clear(bit); return !b.get(bit); }).asTest()); test('next set of empty', forAll(EmptyBitSet) - .satisfy(function(b) { + .satisfy(b => { return b.nextSetBit(0) === -1; }).asTest()); test('next set of one bit', forAll(EmptyBitSet, PosInt) - .satisfy(function(b, bit) { + .satisfy((b, bit) => { b.set(bit); return b.nextSetBit(0) === bit; }).asTest()); test('next set same bit', forAll(EmptyBitSet, PosInt) - .satisfy(function(b, bit) { + .satisfy((b, bit) => { b.set(bit); return b.nextSetBit(bit) === bit; }).asTest()); test('next set following bit', forAll(EmptyBitSet, PosInt) - .satisfy(function(b, bit) { + .satisfy((b, bit) => { b.set(bit); return b.nextSetBit(bit+1) === -1; }).asTest()); test('next clear of empty', forAll(EmptyBitSet, PosInt) - .satisfy(function(b, bit) { return b.nextClearBit(bit) === bit; }) + .satisfy((b, bit) => { return b.nextClearBit(bit) === bit; }) .asTest()); test('next clear of one set', forAll(EmptyBitSet, PosInt) - .satisfy(function(b, bit) { + .satisfy((b, bit) => { b.set(bit); return b.nextClearBit(bit) === bit + 1; }).asTest()); From 6311821bdb4506c43a97dfe31097364159824521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20Wa=CC=88rting?= Date: Tue, 29 Jun 2021 20:47:15 +0200 Subject: [PATCH 014/112] destruct --- test/bitset.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/bitset.js b/test/bitset.js index 935babcd..d03cddd3 100644 --- a/test/bitset.js +++ b/test/bitset.js @@ -2,9 +2,15 @@ const claire = require('claire'); -const forAll = claire.forAll, arb = claire.data, label = claire.label, choice = claire.choice, transform = claire.transform; +const { + forAll, + data: arb, + label, + choice, + transform +} = claire; -const BitSet = require('../lib/bitset').BitSet; +const {BitSet} = require('../lib/bitset'); const PosInt = transform(Math.floor, arb.Positive); const EmptyBitSet = label('bitset', transform( @@ -20,7 +26,7 @@ test('get bit', forAll(EmptyBitSet, PosInt) b.set(bit); return b.get(bit); }).asTest()); - + test('clear bit', forAll(EmptyBitSet, PosInt) .satisfy((b, bit) => { b.set(bit); From 2b3e669e5142cd85a968ba0a8d196d1708348b6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20Wa=CC=88rting?= Date: Tue, 29 Jun 2021 20:48:07 +0200 Subject: [PATCH 015/112] mv import to top --- test/bitset.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/bitset.js b/test/bitset.js index d03cddd3..3108aafe 100644 --- a/test/bitset.js +++ b/test/bitset.js @@ -1,6 +1,7 @@ 'use strict'; const claire = require('claire'); +const {BitSet} = require('../lib/bitset'); const { forAll, @@ -10,7 +11,6 @@ const { transform } = claire; -const {BitSet} = require('../lib/bitset'); const PosInt = transform(Math.floor, arb.Positive); const EmptyBitSet = label('bitset', transform( @@ -66,5 +66,4 @@ test('next clear of one set', forAll(EmptyBitSet, PosInt) b.set(bit); return b.nextClearBit(bit) === bit + 1; }).asTest()); - }); From edaaa498c7dd34c99202f372bcb637831f06fa6d Mon Sep 17 00:00:00 2001 From: Michael Bridgen Date: Fri, 15 Oct 2021 10:33:07 +0100 Subject: [PATCH 016/112] GitHub Actions workflow for tests This is based on the Node.JS template, with an extra step to install RabbitMQ. Signed-off-by: Michael Bridgen --- .github/workflows/test.yml | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..3e02c0b7 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,39 @@ +# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: Node.js CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [10.x, 12.x, 14.x, 16.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + + # Install all prerequisites + - run: npm ci + + # Need RabbitMQ to test against + - name: Install rabbitmq + run: | + sudo apt-get install rabbitmq-server -y --fix-missing + + # Run the tests + - run: make test From 38ba1ce4b4475f2efeca63ef33e42f46e8b29a91 Mon Sep 17 00:00:00 2001 From: Atanasov Date: Fri, 15 Oct 2021 11:54:09 -0700 Subject: [PATCH 017/112] update url-parse package --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6d82f8f6..92607b54 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "bluebird": "^3.7.2", "buffer-more-ints": "~1.0.0", "readable-stream": "1.x >=1.1.9", - "url-parse": "~1.5.1" + "url-parse": "~1.5.3" }, "devDependencies": { "claire": "0.4.1", From f33165703ff6f2d50fa01390080c62db11c37707 Mon Sep 17 00:00:00 2001 From: Michael Bridgen Date: Mon, 18 Oct 2021 07:23:14 +0100 Subject: [PATCH 018/112] Bring package-lock.json up to date The test workflow (rightfully) uses `npm ci`, which will balk if the lockfile does not reflect version in package.json. This commit makes sure they match, through npm install Signed-off-by: Michael Bridgen --- package-lock.json | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 888994d3..480a870f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,14 +6,14 @@ "packages": { "": { "name": "amqplib", - "version": "0.7.1", + "version": "0.8.0", "license": "MIT", "dependencies": { "bitsyntax": "~0.1.0", "bluebird": "^3.7.2", "buffer-more-ints": "~1.0.0", "readable-stream": "1.x >=1.1.9", - "url-parse": "~1.5.1" + "url-parse": "~1.5.3" }, "devDependencies": { "claire": "0.4.1", @@ -731,8 +731,9 @@ "optional": true }, "node_modules/url-parse": { - "version": "1.5.1", - "license": "MIT", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.3.tgz", + "integrity": "sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==", "dependencies": { "querystringify": "^2.1.1", "requires-port": "^1.0.0" @@ -1279,7 +1280,9 @@ "optional": true }, "url-parse": { - "version": "1.5.1", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.3.tgz", + "integrity": "sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==", "requires": { "querystringify": "^2.1.1", "requires-port": "^1.0.0" From 85260e8b7154175db140a08e818956ce5c40f092 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20Wa=CC=88rting?= Date: Tue, 29 Jun 2021 21:25:05 +0200 Subject: [PATCH 019/112] auto format code --- lib/channel_model.js | 554 +++++++++++++++++++++---------------------- 1 file changed, 274 insertions(+), 280 deletions(-) diff --git a/lib/channel_model.js b/lib/channel_model.js index 2097fd14..a66e4fd2 100644 --- a/lib/channel_model.js +++ b/lib/channel_model.js @@ -4,265 +4,270 @@ 'use strict'; -var defs = require('./defs'); -var Promise = require('bluebird'); -var inherits = require('util').inherits; -var EventEmitter = require('events').EventEmitter; -var BaseChannel = require('./channel').BaseChannel; -var acceptMessage = require('./channel').acceptMessage; -var Args = require('./api_args'); - -function ChannelModel(connection) { - if (!(this instanceof ChannelModel)) - return new ChannelModel(connection); - EventEmitter.call( this ); - this.connection = connection; - var self = this; - ['error', 'close', 'blocked', 'unblocked'].forEach(function(ev) { - connection.on(ev, self.emit.bind(self, ev)); - }); +const defs = require('./defs'); +const Promise = require('bluebird'); +const inherits = require('util').inherits; +const EventEmitter = require('events').EventEmitter; +const BaseChannel = require('./channel').BaseChannel; +const acceptMessage = require('./channel').acceptMessage; +const Args = require('./api_args'); + +class ChannelModel extends EventEmitter { + constructor(connection) { + super(); + this.connection = connection; + const self = this; + ['error', 'close', 'blocked', 'unblocked'].forEach(ev => { + connection.on(ev, self.emit.bind(self, ev)); + }); + } + + close() { + return Promise.fromCallback(this.connection.close.bind(this.connection)); + } + + createChannel() { + const c = new Channel(this.connection); + return c.open().then(openOk => { return c; }); + } + + createConfirmChannel() { + const c = new ConfirmChannel(this.connection); + return c.open() + .then(openOk => { + return c.rpc(defs.ConfirmSelect, {nowait: false}, + defs.ConfirmSelectOk) + }) + .then(() => { return c; }); + } } -inherits(ChannelModel, EventEmitter); module.exports.ChannelModel = ChannelModel; -var CM = ChannelModel.prototype; - -CM.close = function() { - return Promise.fromCallback(this.connection.close.bind(this.connection)); -}; - // Channels -function Channel(connection) { - BaseChannel.call(this, connection); - this.on('delivery', this.handleDelivery.bind(this)); - this.on('cancel', this.handleCancel.bind(this)); -} -inherits(Channel, BaseChannel); - -module.exports.Channel = Channel; - -CM.createChannel = function() { - var c = new Channel(this.connection); - return c.open().then(function(openOk) { return c; }); -}; - -var C = Channel.prototype; - -// An RPC that returns a 'proper' promise, which resolves to just the -// response's fields; this is intended to be suitable for implementing -// API procedures. -C.rpc = function(method, fields, expect) { - var self = this; - return Promise.fromCallback(function(cb) { - return self._rpc(method, fields, expect, cb); - }) - .then(function(f) { - return f.fields; - }); -}; - -// Do the remarkably simple channel open handshake -C.open = function() { - return Promise.try(this.allocate.bind(this)).then( - function(ch) { - return ch.rpc(defs.ChannelOpen, {outOfBand: ""}, - defs.ChannelOpenOk); +class Channel extends BaseChannel { + constructor(connection) { + super(connection); + this.on('delivery', this.handleDelivery.bind(this)); + this.on('cancel', this.handleCancel.bind(this)); + } + + // An RPC that returns a 'proper' promise, which resolves to just the + // response's fields; this is intended to be suitable for implementing + // API procedures. + rpc(method, fields, expect) { + const self = this; + return Promise.fromCallback(cb => { + return self._rpc(method, fields, expect, cb); + }) + .then(f => { + return f.fields; }); -}; - -C.close = function() { - var self = this; - return Promise.fromCallback(function(cb) { - return self.closeBecause("Goodbye", defs.constants.REPLY_SUCCESS, - cb); - }); -}; - -// === Public API, declaring queues and stuff === - -C.assertQueue = function(queue, options) { - return this.rpc(defs.QueueDeclare, - Args.assertQueue(queue, options), - defs.QueueDeclareOk); -}; - -C.checkQueue = function(queue) { - return this.rpc(defs.QueueDeclare, - Args.checkQueue(queue), - defs.QueueDeclareOk); -}; - -C.deleteQueue = function(queue, options) { - return this.rpc(defs.QueueDelete, - Args.deleteQueue(queue, options), - defs.QueueDeleteOk); -}; - -C.purgeQueue = function(queue) { - return this.rpc(defs.QueuePurge, - Args.purgeQueue(queue), - defs.QueuePurgeOk); -}; - -C.bindQueue = function(queue, source, pattern, argt) { - return this.rpc(defs.QueueBind, - Args.bindQueue(queue, source, pattern, argt), - defs.QueueBindOk); -}; - -C.unbindQueue = function(queue, source, pattern, argt) { - return this.rpc(defs.QueueUnbind, - Args.unbindQueue(queue, source, pattern, argt), - defs.QueueUnbindOk); -}; - -C.assertExchange = function(exchange, type, options) { - // The server reply is an empty set of fields, but it's convenient - // to have the exchange name handed to the continuation. - return this.rpc(defs.ExchangeDeclare, - Args.assertExchange(exchange, type, options), - defs.ExchangeDeclareOk) - .then(function(_ok) { return { exchange: exchange }; }); -}; - -C.checkExchange = function(exchange) { - return this.rpc(defs.ExchangeDeclare, - Args.checkExchange(exchange), - defs.ExchangeDeclareOk); -}; - -C.deleteExchange = function(name, options) { - return this.rpc(defs.ExchangeDelete, - Args.deleteExchange(name, options), - defs.ExchangeDeleteOk); -}; - -C.bindExchange = function(dest, source, pattern, argt) { - return this.rpc(defs.ExchangeBind, - Args.bindExchange(dest, source, pattern, argt), - defs.ExchangeBindOk); -}; - -C.unbindExchange = function(dest, source, pattern, argt) { - return this.rpc(defs.ExchangeUnbind, - Args.unbindExchange(dest, source, pattern, argt), - defs.ExchangeUnbindOk); -}; - -// Working with messages - -C.publish = function(exchange, routingKey, content, options) { - var fieldsAndProps = Args.publish(exchange, routingKey, options); - return this.sendMessage(fieldsAndProps, fieldsAndProps, content); -}; - -C.sendToQueue = function(queue, content, options) { - return this.publish('', queue, content, options); -}; - -C.consume = function(queue, callback, options) { - var self = this; - // NB we want the callback to be run synchronously, so that we've - // registered the consumerTag before any messages can arrive. - var fields = Args.consume(queue, options); - return Promise.fromCallback(function(cb) { - self._rpc(defs.BasicConsume, fields, defs.BasicConsumeOk, cb); - }) - .then(function(ok) { - self.registerConsumer(ok.fields.consumerTag, callback); - return ok.fields; - }); -}; - -C.cancel = function(consumerTag) { - var self = this; - return Promise.fromCallback(function(cb) { - self._rpc(defs.BasicCancel, Args.cancel(consumerTag), - defs.BasicCancelOk, - cb); - }) - .then(function(ok) { - self.unregisterConsumer(consumerTag); - return ok.fields; - }); -}; - -C.get = function(queue, options) { - var self = this; - var fields = Args.get(queue, options); - return Promise.fromCallback(function(cb) { - return self.sendOrEnqueue(defs.BasicGet, fields, cb); - }) - .then(function(f) { - if (f.id === defs.BasicGetEmpty) { - return false; - } - else if (f.id === defs.BasicGetOk) { - var fields = f.fields; - return new Promise(function(resolve) { - self.handleMessage = acceptMessage(function(m) { - m.fields = fields; - resolve(m); - }); + } + + // Do the remarkably simple channel open handshake + open() { + return Promise.try(this.allocate.bind(this)).then( + ch => { + return ch.rpc(defs.ChannelOpen, {outOfBand: ""}, + defs.ChannelOpenOk); }); - } - else { - throw new Error("Unexpected response to BasicGet: " + - inspect(f)); - } - }) -}; - -C.ack = function(message, allUpTo) { - this.sendImmediately( - defs.BasicAck, - Args.ack(message.fields.deliveryTag, allUpTo)); -}; + } -C.ackAll = function() { - this.sendImmediately(defs.BasicAck, Args.ack(0, true)); -}; - -C.nack = function(message, allUpTo, requeue) { - this.sendImmediately( - defs.BasicNack, - Args.nack(message.fields.deliveryTag, allUpTo, requeue)); -}; + close() { + const self = this; + return Promise.fromCallback(cb => { + return self.closeBecause("Goodbye", defs.constants.REPLY_SUCCESS, + cb); + }); + } + + // === Public API, declaring queues and stuff === + + assertQueue(queue, options) { + return this.rpc(defs.QueueDeclare, + Args.assertQueue(queue, options), + defs.QueueDeclareOk); + } + + checkQueue(queue) { + return this.rpc(defs.QueueDeclare, + Args.checkQueue(queue), + defs.QueueDeclareOk); + } + + deleteQueue(queue, options) { + return this.rpc(defs.QueueDelete, + Args.deleteQueue(queue, options), + defs.QueueDeleteOk); + } + + purgeQueue(queue) { + return this.rpc(defs.QueuePurge, + Args.purgeQueue(queue), + defs.QueuePurgeOk); + } + + bindQueue(queue, source, pattern, argt) { + return this.rpc(defs.QueueBind, + Args.bindQueue(queue, source, pattern, argt), + defs.QueueBindOk); + } + + unbindQueue(queue, source, pattern, argt) { + return this.rpc(defs.QueueUnbind, + Args.unbindQueue(queue, source, pattern, argt), + defs.QueueUnbindOk); + } + + assertExchange(exchange, type, options) { + // The server reply is an empty set of fields, but it's convenient + // to have the exchange name handed to the continuation. + return this.rpc(defs.ExchangeDeclare, + Args.assertExchange(exchange, type, options), + defs.ExchangeDeclareOk) + .then(_ok => { return { exchange }; }); + } + + checkExchange(exchange) { + return this.rpc(defs.ExchangeDeclare, + Args.checkExchange(exchange), + defs.ExchangeDeclareOk); + } + + deleteExchange(name, options) { + return this.rpc(defs.ExchangeDelete, + Args.deleteExchange(name, options), + defs.ExchangeDeleteOk); + } + + bindExchange(dest, source, pattern, argt) { + return this.rpc(defs.ExchangeBind, + Args.bindExchange(dest, source, pattern, argt), + defs.ExchangeBindOk); + } + + unbindExchange(dest, source, pattern, argt) { + return this.rpc(defs.ExchangeUnbind, + Args.unbindExchange(dest, source, pattern, argt), + defs.ExchangeUnbindOk); + } + + // Working with messages + + publish(exchange, routingKey, content, options) { + const fieldsAndProps = Args.publish(exchange, routingKey, options); + return this.sendMessage(fieldsAndProps, fieldsAndProps, content); + } + + sendToQueue(queue, content, options) { + return this.publish('', queue, content, options); + } + + consume(queue, callback, options) { + const self = this; + // NB we want the callback to be run synchronously, so that we've + // registered the consumerTag before any messages can arrive. + const fields = Args.consume(queue, options); + return Promise.fromCallback(cb => { + self._rpc(defs.BasicConsume, fields, defs.BasicConsumeOk, cb); + }) + .then(ok => { + self.registerConsumer(ok.fields.consumerTag, callback); + return ok.fields; + }); + } + + cancel(consumerTag) { + const self = this; + return Promise.fromCallback(cb => { + self._rpc(defs.BasicCancel, Args.cancel(consumerTag), + defs.BasicCancelOk, + cb); + }) + .then(ok => { + self.unregisterConsumer(consumerTag); + return ok.fields; + }); + } -C.nackAll = function(requeue) { - this.sendImmediately(defs.BasicNack, - Args.nack(0, true, requeue)); -}; + get(queue, options) { + const self = this; + const fields = Args.get(queue, options); + return Promise.fromCallback(cb => { + return self.sendOrEnqueue(defs.BasicGet, fields, cb); + }) + .then(f => { + if (f.id === defs.BasicGetEmpty) { + return false; + } + else if (f.id === defs.BasicGetOk) { + const fields = f.fields; + return new Promise(resolve => { + self.handleMessage = acceptMessage(m => { + m.fields = fields; + resolve(m); + }); + }); + } + else { + throw new Error(`Unexpected response to BasicGet: ${inspect(f)}`); + } + }); + } + + ack(message, allUpTo) { + this.sendImmediately( + defs.BasicAck, + Args.ack(message.fields.deliveryTag, allUpTo)); + } + + ackAll() { + this.sendImmediately(defs.BasicAck, Args.ack(0, true)); + } + + nack(message, allUpTo, requeue) { + this.sendImmediately( + defs.BasicNack, + Args.nack(message.fields.deliveryTag, allUpTo, requeue)); + } + + nackAll(requeue) { + this.sendImmediately(defs.BasicNack, + Args.nack(0, true, requeue)); + } + + // `Basic.Nack` is not available in older RabbitMQ versions (or in the + // AMQP specification), so you have to use the one-at-a-time + // `Basic.Reject`. This is otherwise synonymous with + // `#nack(message, false, requeue)`. + reject(message, requeue) { + this.sendImmediately( + defs.BasicReject, + Args.reject(message.fields.deliveryTag, requeue)); + } + + recover() { + return this.rpc(defs.BasicRecover, + Args.recover(), + defs.BasicRecoverOk); + } +} -// `Basic.Nack` is not available in older RabbitMQ versions (or in the -// AMQP specification), so you have to use the one-at-a-time -// `Basic.Reject`. This is otherwise synonymous with -// `#nack(message, false, requeue)`. -C.reject = function(message, requeue) { - this.sendImmediately( - defs.BasicReject, - Args.reject(message.fields.deliveryTag, requeue)); -}; +module.exports.Channel = Channel; // There are more options in AMQP than exposed here; RabbitMQ only // implements prefetch based on message count, and only for individual // channels or consumers. RabbitMQ v3.3.0 and after treat prefetch // (without `global` set) as per-consumer (for consumers following), // and prefetch with `global` set as per-channel. -C.prefetch = C.qos = function(count, global) { +Channel.prototype.prefetch = Channel.prototype.qos = function(count, global) { return this.rpc(defs.BasicQos, Args.prefetch(count, global), defs.BasicQosOk); }; -C.recover = function() { - return this.rpc(defs.BasicRecover, - Args.recover(), - defs.BasicRecoverOk); -}; - // Confirm channel. This is a channel with confirms 'switched on', // meaning sent messages will provoke a responding 'ack' or 'nack' // from the server. The upshot of this is that `publish` and @@ -270,49 +275,38 @@ C.recover = function() { // with `null` as its argument to signify 'ack', or an exception as // its argument to signify 'nack'. -function ConfirmChannel(connection) { - Channel.call(this, connection); +class ConfirmChannel extends Channel { + constructor(connection) { + super(connection); + } + + publish(exchange, routingKey, content, options, cb) { + this.pushConfirmCallback(cb); + return Channel.prototype.publish.call(this, exchange, routingKey, content, options); + } + + sendToQueue(queue, content, options, cb) { + return this.publish('', queue, content, options, cb); + } + + waitForConfirms() { + const awaiting = []; + const unconfirmed = this.unconfirmed; + unconfirmed.forEach((val, index) => { + if (val === null); // already confirmed + else { + const confirmed = new Promise((resolve, reject) => { + unconfirmed[index] = err => { + if (val) val(err); + if (err === null) resolve(); + else reject(err); + }; + }); + awaiting.push(confirmed); + } + }); + return Promise.all(awaiting); + } } -inherits(ConfirmChannel, Channel); module.exports.ConfirmChannel = ConfirmChannel; - -CM.createConfirmChannel = function() { - var c = new ConfirmChannel(this.connection); - return c.open() - .then(function(openOk) { - return c.rpc(defs.ConfirmSelect, {nowait: false}, - defs.ConfirmSelectOk) - }) - .then(function() { return c; }); -}; - -var CC = ConfirmChannel.prototype; - -CC.publish = function(exchange, routingKey, content, options, cb) { - this.pushConfirmCallback(cb); - return C.publish.call(this, exchange, routingKey, content, options); -}; - -CC.sendToQueue = function(queue, content, options, cb) { - return this.publish('', queue, content, options, cb); -}; - -CC.waitForConfirms = function() { - var awaiting = []; - var unconfirmed = this.unconfirmed; - unconfirmed.forEach(function(val, index) { - if (val === null); // already confirmed - else { - var confirmed = new Promise(function(resolve, reject) { - unconfirmed[index] = function(err) { - if (val) val(err); - if (err === null) resolve(); - else reject(err); - }; - }); - awaiting.push(confirmed); - } - }); - return Promise.all(awaiting); -}; From df67c9784a4ebbe2ead6257e81daf24f5cb2364b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20Wa=CC=88rting?= Date: Tue, 29 Jun 2021 21:26:03 +0200 Subject: [PATCH 020/112] rm inherit --- lib/channel_model.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/channel_model.js b/lib/channel_model.js index a66e4fd2..9803e80d 100644 --- a/lib/channel_model.js +++ b/lib/channel_model.js @@ -6,7 +6,6 @@ const defs = require('./defs'); const Promise = require('bluebird'); -const inherits = require('util').inherits; const EventEmitter = require('events').EventEmitter; const BaseChannel = require('./channel').BaseChannel; const acceptMessage = require('./channel').acceptMessage; From 66467feb3c66a799c93db1a5fd94b5ebac3b3177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20Wa=CC=88rting?= Date: Tue, 29 Jun 2021 21:26:23 +0200 Subject: [PATCH 021/112] rm circular ref --- lib/channel_model.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/channel_model.js b/lib/channel_model.js index 9803e80d..615ffe8d 100644 --- a/lib/channel_model.js +++ b/lib/channel_model.js @@ -6,7 +6,7 @@ const defs = require('./defs'); const Promise = require('bluebird'); -const EventEmitter = require('events').EventEmitter; +const EventEmitter = require('events'); const BaseChannel = require('./channel').BaseChannel; const acceptMessage = require('./channel').acceptMessage; const Args = require('./api_args'); From 82b722c8504b8dcd8884473f913f03b33b3b3098 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20Wa=CC=88rting?= Date: Tue, 29 Jun 2021 21:27:11 +0200 Subject: [PATCH 022/112] destruct imports --- lib/channel_model.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/channel_model.js b/lib/channel_model.js index 615ffe8d..ad51fd98 100644 --- a/lib/channel_model.js +++ b/lib/channel_model.js @@ -7,8 +7,8 @@ const defs = require('./defs'); const Promise = require('bluebird'); const EventEmitter = require('events'); -const BaseChannel = require('./channel').BaseChannel; -const acceptMessage = require('./channel').acceptMessage; +const {BaseChannel} = require('./channel'); +const {acceptMessage} = require('./channel'); const Args = require('./api_args'); class ChannelModel extends EventEmitter { From e66acffd50c291ba81c7a3dd91fc60b72acca0d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20Wa=CC=88rting?= Date: Tue, 29 Jun 2021 21:28:16 +0200 Subject: [PATCH 023/112] sort on node, npm own packages --- lib/channel_model.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/channel_model.js b/lib/channel_model.js index ad51fd98..0d1e888b 100644 --- a/lib/channel_model.js +++ b/lib/channel_model.js @@ -4,9 +4,9 @@ 'use strict'; -const defs = require('./defs'); -const Promise = require('bluebird'); const EventEmitter = require('events'); +const Promise = require('bluebird'); +const defs = require('./defs'); const {BaseChannel} = require('./channel'); const {acceptMessage} = require('./channel'); const Args = require('./api_args'); From 71f649b869708c9a9d24103ca14c765c96da5257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20Wa=CC=88rting?= Date: Tue, 29 Jun 2021 21:30:58 +0200 Subject: [PATCH 024/112] rm some self variable --- lib/channel_model.js | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/lib/channel_model.js b/lib/channel_model.js index 0d1e888b..104c81f0 100644 --- a/lib/channel_model.js +++ b/lib/channel_model.js @@ -15,9 +15,9 @@ class ChannelModel extends EventEmitter { constructor(connection) { super(); this.connection = connection; - const self = this; + ['error', 'close', 'blocked', 'unblocked'].forEach(ev => { - connection.on(ev, self.emit.bind(self, ev)); + connection.on(ev, this.emit.bind(this, ev)); }); } @@ -56,9 +56,8 @@ class Channel extends BaseChannel { // response's fields; this is intended to be suitable for implementing // API procedures. rpc(method, fields, expect) { - const self = this; return Promise.fromCallback(cb => { - return self._rpc(method, fields, expect, cb); + return this._rpc(method, fields, expect, cb); }) .then(f => { return f.fields; @@ -75,9 +74,8 @@ class Channel extends BaseChannel { } close() { - const self = this; return Promise.fromCallback(cb => { - return self.closeBecause("Goodbye", defs.constants.REPLY_SUCCESS, + return this.closeBecause("Goodbye", defs.constants.REPLY_SUCCESS, cb); }); } @@ -165,37 +163,34 @@ class Channel extends BaseChannel { } consume(queue, callback, options) { - const self = this; // NB we want the callback to be run synchronously, so that we've // registered the consumerTag before any messages can arrive. const fields = Args.consume(queue, options); return Promise.fromCallback(cb => { - self._rpc(defs.BasicConsume, fields, defs.BasicConsumeOk, cb); + this._rpc(defs.BasicConsume, fields, defs.BasicConsumeOk, cb); }) .then(ok => { - self.registerConsumer(ok.fields.consumerTag, callback); + this.registerConsumer(ok.fields.consumerTag, callback); return ok.fields; }); } cancel(consumerTag) { - const self = this; return Promise.fromCallback(cb => { - self._rpc(defs.BasicCancel, Args.cancel(consumerTag), + this._rpc(defs.BasicCancel, Args.cancel(consumerTag), defs.BasicCancelOk, cb); }) .then(ok => { - self.unregisterConsumer(consumerTag); + this.unregisterConsumer(consumerTag); return ok.fields; }); } get(queue, options) { - const self = this; const fields = Args.get(queue, options); return Promise.fromCallback(cb => { - return self.sendOrEnqueue(defs.BasicGet, fields, cb); + return this.sendOrEnqueue(defs.BasicGet, fields, cb); }) .then(f => { if (f.id === defs.BasicGetEmpty) { @@ -204,7 +199,7 @@ class Channel extends BaseChannel { else if (f.id === defs.BasicGetOk) { const fields = f.fields; return new Promise(resolve => { - self.handleMessage = acceptMessage(m => { + this.handleMessage = acceptMessage(m => { m.fields = fields; resolve(m); }); From a57a3534ce101db17ea2248316caa07d557281f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20Wa=CC=88rting?= Date: Tue, 29 Jun 2021 21:31:57 +0200 Subject: [PATCH 025/112] rm unnecessary constructor --- lib/channel_model.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/channel_model.js b/lib/channel_model.js index 104c81f0..63aceaf5 100644 --- a/lib/channel_model.js +++ b/lib/channel_model.js @@ -270,10 +270,6 @@ Channel.prototype.prefetch = Channel.prototype.qos = function(count, global) { // its argument to signify 'nack'. class ConfirmChannel extends Channel { - constructor(connection) { - super(connection); - } - publish(exchange, routingKey, content, options, cb) { this.pushConfirmCallback(cb); return Channel.prototype.publish.call(this, exchange, routingKey, content, options); From 2484993819c9a9cacf2a06fb72552f21c67c0108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20Wa=CC=88rting?= Date: Tue, 29 Jun 2021 21:33:21 +0200 Subject: [PATCH 026/112] mv exports to bottom --- lib/channel_model.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/channel_model.js b/lib/channel_model.js index 63aceaf5..df57578d 100644 --- a/lib/channel_model.js +++ b/lib/channel_model.js @@ -41,8 +41,6 @@ class ChannelModel extends EventEmitter { } } -module.exports.ChannelModel = ChannelModel; - // Channels class Channel extends BaseChannel { @@ -249,8 +247,6 @@ class Channel extends BaseChannel { } } -module.exports.Channel = Channel; - // There are more options in AMQP than exposed here; RabbitMQ only // implements prefetch based on message count, and only for individual // channels or consumers. RabbitMQ v3.3.0 and after treat prefetch @@ -300,3 +296,5 @@ class ConfirmChannel extends Channel { } module.exports.ConfirmChannel = ConfirmChannel; +module.exports.Channel = Channel; +module.exports.ChannelModel = ChannelModel; From 8e6129ed232bc4ad6160b3790d6ed1a4c681ea8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20Wa=CC=88rting?= Date: Tue, 29 Jun 2021 21:35:26 +0200 Subject: [PATCH 027/112] inspect was undefined and used --- lib/channel_model.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/channel_model.js b/lib/channel_model.js index df57578d..0dfb5bc5 100644 --- a/lib/channel_model.js +++ b/lib/channel_model.js @@ -10,6 +10,7 @@ const defs = require('./defs'); const {BaseChannel} = require('./channel'); const {acceptMessage} = require('./channel'); const Args = require('./api_args'); +const {inspect} = require('./format'); class ChannelModel extends EventEmitter { constructor(connection) { From 85bb5ad3b12f6f77c03cc90e153fb228c64508bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20Wa=CC=88rting?= Date: Tue, 29 Jun 2021 21:56:25 +0200 Subject: [PATCH 028/112] start using async where it may fit --- lib/channel_model.js | 103 ++++++++++++++++++++----------------------- 1 file changed, 49 insertions(+), 54 deletions(-) diff --git a/lib/channel_model.js b/lib/channel_model.js index 0dfb5bc5..e13b1bdc 100644 --- a/lib/channel_model.js +++ b/lib/channel_model.js @@ -26,19 +26,17 @@ class ChannelModel extends EventEmitter { return Promise.fromCallback(this.connection.close.bind(this.connection)); } - createChannel() { - const c = new Channel(this.connection); - return c.open().then(openOk => { return c; }); + async createChannel() { + const channel = new Channel(this.connection); + await channel.open(); + return channel; } - createConfirmChannel() { - const c = new ConfirmChannel(this.connection); - return c.open() - .then(openOk => { - return c.rpc(defs.ConfirmSelect, {nowait: false}, - defs.ConfirmSelectOk) - }) - .then(() => { return c; }); + async createConfirmChannel() { + const channel = new ConfirmChannel(this.connection); + await channel.open(); + await channel.rpc(defs.ConfirmSelect, {nowait: false}, defs.ConfirmSelectOk); + return channel; } } @@ -54,13 +52,12 @@ class Channel extends BaseChannel { // An RPC that returns a 'proper' promise, which resolves to just the // response's fields; this is intended to be suitable for implementing // API procedures. - rpc(method, fields, expect) { - return Promise.fromCallback(cb => { + async rpc(method, fields, expect) { + const f = await Promise.fromCallback(cb => { return this._rpc(method, fields, expect, cb); }) - .then(f => { - return f.fields; - }); + + return f.fields; } // Do the remarkably simple channel open handshake @@ -161,53 +158,50 @@ class Channel extends BaseChannel { return this.publish('', queue, content, options); } - consume(queue, callback, options) { + async consume(queue, callback, options) { // NB we want the callback to be run synchronously, so that we've // registered the consumerTag before any messages can arrive. const fields = Args.consume(queue, options); - return Promise.fromCallback(cb => { + const ok = await Promise.fromCallback(cb => { this._rpc(defs.BasicConsume, fields, defs.BasicConsumeOk, cb); }) - .then(ok => { - this.registerConsumer(ok.fields.consumerTag, callback); - return ok.fields; - }); + + this.registerConsumer(ok.fields.consumerTag, callback); + return ok.fields; } - cancel(consumerTag) { - return Promise.fromCallback(cb => { + async cancel(consumerTag) { + const ok = await Promise.fromCallback(cb => { this._rpc(defs.BasicCancel, Args.cancel(consumerTag), defs.BasicCancelOk, cb); }) - .then(ok => { - this.unregisterConsumer(consumerTag); - return ok.fields; - }); + + this.unregisterConsumer(consumerTag); + return ok.fields; } - get(queue, options) { + async get(queue, options) { const fields = Args.get(queue, options); - return Promise.fromCallback(cb => { - return this.sendOrEnqueue(defs.BasicGet, fields, cb); + const f = await Promise.fromCallback(cb => { + this.sendOrEnqueue(defs.BasicGet, fields, cb); }) - .then(f => { - if (f.id === defs.BasicGetEmpty) { - return false; - } - else if (f.id === defs.BasicGetOk) { - const fields = f.fields; - return new Promise(resolve => { - this.handleMessage = acceptMessage(m => { - m.fields = fields; - resolve(m); - }); + + if (f.id === defs.BasicGetEmpty) { + return false; + } + else if (f.id === defs.BasicGetOk) { + const fields = f.fields; + return new Promise(resolve => { + this.handleMessage = acceptMessage(m => { + m.fields = fields; + resolve(m); }); - } - else { - throw new Error(`Unexpected response to BasicGet: ${inspect(f)}`); - } - }); + }); + } + else { + throw new Error(`Unexpected response to BasicGet: ${inspect(f)}`); + } } ack(message, allUpTo) { @@ -246,6 +240,12 @@ class Channel extends BaseChannel { Args.recover(), defs.BasicRecoverOk); } + + qos(count, global) { + return this.rpc(defs.BasicQos, + Args.prefetch(count, global), + defs.BasicQosOk); + } } // There are more options in AMQP than exposed here; RabbitMQ only @@ -253,11 +253,7 @@ class Channel extends BaseChannel { // channels or consumers. RabbitMQ v3.3.0 and after treat prefetch // (without `global` set) as per-consumer (for consumers following), // and prefetch with `global` set as per-channel. -Channel.prototype.prefetch = Channel.prototype.qos = function(count, global) { - return this.rpc(defs.BasicQos, - Args.prefetch(count, global), - defs.BasicQosOk); -}; +Channel.prototype.prefetch = Channel.prototype.qos // Confirm channel. This is a channel with confirms 'switched on', // meaning sent messages will provoke a responding 'ack' or 'nack' @@ -280,8 +276,7 @@ class ConfirmChannel extends Channel { const awaiting = []; const unconfirmed = this.unconfirmed; unconfirmed.forEach((val, index) => { - if (val === null); // already confirmed - else { + if (val !== null) { const confirmed = new Promise((resolve, reject) => { unconfirmed[index] = err => { if (val) val(err); From 0d3ec995dad477d72ba670e06ce5521aa802a409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20Wa=CC=88rting?= Date: Wed, 7 Jul 2021 00:20:29 +0200 Subject: [PATCH 029/112] revert some failing test --- lib/channel_model.js | 55 +++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/lib/channel_model.js b/lib/channel_model.js index e13b1bdc..ea652e2f 100644 --- a/lib/channel_model.js +++ b/lib/channel_model.js @@ -158,16 +158,17 @@ class Channel extends BaseChannel { return this.publish('', queue, content, options); } - async consume(queue, callback, options) { + consume(queue, callback, options) { // NB we want the callback to be run synchronously, so that we've // registered the consumerTag before any messages can arrive. const fields = Args.consume(queue, options); - const ok = await Promise.fromCallback(cb => { + return Promise.fromCallback(cb => { this._rpc(defs.BasicConsume, fields, defs.BasicConsumeOk, cb); }) - - this.registerConsumer(ok.fields.consumerTag, callback); - return ok.fields; + .then(ok => { + this.registerConsumer(ok.fields.consumerTag, callback); + return ok.fields; + }); } async cancel(consumerTag) { @@ -176,32 +177,34 @@ class Channel extends BaseChannel { defs.BasicCancelOk, cb); }) - - this.unregisterConsumer(consumerTag); - return ok.fields; + .then(ok => { + this.unregisterConsumer(consumerTag); + return ok.fields; + }); } - async get(queue, options) { + get(queue, options) { const fields = Args.get(queue, options); - const f = await Promise.fromCallback(cb => { - this.sendOrEnqueue(defs.BasicGet, fields, cb); + return Promise.fromCallback(cb => { + return this.sendOrEnqueue(defs.BasicGet, fields, cb); }) - - if (f.id === defs.BasicGetEmpty) { - return false; - } - else if (f.id === defs.BasicGetOk) { - const fields = f.fields; - return new Promise(resolve => { - this.handleMessage = acceptMessage(m => { - m.fields = fields; - resolve(m); + .then(f => { + if (f.id === defs.BasicGetEmpty) { + return false; + } + else if (f.id === defs.BasicGetOk) { + const fields = f.fields; + return new Promise(resolve => { + this.handleMessage = acceptMessage(m => { + m.fields = fields; + resolve(m); + }); }); - }); - } - else { - throw new Error(`Unexpected response to BasicGet: ${inspect(f)}`); - } + } + else { + throw new Error(`Unexpected response to BasicGet: ${inspect(f)}`); + } + }); } ack(message, allUpTo) { From 99a9058ad119e9118aef1ca3b3c6053d25744e65 Mon Sep 17 00:00:00 2001 From: Mathias Lundell Date: Tue, 28 Dec 2021 14:34:30 +0100 Subject: [PATCH 030/112] Close connection to server on connect errors (#647) --- lib/connect.js | 6 +++++- test/connect.js | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/lib/connect.js b/lib/connect.js index 27a042ec..478dd76c 100644 --- a/lib/connect.js +++ b/lib/connect.js @@ -152,8 +152,12 @@ function connect(url, socketOptions, openCallback) { if (timeout) sock.setTimeout(0); if (err === null) { openCallback(null, c); + } else { + // The connection isn't closed by the server on e.g. wrong password + sock.end(); + sock.destroy(); + openCallback(err); } - else openCallback(err); }); } diff --git a/test/connect.js b/test/connect.js index aeba33e8..5a0b2613 100644 --- a/test/connect.js +++ b/test/connect.js @@ -2,10 +2,11 @@ var connect = require('../lib/connect').connect; var credentialsFromUrl = require('../lib/connect').credentialsFromUrl; +var defs = require('../lib/defs'); var assert = require('assert'); var util = require('./util'); var net = require('net'); -var fail = util.fail, succeed = util.succeed, +var fail = util.fail, succeed = util.succeed, latch = util.latch, kCallback = util.kCallback, succeedIfAttributeEquals = util.succeedIfAttributeEquals; var format = require('util').format; @@ -147,5 +148,50 @@ suite("Connect API", function() { else done(); }); }); +}); +suite('Errors on connect', function() { + var server + afterEach(function() { + if (server) { + server.close(); + } + }) + + test("closes underlying connection on authentication error", function(done) { + var bothDone = latch(2, done); + server = net.createServer(function(socket) { + socket.once('data', function(protocolHeader) { + assert.deepStrictEqual( + protocolHeader, + Buffer.from("AMQP" + String.fromCharCode(0,0,9,1)) + ); + util.runServer(socket, function(send, wait) { + send(defs.ConnectionStart, + {versionMajor: 0, + versionMinor: 9, + serverProperties: {}, + mechanisms: Buffer.from('PLAIN'), + locales: Buffer.from('en_US')}); + wait(defs.ConnectionStartOk)().then(function() { + send(defs.ConnectionClose, + {replyCode: 403, + replyText: 'ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN', + classId: 0, + methodId: 0}); + }); + }); + }); + + // Wait for the connection to be closed after the authentication error + socket.once('end', function() { + bothDone(); + }); + }).listen(0); + + connect('amqp://localhost:' + server.address().port, {}, function(err) { + if (!err) bothDone(new Error('Expected authentication error')); + bothDone(); + }); + }); }); From 11d4706ffdfb3f2b7e5d5f9b4b788a79f6e70cb0 Mon Sep 17 00:00:00 2001 From: Mathias Lundell Date: Tue, 28 Dec 2021 18:08:04 +0100 Subject: [PATCH 031/112] fix: done called twice on invalid options (#667) --- lib/connection.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/connection.js b/lib/connection.js index 5f3bed3a..22a73332 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -178,8 +178,7 @@ C.open = function(allFields, openCallback0) { function send(Method) { // This can throw an exception if there's some problem with the // options; e.g., something is a string instead of a number. - try { self.sendMethod(0, Method, tunedOptions); } - catch (err) { bail(err); } + self.sendMethod(0, Method, tunedOptions); } function negotiate(server, desired) { @@ -205,7 +204,12 @@ C.open = function(allFields, openCallback0) { return; } self.serverProperties = start.fields.serverProperties; - send(defs.ConnectionStartOk); + try { + send(defs.ConnectionStartOk); + } catch (err) { + bail(err); + return; + } wait(afterStartOk); } @@ -227,8 +231,13 @@ C.open = function(allFields, openCallback0) { negotiate(fields.channelMax, allFields.channelMax); tunedOptions.heartbeat = negotiate(fields.heartbeat, allFields.heartbeat); - send(defs.ConnectionTuneOk); - send(defs.ConnectionOpen); + try { + send(defs.ConnectionTuneOk); + send(defs.ConnectionOpen); + } catch (err) { + bail(err); + return; + } expect(defs.ConnectionOpenOk, onOpenOk); break; default: From eb93c8a524ea3eacd907b4a5b26b7aba4e3cbe15 Mon Sep 17 00:00:00 2001 From: Suhail-n <20075736+suhail-n@users.noreply.github.com> Date: Sun, 20 Mar 2022 14:45:54 -0400 Subject: [PATCH 032/112] =?UTF-8?q?chore:=20:lock:=20amqplib=20will=20use?= =?UTF-8?q?=20the=20security=20patched=20version=20of=20urlpar=E2=80=A6=20?= =?UTF-8?q?(#675)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yml | 39 +++++++++++++++++++------------------- package-lock.json | 14 +++++++------- package.json | 5 ++--- 3 files changed, 28 insertions(+), 30 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3e02c0b7..717d5bb3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,14 +5,18 @@ name: Node.js CI on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: build: - runs-on: ubuntu-latest + services: + rabbitmq: + image: rabbitmq + ports: + - 5672:5672 strategy: matrix: @@ -20,20 +24,15 @@ jobs: # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - # Install all prerequisites - - run: npm ci - - # Need RabbitMQ to test against - - name: Install rabbitmq - run: | - sudo apt-get install rabbitmq-server -y --fix-missing - - # Run the tests - - run: make test + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + cache: "npm" + + # Install all prerequisites + - run: npm ci + + # Run the tests + - run: make test diff --git a/package-lock.json b/package-lock.json index 480a870f..ecf991ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "bluebird": "^3.7.2", "buffer-more-ints": "~1.0.0", "readable-stream": "1.x >=1.1.9", - "url-parse": "~1.5.3" + "url-parse": "~1.5.10" }, "devDependencies": { "claire": "0.4.1", @@ -731,9 +731,9 @@ "optional": true }, "node_modules/url-parse": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.3.tgz", - "integrity": "sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==", + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", "dependencies": { "querystringify": "^2.1.1", "requires-port": "^1.0.0" @@ -1280,9 +1280,9 @@ "optional": true }, "url-parse": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.3.tgz", - "integrity": "sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==", + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", "requires": { "querystringify": "^2.1.1", "requires-port": "^1.0.0" diff --git a/package.json b/package.json index 92607b54..41d517b9 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,3 @@ - { "name": "amqplib", "homepage": "http://squaremo.github.io/amqp.node/", @@ -17,7 +16,7 @@ "bluebird": "^3.7.2", "buffer-more-ints": "~1.0.0", "readable-stream": "1.x >=1.1.9", - "url-parse": "~1.5.3" + "url-parse": "~1.5.10" }, "devDependencies": { "claire": "0.4.1", @@ -36,4 +35,4 @@ ], "author": "Michael Bridgen ", "license": "MIT" -} +} \ No newline at end of file From e2dc08f19c57a849800bfbf07c5a1e5ae759bc6d Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Wed, 4 May 2022 22:45:03 +0100 Subject: [PATCH 033/112] Update README.md --- examples/tutorials/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/tutorials/README.md b/examples/tutorials/README.md index 333fda3f..8237cc33 100644 --- a/examples/tutorials/README.md +++ b/examples/tutorials/README.md @@ -85,9 +85,9 @@ some needless object-orientation (in the Python code; you don't get a choice about needless object-orientation in Java). [rabbitmq-tutes]: http://github.com/rabbitmq/rabbitmq-tutorials -[tute-one]: http://www.rabbitmq.com/tutorials/tutorial-one-python.html -[tute-two]: http://www.rabbitmq.com/tutorials/tutorial-two-python.html -[tute-three]: http://www.rabbitmq.com/tutorials/tutorial-three-python.html -[tute-four]: http://www.rabbitmq.com/tutorials/tutorial-four-python.html -[tute-five]: http://www.rabbitmq.com/tutorials/tutorial-five-python.html -[tute-six]: http://www.rabbitmq.com/tutorials/tutorial-six-python.html +[tute-one]: http://www.rabbitmq.com/tutorials/tutorial-one-javascript.html +[tute-two]: http://www.rabbitmq.com/tutorials/tutorial-two-javascript.html +[tute-three]: http://www.rabbitmq.com/tutorials/tutorial-three-javascript.html +[tute-four]: http://www.rabbitmq.com/tutorials/tutorial-four-javascript.html +[tute-five]: http://www.rabbitmq.com/tutorials/tutorial-five-javascript.html +[tute-six]: http://www.rabbitmq.com/tutorials/tutorial-six-javascript.html From 6f9cd7f1695b08a8a4db8f7249df44ecfe298522 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Thu, 5 May 2022 20:51:45 +0100 Subject: [PATCH 034/112] Replace the deprecated istanbul with nyc --- .gitignore | 1 + Makefile | 7 +- package-lock.json | 2192 ++++++++++++++++++++++++++++----------------- package.json | 4 +- 4 files changed, 1358 insertions(+), 846 deletions(-) diff --git a/.gitignore b/.gitignore index 17a06292..266a9a78 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ bin/amqp-rabbitmq-0.9.1.json etc/ coverage/ /.idea/ +.nyc_output/ \ No newline at end of file diff --git a/Makefile b/Makefile index e1393322..b63de0f6 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ NODEJS_VERSIONS='10.21' '11.15' '12.18' '13.14' '14.5' '15.8' MOCHA=./node_modules/.bin/mocha _MOCHA=./node_modules/.bin/_mocha UGLIFY=./node_modules/.bin/uglifyjs -ISTANBUL=./node_modules/.bin/istanbul +NYC=./node_modules/.bin/nyc .PHONY: test test-all-nodejs all clean coverage @@ -33,9 +33,8 @@ test-all-nodejs: lib/defs.js nave use $$v $(MOCHA) -u tdd -R progress test; \ done -coverage: $(ISTANBUL) lib/defs.js - $(ISTANBUL) cover $(_MOCHA) -- -u tdd -R progress test/ - $(ISTANBUL) report +coverage: $(NYC) lib/defs.js + $(NYC) --reporter=lcov --reporter=text $(_MOCHA) -u tdd -R progress test/ @echo "HTML report at file://$$(pwd)/coverage/lcov-report/index.html" bin/amqp-rabbitmq-0.9.1.json: diff --git a/package-lock.json b/package-lock.json index ecf991ad..834f540f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,791 +1,343 @@ { "name": "amqplib", "version": "0.8.0", - "lockfileVersion": 2, + "lockfileVersion": 1, "requires": true, - "packages": { - "": { - "name": "amqplib", - "version": "0.8.0", - "license": "MIT", - "dependencies": { - "bitsyntax": "~0.1.0", - "bluebird": "^3.7.2", - "buffer-more-ints": "~1.0.0", - "readable-stream": "1.x >=1.1.9", - "url-parse": "~1.5.10" - }, - "devDependencies": { - "claire": "0.4.1", - "istanbul": "0.1.x", - "mocha": "^3.5.3", - "uglify-js": "2.8.x" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/abbrev": { - "version": "1.0.9", - "dev": true, - "license": "ISC" - }, - "node_modules/align-text": { - "version": "0.1.4", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^3.0.2", - "longest": "^1.0.1", - "repeat-string": "^1.5.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/amdefine": { - "version": "1.0.1", - "dev": true, - "license": "BSD-3-Clause OR MIT", - "engines": { - "node": ">=0.4.2" - } - }, - "node_modules/async": { - "version": "0.2.10", - "dev": true - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "dev": true, - "license": "MIT" - }, - "node_modules/bitsyntax": { - "version": "0.1.0", - "license": "MIT", - "dependencies": { - "buffer-more-ints": "~1.0.0", - "debug": "~2.6.9", - "safe-buffer": "~5.1.2" - }, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/bitsyntax/node_modules/safe-buffer": { - "version": "5.1.2", - "license": "MIT" - }, - "node_modules/bluebird": { - "version": "3.7.2", - "license": "MIT" - }, - "node_modules/boo": { - "version": "1.2.4", - "dev": true - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/browser-stdout": { - "version": "1.3.0", - "dev": true, - "license": "ISC" - }, - "node_modules/buffer-more-ints": { - "version": "1.0.0", - "license": "MIT" - }, - "node_modules/camelcase": { - "version": "1.2.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/center-align": { - "version": "0.1.3", - "dev": true, - "license": "MIT", - "dependencies": { - "align-text": "^0.1.3", - "lazy-cache": "^1.0.3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/claire": { - "version": "0.4.1", - "dev": true, - "license": "MIT", - "dependencies": { - "boo": "~1.2.4", - "flaw": "~0.1.0", - "prelude-ls": "~0.6.0" - } - }, - "node_modules/cliui": { - "version": "2.1.0", - "dev": true, - "license": "ISC", - "dependencies": { - "center-align": "^0.1.1", - "right-align": "^0.1.1", - "wordwrap": "0.0.2" - } - }, - "node_modules/cliui/node_modules/wordwrap": { - "version": "0.0.2", - "dev": true, - "license": "MIT/X11", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/commander": { - "version": "2.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-readlink": ">= 1.0.0" - }, - "engines": { - "node": ">= 0.6.x" - } - }, - "node_modules/concat-map": { - "version": "0.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/core-util-is": { - "version": "1.0.2", - "license": "MIT" - }, - "node_modules/debug": { - "version": "2.6.9", - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/decamelize": { - "version": "1.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/diff": { - "version": "3.2.0", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/escodegen": { - "version": "0.0.23", - "dev": true, - "dependencies": { - "esprima": "~1.0.2", - "estraverse": "~0.0.4" - }, - "bin": { - "escodegen": "bin/escodegen.js", - "esgenerate": "bin/esgenerate.js" - }, - "engines": { - "node": ">=0.4.0" - }, - "optionalDependencies": { - "source-map": ">= 0.1.2" - } - }, - "node_modules/esprima": { - "version": "1.0.4", - "dev": true, - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/estraverse": { - "version": "0.0.4", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/fileset": { - "version": "0.1.8", - "dev": true, - "dependencies": { - "glob": "3.x", - "minimatch": "0.x" - } - }, - "node_modules/flaw": { - "version": "0.1.0", - "dev": true, - "license": "MIT" - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/glob": { - "version": "3.2.11", - "dev": true, - "license": "BSD", - "dependencies": { - "inherits": "2", - "minimatch": "0.3" - }, - "engines": { - "node": "*" - } - }, - "node_modules/glob/node_modules/minimatch": { - "version": "0.3.0", - "deprecated": "Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue", - "dev": true, - "license": "MIT", - "dependencies": { - "lru-cache": "2", - "sigmund": "~1.0.0" - }, - "engines": { - "node": "*" - } - }, - "node_modules/graceful-readlink": { - "version": "1.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/growl": { - "version": "1.9.2", - "dev": true, - "license": "MIT" - }, - "node_modules/handlebars": { - "version": "1.0.12", - "dev": true, - "dependencies": { - "optimist": "~0.3", - "uglify-js": "~2.3" - }, - "bin": { - "handlebars": "bin/handlebars" - }, - "engines": { - "node": ">=0.4.7" - } - }, - "node_modules/handlebars/node_modules/source-map": { - "version": "0.1.43", - "dev": true, - "dependencies": { - "amdefine": ">=0.0.4" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/handlebars/node_modules/uglify-js": { - "version": "2.3.6", - "dev": true, - "dependencies": { - "async": "~0.2.6", - "optimist": "~0.3.5", - "source-map": "~0.1.7" - }, - "bin": { - "uglifyjs": "bin/uglifyjs" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/has-flag": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/he": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "bin": { - "he": "bin/he" - } - }, - "node_modules/inflight": { - "version": "1.0.6", + "dependencies": { + "@ampproject/remapping": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", + "integrity": "sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==", "dev": true, - "license": "ISC", - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" + "requires": { + "@jridgewell/gen-mapping": "^0.1.0", + "@jridgewell/trace-mapping": "^0.3.9" } }, - "node_modules/inherits": { - "version": "2.0.4", - "license": "ISC" - }, - "node_modules/is-buffer": { - "version": "1.1.6", + "@babel/code-frame": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", "dev": true, - "license": "MIT" - }, - "node_modules/isarray": { - "version": "0.0.1", - "license": "MIT" - }, - "node_modules/istanbul": { - "version": "0.1.46", - "deprecated": "This module is no longer maintained, try this instead:\n npm i nyc\nVisit https://istanbul.js.org/integrations for other alternatives.", - "dev": true, - "dependencies": { - "abbrev": "1.0.x", - "async": "0.2.x", - "escodegen": "0.0.23", - "esprima": "1.0.x", - "fileset": "0.1.x", - "handlebars": "1.0.x", - "mkdirp": "0.3.x", - "nopt": "2.1.x", - "resolve": "0.5.x", - "which": "1.0.x", - "wordwrap": "0.0.x" - }, - "bin": { - "istanbul": "lib/cli.js" + "requires": { + "@babel/highlight": "^7.16.7" } }, - "node_modules/json3": { - "version": "3.3.2", - "deprecated": "Please use the native JSON object instead of JSON 3", + "@babel/compat-data": { + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.17.10.tgz", + "integrity": "sha512-GZt/TCsG70Ms19gfZO1tM4CVnXsPgEPBCpJu+Qz3L0LUDsY5nZqFZglIoPC1kIYOtNBZlrnFT+klg12vFGZXrw==", "dev": true }, - "node_modules/kind-of": { - "version": "3.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/lazy-cache": { - "version": "1.0.4", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/lodash._baseassign": { - "version": "3.2.0", + "@babel/core": { + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.17.10.tgz", + "integrity": "sha512-liKoppandF3ZcBnIYFjfSDHZLKdLHGJRkoWtG8zQyGJBQfIYobpnVGI5+pLBNtS6psFLDzyq8+h5HiVljW9PNA==", "dev": true, - "license": "MIT", - "dependencies": { - "lodash._basecopy": "^3.0.0", - "lodash.keys": "^3.0.0" - } - }, - "node_modules/lodash._basecopy": { - "version": "3.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash._basecreate": { - "version": "3.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash._getnative": { - "version": "3.9.1", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash._isiterateecall": { - "version": "3.0.9", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash.create": { - "version": "3.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "lodash._baseassign": "^3.0.0", - "lodash._basecreate": "^3.0.0", - "lodash._isiterateecall": "^3.0.0" - } - }, - "node_modules/lodash.isarguments": { - "version": "3.1.0", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash.isarray": { - "version": "3.0.4", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash.keys": { - "version": "3.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "lodash._getnative": "^3.0.0", - "lodash.isarguments": "^3.0.0", - "lodash.isarray": "^3.0.0" - } - }, - "node_modules/longest": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/lru-cache": { - "version": "2.7.3", - "dev": true, - "license": "ISC" - }, - "node_modules/minimatch": { - "version": "0.4.0", - "deprecated": "Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue", - "dev": true, - "license": "MIT", - "dependencies": { - "lru-cache": "2", - "sigmund": "~1.0.0" - }, - "engines": { - "node": "*" - } - }, - "node_modules/minimist": { - "version": "0.0.8", - "dev": true, - "license": "MIT" - }, - "node_modules/mkdirp": { - "version": "0.3.5", - "deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)", - "dev": true, - "license": "MIT" - }, - "node_modules/mocha": { - "version": "3.5.3", - "dev": true, - "license": "MIT", - "dependencies": { - "browser-stdout": "1.3.0", - "commander": "2.9.0", - "debug": "2.6.8", - "diff": "3.2.0", - "escape-string-regexp": "1.0.5", - "glob": "7.1.1", - "growl": "1.9.2", - "he": "1.1.1", - "json3": "3.3.2", - "lodash.create": "3.1.1", - "mkdirp": "0.5.1", - "supports-color": "3.1.2" - }, - "bin": { - "_mocha": "bin/_mocha", - "mocha": "bin/mocha" - }, - "engines": { - "node": ">= 0.10.x", - "npm": ">= 1.4.x" - } - }, - "node_modules/mocha/node_modules/debug": { - "version": "2.6.8", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/mocha/node_modules/glob": { - "version": "7.1.1", - "dev": true, - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.2", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - } - }, - "node_modules/mocha/node_modules/minimatch": { - "version": "3.0.4", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" + "requires": { + "@ampproject/remapping": "^2.1.0", + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.17.10", + "@babel/helper-compilation-targets": "^7.17.10", + "@babel/helper-module-transforms": "^7.17.7", + "@babel/helpers": "^7.17.9", + "@babel/parser": "^7.17.10", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.17.10", + "@babel/types": "^7.17.10", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.1", + "semver": "^6.3.0" }, - "engines": { - "node": "*" - } - }, - "node_modules/mocha/node_modules/mkdirp": { - "version": "0.5.1", - "dev": true, - "license": "MIT", "dependencies": { - "minimist": "0.0.8" - }, - "bin": { - "mkdirp": "bin/cmd.js" + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } }, - "node_modules/ms": { - "version": "2.0.0", - "license": "MIT" - }, - "node_modules/nopt": { - "version": "2.1.2", + "@babel/generator": { + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.17.10.tgz", + "integrity": "sha512-46MJZZo9y3o4kmhBVc7zW7i8dtR1oIK/sdO5NcfcZRhTGYi+KKJRtHNgsU6c4VUcJmUNV/LQdebD/9Dlv4K+Tg==", "dev": true, - "license": "MIT", - "dependencies": { - "abbrev": "1" - }, - "bin": { - "nopt": "bin/nopt.js" + "requires": { + "@babel/types": "^7.17.10", + "@jridgewell/gen-mapping": "^0.1.0", + "jsesc": "^2.5.1" } }, - "node_modules/once": { - "version": "1.4.0", + "@babel/helper-compilation-targets": { + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.17.10.tgz", + "integrity": "sha512-gh3RxjWbauw/dFiU/7whjd0qN9K6nPJMqe6+Er7rOavFh0CQUSwhAE3IcTho2rywPJFxej6TUUHDkWcYI6gGqQ==", "dev": true, - "license": "ISC", - "dependencies": { - "wrappy": "1" + "requires": { + "@babel/compat-data": "^7.17.10", + "@babel/helper-validator-option": "^7.16.7", + "browserslist": "^4.20.2", + "semver": "^6.3.0" } }, - "node_modules/optimist": { - "version": "0.3.7", + "@babel/helper-environment-visitor": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.7.tgz", + "integrity": "sha512-SLLb0AAn6PkUeAfKJCCOl9e1R53pQlGAfc4y4XuMRZfqeMYLE0dM1LMhqbGAlGQY0lfw5/ohoYWAe9V1yibRag==", "dev": true, - "license": "MIT/X11", - "dependencies": { - "wordwrap": "~0.0.2" + "requires": { + "@babel/types": "^7.16.7" } }, - "node_modules/path-is-absolute": { - "version": "1.0.1", + "@babel/helper-function-name": { + "version": "7.17.9", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.17.9.tgz", + "integrity": "sha512-7cRisGlVtiVqZ0MW0/yFB4atgpGLWEHUVYnb448hZK4x+vih0YO5UoS11XIYtZYqHd0dIPMdUSv8q5K4LdMnIg==", "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" + "requires": { + "@babel/template": "^7.16.7", + "@babel/types": "^7.17.0" } }, - "node_modules/prelude-ls": { - "version": "0.6.0", + "@babel/helper-hoist-variables": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz", + "integrity": "sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg==", "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/querystringify": { - "version": "2.2.0", - "license": "MIT" - }, - "node_modules/readable-stream": { - "version": "1.1.14", - "license": "MIT", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" + "requires": { + "@babel/types": "^7.16.7" } }, - "node_modules/repeat-string": { - "version": "1.6.1", + "@babel/helper-module-imports": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz", + "integrity": "sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg==", "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10" + "requires": { + "@babel/types": "^7.16.7" } - }, - "node_modules/requires-port": { - "version": "1.0.0", - "license": "MIT" - }, - "node_modules/resolve": { - "version": "0.5.1", - "dev": true, - "license": "MIT" - }, - "node_modules/right-align": { - "version": "0.1.3", - "dev": true, - "license": "MIT", - "dependencies": { - "align-text": "^0.1.1" - }, - "engines": { - "node": ">=0.10.0" + }, + "@babel/helper-module-transforms": { + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.17.7.tgz", + "integrity": "sha512-VmZD99F3gNTYB7fJRDTi+u6l/zxY0BE6OIxPSU7a50s6ZUQkHwSDmV92FfM+oCG0pZRVojGYhkR8I0OGeCVREw==", + "dev": true, + "requires": { + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-module-imports": "^7.16.7", + "@babel/helper-simple-access": "^7.17.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/helper-validator-identifier": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.17.3", + "@babel/types": "^7.17.0" } }, - "node_modules/sigmund": { - "version": "1.0.1", + "@babel/helper-simple-access": { + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.17.7.tgz", + "integrity": "sha512-txyMCGroZ96i+Pxr3Je3lzEJjqwaRC9buMUgtomcrLe5Nd0+fk1h0LLA+ixUF5OW7AhHuQ7Es1WcQJZmZsz2XA==", "dev": true, - "license": "ISC" + "requires": { + "@babel/types": "^7.17.0" + } }, - "node_modules/source-map": { - "version": "0.7.3", + "@babel/helper-split-export-declaration": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz", + "integrity": "sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw==", "dev": true, - "license": "BSD-3-Clause", - "optional": true, - "engines": { - "node": ">= 8" + "requires": { + "@babel/types": "^7.16.7" } }, - "node_modules/string_decoder": { - "version": "0.10.31", - "license": "MIT" + "@babel/helper-validator-identifier": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", + "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", + "dev": true }, - "node_modules/supports-color": { - "version": "3.1.2", + "@babel/helper-validator-option": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz", + "integrity": "sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ==", + "dev": true + }, + "@babel/helpers": { + "version": "7.17.9", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.17.9.tgz", + "integrity": "sha512-cPCt915ShDWUEzEp3+UNRktO2n6v49l5RSnG9M5pS24hA+2FAc5si+Pn1i4VVbQQ+jh+bIZhPFQOJOzbrOYY1Q==", "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^1.0.0" - }, - "engines": { - "node": ">=0.8.0" + "requires": { + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.17.9", + "@babel/types": "^7.17.0" } }, - "node_modules/uglify-js": { - "version": "2.8.29", + "@babel/highlight": { + "version": "7.17.9", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.17.9.tgz", + "integrity": "sha512-J9PfEKCbFIv2X5bjTMiZu6Vf341N05QIY+d6FvVKynkG1S7G0j3I0QoRtWIrXhZ+/Nlb5Q0MzqL7TokEJ5BNHg==", "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "source-map": "~0.5.1", - "yargs": "~3.10.0" - }, - "bin": { - "uglifyjs": "bin/uglifyjs" - }, - "engines": { - "node": ">=0.8.0" - }, - "optionalDependencies": { - "uglify-to-browserify": "~1.0.0" + "requires": { + "@babel/helper-validator-identifier": "^7.16.7", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" } }, - "node_modules/uglify-js/node_modules/source-map": { - "version": "0.5.7", + "@babel/parser": { + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.17.10.tgz", + "integrity": "sha512-n2Q6i+fnJqzOaq2VkdXxy2TCPCWQZHiCo0XqmrCvDWcZQKRyZzYi4Z0yxlBuN0w+r2ZHmre+Q087DSrw3pbJDQ==", + "dev": true + }, + "@babel/template": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.7.tgz", + "integrity": "sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w==", "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" + "requires": { + "@babel/code-frame": "^7.16.7", + "@babel/parser": "^7.16.7", + "@babel/types": "^7.16.7" } }, - "node_modules/uglify-to-browserify": { - "version": "1.0.2", + "@babel/traverse": { + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.17.10.tgz", + "integrity": "sha512-VmbrTHQteIdUUQNTb+zE12SHS/xQVIShmBPhlNP12hD5poF2pbITW1Z4172d03HegaQWhLffdkRJYtAzp0AGcw==", "dev": true, - "license": "MIT", - "optional": true - }, - "node_modules/url-parse": { - "version": "1.5.10", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", - "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "requires": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.17.10", + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-function-name": "^7.17.9", + "@babel/helper-hoist-variables": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/parser": "^7.17.10", + "@babel/types": "^7.17.10", + "debug": "^4.1.0", + "globals": "^11.1.0" + }, "dependencies": { - "querystringify": "^2.1.1", - "requires-port": "^1.0.0" + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } }, - "node_modules/which": { - "version": "1.0.9", + "@babel/types": { + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.17.10.tgz", + "integrity": "sha512-9O26jG0mBYfGkUYCYZRnBwbVLd1UZOICEr2Em6InB6jVfsAv1GKgwXHmrSg+WFWDmeKTA6vyTZiN8tCSM5Oo3A==", "dev": true, - "license": "ISC", - "bin": { - "which": "bin/which" + "requires": { + "@babel/helper-validator-identifier": "^7.16.7", + "to-fast-properties": "^2.0.0" } }, - "node_modules/window-size": { - "version": "0.1.0", + "@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", "dev": true, - "engines": { - "node": ">= 0.8.0" + "requires": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "dependencies": { + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + } } }, - "node_modules/wordwrap": { - "version": "0.0.3", + "@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true + }, + "@jridgewell/gen-mapping": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz", + "integrity": "sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==", "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.4.0" + "requires": { + "@jridgewell/set-array": "^1.0.0", + "@jridgewell/sourcemap-codec": "^1.4.10" } }, - "node_modules/wrappy": { - "version": "1.0.2", + "@jridgewell/resolve-uri": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.6.tgz", + "integrity": "sha512-R7xHtBSNm+9SyvpJkdQl+qrM3Hm2fea3Ef197M3mUug+v+yR+Rhfbs7PBtcBUVnIWJ4JcAdjvij+c8hXS9p5aw==", + "dev": true + }, + "@jridgewell/set-array": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.0.tgz", + "integrity": "sha512-SfJxIxNVYLTsKwzB3MoOQ1yxf4w/E6MdkvTgrgAt1bfxjSrLUoHMKrDOykwN14q65waezZIdqDneUIPh4/sKxg==", + "dev": true + }, + "@jridgewell/sourcemap-codec": { + "version": "1.4.12", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.12.tgz", + "integrity": "sha512-az/NhpIwP3K33ILr0T2bso+k2E/SLf8Yidd8mHl0n6sCQ4YdyC8qDhZA6kOPDNDBA56ZnIjngVl0U3jREA0BUA==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", "dev": true, - "license": "ISC" + "requires": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } }, - "node_modules/yargs": { - "version": "3.10.0", + "aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", "dev": true, - "license": "MIT", - "dependencies": { - "camelcase": "^1.0.2", - "cliui": "^2.1.0", - "decamelize": "^1.0.0", - "window-size": "0.1.0" + "requires": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" } - } - }, - "dependencies": { - "abbrev": { - "version": "1.0.9", - "dev": true }, "align-text": { "version": "0.1.4", + "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", + "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", "dev": true, "requires": { "kind-of": "^3.0.2", @@ -793,20 +345,55 @@ "repeat-string": "^1.5.2" } }, - "amdefine": { - "version": "1.0.1", + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true }, - "async": { - "version": "0.2.10", + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "append-transform": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-2.0.0.tgz", + "integrity": "sha512-7yeyCEurROLQJFv5Xj4lEGTy0borxepjFv1g22oAdqFu//SrAlDl1O1Nxx15SH1RoliUml6p8dwJW9jvZughhg==", + "dev": true, + "requires": { + "default-require-extensions": "^3.0.0" + } + }, + "archy": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", + "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=", "dev": true }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, "balanced-match": { "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, "bitsyntax": { "version": "0.1.0", + "resolved": "https://registry.npmjs.org/bitsyntax/-/bitsyntax-0.1.0.tgz", + "integrity": "sha512-ikAdCnrloKmFOugAfxWws89/fPc+nw0OOG1IzIE72uSOg/A3cYptKCjSUhDTuj7fhsJtzkzlv7l3b8PzRHLN0Q==", "requires": { "buffer-more-ints": "~1.0.0", "debug": "~2.6.9", @@ -814,19 +401,27 @@ }, "dependencies": { "safe-buffer": { - "version": "5.1.2" + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" } } }, "bluebird": { - "version": "3.7.2" + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" }, "boo": { "version": "1.2.4", + "resolved": "https://registry.npmjs.org/boo/-/boo-1.2.4.tgz", + "integrity": "sha1-szMxw2xK552C9P0ORJBgTLfFE7U=", "dev": true }, "brace-expansion": { "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { "balanced-match": "^1.0.0", @@ -835,25 +430,94 @@ }, "browser-stdout": { "version": "1.3.0", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", + "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", "dev": true }, + "browserslist": { + "version": "4.20.3", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.20.3.tgz", + "integrity": "sha512-NBhymBQl1zM0Y5dQT/O+xiLP9/rzOIQdKM/eMJBAq7yBgaB6krIYLGejrwVYnSHZdqjscB1SPuAjHwxjvN6Wdg==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001332", + "electron-to-chromium": "^1.4.118", + "escalade": "^3.1.1", + "node-releases": "^2.0.3", + "picocolors": "^1.0.0" + } + }, "buffer-more-ints": { - "version": "1.0.0" + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-more-ints/-/buffer-more-ints-1.0.0.tgz", + "integrity": "sha512-EMetuGFz5SLsT0QTnXzINh4Ksr+oo4i+UGTXEshiGCQWnsgSs7ZhJ8fzlwQ+OzEMs0MpDAMr1hxnblp5a4vcHg==" + }, + "caching-transform": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz", + "integrity": "sha512-kpqOvwXnjjN44D89K5ccQC+RUrsy7jB/XLlRrx0D7/2HNcTPqzsb6XgYoErwko6QsV184CA2YgS1fxDiiDZMWA==", + "dev": true, + "requires": { + "hasha": "^5.0.0", + "make-dir": "^3.0.0", + "package-hash": "^4.0.0", + "write-file-atomic": "^3.0.0" + } }, "camelcase": { "version": "1.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "dev": true + }, + "caniuse-lite": { + "version": "1.0.30001336", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001336.tgz", + "integrity": "sha512-/YxSlBmL7iKXTbIJ48IQTnAOBk7XmWsxhBF1PZLOko5Dt9qc4Pl+84lfqG3Tc4EuavurRn1QLoVJGxY2iSycfw==", "dev": true }, "center-align": { "version": "0.1.3", + "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", + "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", "dev": true, "requires": { "align-text": "^0.1.3", "lazy-cache": "^1.0.3" } }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "claire": { "version": "0.4.1", + "resolved": "https://registry.npmjs.org/claire/-/claire-0.4.1.tgz", + "integrity": "sha1-ynDcEmHd2PJaGvq604BcOfziY7w=", "dev": true, "requires": { "boo": "~1.2.4", @@ -861,8 +525,16 @@ "prelude-ls": "~0.6.0" } }, + "clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true + }, "cliui": { "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", + "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", "dev": true, "requires": { "center-align": "^0.1.1", @@ -872,176 +544,490 @@ "dependencies": { "wordwrap": { "version": "0.0.2", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", "dev": true } } }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, "commander": { "version": "2.9.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", + "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", "dev": true, "requires": { "graceful-readlink": ">= 1.0.0" } }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, "concat-map": { "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, + "convert-source-map": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", + "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.1" + } + }, "core-util-is": { - "version": "1.0.2" + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "dependencies": { + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } }, "debug": { "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "requires": { "ms": "2.0.0" } }, "decamelize": { "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "dev": true }, + "default-require-extensions": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-3.0.0.tgz", + "integrity": "sha512-ek6DpXq/SCpvjhpFsLFRVtIxJCRw6fUR42lYMVZuUMK7n8eMz4Uh5clckdBjEpLhn/gEBZo7hDJnJcwdKLKQjg==", + "dev": true, + "requires": { + "strip-bom": "^4.0.0" + } + }, "diff": { "version": "3.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", + "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", + "dev": true + }, + "electron-to-chromium": { + "version": "1.4.134", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.134.tgz", + "integrity": "sha512-OdD7M2no4Mi8PopfvoOuNcwYDJ2mNFxaBfurA6okG3fLBaMcFah9S+si84FhX+FIWLKkdaiHfl4A+5ep/gOVrg==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "es6-error": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", + "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", + "dev": true + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", "dev": true }, "escape-string-regexp": { "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, - "escodegen": { - "version": "0.0.23", + "find-cache-dir": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", + "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", "dev": true, "requires": { - "esprima": "~1.0.2", - "estraverse": "~0.0.4", - "source-map": ">= 0.1.2" + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" } }, - "esprima": { - "version": "1.0.4", - "dev": true + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } }, - "estraverse": { - "version": "0.0.4", + "flaw": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/flaw/-/flaw-0.1.0.tgz", + "integrity": "sha1-wMPo+BYWdTh+2tofbOhNZ5sCUn8=", "dev": true }, - "fileset": { - "version": "0.1.8", + "foreground-child": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", + "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", "dev": true, "requires": { - "glob": "3.x", - "minimatch": "0.x" + "cross-spawn": "^7.0.0", + "signal-exit": "^3.0.2" } }, - "flaw": { - "version": "0.1.0", + "fromentries": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fromentries/-/fromentries-1.3.2.tgz", + "integrity": "sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg==", "dev": true }, "fs.realpath": { "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, - "glob": { - "version": "3.2.11", - "dev": true, - "requires": { - "inherits": "2", - "minimatch": "0.3" - }, - "dependencies": { - "minimatch": { - "version": "0.3.0", - "dev": true, - "requires": { - "lru-cache": "2", - "sigmund": "~1.0.0" - } - } - } + "gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true + }, + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true + }, + "graceful-fs": { + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", + "dev": true }, "graceful-readlink": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", + "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", "dev": true }, "growl": { "version": "1.9.2", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", + "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", + "dev": true + }, + "has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true + }, + "hasha": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.2.tgz", + "integrity": "sha512-Hrp5vIK/xr5SkeN2onO32H0MgNZ0f17HRNH39WfL0SYUNOTZ5Lz1TJ8Pajo/87dYGEFlLMm7mIc/k/s6Bvz9HQ==", + "dev": true, + "requires": { + "is-stream": "^2.0.0", + "type-fest": "^0.8.0" + } + }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true + }, + "html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "istanbul-lib-coverage": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", + "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", "dev": true }, - "handlebars": { - "version": "1.0.12", + "istanbul-lib-hook": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-3.0.0.tgz", + "integrity": "sha512-Pt/uge1Q9s+5VAZ+pCo16TYMWPBIl+oaNIjgLQxcX0itS6ueeaA+pEfThZpH8WxhFgCiEb8sAJY6MdUKgiIWaQ==", + "dev": true, + "requires": { + "append-transform": "^2.0.0" + } + }, + "istanbul-lib-instrument": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz", + "integrity": "sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ==", + "dev": true, + "requires": { + "@babel/core": "^7.7.5", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.0.0", + "semver": "^6.3.0" + } + }, + "istanbul-lib-processinfo": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-processinfo/-/istanbul-lib-processinfo-2.0.2.tgz", + "integrity": "sha512-kOwpa7z9hme+IBPZMzQ5vdQj8srYgAtaRqeI48NGmAQ+/5yKiHLV0QbYqQpxsdEF0+w14SoB8YbnHKcXE2KnYw==", + "dev": true, + "requires": { + "archy": "^1.0.0", + "cross-spawn": "^7.0.0", + "istanbul-lib-coverage": "^3.0.0-alpha.1", + "make-dir": "^3.0.0", + "p-map": "^3.0.0", + "rimraf": "^3.0.0", + "uuid": "^3.3.3" + } + }, + "istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "dev": true, + "requires": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", "dev": true, "requires": { - "optimist": "~0.3", - "uglify-js": "~2.3" + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" }, "dependencies": { - "source-map": { - "version": "0.1.43", + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "requires": { - "amdefine": ">=0.0.4" + "ms": "2.1.2" } }, - "uglify-js": { - "version": "2.3.6", - "dev": true, - "requires": { - "async": "~0.2.6", - "optimist": "~0.3.5", - "source-map": "~0.1.7" - } + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true } } }, - "has-flag": { - "version": "1.0.0", - "dev": true - }, - "he": { - "version": "1.1.1", - "dev": true - }, - "inflight": { - "version": "1.0.6", + "istanbul-reports": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.4.tgz", + "integrity": "sha512-r1/DshN4KSE7xWEknZLLLLDn5CJybV3nw01VTkp6D5jzLuELlcbudfj/eSQFvrKsJuTVCGnePO7ho82Nw9zzfw==", "dev": true, "requires": { - "once": "^1.3.0", - "wrappy": "1" + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" } }, - "inherits": { - "version": "2.0.4" - }, - "is-buffer": { - "version": "1.1.6", + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", "dev": true }, - "isarray": { - "version": "0.0.1" - }, - "istanbul": { - "version": "0.1.46", + "js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dev": true, "requires": { - "abbrev": "1.0.x", - "async": "0.2.x", - "escodegen": "0.0.23", - "esprima": "1.0.x", - "fileset": "0.1.x", - "handlebars": "1.0.x", - "mkdirp": "0.3.x", - "nopt": "2.1.x", - "resolve": "0.5.x", - "which": "1.0.x", - "wordwrap": "0.0.x" + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "dependencies": { + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + } } }, + "jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true + }, "json3": { "version": "3.3.2", + "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", + "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", + "dev": true + }, + "json5": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", + "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", "dev": true }, "kind-of": { "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { "is-buffer": "^1.1.5" @@ -1049,10 +1035,23 @@ }, "lazy-cache": { "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", "dev": true }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, "lodash._baseassign": { "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", + "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", "dev": true, "requires": { "lodash._basecopy": "^3.0.0", @@ -1061,22 +1060,32 @@ }, "lodash._basecopy": { "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", + "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", "dev": true }, "lodash._basecreate": { "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", + "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=", "dev": true }, "lodash._getnative": { "version": "3.9.1", + "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", + "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", "dev": true }, "lodash._isiterateecall": { "version": "3.0.9", + "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", + "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", "dev": true }, "lodash.create": { "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", + "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", "dev": true, "requires": { "lodash._baseassign": "^3.0.0", @@ -1084,16 +1093,28 @@ "lodash._isiterateecall": "^3.0.0" } }, + "lodash.flattendeep": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", + "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", + "dev": true + }, "lodash.isarguments": { "version": "3.1.0", + "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", + "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", "dev": true }, "lodash.isarray": { "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", + "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", "dev": true }, "lodash.keys": { "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", + "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", "dev": true, "requires": { "lodash._getnative": "^3.0.0", @@ -1103,30 +1124,29 @@ }, "longest": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", "dev": true }, - "lru-cache": { - "version": "2.7.3", - "dev": true - }, - "minimatch": { - "version": "0.4.0", + "make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", "dev": true, "requires": { - "lru-cache": "2", - "sigmund": "~1.0.0" + "semver": "^6.0.0" } }, "minimist": { "version": "0.0.8", - "dev": true - }, - "mkdirp": { - "version": "0.3.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, "mocha": { "version": "3.5.3", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.5.3.tgz", + "integrity": "sha512-/6na001MJWEtYxHOV1WLfsmR4YIynkUEhBwzsb+fk2qmQ3iqsi258l/Q2MWHJMImAcNpZ8DEdYAK72NHoIQ9Eg==", "dev": true, "requires": { "browser-stdout": "1.3.0", @@ -1145,6 +1165,8 @@ "dependencies": { "debug": { "version": "2.6.8", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", "dev": true, "requires": { "ms": "2.0.0" @@ -1152,6 +1174,8 @@ }, "glob": { "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", + "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", "dev": true, "requires": { "fs.realpath": "^1.0.0", @@ -1164,6 +1188,8 @@ }, "minimatch": { "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { "brace-expansion": "^1.1.7" @@ -1171,6 +1197,8 @@ }, "mkdirp": { "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { "minimist": "0.0.8" @@ -1179,42 +1207,226 @@ } }, "ms": { - "version": "2.0.0" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "node-preload": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/node-preload/-/node-preload-0.2.1.tgz", + "integrity": "sha512-RM5oyBy45cLEoHqCeh+MNuFAxO0vTFBLskvQbOKnEE7YTTSN4tbN8QWDIPQ6L+WvKsB/qLEGpYe2ZZ9d4W9OIQ==", + "dev": true, + "requires": { + "process-on-spawn": "^1.0.0" + } + }, + "node-releases": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.4.tgz", + "integrity": "sha512-gbMzqQtTtDz/00jQzZ21PQzdI9PyLYqUSvD0p3naOhX4odFji0ZxYdnVwPTxmSwkmxhcFImpozceidSG+AgoPQ==", + "dev": true }, - "nopt": { - "version": "2.1.2", + "nyc": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/nyc/-/nyc-15.1.0.tgz", + "integrity": "sha512-jMW04n9SxKdKi1ZMGhvUTHBN0EICCRkHemEoE5jm6mTYcqcdas0ATzgUgejlQUHMvpnOZqGB5Xxsv9KxJW1j8A==", "dev": true, "requires": { - "abbrev": "1" + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "caching-transform": "^4.0.0", + "convert-source-map": "^1.7.0", + "decamelize": "^1.2.0", + "find-cache-dir": "^3.2.0", + "find-up": "^4.1.0", + "foreground-child": "^2.0.0", + "get-package-type": "^0.1.0", + "glob": "^7.1.6", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-hook": "^3.0.0", + "istanbul-lib-instrument": "^4.0.0", + "istanbul-lib-processinfo": "^2.0.2", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.0.2", + "make-dir": "^3.0.0", + "node-preload": "^0.2.1", + "p-map": "^3.0.0", + "process-on-spawn": "^1.0.0", + "resolve-from": "^5.0.0", + "rimraf": "^3.0.0", + "signal-exit": "^3.0.2", + "spawn-wrap": "^2.0.0", + "test-exclude": "^6.0.0", + "yargs": "^15.0.2" + }, + "dependencies": { + "cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "yargs": { + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "dev": true, + "requires": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + } + } } }, "once": { "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { "wrappy": "1" } }, - "optimist": { - "version": "0.3.7", + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-map": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", + "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", + "dev": true, + "requires": { + "aggregate-error": "^3.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "package-hash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/package-hash/-/package-hash-4.0.0.tgz", + "integrity": "sha512-whdkPIooSu/bASggZ96BWVvZTRMOFxnyUG5PnTSGKoJE2gd5mbVNmR2Nj20QFzxYYgAXpoqC+AiXzl+UMRh7zQ==", "dev": true, "requires": { - "wordwrap": "~0.0.2" + "graceful-fs": "^4.1.15", + "hasha": "^5.0.0", + "lodash.flattendeep": "^4.4.0", + "release-zalgo": "^1.0.0" } }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, "path-is-absolute": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", "dev": true }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + } + }, "prelude-ls": { "version": "0.6.0", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-0.6.0.tgz", + "integrity": "sha1-z4JLS0fMc8vZb56YhQc7Q6rqqzs=", "dev": true }, + "process-on-spawn": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/process-on-spawn/-/process-on-spawn-1.0.0.tgz", + "integrity": "sha512-1WsPDsUSMmZH5LeMLegqkPDrsGgsWwk1Exipy2hvB0o/F0ASzbpIctSCcZIK1ykJvtTJULEH+20WOFjMvGnCTg==", + "dev": true, + "requires": { + "fromentries": "^1.2.0" + } + }, "querystringify": { - "version": "2.2.0" + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" }, "readable-stream": { "version": "1.1.14", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.1", @@ -1222,45 +1434,258 @@ "string_decoder": "~0.10.x" } }, + "release-zalgo": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/release-zalgo/-/release-zalgo-1.0.0.tgz", + "integrity": "sha1-CXALflB0Mpc5Mw5TXFqQ+2eFFzA=", + "dev": true, + "requires": { + "es6-error": "^4.0.1" + } + }, "repeat-string": { "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "dev": true }, "requires-port": { - "version": "1.0.0" + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" }, - "resolve": { - "version": "0.5.1", + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", "dev": true }, "right-align": { "version": "0.1.3", + "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", + "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", "dev": true, "requires": { "align-text": "^0.1.1" } }, - "sigmund": { - "version": "1.0.1", + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + }, + "dependencies": { + "glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, + "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 + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, - "source-map": { - "version": "0.7.3", + "spawn-wrap": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-2.0.0.tgz", + "integrity": "sha512-EeajNjfN9zMnULLwhZZQU3GWBoFNkbngTUPfaawT4RkMiviTxcX0qfhVbGey39mfctfDHkWtuecgQ8NJcyQWHg==", "dev": true, - "optional": true + "requires": { + "foreground-child": "^2.0.0", + "is-windows": "^1.0.2", + "make-dir": "^3.0.0", + "rimraf": "^3.0.0", + "signal-exit": "^3.0.2", + "which": "^2.0.1" + }, + "dependencies": { + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } }, "string_decoder": { - "version": "0.10.31" + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true }, "supports-color": { "version": "3.1.2", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", + "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", "dev": true, "requires": { "has-flag": "^1.0.0" } }, + "test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "requires": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "dependencies": { + "glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true + }, + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true + }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dev": true, + "requires": { + "is-typedarray": "^1.0.0" + } + }, "uglify-js": { "version": "2.8.29", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", + "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", "dev": true, "requires": { "source-map": "~0.5.1", @@ -1270,12 +1695,16 @@ "dependencies": { "source-map": { "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", "dev": true } } }, "uglify-to-browserify": { "version": "1.0.2", + "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", + "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", "dev": true, "optional": true }, @@ -1288,24 +1717,89 @@ "requires-port": "^1.0.0" } }, - "which": { - "version": "1.0.9", + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "dev": true + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, "window-size": { "version": "0.1.0", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", + "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", "dev": true }, - "wordwrap": { - "version": "0.0.3", - "dev": true + "wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + } + } }, "wrappy": { "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, + "y18n": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", "dev": true }, "yargs": { "version": "3.10.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", "dev": true, "requires": { "camelcase": "^1.0.2", @@ -1313,6 +1807,24 @@ "decamelize": "^1.0.0", "window-size": "0.1.0" } + }, + "yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "dependencies": { + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + } + } } } } diff --git a/package.json b/package.json index 41d517b9..2fea8cb9 100644 --- a/package.json +++ b/package.json @@ -20,8 +20,8 @@ }, "devDependencies": { "claire": "0.4.1", - "istanbul": "0.1.x", "mocha": "^3.5.3", + "nyc": "^15.1.0", "uglify-js": "2.8.x" }, "scripts": { @@ -35,4 +35,4 @@ ], "author": "Michael Bridgen ", "license": "MIT" -} \ No newline at end of file +} From 427954973e7052acdab3b2f20eadc96044f65a90 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Thu, 5 May 2022 20:58:52 +0100 Subject: [PATCH 035/112] Update mocha to latest version still compatible with node 10 --- Makefile | 4 +- package-lock.json | 652 +++++++++++++++++++++++++++++++++++----------- package.json | 2 +- test/connect.js | 2 +- 4 files changed, 506 insertions(+), 154 deletions(-) diff --git a/Makefile b/Makefile index b63de0f6..ed135dde 100644 --- a/Makefile +++ b/Makefile @@ -25,12 +25,12 @@ lib/defs.js: $(UGLIFY) bin/generate-defs.js bin/amqp-rabbitmq-0.9.1.json -b 'indent-level=2' 2>&1 | (grep -v 'WARN' || true) test: lib/defs.js - $(MOCHA) --check-leaks -u tdd test/ + $(MOCHA) --check-leaks -u tdd --exit test/ test-all-nodejs: lib/defs.js for v in $(NODEJS_VERSIONS); \ do echo "-- Node version $$v --"; \ - nave use $$v $(MOCHA) -u tdd -R progress test; \ + nave use $$v $(MOCHA) -u tdd --exit -R progress test; \ done coverage: $(NYC) lib/defs.js diff --git a/package-lock.json b/package-lock.json index 834f540f..a83f8912 100644 --- a/package-lock.json +++ b/package-lock.json @@ -324,6 +324,12 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, + "@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", + "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", + "dev": true + }, "aggregate-error": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", @@ -345,6 +351,12 @@ "repeat-string": "^1.5.2" } }, + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + }, "ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -360,6 +372,16 @@ "color-convert": "^1.9.0" } }, + "anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, "append-transform": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-2.0.0.tgz", @@ -390,6 +412,12 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "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 + }, "bitsyntax": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/bitsyntax/-/bitsyntax-0.1.0.tgz", @@ -428,10 +456,19 @@ "concat-map": "0.0.1" } }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, "browser-stdout": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", - "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, "browserslist": { @@ -514,6 +551,22 @@ } } }, + "chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, "claire": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/claire/-/claire-0.4.1.tgz", @@ -565,15 +618,6 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, - "commander": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", - "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", - "dev": true, - "requires": { - "graceful-readlink": ">= 1.0.0" - } - }, "commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", @@ -646,9 +690,9 @@ } }, "diff": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", - "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", "dev": true }, "electron-to-chromium": { @@ -681,6 +725,15 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, "find-cache-dir": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", @@ -702,6 +755,12 @@ "path-exists": "^4.0.0" } }, + "flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true + }, "flaw": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/flaw/-/flaw-0.1.0.tgz", @@ -730,6 +789,13 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, "gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -748,6 +814,40 @@ "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", "dev": true }, + "glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "dependencies": { + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, "globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", @@ -760,22 +860,16 @@ "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "dev": true }, - "graceful-readlink": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", - "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", - "dev": true - }, "growl": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", - "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", "dev": true }, "has-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, "hasha": { @@ -789,9 +883,9 @@ } }, "he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true }, "html-escaper": { @@ -827,18 +921,54 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", "dev": true }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true + }, "is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -851,6 +981,12 @@ "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true }, + "is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true + }, "is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -1012,12 +1148,6 @@ "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", "dev": true }, - "json3": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", - "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", - "dev": true - }, "json5": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", @@ -1048,78 +1178,65 @@ "p-locate": "^4.1.0" } }, - "lodash._baseassign": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", - "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", - "dev": true, - "requires": { - "lodash._basecopy": "^3.0.0", - "lodash.keys": "^3.0.0" - } - }, - "lodash._basecopy": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", - "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", - "dev": true - }, - "lodash._basecreate": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", - "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=", - "dev": true - }, - "lodash._getnative": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", - "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", - "dev": true - }, - "lodash._isiterateecall": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", - "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", - "dev": true - }, - "lodash.create": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", - "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", - "dev": true, - "requires": { - "lodash._baseassign": "^3.0.0", - "lodash._basecreate": "^3.0.0", - "lodash._isiterateecall": "^3.0.0" - } - }, "lodash.flattendeep": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", "dev": true }, - "lodash.isarguments": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", - "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", - "dev": true - }, - "lodash.isarray": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", - "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", - "dev": true - }, - "lodash.keys": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", - "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", "dev": true, "requires": { - "lodash._getnative": "^3.0.0", - "lodash.isarguments": "^3.0.0", - "lodash.isarray": "^3.0.0" + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } } }, "longest": { @@ -1137,72 +1254,200 @@ "semver": "^6.0.0" } }, - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true + "minimatch": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-4.2.1.tgz", + "integrity": "sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } }, "mocha": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.5.3.tgz", - "integrity": "sha512-/6na001MJWEtYxHOV1WLfsmR4YIynkUEhBwzsb+fk2qmQ3iqsi258l/Q2MWHJMImAcNpZ8DEdYAK72NHoIQ9Eg==", - "dev": true, - "requires": { - "browser-stdout": "1.3.0", - "commander": "2.9.0", - "debug": "2.6.8", - "diff": "3.2.0", - "escape-string-regexp": "1.0.5", - "glob": "7.1.1", - "growl": "1.9.2", - "he": "1.1.1", - "json3": "3.3.2", - "lodash.create": "3.1.1", - "mkdirp": "0.5.1", - "supports-color": "3.1.2" + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.2.2.tgz", + "integrity": "sha512-L6XC3EdwT6YrIk0yXpavvLkn8h+EU+Y5UcCHKECyMbdUIxyMuZj4bX4U9e1nvnvUUvQVsV2VHQr5zLdcUkhW/g==", + "dev": true, + "requires": { + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.3", + "debug": "4.3.3", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.2.0", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", + "minimatch": "4.2.1", + "ms": "2.1.3", + "nanoid": "3.3.1", + "serialize-javascript": "6.0.0", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "which": "2.0.2", + "workerpool": "6.2.0", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" }, "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, "debug": { - "version": "2.6.8", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", - "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", "dev": true, "requires": { - "ms": "2.0.0" + "ms": "2.1.2" + }, + "dependencies": { + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } }, - "glob": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", - "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.2", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" } }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, "requires": { - "brace-expansion": "^1.1.7" + "argparse": "^2.0.1" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" } }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", "dev": true, "requires": { - "minimist": "0.0.8" + "yocto-queue": "^0.1.0" } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true + }, + "yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + } + }, + "yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "dev": true } } }, @@ -1211,6 +1456,12 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, + "nanoid": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz", + "integrity": "sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==", + "dev": true + }, "node-preload": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/node-preload/-/node-preload-0.2.1.tgz", @@ -1226,6 +1477,12 @@ "integrity": "sha512-gbMzqQtTtDz/00jQzZ21PQzdI9PyLYqUSvD0p3naOhX4odFji0ZxYdnVwPTxmSwkmxhcFImpozceidSG+AgoPQ==", "dev": true }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, "nyc": { "version": "15.1.0", "resolved": "https://registry.npmjs.org/nyc/-/nyc-15.1.0.tgz", @@ -1394,6 +1651,12 @@ "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", "dev": true }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, "pkg-dir": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", @@ -1423,6 +1686,15 @@ "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, "readable-stream": { "version": "1.1.14", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", @@ -1434,6 +1706,15 @@ "string_decoder": "~0.10.x" } }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, "release-zalgo": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/release-zalgo/-/release-zalgo-1.0.0.tgz", @@ -1527,6 +1808,15 @@ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true }, + "serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", @@ -1616,13 +1906,19 @@ "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", "dev": true }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, "supports-color": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", - "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, "requires": { - "has-flag": "^1.0.0" + "has-flag": "^4.0.0" } }, "test-exclude": { @@ -1667,6 +1963,15 @@ "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", "dev": true }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, "type-fest": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", @@ -1723,6 +2028,15 @@ "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", "dev": true }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, "which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", @@ -1735,6 +2049,12 @@ "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", "dev": true }, + "workerpool": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz", + "integrity": "sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A==", + "dev": true + }, "wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", @@ -1825,6 +2145,38 @@ "dev": true } } + }, + "yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dev": true, + "requires": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "dependencies": { + "camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true + }, + "decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true + } + } + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true } } } diff --git a/package.json b/package.json index 2fea8cb9..e0b25a06 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ }, "devDependencies": { "claire": "0.4.1", - "mocha": "^3.5.3", + "mocha": "^9.2.2", "nyc": "^15.1.0", "uglify-js": "2.8.x" }, diff --git a/test/connect.js b/test/connect.js index 5a0b2613..fcfd5c01 100644 --- a/test/connect.js +++ b/test/connect.js @@ -152,7 +152,7 @@ suite("Connect API", function() { suite('Errors on connect', function() { var server - afterEach(function() { + teardown(function() { if (server) { server.close(); } From c71b89d65c9ddf57ebfff4a787dd6b5e87f0ff3e Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Mon, 9 May 2022 21:13:17 +0100 Subject: [PATCH 036/112] Update CHANGELOG --- CHANGELOG.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5426d6b2..a0638df7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,41 @@ # Change log for amqplib +## Changes in v0.9.0 + + git log v0.8.0..v0.9.0 + + * Update mocha and replace the deprecated istanbul with nyc ([PR + 681](https://github.com/squaremo/amqp.node/pull/681) + * Update url-parse ([PR + 675](https://github.com/squaremo/amqp.node/pull/675), thank you + @suhail-n and @kibertoad) + * fix: done called twice on invalid options ([PR + 667](https://github.com/squaremo/amqp.node/pull/667), thank you + @luddd3 and @kibertoad) + * Close connection to server on connect errors ([PR + 647](https://github.com/squaremo/amqp.node/pull/647), thank you + @luddd3 and @kibertoad) + * Modernise channel_model.js ([PR + 635](https://github.com/squaremo/amqp.node/pull/635), thank you + @kibertoad and @jimmywarting) + * Bring package-lock.json up to date ([PR + 653](https://github.com/squaremo/amqp.node/pull/653) + * Update url-parse ([PR + 652](https://github.com/squaremo/amqp.node/pull/652), thank you + @giorgioatanasov and @buffolander) + * Modernise channel_model.js ([PR + 651](https://github.com/squaremo/amqp.node/pull/651), thank you + for the review @kibertoad) + * Modernise bitset.js ([PR + 634](https://github.com/squaremo/amqp.node/pull/634), thank you + @kibertoad and @jimmywarting) + * :warning: Drop CI for node versions below 10 ([PR + 631](https://github.com/squaremo/amqp.node/pull/631), thank you + for the review @kibertoad) + * Replace safe-buffer dependency with native buffers ([PR + 628](https://github.com/squaremo/amqp.node/pull/628), thank you + @kibertoad and @jimmywarting) + ## Changes in v0.8.0 git log v0.7.1..v0.8.0 From fb042cf4218cff0c3403cc5ef1c30b11bdbe2528 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Mon, 9 May 2022 21:28:10 +0100 Subject: [PATCH 037/112] 0.9.0 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index a83f8912..b305e379 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "amqplib", - "version": "0.8.0", + "version": "0.9.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index e0b25a06..3bfe9d07 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "amqplib", "homepage": "http://squaremo.github.io/amqp.node/", "main": "./channel_api.js", - "version": "0.8.0", + "version": "0.9.0", "description": "An AMQP 0-9-1 (e.g., RabbitMQ) library and client.", "repository": { "type": "git", From c41a09c9287939dab4696d7497e68d8ae192c0df Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Sun, 15 May 2022 17:10:27 +0100 Subject: [PATCH 038/112] Update README references --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a7a11b2b..aa125039 100644 --- a/README.md +++ b/README.md @@ -146,10 +146,10 @@ really only useful for checking the kind and formatting of the errors. make coverage open file://`pwd`/coverage/lcov-report/index.html -[gh-pages]: http://www.squaremobius.net/amqp.node/ -[gh-pages-apiref]: http://www.squaremobius.net/amqp.node/channel_api.html +[gh-pages]: https://amqp-node.github.io/amqplib/ +[gh-pages-apiref]: https://amqp-node.github.io/amqplib/channel_api.html [nave]: https://github.com/isaacs/nave -[tutes]: https://github.com/squaremo/amqp.node/tree/main/examples/tutorials +[tutes]: https://github.com/amqp-node/amqplib/tree/main/examples/tutorials [rabbitmq-tutes]: http://www.rabbitmq.com/getstarted.html -[changelog]: https://github.com/squaremo/amqp.node/blob/main/CHANGELOG.md +[changelog]: https://github.com/amqp-node/amqplib/blob/main/CHANGELOG.md [docker]: https://www.docker.com/ From ad39bc846bb7a559e0253645dcfe14f1097cb00d Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Sun, 15 May 2022 17:30:14 +0100 Subject: [PATCH 039/112] Retire travis as per #684 --- .travis.yml | 41 ----------------------------------------- README.md | 2 +- 2 files changed, 1 insertion(+), 42 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index de475131..00000000 --- a/.travis.yml +++ /dev/null @@ -1,41 +0,0 @@ -language: node_js -node_js: -- "10.10" -- "11.1" -- "12" -- "13" -- "14" -- "15" -- "16" -- "node" # Latest stable Node version - -sudo: false - -addons: - apt: - packages: - - rabbitmq-server - -before_install: -- node --version | (grep -v 'v5' && npm install -g npm@2) || true - -# This makes a deploy stage that will run *after* the whole matrix of -# builds above has completed successfully. -jobs: - include: - - stage: deploy - node_js: '11.1' - script: skip - before_deploy: - - sudo apt-get install -y jq - - test "$TRAVIS_TAG" == "v$(jq -r .version < package.json)" - - npm run prepare - deploy: - provider: npm - email: "$NPM_USER" - api_key: "$NPM_TOKEN" - skip_cleanup: true # stop TravisCI from doing git stash --all - on: - branch: master - tags: true - condition: $TRAVIS_TAG =~ ^v[0-9]+.[0-9]+.[0-9]+$ diff --git a/README.md b/README.md index aa125039..c6e29cf6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # AMQP 0-9-1 library and client for Node.JS -[![Build Status](https://travis-ci.org/squaremo/amqp.node.png)](https://travis-ci.org/squaremo/amqp.node) +[![Node.js CI](https://github.com/amqp-node/amqplib/workflows/Node.js%20CI/badge.svg)](https://github.com/amqp-node/amqplib/actions?query=workflow%3A%22Node.js+CI%22) npm install amqplib From 644ebd22a1b3baf3fa8fc9edd0b4c870578be6e9 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Sun, 15 May 2022 17:38:32 +0100 Subject: [PATCH 040/112] Test against recent node versions --- .github/workflows/test.yml | 2 +- Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 717d5bb3..f451d1a0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,7 +20,7 @@ jobs: strategy: matrix: - node-version: [10.x, 12.x, 14.x, 16.x] + node-version: [10.x, 12.x, 14.x, 16.x, 18.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: diff --git a/Makefile b/Makefile index ed135dde..a48005f3 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ JSON=amqp-rabbitmq-0.9.1.json RABBITMQ_CODEGEN=https://raw.githubusercontent.com/rabbitmq/rabbitmq-codegen AMQP_JSON=$(RABBITMQ_CODEGEN)/$(RABBITMQ_SRC_VERSION)/$(JSON) -NODEJS_VERSIONS='10.21' '11.15' '12.18' '13.14' '14.5' '15.8' +NODEJS_VERSIONS='10.21' '11.15' '12.18' '13.14' '14.5' '15.8' '16.3.0' '18.1.0' MOCHA=./node_modules/.bin/mocha _MOCHA=./node_modules/.bin/_mocha From 68b1534724ab29fa5b7c495b6c3d5a9ee71f6a80 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Sun, 15 May 2022 17:47:43 +0100 Subject: [PATCH 041/112] Add readme badges --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index c6e29cf6..0aefbb02 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # AMQP 0-9-1 library and client for Node.JS +[![NPM version](https://img.shields.io/npm/v/amqplib.svg?style=flat-square)](https://www.npmjs.com/package/amqplib) +[![NPM downloads](https://img.shields.io/npm/dm/amqplib.svg?style=flat-square)](https://www.npmjs.com/package/amqplib) [![Node.js CI](https://github.com/amqp-node/amqplib/workflows/Node.js%20CI/badge.svg)](https://github.com/amqp-node/amqplib/actions?query=workflow%3A%22Node.js+CI%22) +[![amqplib](https://snyk.io/advisor/npm-package/amqplib/badge.svg)](https://snyk.io/advisor/npm-package/amqplib) npm install amqplib From 153a40e3823379b9bae181b6e1276bf8e0b48c11 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Sun, 15 May 2022 18:57:31 +0100 Subject: [PATCH 042/112] Add troubleshooting link to the readme --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 0aefbb02..19b2dfa9 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,10 @@ * [Change log][changelog] * [GitHub pages][gh-pages] * [API reference][gh-pages-apiref] + * [Troubleshooting][gh-pages-trouble] * [Examples from RabbitMQ tutorials][tutes] + A library for making AMQP 0-9-1 clients for Node.JS, and an AMQP 0-9-1 client for Node.JS v10+. This library does not implement [AMQP @@ -151,6 +153,7 @@ really only useful for checking the kind and formatting of the errors. [gh-pages]: https://amqp-node.github.io/amqplib/ [gh-pages-apiref]: https://amqp-node.github.io/amqplib/channel_api.html +[gh-pages-trouble]: https://amqp-node.github.io/amqplib/#troubleshooting [nave]: https://github.com/isaacs/nave [tutes]: https://github.com/amqp-node/amqplib/tree/main/examples/tutorials [rabbitmq-tutes]: http://www.rabbitmq.com/getstarted.html From f6bfc55ec751a26ccce8d9e4412f39db7b7312cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C4=81rs=20Vilnis?= Date: Wed, 31 Oct 2018 17:40:49 +0200 Subject: [PATCH 043/112] Update README promise example Hey, I started learning Rabbitmq in node using this library and noticed that the readme promise example wasn't clear enough and didn't follow current node.js tendencies. I updated the example, now It's way more readable and easier to understand what is going on for someone starting out. --- README.md | 48 +++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 19b2dfa9..549edb2c 100644 --- a/README.md +++ b/README.md @@ -77,35 +77,33 @@ require('amqplib/callback_api') }); ``` -## Promise API example +## Promise/Async API example ```javascript -var q = 'tasks'; - -var open = require('amqplib').connect('amqp://localhost'); - -// Publisher -open.then(function(conn) { - return conn.createChannel(); -}).then(function(ch) { - return ch.assertQueue(q).then(function(ok) { - return ch.sendToQueue(q, Buffer.from('something to do')); +const amqplib = require('amqplib'); + +(async () => { + const conn = await amqplib.connect('amqp://localhost'); + const ch = await conn.createChannel(); + + const queue = 'tasks'; + + await ch.assertQueue(queue); + + // Listener + ch.consume(queue, function(msg) { + if (msg !== null) { + console.log('Recieved:', msg.content.toString()); + ch.ack(msg); + } }); -}).catch(console.warn); -// Consumer -open.then(function(conn) { - return conn.createChannel(); -}).then(function(ch) { - return ch.assertQueue(q).then(function(ok) { - return ch.consume(q, function(msg) { - if (msg !== null) { - console.log(msg.content.toString()); - ch.ack(msg); - } - }); - }); -}).catch(console.warn); + // Sender + setInterval(async () => { + await ch.sendToQueue(queue, Buffer.from('something to do')); + }, 1000); +})() + ``` ## Running tests From 375560c42e5e3ef595da9bf41ea88c77705eaadc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C4=81rs=20Vilnis?= Date: Thu, 28 Feb 2019 13:18:25 +0200 Subject: [PATCH 044/112] Fix readme example unneeded async-await and convert more examples to arrow functions --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 549edb2c..5f96ed3c 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ function consumer(conn) { function on_open(err, ch) { if (err != null) bail(err); ch.assertQueue(q); - ch.consume(q, function(msg) { + ch.consume(q, (msg) => { if (msg !== null) { console.log(msg.content.toString()); ch.ack(msg); @@ -70,7 +70,7 @@ function consumer(conn) { } require('amqplib/callback_api') - .connect('amqp://localhost', function(err, conn) { + .connect('amqp://localhost', (err, conn) => { if (err != null) bail(err); consumer(conn); publisher(conn); @@ -87,11 +87,11 @@ const amqplib = require('amqplib'); const ch = await conn.createChannel(); const queue = 'tasks'; - + await ch.assertQueue(queue); // Listener - ch.consume(queue, function(msg) { + ch.consume(queue, (msg) => { if (msg !== null) { console.log('Recieved:', msg.content.toString()); ch.ack(msg); @@ -99,8 +99,8 @@ const amqplib = require('amqplib'); }); // Sender - setInterval(async () => { - await ch.sendToQueue(queue, Buffer.from('something to do')); + setInterval(() => { + ch.sendToQueue(queue, Buffer.from('something to do')); }, 1000); })() From 8228062ca936e3e6afc6f02113384bfe31fec12c Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Sun, 15 May 2022 19:25:50 +0100 Subject: [PATCH 045/112] Make README examples more consistent --- README.md | 80 +++++++++++++++++++++++++++---------------------------- 1 file changed, 39 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index 5f96ed3c..d87e25bc 100644 --- a/README.md +++ b/README.md @@ -37,44 +37,39 @@ Still working on: ## Callback API example ```javascript -var q = 'tasks'; - -function bail(err) { - console.error(err); - process.exit(1); -} - -// Publisher -function publisher(conn) { - conn.createChannel(on_open); - function on_open(err, ch) { - if (err != null) bail(err); - ch.assertQueue(q); - ch.sendToQueue(q, Buffer.from('something to do')); - } -} - -// Consumer -function consumer(conn) { - var ok = conn.createChannel(on_open); - function on_open(err, ch) { - if (err != null) bail(err); - ch.assertQueue(q); - ch.consume(q, (msg) => { +const amqplib = require('amqplib/callback_api'); +const queue = 'tasks'; + +amqplib.connect('amqp://localhost', (err, conn) => { + if (err) throw err; + + // Listener + conn.createChannel((err, ch2) => { + if (err) throw err; + + ch2.assertQueue(queue); + + ch2.consume(queue, (msg) => { if (msg !== null) { console.log(msg.content.toString()); - ch.ack(msg); + ch2.ack(msg); + } else { + console.log('Consumer cancelled by server'); } }); - } -} - -require('amqplib/callback_api') - .connect('amqp://localhost', (err, conn) => { - if (err != null) bail(err); - consumer(conn); - publisher(conn); }); + + // Sender + conn.createChannel((err, ch1) => { + if (err) throw err; + + ch1.assertQueue(queue); + + setInterval(() => { + ch1.sendToQueue(queue, Buffer.from('something to do')); + }, 1000); + }); +}); ``` ## Promise/Async API example @@ -83,26 +78,29 @@ require('amqplib/callback_api') const amqplib = require('amqplib'); (async () => { - const conn = await amqplib.connect('amqp://localhost'); - const ch = await conn.createChannel(); - const queue = 'tasks'; + const conn = await amqplib.connect('amqp://localhost'); - await ch.assertQueue(queue); + const ch1 = await conn.createChannel(); + await ch1.assertQueue(queue); // Listener - ch.consume(queue, (msg) => { + ch1.consume(queue, (msg) => { if (msg !== null) { console.log('Recieved:', msg.content.toString()); - ch.ack(msg); + ch1.ack(msg); + } else { + console.log('Consumer cancelled by server'); } }); // Sender + const ch2 = await conn.createChannel(); + setInterval(() => { - ch.sendToQueue(queue, Buffer.from('something to do')); + ch2.sendToQueue(queue, Buffer.from('something to do')); }, 1000); -})() +})(); ``` From 21a31ac338a7fe97461c6f6007610592980a9111 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Sun, 15 May 2022 19:33:10 +0100 Subject: [PATCH 046/112] Update links in package.json --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 3bfe9d07..fb489ce0 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { "name": "amqplib", - "homepage": "http://squaremo.github.io/amqp.node/", + "homepage": "http://amqp-node.github.io/amqplib/", "main": "./channel_api.js", "version": "0.9.0", "description": "An AMQP 0-9-1 (e.g., RabbitMQ) library and client.", "repository": { "type": "git", - "url": "https://github.com/squaremo/amqp.node.git" + "url": "https://github.com/amqp-node/amqplib.git" }, "engines": { "node": ">=10" From 8da6d4a3464e63be4deb7728fe5bd11220625f04 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Sun, 15 May 2022 19:37:00 +0100 Subject: [PATCH 047/112] Update README with more recent node version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d87e25bc..bccaa2ed 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,7 @@ dev.rabbitmq.com instance. You can run it under different versions of Node.JS using [nave][]: - nave use 0.8 npm test + nave use 10 npm test or run the tests on all supported versions of Node.JS in one go: From f4c3189717eae1460bb04774387497bca6099f00 Mon Sep 17 00:00:00 2001 From: Aras Abbasi Date: Fri, 5 Nov 2021 00:11:28 +0100 Subject: [PATCH 048/112] use .push.apply instead of concat in Mux _readIncoming remove unused require remove unused self variable --- lib/mux.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/mux.js b/lib/mux.js index 09040d8b..3ffe0976 100644 --- a/lib/mux.js +++ b/lib/mux.js @@ -8,7 +8,6 @@ // it then writes 'packets' from the upstreams to the given // downstream. -var inherits = require('util').inherits; var assert = require('assert'); var schedule = (typeof setImmediate === 'function') ? @@ -47,7 +46,6 @@ Mux.prototype._readIncoming = function() { // become readable if (this.blocked) return; - var self = this; var accepting = true; var out = this.out; @@ -79,7 +77,7 @@ Mux.prototype._readIncoming = function() { } else { // ran out of room assert(this.newStreams.length > 0, "Expect some new streams to remain"); - this.oldStreams = this.oldStreams.concat(this.newStreams); + this.oldStreams.push.apply(this.newStreams); this.newStreams = []; } // We may have exhausted all the old queues, or run out of room; From d5e1a10a96ea222ac74e72242b3cb79ff394b08f Mon Sep 17 00:00:00 2001 From: Aras Abbasi Date: Fri, 5 Nov 2021 00:15:24 +0100 Subject: [PATCH 049/112] fix wrong implementation of push.apply --- lib/mux.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mux.js b/lib/mux.js index 3ffe0976..433622fe 100644 --- a/lib/mux.js +++ b/lib/mux.js @@ -77,7 +77,7 @@ Mux.prototype._readIncoming = function() { } else { // ran out of room assert(this.newStreams.length > 0, "Expect some new streams to remain"); - this.oldStreams.push.apply(this.newStreams); + Array.prototype.push.apply(this.oldStreams, this.newStreams); this.newStreams = []; } // We may have exhausted all the old queues, or run out of room; From b1dec783578c263d21d0b650651cf288bec0e168 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Sun, 15 May 2022 21:05:25 +0100 Subject: [PATCH 050/112] Update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0638df7..94a9e7b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change log for amqplib +## Unreleased + * Assorted readme changes + * Use Array.prototype.push.apply instead of concat in Mux ([PR + 658](https://github.com/squaremo/amqp.node/pull/658), thank you + @Uzlopak and @kibertoad) + ## Changes in v0.9.0 git log v0.8.0..v0.9.0 From 899affe14d30107514da87df3c4c6c7400455cf5 Mon Sep 17 00:00:00 2001 From: Aras Abbasi Date: Fri, 5 Nov 2021 02:11:39 +0100 Subject: [PATCH 051/112] transform throws string into throw Error --- lib/channel.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/channel.js b/lib/channel.js index c6604fb4..38f388ae 100644 --- a/lib/channel.js +++ b/lib/channel.js @@ -268,8 +268,8 @@ function acceptDeliveryOrReturn(f) { var event; if (f.id === defs.BasicDeliver) event = 'delivery'; else if (f.id === defs.BasicReturn) event = 'return'; - else throw fmt("Expected BasicDeliver or BasicReturn; got %s", - inspect(f)); + else throw new Error(fmt("Expected BasicDeliver or BasicReturn; got %s", + inspect(f))); var self = this; var fields = f.fields; @@ -310,7 +310,7 @@ function acceptMessage(continuation) { } } else { - throw "Expected headers frame after delivery"; + throw new Error("Expected headers frame after delivery"); } } @@ -332,8 +332,8 @@ function acceptMessage(continuation) { return acceptDeliveryOrReturn; } else if (remaining < 0) { - throw fmt("Too much content sent! Expected %d bytes", - totalSize); + throw new Error(fmt("Too much content sent! Expected %d bytes", + totalSize)); } else { if (buffers !== null) @@ -343,7 +343,7 @@ function acceptMessage(continuation) { return content; } } - else throw "Expected content frame after headers" + else throw new Error("Expected content frame after headers"); } } From d99c305b7f02e579e413441ea8da92c9a2c80ef6 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Sun, 15 May 2022 21:22:50 +0100 Subject: [PATCH 052/112] Revert "Merge pull request #661 from Uzlopak/code-smells-throw-errors" This reverts commit 691568c1ed5ee0e0d3c9f4e6fef7d298c0b1744f, reversing changes made to 7c3de5dbcb84df9be98524a0feaf6c1355d1ca83. --- lib/channel.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/channel.js b/lib/channel.js index 38f388ae..c6604fb4 100644 --- a/lib/channel.js +++ b/lib/channel.js @@ -268,8 +268,8 @@ function acceptDeliveryOrReturn(f) { var event; if (f.id === defs.BasicDeliver) event = 'delivery'; else if (f.id === defs.BasicReturn) event = 'return'; - else throw new Error(fmt("Expected BasicDeliver or BasicReturn; got %s", - inspect(f))); + else throw fmt("Expected BasicDeliver or BasicReturn; got %s", + inspect(f)); var self = this; var fields = f.fields; @@ -310,7 +310,7 @@ function acceptMessage(continuation) { } } else { - throw new Error("Expected headers frame after delivery"); + throw "Expected headers frame after delivery"; } } @@ -332,8 +332,8 @@ function acceptMessage(continuation) { return acceptDeliveryOrReturn; } else if (remaining < 0) { - throw new Error(fmt("Too much content sent! Expected %d bytes", - totalSize)); + throw fmt("Too much content sent! Expected %d bytes", + totalSize); } else { if (buffers !== null) @@ -343,7 +343,7 @@ function acceptMessage(continuation) { return content; } } - else throw new Error("Expected content frame after headers"); + else throw "Expected content frame after headers" } } From fd9525ab5179b22169dd4371fc88a7f58450d0e3 Mon Sep 17 00:00:00 2001 From: Aras Abbasi Date: Fri, 5 Nov 2021 00:47:22 +0100 Subject: [PATCH 053/112] Use Map instead of Object for BaseChannel.consumers --- lib/channel.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/channel.js b/lib/channel.js index c6604fb4..6a34504b 100644 --- a/lib/channel.js +++ b/lib/channel.js @@ -460,7 +460,7 @@ C.onBufferDrain = function() { // low-level machinery. function BaseChannel(connection) { Channel.call(this, connection); - this.consumers = {}; + this.consumers = new Map(); } inherits(BaseChannel, Channel); @@ -469,16 +469,16 @@ module.exports.BaseChannel = BaseChannel; // Not sure I like the ff, it's going to be changing hidden classes // all over the place. On the other hand, whaddya do. BaseChannel.prototype.registerConsumer = function(tag, callback) { - this.consumers[tag] = callback; + this.consumers.set(tag, callback); }; BaseChannel.prototype.unregisterConsumer = function(tag) { - delete this.consumers[tag]; + this.consumers.delete(tag); }; BaseChannel.prototype.dispatchMessage = function(fields, message) { var consumerTag = fields.consumerTag; - var consumer = this.consumers[consumerTag]; + var consumer = this.consumers.get(consumerTag); if (consumer) { return consumer(message); } From cc4add5a43a5841c7608a16f63527c573c4fc6cf Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Sun, 15 May 2022 21:33:16 +0100 Subject: [PATCH 054/112] update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94a9e7b2..d9b7f636 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ * Use Array.prototype.push.apply instead of concat in Mux ([PR 658](https://github.com/squaremo/amqp.node/pull/658), thank you @Uzlopak and @kibertoad) + * Use Map instead of Object for BaseChannel.consumers ([PR + 660](https://github.com/squaremo/amqp.node/pull/660), thank you + @Uzlopak) ## Changes in v0.9.0 From 8c498e901e246fb2046bc0ecf13784a3e5cf479c Mon Sep 17 00:00:00 2001 From: Aras Abbasi Date: Fri, 5 Nov 2021 00:42:05 +0100 Subject: [PATCH 055/112] call unregisterConsumer in handleCancel --- lib/channel.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/channel.js b/lib/channel.js index 6a34504b..2f589bfc 100644 --- a/lib/channel.js +++ b/lib/channel.js @@ -493,5 +493,7 @@ BaseChannel.prototype.handleDelivery = function(message) { }; BaseChannel.prototype.handleCancel = function(fields) { - return this.dispatchMessage(fields, null); + var result = this.dispatchMessage(fields, null); + this.unregisterConsumer(fields.consumerTag); + return result; }; From 9eeefff6cd10100ff5af78344f4fe2c3c7287384 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Sun, 15 May 2022 21:52:22 +0100 Subject: [PATCH 056/112] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9b7f636..4f7ea50f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ * Use Map instead of Object for BaseChannel.consumers ([PR 660](https://github.com/squaremo/amqp.node/pull/660), thank you @Uzlopak) + * Delete consumer callback after cancellation to free memory ([PR + 659](https://github.com/squaremo/amqp.node/pull/659), thank you + @Uzlopak and @kibertoad) + ## Changes in v0.9.0 From 0924cf021f594aec4664da383d0aecef1e11a5c3 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Sat, 21 May 2022 10:28:20 +0100 Subject: [PATCH 057/112] Add version to changelog --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f7ea50f..9bf7ac59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Change log for amqplib -## Unreleased +## Changes in v0.9.1 + + git log v0.9.0..v0.9.1 + * Assorted readme changes * Use Array.prototype.push.apply instead of concat in Mux ([PR 658](https://github.com/squaremo/amqp.node/pull/658), thank you From ef94852d1d553b165f28648b1b33ad96b7899198 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Sat, 21 May 2022 10:28:24 +0100 Subject: [PATCH 058/112] 0.9.1 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index b305e379..05eb2e66 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "amqplib", - "version": "0.9.0", + "version": "0.9.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index fb489ce0..cb1a5543 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "amqplib", "homepage": "http://amqp-node.github.io/amqplib/", "main": "./channel_api.js", - "version": "0.9.0", + "version": "0.9.1", "description": "An AMQP 0-9-1 (e.g., RabbitMQ) library and client.", "repository": { "type": "git", From 476cf9d030697aac085c8ae9b9a2ce7c9877663f Mon Sep 17 00:00:00 2001 From: Mohamed Akram Date: Thu, 19 May 2022 18:02:29 +0400 Subject: [PATCH 059/112] Use native promises --- channel_api.js | 6 +- examples/tutorials/receive_logs_direct.js | 3 +- examples/tutorials/receive_logs_topic.js | 3 +- examples/tutorials/rpc_client.js | 1 - lib/callback_model.js | 1 - lib/channel_model.js | 67 +- package-lock.json | 2912 ++++++++++++++++++++- package.json | 1 - test/channel.js | 16 +- test/channel_api.js | 72 +- test/util.js | 1 - 11 files changed, 2981 insertions(+), 102 deletions(-) diff --git a/channel_api.js b/channel_api.js index 6c8c4dd7..4fe67f68 100644 --- a/channel_api.js +++ b/channel_api.js @@ -1,11 +1,11 @@ var raw_connect = require('./lib/connect').connect; var ChannelModel = require('./lib/channel_model').ChannelModel; -var Promise = require('bluebird'); +var promisify = require('util').promisify; function connect(url, connOptions) { - return Promise.fromCallback(function(cb) { + return promisify(function(cb) { return raw_connect(url, connOptions, cb); - }) + })() .then(function(conn) { return new ChannelModel(conn); }); diff --git a/examples/tutorials/receive_logs_direct.js b/examples/tutorials/receive_logs_direct.js index 17fc22de..f1e77f95 100755 --- a/examples/tutorials/receive_logs_direct.js +++ b/examples/tutorials/receive_logs_direct.js @@ -1,7 +1,6 @@ #!/usr/bin/env node var amqp = require('amqplib'); -var all = require('bluebird').all; var basename = require('path').basename; var severities = process.argv.slice(2); @@ -24,7 +23,7 @@ amqp.connect('amqp://localhost').then(function(conn) { ok = ok.then(function(qok) { var queue = qok.queue; - return all(severities.map(function(sev) { + return Promise.all(severities.map(function(sev) { ch.bindQueue(queue, ex, sev); })).then(function() { return queue; }); }); diff --git a/examples/tutorials/receive_logs_topic.js b/examples/tutorials/receive_logs_topic.js index 3e8eb6f0..cc8e47f1 100755 --- a/examples/tutorials/receive_logs_topic.js +++ b/examples/tutorials/receive_logs_topic.js @@ -2,7 +2,6 @@ var amqp = require('amqplib'); var basename = require('path').basename; -var all = require('bluebird').all; var keys = process.argv.slice(2); if (keys.length < 1) { @@ -23,7 +22,7 @@ amqp.connect('amqp://localhost').then(function(conn) { ok = ok.then(function(qok) { var queue = qok.queue; - return all(keys.map(function(rk) { + return Promise.all(keys.map(function(rk) { ch.bindQueue(queue, ex, rk); })).then(function() { return queue; }); }); diff --git a/examples/tutorials/rpc_client.js b/examples/tutorials/rpc_client.js index 47566b34..88cc72a4 100755 --- a/examples/tutorials/rpc_client.js +++ b/examples/tutorials/rpc_client.js @@ -2,7 +2,6 @@ var amqp = require('amqplib'); var basename = require('path').basename; -var Promise = require('bluebird'); var uuid = require('node-uuid'); // I've departed from the form of the original RPC tutorial, which diff --git a/lib/callback_model.js b/lib/callback_model.js index dca383f8..3a0b3b3e 100644 --- a/lib/callback_model.js +++ b/lib/callback_model.js @@ -5,7 +5,6 @@ 'use strict'; var defs = require('./defs'); -var Promise = require('bluebird'); var inherits = require('util').inherits; var EventEmitter = require('events').EventEmitter; var BaseChannel = require('./channel').BaseChannel; diff --git a/lib/channel_model.js b/lib/channel_model.js index ea652e2f..cc3bc87f 100644 --- a/lib/channel_model.js +++ b/lib/channel_model.js @@ -5,7 +5,7 @@ 'use strict'; const EventEmitter = require('events'); -const Promise = require('bluebird'); +const promisify = require('util').promisify; const defs = require('./defs'); const {BaseChannel} = require('./channel'); const {acceptMessage} = require('./channel'); @@ -23,7 +23,7 @@ class ChannelModel extends EventEmitter { } close() { - return Promise.fromCallback(this.connection.close.bind(this.connection)); + return promisify(this.connection.close.bind(this.connection))(); } async createChannel() { @@ -53,27 +53,25 @@ class Channel extends BaseChannel { // response's fields; this is intended to be suitable for implementing // API procedures. async rpc(method, fields, expect) { - const f = await Promise.fromCallback(cb => { + const f = await promisify(cb => { return this._rpc(method, fields, expect, cb); - }) + })(); return f.fields; } // Do the remarkably simple channel open handshake - open() { - return Promise.try(this.allocate.bind(this)).then( - ch => { - return ch.rpc(defs.ChannelOpen, {outOfBand: ""}, - defs.ChannelOpenOk); - }); + async open() { + const ch = await this.allocate.bind(this)(); + return ch.rpc(defs.ChannelOpen, {outOfBand: ""}, + defs.ChannelOpenOk); } close() { - return Promise.fromCallback(cb => { + return promisify(cb => { return this.closeBecause("Goodbye", defs.constants.REPLY_SUCCESS, cb); - }); + })(); } // === Public API, declaring queues and stuff === @@ -162,21 +160,21 @@ class Channel extends BaseChannel { // NB we want the callback to be run synchronously, so that we've // registered the consumerTag before any messages can arrive. const fields = Args.consume(queue, options); - return Promise.fromCallback(cb => { - this._rpc(defs.BasicConsume, fields, defs.BasicConsumeOk, cb); - }) - .then(ok => { - this.registerConsumer(ok.fields.consumerTag, callback); - return ok.fields; + return new Promise((resolve, reject) => { + this._rpc(defs.BasicConsume, fields, defs.BasicConsumeOk, (err, ok) => { + if (err) return reject(err); + this.registerConsumer(ok.fields.consumerTag, callback); + resolve(ok.fields); + }); }); } async cancel(consumerTag) { - const ok = await Promise.fromCallback(cb => { + const ok = await promisify(cb => { this._rpc(defs.BasicCancel, Args.cancel(consumerTag), defs.BasicCancelOk, cb); - }) + })() .then(ok => { this.unregisterConsumer(consumerTag); return ok.fields; @@ -185,25 +183,23 @@ class Channel extends BaseChannel { get(queue, options) { const fields = Args.get(queue, options); - return Promise.fromCallback(cb => { - return this.sendOrEnqueue(defs.BasicGet, fields, cb); - }) - .then(f => { - if (f.id === defs.BasicGetEmpty) { - return false; - } - else if (f.id === defs.BasicGetOk) { - const fields = f.fields; - return new Promise(resolve => { + return new Promise((resolve, reject) => { + this.sendOrEnqueue(defs.BasicGet, fields, (err, f) => { + if (err) return reject(err); + if (f.id === defs.BasicGetEmpty) { + return resolve(false); + } + else if (f.id === defs.BasicGetOk) { + const fields = f.fields; this.handleMessage = acceptMessage(m => { m.fields = fields; resolve(m); }); - }); - } - else { - throw new Error(`Unexpected response to BasicGet: ${inspect(f)}`); - } + } + else { + reject(new Error(`Unexpected response to BasicGet: ${inspect(f)}`)); + } + }); }); } @@ -286,6 +282,7 @@ class ConfirmChannel extends Channel { if (err === null) resolve(); else reject(err); }; + if (!this.pending) unconfirmed[index](new Error('channel closed')) }); awaiting.push(confirmed); } diff --git a/package-lock.json b/package-lock.json index 05eb2e66..0dec4570 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,8 +1,2903 @@ { "name": "amqplib", "version": "0.9.1", - "lockfileVersion": 1, + "lockfileVersion": 2, "requires": true, + "packages": { + "": { + "name": "amqplib", + "version": "0.9.1", + "license": "MIT", + "dependencies": { + "bitsyntax": "~0.1.0", + "buffer-more-ints": "~1.0.0", + "readable-stream": "1.x >=1.1.9", + "url-parse": "~1.5.10" + }, + "devDependencies": { + "claire": "0.4.1", + "mocha": "^9.2.2", + "nyc": "^15.1.0", + "uglify-js": "2.8.x" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@ampproject/remapping": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", + "integrity": "sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.1.0", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.17.10.tgz", + "integrity": "sha512-GZt/TCsG70Ms19gfZO1tM4CVnXsPgEPBCpJu+Qz3L0LUDsY5nZqFZglIoPC1kIYOtNBZlrnFT+klg12vFGZXrw==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.17.10.tgz", + "integrity": "sha512-liKoppandF3ZcBnIYFjfSDHZLKdLHGJRkoWtG8zQyGJBQfIYobpnVGI5+pLBNtS6psFLDzyq8+h5HiVljW9PNA==", + "dev": true, + "dependencies": { + "@ampproject/remapping": "^2.1.0", + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.17.10", + "@babel/helper-compilation-targets": "^7.17.10", + "@babel/helper-module-transforms": "^7.17.7", + "@babel/helpers": "^7.17.9", + "@babel/parser": "^7.17.10", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.17.10", + "@babel/types": "^7.17.10", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.1", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/core/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@babel/core/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@babel/generator": { + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.17.10.tgz", + "integrity": "sha512-46MJZZo9y3o4kmhBVc7zW7i8dtR1oIK/sdO5NcfcZRhTGYi+KKJRtHNgsU6c4VUcJmUNV/LQdebD/9Dlv4K+Tg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.17.10", + "@jridgewell/gen-mapping": "^0.1.0", + "jsesc": "^2.5.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.17.10.tgz", + "integrity": "sha512-gh3RxjWbauw/dFiU/7whjd0qN9K6nPJMqe6+Er7rOavFh0CQUSwhAE3IcTho2rywPJFxej6TUUHDkWcYI6gGqQ==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.17.10", + "@babel/helper-validator-option": "^7.16.7", + "browserslist": "^4.20.2", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-environment-visitor": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.7.tgz", + "integrity": "sha512-SLLb0AAn6PkUeAfKJCCOl9e1R53pQlGAfc4y4XuMRZfqeMYLE0dM1LMhqbGAlGQY0lfw5/ohoYWAe9V1yibRag==", + "dev": true, + "dependencies": { + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-function-name": { + "version": "7.17.9", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.17.9.tgz", + "integrity": "sha512-7cRisGlVtiVqZ0MW0/yFB4atgpGLWEHUVYnb448hZK4x+vih0YO5UoS11XIYtZYqHd0dIPMdUSv8q5K4LdMnIg==", + "dev": true, + "dependencies": { + "@babel/template": "^7.16.7", + "@babel/types": "^7.17.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-hoist-variables": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz", + "integrity": "sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz", + "integrity": "sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.17.7.tgz", + "integrity": "sha512-VmZD99F3gNTYB7fJRDTi+u6l/zxY0BE6OIxPSU7a50s6ZUQkHwSDmV92FfM+oCG0pZRVojGYhkR8I0OGeCVREw==", + "dev": true, + "dependencies": { + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-module-imports": "^7.16.7", + "@babel/helper-simple-access": "^7.17.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/helper-validator-identifier": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.17.3", + "@babel/types": "^7.17.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-simple-access": { + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.17.7.tgz", + "integrity": "sha512-txyMCGroZ96i+Pxr3Je3lzEJjqwaRC9buMUgtomcrLe5Nd0+fk1h0LLA+ixUF5OW7AhHuQ7Es1WcQJZmZsz2XA==", + "dev": true, + "dependencies": { + "@babel/types": "^7.17.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-split-export-declaration": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz", + "integrity": "sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", + "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz", + "integrity": "sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.17.9", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.17.9.tgz", + "integrity": "sha512-cPCt915ShDWUEzEp3+UNRktO2n6v49l5RSnG9M5pS24hA+2FAc5si+Pn1i4VVbQQ+jh+bIZhPFQOJOzbrOYY1Q==", + "dev": true, + "dependencies": { + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.17.9", + "@babel/types": "^7.17.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.17.9", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.17.9.tgz", + "integrity": "sha512-J9PfEKCbFIv2X5bjTMiZu6Vf341N05QIY+d6FvVKynkG1S7G0j3I0QoRtWIrXhZ+/Nlb5Q0MzqL7TokEJ5BNHg==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.16.7", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.17.10.tgz", + "integrity": "sha512-n2Q6i+fnJqzOaq2VkdXxy2TCPCWQZHiCo0XqmrCvDWcZQKRyZzYi4Z0yxlBuN0w+r2ZHmre+Q087DSrw3pbJDQ==", + "dev": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/template": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.7.tgz", + "integrity": "sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.16.7", + "@babel/parser": "^7.16.7", + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.17.10.tgz", + "integrity": "sha512-VmbrTHQteIdUUQNTb+zE12SHS/xQVIShmBPhlNP12hD5poF2pbITW1Z4172d03HegaQWhLffdkRJYtAzp0AGcw==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.17.10", + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-function-name": "^7.17.9", + "@babel/helper-hoist-variables": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/parser": "^7.17.10", + "@babel/types": "^7.17.10", + "debug": "^4.1.0", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@babel/traverse/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@babel/types": { + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.17.10.tgz", + "integrity": "sha512-9O26jG0mBYfGkUYCYZRnBwbVLd1UZOICEr2Em6InB6jVfsAv1GKgwXHmrSg+WFWDmeKTA6vyTZiN8tCSM5Oo3A==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.16.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dev": true, + "dependencies": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz", + "integrity": "sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.0.0", + "@jridgewell/sourcemap-codec": "^1.4.10" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.6.tgz", + "integrity": "sha512-R7xHtBSNm+9SyvpJkdQl+qrM3Hm2fea3Ef197M3mUug+v+yR+Rhfbs7PBtcBUVnIWJ4JcAdjvij+c8hXS9p5aw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.0.tgz", + "integrity": "sha512-SfJxIxNVYLTsKwzB3MoOQ1yxf4w/E6MdkvTgrgAt1bfxjSrLUoHMKrDOykwN14q65waezZIdqDneUIPh4/sKxg==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.12", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.12.tgz", + "integrity": "sha512-az/NhpIwP3K33ILr0T2bso+k2E/SLf8Yidd8mHl0n6sCQ4YdyC8qDhZA6kOPDNDBA56ZnIjngVl0U3jREA0BUA==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", + "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", + "dev": true + }, + "node_modules/aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "dependencies": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/align-text": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", + "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "dev": true, + "dependencies": { + "kind-of": "^3.0.2", + "longest": "^1.0.1", + "repeat-string": "^1.5.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/append-transform": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-2.0.0.tgz", + "integrity": "sha512-7yeyCEurROLQJFv5Xj4lEGTy0borxepjFv1g22oAdqFu//SrAlDl1O1Nxx15SH1RoliUml6p8dwJW9jvZughhg==", + "dev": true, + "dependencies": { + "default-require-extensions": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/archy": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", + "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=", + "dev": true + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/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, + "engines": { + "node": ">=8" + } + }, + "node_modules/bitsyntax": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/bitsyntax/-/bitsyntax-0.1.0.tgz", + "integrity": "sha512-ikAdCnrloKmFOugAfxWws89/fPc+nw0OOG1IzIE72uSOg/A3cYptKCjSUhDTuj7fhsJtzkzlv7l3b8PzRHLN0Q==", + "dependencies": { + "buffer-more-ints": "~1.0.0", + "debug": "~2.6.9", + "safe-buffer": "~5.1.2" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/bitsyntax/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "node_modules/boo": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/boo/-/boo-1.2.4.tgz", + "integrity": "sha1-szMxw2xK552C9P0ORJBgTLfFE7U=", + "dev": true + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "node_modules/browserslist": { + "version": "4.20.3", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.20.3.tgz", + "integrity": "sha512-NBhymBQl1zM0Y5dQT/O+xiLP9/rzOIQdKM/eMJBAq7yBgaB6krIYLGejrwVYnSHZdqjscB1SPuAjHwxjvN6Wdg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + } + ], + "dependencies": { + "caniuse-lite": "^1.0.30001332", + "electron-to-chromium": "^1.4.118", + "escalade": "^3.1.1", + "node-releases": "^2.0.3", + "picocolors": "^1.0.0" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/buffer-more-ints": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-more-ints/-/buffer-more-ints-1.0.0.tgz", + "integrity": "sha512-EMetuGFz5SLsT0QTnXzINh4Ksr+oo4i+UGTXEshiGCQWnsgSs7ZhJ8fzlwQ+OzEMs0MpDAMr1hxnblp5a4vcHg==" + }, + "node_modules/caching-transform": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz", + "integrity": "sha512-kpqOvwXnjjN44D89K5ccQC+RUrsy7jB/XLlRrx0D7/2HNcTPqzsb6XgYoErwko6QsV184CA2YgS1fxDiiDZMWA==", + "dev": true, + "dependencies": { + "hasha": "^5.0.0", + "make-dir": "^3.0.0", + "package-hash": "^4.0.0", + "write-file-atomic": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/camelcase": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001336", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001336.tgz", + "integrity": "sha512-/YxSlBmL7iKXTbIJ48IQTnAOBk7XmWsxhBF1PZLOko5Dt9qc4Pl+84lfqG3Tc4EuavurRn1QLoVJGxY2iSycfw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + } + ] + }, + "node_modules/center-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", + "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", + "dev": true, + "dependencies": { + "align-text": "^0.1.3", + "lazy-cache": "^1.0.3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/claire": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/claire/-/claire-0.4.1.tgz", + "integrity": "sha1-ynDcEmHd2PJaGvq604BcOfziY7w=", + "dev": true, + "dependencies": { + "boo": "~1.2.4", + "flaw": "~0.1.0", + "prelude-ls": "~0.6.0" + } + }, + "node_modules/clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/cliui": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", + "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", + "dev": true, + "dependencies": { + "center-align": "^0.1.1", + "right-align": "^0.1.1", + "wordwrap": "0.0.2" + } + }, + "node_modules/cliui/node_modules/wordwrap": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "node_modules/convert-source-map": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", + "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.1" + } + }, + "node_modules/core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/cross-spawn/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/default-require-extensions": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-3.0.0.tgz", + "integrity": "sha512-ek6DpXq/SCpvjhpFsLFRVtIxJCRw6fUR42lYMVZuUMK7n8eMz4Uh5clckdBjEpLhn/gEBZo7hDJnJcwdKLKQjg==", + "dev": true, + "dependencies": { + "strip-bom": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.4.134", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.134.tgz", + "integrity": "sha512-OdD7M2no4Mi8PopfvoOuNcwYDJ2mNFxaBfurA6okG3fLBaMcFah9S+si84FhX+FIWLKkdaiHfl4A+5ep/gOVrg==", + "dev": true + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/es6-error": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", + "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", + "dev": true + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-cache-dir": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", + "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", + "dev": true, + "dependencies": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/avajs/find-cache-dir?sponsor=1" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true, + "bin": { + "flat": "cli.js" + } + }, + "node_modules/flaw": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/flaw/-/flaw-0.1.0.tgz", + "integrity": "sha1-wMPo+BYWdTh+2tofbOhNZ5sCUn8=", + "dev": true + }, + "node_modules/foreground-child": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", + "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/fromentries": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fromentries/-/fromentries-1.3.2.tgz", + "integrity": "sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", + "dev": true + }, + "node_modules/growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true, + "engines": { + "node": ">=4.x" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/hasha": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.2.tgz", + "integrity": "sha512-Hrp5vIK/xr5SkeN2onO32H0MgNZ0f17HRNH39WfL0SYUNOTZ5Lz1TJ8Pajo/87dYGEFlLMm7mIc/k/s6Bvz9HQ==", + "dev": true, + "dependencies": { + "is-stream": "^2.0.0", + "type-fest": "^0.8.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true, + "bin": { + "he": "bin/he" + } + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", + "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-hook": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-3.0.0.tgz", + "integrity": "sha512-Pt/uge1Q9s+5VAZ+pCo16TYMWPBIl+oaNIjgLQxcX0itS6ueeaA+pEfThZpH8WxhFgCiEb8sAJY6MdUKgiIWaQ==", + "dev": true, + "dependencies": { + "append-transform": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-instrument": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz", + "integrity": "sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ==", + "dev": true, + "dependencies": { + "@babel/core": "^7.7.5", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.0.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-processinfo": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-processinfo/-/istanbul-lib-processinfo-2.0.2.tgz", + "integrity": "sha512-kOwpa7z9hme+IBPZMzQ5vdQj8srYgAtaRqeI48NGmAQ+/5yKiHLV0QbYqQpxsdEF0+w14SoB8YbnHKcXE2KnYw==", + "dev": true, + "dependencies": { + "archy": "^1.0.0", + "cross-spawn": "^7.0.0", + "istanbul-lib-coverage": "^3.0.0-alpha.1", + "make-dir": "^3.0.0", + "p-map": "^3.0.0", + "rimraf": "^3.0.0", + "uuid": "^3.3.3" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "dev": true, + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-source-maps/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/istanbul-lib-source-maps/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/istanbul-lib-source-maps/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/istanbul-reports": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.4.tgz", + "integrity": "sha512-r1/DshN4KSE7xWEknZLLLLDn5CJybV3nw01VTkp6D5jzLuELlcbudfj/eSQFvrKsJuTVCGnePO7ho82Nw9zzfw==", + "dev": true, + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/js-yaml/node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/json5": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", + "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", + "dev": true, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "dependencies": { + "is-buffer": "^1.1.5" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/lazy-cache": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash.flattendeep": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", + "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", + "dev": true + }, + "node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-symbols/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/log-symbols/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/log-symbols/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/log-symbols/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/log-symbols/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/longest": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimatch": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-4.2.1.tgz", + "integrity": "sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/mocha": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.2.2.tgz", + "integrity": "sha512-L6XC3EdwT6YrIk0yXpavvLkn8h+EU+Y5UcCHKECyMbdUIxyMuZj4bX4U9e1nvnvUUvQVsV2VHQr5zLdcUkhW/g==", + "dev": true, + "dependencies": { + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.3", + "debug": "4.3.3", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.2.0", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", + "minimatch": "4.2.1", + "ms": "2.1.3", + "nanoid": "3.3.1", + "serialize-javascript": "6.0.0", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "which": "2.0.2", + "workerpool": "6.2.0", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mochajs" + } + }, + "node_modules/mocha/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/mocha/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/mocha/node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/mocha/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/mocha/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/mocha/node_modules/debug": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/mocha/node_modules/debug/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/mocha/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/mocha/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/mocha/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/mocha/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/mocha/node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/mocha/node_modules/yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "node_modules/nanoid": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz", + "integrity": "sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==", + "dev": true, + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/node-preload": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/node-preload/-/node-preload-0.2.1.tgz", + "integrity": "sha512-RM5oyBy45cLEoHqCeh+MNuFAxO0vTFBLskvQbOKnEE7YTTSN4tbN8QWDIPQ6L+WvKsB/qLEGpYe2ZZ9d4W9OIQ==", + "dev": true, + "dependencies": { + "process-on-spawn": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/node-releases": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.4.tgz", + "integrity": "sha512-gbMzqQtTtDz/00jQzZ21PQzdI9PyLYqUSvD0p3naOhX4odFji0ZxYdnVwPTxmSwkmxhcFImpozceidSG+AgoPQ==", + "dev": true + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/nyc": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/nyc/-/nyc-15.1.0.tgz", + "integrity": "sha512-jMW04n9SxKdKi1ZMGhvUTHBN0EICCRkHemEoE5jm6mTYcqcdas0ATzgUgejlQUHMvpnOZqGB5Xxsv9KxJW1j8A==", + "dev": true, + "dependencies": { + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "caching-transform": "^4.0.0", + "convert-source-map": "^1.7.0", + "decamelize": "^1.2.0", + "find-cache-dir": "^3.2.0", + "find-up": "^4.1.0", + "foreground-child": "^2.0.0", + "get-package-type": "^0.1.0", + "glob": "^7.1.6", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-hook": "^3.0.0", + "istanbul-lib-instrument": "^4.0.0", + "istanbul-lib-processinfo": "^2.0.2", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.0.2", + "make-dir": "^3.0.0", + "node-preload": "^0.2.1", + "p-map": "^3.0.0", + "process-on-spawn": "^1.0.0", + "resolve-from": "^5.0.0", + "rimraf": "^3.0.0", + "signal-exit": "^3.0.2", + "spawn-wrap": "^2.0.0", + "test-exclude": "^6.0.0", + "yargs": "^15.0.2" + }, + "bin": { + "nyc": "bin/nyc.js" + }, + "engines": { + "node": ">=8.9" + } + }, + "node_modules/nyc/node_modules/cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "node_modules/nyc/node_modules/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/nyc/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/nyc/node_modules/yargs": { + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "dev": true, + "dependencies": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-map": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", + "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", + "dev": true, + "dependencies": { + "aggregate-error": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/package-hash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/package-hash/-/package-hash-4.0.0.tgz", + "integrity": "sha512-whdkPIooSu/bASggZ96BWVvZTRMOFxnyUG5PnTSGKoJE2gd5mbVNmR2Nj20QFzxYYgAXpoqC+AiXzl+UMRh7zQ==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.15", + "hasha": "^5.0.0", + "lodash.flattendeep": "^4.4.0", + "release-zalgo": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/prelude-ls": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-0.6.0.tgz", + "integrity": "sha1-z4JLS0fMc8vZb56YhQc7Q6rqqzs=", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/process-on-spawn": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/process-on-spawn/-/process-on-spawn-1.0.0.tgz", + "integrity": "sha512-1WsPDsUSMmZH5LeMLegqkPDrsGgsWwk1Exipy2hvB0o/F0ASzbpIctSCcZIK1ykJvtTJULEH+20WOFjMvGnCTg==", + "dev": true, + "dependencies": { + "fromentries": "^1.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/readable-stream": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/release-zalgo": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/release-zalgo/-/release-zalgo-1.0.0.tgz", + "integrity": "sha1-CXALflB0Mpc5Mw5TXFqQ+2eFFzA=", + "dev": true, + "dependencies": { + "es6-error": "^4.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/right-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", + "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", + "dev": true, + "dependencies": { + "align-text": "^0.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "dev": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "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 + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/spawn-wrap": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-2.0.0.tgz", + "integrity": "sha512-EeajNjfN9zMnULLwhZZQU3GWBoFNkbngTUPfaawT4RkMiviTxcX0qfhVbGey39mfctfDHkWtuecgQ8NJcyQWHg==", + "dev": true, + "dependencies": { + "foreground-child": "^2.0.0", + "is-windows": "^1.0.2", + "make-dir": "^3.0.0", + "rimraf": "^3.0.0", + "signal-exit": "^3.0.2", + "which": "^2.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/spawn-wrap/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "node_modules/string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/test-exclude/node_modules/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/test-exclude/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dev": true, + "dependencies": { + "is-typedarray": "^1.0.0" + } + }, + "node_modules/uglify-js": { + "version": "2.8.29", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", + "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", + "dev": true, + "dependencies": { + "source-map": "~0.5.1", + "yargs": "~3.10.0" + }, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + }, + "optionalDependencies": { + "uglify-to-browserify": "~1.0.0" + } + }, + "node_modules/uglify-js/node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/uglify-to-browserify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", + "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", + "dev": true, + "optional": true + }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "node_modules/uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", + "dev": true, + "bin": { + "uuid": "bin/uuid" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "node_modules/window-size": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", + "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/workerpool": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz", + "integrity": "sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A==", + "dev": true + }, + "node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/wrap-ansi/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "node_modules/write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "dev": true, + "dependencies": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, + "node_modules/y18n": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", + "dev": true + }, + "node_modules/yargs": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", + "dev": true, + "dependencies": { + "camelcase": "^1.0.2", + "cliui": "^2.1.0", + "decamelize": "^1.0.0", + "window-size": "0.1.0" + } + }, + "node_modules/yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dev": true, + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/yargs-parser/node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dev": true, + "dependencies": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-unparser/node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/yargs-unparser/node_modules/decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + }, "dependencies": { "@ampproject/remapping": { "version": "2.2.0", @@ -435,11 +3330,6 @@ } } }, - "bluebird": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", - "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" - }, "boo": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/boo/-/boo-1.2.4.tgz", @@ -1875,6 +4765,11 @@ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + }, "string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -1886,11 +4781,6 @@ "strip-ansi": "^6.0.1" } }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - }, "strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", diff --git a/package.json b/package.json index cb1a5543..fab9d104 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,6 @@ }, "dependencies": { "bitsyntax": "~0.1.0", - "bluebird": "^3.7.2", "buffer-more-ints": "~1.0.0", "readable-stream": "1.x >=1.1.9", "url-parse": "~1.5.10" diff --git a/test/channel.js b/test/channel.js index 47cbc7ba..afe65f5b 100644 --- a/test/channel.js +++ b/test/channel.js @@ -3,7 +3,7 @@ 'use strict'; var assert = require('assert'); -var Promise = require('bluebird'); +var promisify = require('util').promisify; var Channel = require('../lib/channel').Channel; var Connection = require('../lib/connection').Connection; var util = require('./util'); @@ -75,13 +75,11 @@ var DELIVER_FIELDS = { replyText: 'derp', }; -function open(ch) { - return Promise.try(function() { - ch.allocate(); - return Promise.fromCallback(function(cb) { - ch._rpc(defs.ChannelOpen, {outOfBand: ''}, defs.ChannelOpenOk, cb); - }); - }); +async function open(ch) { + ch.allocate(); + return promisify(function(cb) { + ch._rpc(defs.ChannelOpen, {outOfBand: ''}, defs.ChannelOpenOk, cb); + })(); } suite("channel open and close", function() { @@ -285,7 +283,7 @@ test("RPC on closed channel", channelTest( failureCb(resolve, reject)); }); - Promise.join(close, fail1, fail2) + Promise.all([close, fail1, fail2]) .then(succeed(done)) .catch(fail(done)); }, diff --git a/test/channel_api.js b/test/channel_api.js index 316070c8..b4952e27 100644 --- a/test/channel_api.js +++ b/test/channel_api.js @@ -6,7 +6,7 @@ var util = require('./util'); var succeed = util.succeed, fail = util.fail; var schedule = util.schedule; var randomString = util.randomString; -var Promise = require('bluebird'); +var promisify = require('util').promisify; var URL = process.env.URL || 'amqp://localhost'; @@ -118,9 +118,9 @@ chtest("channel break on publishing to non-exchange", function(ch) { chtest("delete queue", function(ch) { var q = 'test.delete-queue'; - return Promise.join( + return Promise.all([ ch.assertQueue(q, QUEUE_OPTS), - ch.checkQueue(q)) + ch.checkQueue(q)]) .then(function() { return ch.deleteQueue(q);}) .then(function() { @@ -129,9 +129,9 @@ chtest("delete queue", function(ch) { chtest("delete exchange", function(ch) { var ex = 'test.delete-exchange'; - return Promise.join( + return Promise.all([ ch.assertExchange(ex, 'fanout', EX_OPTS), - ch.checkExchange(ex)) + ch.checkExchange(ex)]) .then(function() { return ch.deleteExchange(ex);}) .then(function() { @@ -177,7 +177,7 @@ suite("sendMessage", function() { chtest("send to queue and get from queue", function(ch) { var q = 'test.send-to-q'; var msg = randomString(); - return Promise.join(ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q)) + return Promise.all([ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q)]) .then(function() { ch.sendToQueue(q, Buffer.from(msg)); return waitForMessages(q); @@ -194,9 +194,9 @@ chtest("send to queue and get from queue", function(ch) { chtest("send (and get) zero content to queue", function(ch) { var q = 'test.send-to-q'; var msg = Buffer.alloc(0); - return Promise.join( + return Promise.all([ ch.assertQueue(q, QUEUE_OPTS), - ch.purgeQueue(q)) + ch.purgeQueue(q)]) .then(function() { ch.sendToQueue(q, msg); return waitForMessages(q);}) @@ -218,11 +218,11 @@ chtest("route message", function(ch) { var q = 'test.route-message-q'; var msg = randomString(); - return Promise.join( + return Promise.all([ ch.assertExchange(ex, 'fanout', EX_OPTS), ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q), - ch.bindQueue(q, ex, '', {})) + ch.bindQueue(q, ex, '', {})]) .then(function() { ch.publish(ex, '', Buffer.from(msg)); return waitForMessages(q);}) @@ -256,11 +256,11 @@ chtest("unbind queue", function(ch) { var viabinding = randomString(); var direct = randomString(); - return Promise.join( + return Promise.all([ ch.assertExchange(ex, 'fanout', EX_OPTS), ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q), - ch.bindQueue(q, ex, '', {})) + ch.bindQueue(q, ex, '', {})]) .then(function() { ch.publish(ex, '', Buffer.from('foobar')); return waitForMessages(q);}) @@ -289,14 +289,14 @@ chtest("consume via exchange-exchange binding", function(ch) { var ex1 = 'test.ex-ex-binding1', ex2 = 'test.ex-ex-binding2'; var q = 'test.ex-ex-binding-q'; var rk = 'test.routing.key', msg = randomString(); - return Promise.join( + return Promise.all([ ch.assertExchange(ex1, 'direct', EX_OPTS), ch.assertExchange(ex2, 'fanout', {durable: false, internal: true}), ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q), ch.bindExchange(ex2, ex1, rk, {}), - ch.bindQueue(q, ex2, '', {})) + ch.bindQueue(q, ex2, '', {})]) .then(function() { return new Promise(function(resolve, reject) { function delivery(m) { @@ -319,13 +319,13 @@ chtest("unbind exchange", function(ch) { var viabinding = randomString(); var direct = randomString(); - return Promise.join( + return Promise.all([ ch.assertExchange(source, 'fanout', EX_OPTS), ch.assertExchange(dest, 'fanout', EX_OPTS), ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q), ch.bindExchange(dest, source, '', {}), - ch.bindQueue(q, dest, '', {})) + ch.bindQueue(q, dest, '', {})]) .then(function() { ch.publish(source, '', Buffer.from('foobar')); return waitForMessages(q);}) @@ -353,7 +353,7 @@ chtest("cancel consumer", function(ch) { var q = 'test.consumer-cancel'; var ctag; var recv1 = new Promise(function (resolve, reject) { - Promise.join( + Promise.all([ ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q), // My callback is 'resolve the promise in `arrived`' @@ -361,17 +361,17 @@ chtest("cancel consumer", function(ch) { .then(function(ok) { ctag = ok.consumerTag; ch.sendToQueue(q, Buffer.from('foo')); - })); + })]); }); // A message should arrive because of the consume return recv1.then(function() { - var recv2 = Promise.join( + var recv2 = Promise.all([ ch.cancel(ctag).then(function() { return ch.sendToQueue(q, Buffer.from('bar')); }), // but check a message did arrive in the queue - waitForMessages(q)) + waitForMessages(q)]) .then(function() { return ch.get(q, {noAck:true}); }) @@ -390,13 +390,13 @@ chtest("cancel consumer", function(ch) { chtest("cancelled consumer", function(ch) { var q = 'test.cancelled-consumer'; return new Promise(function(resolve, reject) { - return Promise.join( + return Promise.all([ ch.assertQueue(q), ch.purgeQueue(q), ch.consume(q, function(msg) { if (msg === null) resolve(); else reject(new Error('Message not expected')); - })) + })]) .then(function() { return ch.deleteQueue(q); }); @@ -408,9 +408,9 @@ chtest("ack", function(ch) { var q = 'test.ack'; var msg1 = randomString(), msg2 = randomString(); - return Promise.join( + return Promise.all([ ch.assertQueue(q, QUEUE_OPTS), - ch.purgeQueue(q)) + ch.purgeQueue(q)]) .then(function() { ch.sendToQueue(q, Buffer.from(msg1)); ch.sendToQueue(q, Buffer.from(msg2)); @@ -438,8 +438,8 @@ chtest("nack", function(ch) { var q = 'test.nack'; var msg1 = randomString(); - return Promise.join( - ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q)) + return Promise.all([ + ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q)]) .then(function() { ch.sendToQueue(q, Buffer.from(msg1)); return waitForMessages(q);}) @@ -463,8 +463,8 @@ chtest("reject", function(ch) { var q = 'test.reject'; var msg1 = randomString(); - return Promise.join( - ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q)) + return Promise.all([ + ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q)]) .then(function() { ch.sendToQueue(q, Buffer.from(msg1)); return waitForMessages(q);}) @@ -484,9 +484,9 @@ chtest("reject", function(ch) { chtest("prefetch", function(ch) { var q = 'test.prefetch'; - return Promise.join( + return Promise.all([ ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q), - ch.prefetch(1)) + ch.prefetch(1)]) .then(function() { ch.sendToQueue(q, Buffer.from('foobar')); ch.sendToQueue(q, Buffer.from('foobar')); @@ -523,8 +523,8 @@ suite("confirms", function() { confirmtest('message is confirmed', function(ch) { var q = 'test.confirm-message'; - return Promise.join( - ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q)) + return Promise.all([ + ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q)]) .then(function() { return ch.sendToQueue(q, Buffer.from('bleep')); }); @@ -537,8 +537,8 @@ confirmtest('message is confirmed', function(ch) { // multi-ack. confirmtest('multiple confirms', function(ch) { var q = 'test.multiple-confirms'; - return Promise.join( - ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q)) + return Promise.all([ + ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q)]) .then(function() { var multipleRainbows = false; ch.on('ack', function(a) { @@ -549,9 +549,9 @@ confirmtest('multiple confirms', function(ch) { var cs = []; function sendAndPushPromise() { - var conf = Promise.fromCallback(function(cb) { + var conf = promisify(function(cb) { return ch.sendToQueue(q, Buffer.from('bleep'), {}, cb); - }); + })(); cs.push(conf); } diff --git a/test/util.js b/test/util.js index a41a8eb3..0cc8122d 100644 --- a/test/util.js +++ b/test/util.js @@ -1,6 +1,5 @@ 'use strict'; -var Promise = require('bluebird'); var crypto = require('crypto'); var Connection = require('../lib/connection').Connection; var PassThrough = From 0201e89755f105f5d54caea048933c95b11f91ff Mon Sep 17 00:00:00 2001 From: Mohamed Akram Date: Mon, 23 May 2022 14:54:50 +0400 Subject: [PATCH 060/112] Address review comments --- lib/channel_model.js | 8 +++++++- test/channel.js | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/channel_model.js b/lib/channel_model.js index cc3bc87f..383f250a 100644 --- a/lib/channel_model.js +++ b/lib/channel_model.js @@ -282,11 +282,17 @@ class ConfirmChannel extends Channel { if (err === null) resolve(); else reject(err); }; - if (!this.pending) unconfirmed[index](new Error('channel closed')) }); awaiting.push(confirmed); } }); + // Channel closed + if (!this.pending) { + var cb; + while (cb = this.unconfirmed.shift()) { + if (cb) cb(new Error('channel closed')); + } + } return Promise.all(awaiting); } } diff --git a/test/channel.js b/test/channel.js index afe65f5b..03657ce7 100644 --- a/test/channel.js +++ b/test/channel.js @@ -75,7 +75,7 @@ var DELIVER_FIELDS = { replyText: 'derp', }; -async function open(ch) { +function open(ch) { ch.allocate(); return promisify(function(cb) { ch._rpc(defs.ChannelOpen, {outOfBand: ''}, defs.ChannelOpenOk, cb); From 1230f1411c279b3871604457eb384aa30fff3acd Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Thu, 2 Jun 2022 14:12:23 +0100 Subject: [PATCH 061/112] Update CHANGELOG --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bf7ac59..68a94269 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change log for amqplib +## Chagnes in v0.10.0 + * Use Native promises ([PR + 689](https://github.com/amqp-node/amqplib/pull/689), thank you + @mohd-akram and @kibertoad) + ## Changes in v0.9.1 git log v0.9.0..v0.9.1 From 876ddc890e648e483c3939527dff54d6f7817209 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Thu, 2 Jun 2022 14:15:06 +0100 Subject: [PATCH 062/112] 0.10.0 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0dec4570..decc1139 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "amqplib", - "version": "0.9.1", + "version": "0.10.0", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index fab9d104..867620a4 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "amqplib", "homepage": "http://amqp-node.github.io/amqplib/", "main": "./channel_api.js", - "version": "0.9.1", + "version": "0.10.0", "description": "An AMQP 0-9-1 (e.g., RabbitMQ) library and client.", "repository": { "type": "git", From d02216d197fa7d407aa01f5a8fe85bfd3e74adf0 Mon Sep 17 00:00:00 2001 From: Steve Cresswell <229672+cressie176@users.noreply.github.com> Date: Tue, 26 Jul 2022 21:24:59 +0100 Subject: [PATCH 063/112] Allow servername to be specified via socket options --- CHANGELOG.md | 12 +++++++++++- lib/connect.js | 4 ++-- package-lock.json | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68a94269..75c89c6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,16 @@ # Change log for amqplib -## Chagnes in v0.10.0 +## Changes in v0.10.1 + + git log v0.9.1..v0.10.0 + + * Allow servername to be specified via socket options as discussed in as discussed in + [issue 697](https://github.com/squaremo/amqp.node/issues/697) + +## Changes in v0.10.0 + + git log v0.9.1..v0.10.0 + * Use Native promises ([PR 689](https://github.com/amqp-node/amqplib/pull/689), thank you @mohd-akram and @kibertoad) diff --git a/lib/connect.js b/lib/connect.js index 478dd76c..afbefadf 100644 --- a/lib/connect.js +++ b/lib/connect.js @@ -106,7 +106,7 @@ function connect(url, socketOptions, openCallback) { if (typeof url === 'object') { protocol = (url.protocol || 'amqp') + ':'; sockopts.host = url.hostname; - sockopts.servername = url.hostname; + sockopts.servername = sockopts.servername || url.hostname; sockopts.port = url.port || ((protocol === 'amqp:') ? 5672 : 5671); var user, pass; @@ -131,7 +131,7 @@ function connect(url, socketOptions, openCallback) { var parts = URL(url, true); // yes, parse the query string protocol = parts.protocol; sockopts.host = parts.hostname; - sockopts.servername = parts.hostname; + sockopts.servername = sockopts.servername || parts.hostname; sockopts.port = parseInt(parts.port) || ((protocol === 'amqp:') ? 5672 : 5671); var vhost = parts.pathname ? parts.pathname.substr(1) : null; fields = openFrames(vhost, parts.query, sockopts.credentials || credentialsFromUrl(parts), extraClientProperties); diff --git a/package-lock.json b/package-lock.json index decc1139..52e39d5b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "amqplib", - "version": "0.9.1", + "version": "0.10.0", "license": "MIT", "dependencies": { "bitsyntax": "~0.1.0", From 54460ea4f4029b558a317bd916405bc9173ae38a Mon Sep 17 00:00:00 2001 From: Steve Cresswell <229672+cressie176@users.noreply.github.com> Date: Tue, 26 Jul 2022 21:29:03 +0100 Subject: [PATCH 064/112] Fix changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75c89c6a..bd5a2876 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Changes in v0.10.1 - git log v0.9.1..v0.10.0 + git log v0.10.0..v0.10.1 * Allow servername to be specified via socket options as discussed in as discussed in [issue 697](https://github.com/squaremo/amqp.node/issues/697) From ebd125d0ae76290d2159616aa30c667551b0f2ef Mon Sep 17 00:00:00 2001 From: Steve Cresswell <229672+cressie176@users.noreply.github.com> Date: Tue, 26 Jul 2022 21:29:42 +0100 Subject: [PATCH 065/112] 0.10.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 52e39d5b..bbc23087 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "amqplib", - "version": "0.10.0", + "version": "0.10.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "amqplib", - "version": "0.10.0", + "version": "0.10.1", "license": "MIT", "dependencies": { "bitsyntax": "~0.1.0", diff --git a/package.json b/package.json index 867620a4..f0e005f8 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "amqplib", "homepage": "http://amqp-node.github.io/amqplib/", "main": "./channel_api.js", - "version": "0.10.0", + "version": "0.10.1", "description": "An AMQP 0-9-1 (e.g., RabbitMQ) library and client.", "repository": { "type": "git", From a98ad81ac97c62f20481c649e8097cbecaafb38a Mon Sep 17 00:00:00 2001 From: Chad Kimes <1936066+chkimes@users.noreply.github.com> Date: Wed, 13 Jul 2022 10:19:53 -0400 Subject: [PATCH 066/112] Use Buffer.allocUnsafe to reduce allocations --- lib/connection.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/connection.js b/lib/connection.js index 22a73332..10acf607 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -560,7 +560,7 @@ C.sendMessage = function(channel, var allLen = methodHeaderLen + bodyLen; if (allLen < SINGLE_CHUNK_THRESHOLD) { - var all = Buffer.alloc(allLen); + var all = Buffer.allocUnsafe(allLen); var offset = mframe.copy(all, 0); offset += pframe.copy(all, offset); @@ -570,7 +570,7 @@ C.sendMessage = function(channel, } else { if (methodHeaderLen < SINGLE_CHUNK_THRESHOLD) { - var both = Buffer.alloc(methodHeaderLen); + var both = Buffer.allocUnsafe(methodHeaderLen); var offset = mframe.copy(both, 0); pframe.copy(both, offset); buffer.write(both); From 2b32550865c1e5fb47a2ae970c70587b8a3189a3 Mon Sep 17 00:00:00 2001 From: Chad Kimes <1936066+chkimes@users.noreply.github.com> Date: Thu, 4 Aug 2022 13:49:30 -0400 Subject: [PATCH 067/112] Update connection.js --- lib/connection.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/connection.js b/lib/connection.js index 10acf607..19cbcaa8 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -560,6 +560,9 @@ C.sendMessage = function(channel, var allLen = methodHeaderLen + bodyLen; if (allLen < SINGLE_CHUNK_THRESHOLD) { + // Use `allocUnsafe` to avoid excessive allocations and CPU usage + // from zeroing. The returned Buffer is not zeroed and so must be + // completely filled to be used safely. var all = Buffer.allocUnsafe(allLen); var offset = mframe.copy(all, 0); offset += pframe.copy(all, offset); @@ -570,6 +573,9 @@ C.sendMessage = function(channel, } else { if (methodHeaderLen < SINGLE_CHUNK_THRESHOLD) { + // Use `allocUnsafe` to avoid excessive allocations and CPU usage + // from zeroing. The returned Buffer is not zeroed and so must be + // completely filled to be used safely. var both = Buffer.allocUnsafe(methodHeaderLen); var offset = mframe.copy(both, 0); pframe.copy(both, offset); From 85e90511c068893aa11858bd0e643a9872ceeb83 Mon Sep 17 00:00:00 2001 From: Steve Cresswell <229672+cressie176@users.noreply.github.com> Date: Sun, 7 Aug 2022 09:45:48 +0100 Subject: [PATCH 068/112] Link to PR from allocUnsafe comment --- lib/connection.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/connection.js b/lib/connection.js index 19cbcaa8..c60243ff 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -563,6 +563,7 @@ C.sendMessage = function(channel, // Use `allocUnsafe` to avoid excessive allocations and CPU usage // from zeroing. The returned Buffer is not zeroed and so must be // completely filled to be used safely. + // See https://github.com/amqp-node/amqplib/pull/695 var all = Buffer.allocUnsafe(allLen); var offset = mframe.copy(all, 0); offset += pframe.copy(all, offset); @@ -576,6 +577,7 @@ C.sendMessage = function(channel, // Use `allocUnsafe` to avoid excessive allocations and CPU usage // from zeroing. The returned Buffer is not zeroed and so must be // completely filled to be used safely. + // See https://github.com/amqp-node/amqplib/pull/695 var both = Buffer.allocUnsafe(methodHeaderLen); var offset = mframe.copy(both, 0); pframe.copy(both, offset); From 27b1e8e7b506ad71d7f2971675896ed3b04f1224 Mon Sep 17 00:00:00 2001 From: Steve Cresswell <229672+cressie176@users.noreply.github.com> Date: Sun, 7 Aug 2022 09:46:28 +0100 Subject: [PATCH 069/112] Update CHANGELOG --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd5a2876..3fa42de2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Change log for amqplib +## Changes in v0.10.2 + + git log v0.10.1..v0.10.2 + +- Use Buffer.allocUnsafe when sending messages to improve performance ([PR + 695](https://github.com/amqp-node/amqplib/pull/695), thank you + @chkimes and @Uzlopak) + ## Changes in v0.10.1 git log v0.10.0..v0.10.1 From 2d324b7b85385b6251893587aaa42f14b7916d03 Mon Sep 17 00:00:00 2001 From: Steve Cresswell <229672+cressie176@users.noreply.github.com> Date: Sun, 7 Aug 2022 09:48:43 +0100 Subject: [PATCH 070/112] 0.10.2 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index bbc23087..225b86e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "amqplib", - "version": "0.10.1", + "version": "0.10.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "amqplib", - "version": "0.10.1", + "version": "0.10.2", "license": "MIT", "dependencies": { "bitsyntax": "~0.1.0", diff --git a/package.json b/package.json index f0e005f8..3a3ceab3 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "amqplib", "homepage": "http://amqp-node.github.io/amqplib/", "main": "./channel_api.js", - "version": "0.10.1", + "version": "0.10.2", "description": "An AMQP 0-9-1 (e.g., RabbitMQ) library and client.", "repository": { "type": "git", From c160cce1790858c77a4ea1178c5b5d30050afdfe Mon Sep 17 00:00:00 2001 From: Steve Cresswell <229672+cressie176@users.noreply.github.com> Date: Wed, 10 Aug 2022 21:20:04 +0100 Subject: [PATCH 071/112] Experiment with issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..a4d5dea9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,36 @@ +--- +name: Bug report / Support request +about: Report a bug or ask for help +title: '' +labels: '' +assignees: '' + +--- + +Before reporting a bug or requesting support please + +1. Read the troubleshooting guide (https://amqp-node.github.io/amqplib/#troubleshooting) +2. Search the existing open and closed issues for similar questions + +If you are new to amqplib then please familiarise yourself with the channel api documentation + +- https://amqp-node.github.io/amqplib/channel_api.html + +If you are new to RabbitMQ then the following articles may be helpful + +- https://www.cloudamqp.com/blog/part1-rabbitmq-for-beginners-what-is-rabbitmq.html +- https://www.rabbitmq.com/tutorials/amqp-concepts.html + +If the above does not help, please provide the following information... + +- A clear and concise description of what the bug is. +- RabbitMQ version +- amqplib version + +If you include code snippets, please take the time to format them for they are easier to read + +- https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks + +Thank you + + From 038524b10c403cc45df4dd8a32d8f10a8e129202 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Wed, 10 Aug 2022 21:24:24 +0100 Subject: [PATCH 072/112] Update bug_report.md --- .github/ISSUE_TEMPLATE/bug_report.md | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index a4d5dea9..7cd76373 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -7,25 +7,27 @@ assignees: '' --- -Before reporting a bug or requesting support please +Before reporting a bug or requesting support please... -1. Read the troubleshooting guide (https://amqp-node.github.io/amqplib/#troubleshooting) -2. Search the existing open and closed issues for similar questions +1. Read the troubleshooting guide -If you are new to amqplib then please familiarise yourself with the channel api documentation + - https://amqp-node.github.io/amqplib/#troubleshooting -- https://amqp-node.github.io/amqplib/channel_api.html +2. Search for existing open and closed issues -If you are new to RabbitMQ then the following articles may be helpful + - https://github.com/amqp-node/amqplib/issues?q=is%3Aissue+TYPE+YOUR+KEYWORDS+HERE -- https://www.cloudamqp.com/blog/part1-rabbitmq-for-beginners-what-is-rabbitmq.html -- https://www.rabbitmq.com/tutorials/amqp-concepts.html +3. Ensure you are familiar with the amqplib Channel API and RabbitMQ basics + + - https://amqp-node.github.io/amqplib/channel_api.html + - https://www.cloudamqp.com/blog/part1-rabbitmq-for-beginners-what-is-rabbitmq.html + - https://www.rabbitmq.com/tutorials/amqp-concepts.html If the above does not help, please provide the following information... -- A clear and concise description of what the bug is. -- RabbitMQ version -- amqplib version + - A clear and concise description of what the bug is. + - RabbitMQ version + - amqplib version If you include code snippets, please take the time to format them for they are easier to read From 267fe5af141daca1401b5910fcbe42f220821232 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Wed, 10 Aug 2022 21:25:43 +0100 Subject: [PATCH 073/112] Update bug_report.md --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 7cd76373..3f0ba9c5 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -29,7 +29,7 @@ If the above does not help, please provide the following information... - RabbitMQ version - amqplib version -If you include code snippets, please take the time to format them for they are easier to read +If you include code snippets, please format them so they are easier to read - https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks From 0f83f307320d07656a0c41e577c979469e5df2ed Mon Sep 17 00:00:00 2001 From: Steve Cresswell <229672+cressie176@users.noreply.github.com> Date: Thu, 1 Sep 2022 07:35:29 +0100 Subject: [PATCH 074/112] Use @acuminous/bitsytnax fork --- CHANGELOG.md | 6 ++ lib/frame.js | 2 +- package-lock.json | 220 ++++++++++------------------------------------ package.json | 2 +- 4 files changed, 56 insertions(+), 174 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fa42de2..2ee4e226 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change log for amqplib +## Changes in v0.10.3 + + git log v0.10.2..v0.10.3 + +- Use @acuminous/bitsyntax fork. See https://github.com/amqp-node/amqplib/issues/453 + ## Changes in v0.10.2 git log v0.10.1..v0.10.2 diff --git a/lib/frame.js b/lib/frame.js index f96dfa8e..ad0ea090 100644 --- a/lib/frame.js +++ b/lib/frame.js @@ -8,7 +8,7 @@ var defs = require('./defs'); var constants = defs.constants; var decode = defs.decode; -var Bits = require('bitsyntax'); +var Bits = require('@acuminous/bitsyntax'); module.exports.PROTOCOL_HEADER = "AMQP" + String.fromCharCode(0, 0, 9, 1); diff --git a/package-lock.json b/package-lock.json index 225b86e2..6e33095a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.10.2", "license": "MIT", "dependencies": { - "bitsyntax": "~0.1.0", + "@acuminous/bitsyntax": "^0.1.1", "buffer-more-ints": "~1.0.0", "readable-stream": "1.x >=1.1.9", "url-parse": "~1.5.10" @@ -24,6 +24,19 @@ "node": ">=10" } }, + "node_modules/@acuminous/bitsyntax": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@acuminous/bitsyntax/-/bitsyntax-0.1.1.tgz", + "integrity": "sha512-0TJeI9G340fziOaPGICSFNbff6dlC336orDVZapZYd0KTS6TO/0yV2UkYVOVUotB4/bz+O6xgMvt06SP9bLoqg==", + "dependencies": { + "buffer-more-ints": "~1.0.0", + "debug": "^4.3.4", + "safe-buffer": "~5.1.2" + }, + "engines": { + "node": ">=0.8" + } + }, "node_modules/@ampproject/remapping": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", @@ -88,29 +101,6 @@ "url": "https://opencollective.com/babel" } }, - "node_modules/@babel/core/node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/@babel/core/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, "node_modules/@babel/generator": { "version": "7.17.10", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.17.10.tgz", @@ -328,29 +318,6 @@ "node": ">=6.9.0" } }, - "node_modules/@babel/traverse/node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/@babel/traverse/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, "node_modules/@babel/types": { "version": "7.17.10", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.17.10.tgz", @@ -563,24 +530,6 @@ "node": ">=8" } }, - "node_modules/bitsyntax": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/bitsyntax/-/bitsyntax-0.1.0.tgz", - "integrity": "sha512-ikAdCnrloKmFOugAfxWws89/fPc+nw0OOG1IzIE72uSOg/A3cYptKCjSUhDTuj7fhsJtzkzlv7l3b8PzRHLN0Q==", - "dependencies": { - "buffer-more-ints": "~1.0.0", - "debug": "~2.6.9", - "safe-buffer": "~5.1.2" - }, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/bitsyntax/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, "node_modules/boo": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/boo/-/boo-1.2.4.tgz", @@ -875,11 +824,19 @@ } }, "node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dependencies": { - "ms": "2.0.0" + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, "node_modules/decamelize": { @@ -1445,29 +1402,6 @@ "node": ">=10" } }, - "node_modules/istanbul-lib-source-maps/node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/istanbul-lib-source-maps/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, "node_modules/istanbul-lib-source-maps/node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -1959,9 +1893,9 @@ } }, "node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "node_modules/nanoid": { "version": "3.3.1", @@ -2407,8 +2341,7 @@ "node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, "node_modules/semver": { "version": "6.3.0", @@ -2899,6 +2832,16 @@ } }, "dependencies": { + "@acuminous/bitsyntax": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@acuminous/bitsyntax/-/bitsyntax-0.1.1.tgz", + "integrity": "sha512-0TJeI9G340fziOaPGICSFNbff6dlC336orDVZapZYd0KTS6TO/0yV2UkYVOVUotB4/bz+O6xgMvt06SP9bLoqg==", + "requires": { + "buffer-more-ints": "~1.0.0", + "debug": "^4.3.4", + "safe-buffer": "~5.1.2" + } + }, "@ampproject/remapping": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", @@ -2945,23 +2888,6 @@ "gensync": "^1.0.0-beta.2", "json5": "^2.2.1", "semver": "^6.3.0" - }, - "dependencies": { - "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } } }, "@babel/generator": { @@ -3125,23 +3051,6 @@ "@babel/types": "^7.17.10", "debug": "^4.1.0", "globals": "^11.1.0" - }, - "dependencies": { - "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } } }, "@babel/types": { @@ -3313,23 +3222,6 @@ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true }, - "bitsyntax": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/bitsyntax/-/bitsyntax-0.1.0.tgz", - "integrity": "sha512-ikAdCnrloKmFOugAfxWws89/fPc+nw0OOG1IzIE72uSOg/A3cYptKCjSUhDTuj7fhsJtzkzlv7l3b8PzRHLN0Q==", - "requires": { - "buffer-more-ints": "~1.0.0", - "debug": "~2.6.9", - "safe-buffer": "~5.1.2" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - } - } - }, "boo": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/boo/-/boo-1.2.4.tgz", @@ -3557,11 +3449,11 @@ } }, "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "requires": { - "ms": "2.0.0" + "ms": "2.1.2" } }, "decamelize": { @@ -3975,21 +3867,6 @@ "source-map": "^0.6.1" }, "dependencies": { - "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -4342,9 +4219,9 @@ } }, "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "nanoid": { "version": "3.3.1", @@ -4689,8 +4566,7 @@ "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, "semver": { "version": "6.3.0", diff --git a/package.json b/package.json index 3a3ceab3..576a3426 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "node": ">=10" }, "dependencies": { - "bitsyntax": "~0.1.0", + "@acuminous/bitsyntax": "^0.1.1", "buffer-more-ints": "~1.0.0", "readable-stream": "1.x >=1.1.9", "url-parse": "~1.5.10" From 6cb0ea682d5ef6f16950ceffc47e8e7204f7a059 Mon Sep 17 00:00:00 2001 From: Steve Cresswell <229672+cressie176@users.noreply.github.com> Date: Thu, 1 Sep 2022 07:42:45 +0100 Subject: [PATCH 075/112] Update bitsyntax --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6e33095a..c4d1cc37 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.10.2", "license": "MIT", "dependencies": { - "@acuminous/bitsyntax": "^0.1.1", + "@acuminous/bitsyntax": "^0.1.2", "buffer-more-ints": "~1.0.0", "readable-stream": "1.x >=1.1.9", "url-parse": "~1.5.10" @@ -25,9 +25,9 @@ } }, "node_modules/@acuminous/bitsyntax": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@acuminous/bitsyntax/-/bitsyntax-0.1.1.tgz", - "integrity": "sha512-0TJeI9G340fziOaPGICSFNbff6dlC336orDVZapZYd0KTS6TO/0yV2UkYVOVUotB4/bz+O6xgMvt06SP9bLoqg==", + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@acuminous/bitsyntax/-/bitsyntax-0.1.2.tgz", + "integrity": "sha512-29lUK80d1muEQqiUsSo+3A0yP6CdspgC95EnKBMi22Xlwt79i/En4Vr67+cXhU+cZjbti3TgGGC5wy1stIywVQ==", "dependencies": { "buffer-more-ints": "~1.0.0", "debug": "^4.3.4", @@ -2833,9 +2833,9 @@ }, "dependencies": { "@acuminous/bitsyntax": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@acuminous/bitsyntax/-/bitsyntax-0.1.1.tgz", - "integrity": "sha512-0TJeI9G340fziOaPGICSFNbff6dlC336orDVZapZYd0KTS6TO/0yV2UkYVOVUotB4/bz+O6xgMvt06SP9bLoqg==", + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@acuminous/bitsyntax/-/bitsyntax-0.1.2.tgz", + "integrity": "sha512-29lUK80d1muEQqiUsSo+3A0yP6CdspgC95EnKBMi22Xlwt79i/En4Vr67+cXhU+cZjbti3TgGGC5wy1stIywVQ==", "requires": { "buffer-more-ints": "~1.0.0", "debug": "^4.3.4", diff --git a/package.json b/package.json index 576a3426..e5683a30 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "node": ">=10" }, "dependencies": { - "@acuminous/bitsyntax": "^0.1.1", + "@acuminous/bitsyntax": "^0.1.2", "buffer-more-ints": "~1.0.0", "readable-stream": "1.x >=1.1.9", "url-parse": "~1.5.10" From 996eac67f943b0fee486deb1f3333e32ee22e7a5 Mon Sep 17 00:00:00 2001 From: Steve Cresswell <229672+cressie176@users.noreply.github.com> Date: Thu, 1 Sep 2022 07:43:42 +0100 Subject: [PATCH 076/112] 0.10.3 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index c4d1cc37..1b2ba950 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "amqplib", - "version": "0.10.2", + "version": "0.10.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "amqplib", - "version": "0.10.2", + "version": "0.10.3", "license": "MIT", "dependencies": { "@acuminous/bitsyntax": "^0.1.2", diff --git a/package.json b/package.json index e5683a30..ef301e41 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "amqplib", "homepage": "http://amqp-node.github.io/amqplib/", "main": "./channel_api.js", - "version": "0.10.2", + "version": "0.10.3", "description": "An AMQP 0-9-1 (e.g., RabbitMQ) library and client.", "repository": { "type": "git", From 55851b4de5997a118885acf345797c25c8f59edf Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Thu, 1 Sep 2022 08:31:52 +0100 Subject: [PATCH 077/112] Update bug_report.md --- .github/ISSUE_TEMPLATE/bug_report.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 3f0ba9c5..15f735fb 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -25,11 +25,11 @@ Before reporting a bug or requesting support please... If the above does not help, please provide the following information... - - A clear and concise description of what the bug is. + - A clear and concise description of the problem - RabbitMQ version - amqplib version -If you include code snippets, please format them so they are easier to read +If you include code snippets, please format them so they are easier to read and keep them to the bare minimum that demonstrates the problem. - https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks From 72c1ac7c4bf8295347ffcc69ee0416d06c6f6862 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Fri, 2 Sep 2022 23:13:31 +0100 Subject: [PATCH 078/112] Update bug_report.md --- .github/ISSUE_TEMPLATE/bug_report.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 15f735fb..1608c52d 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -28,6 +28,7 @@ If the above does not help, please provide the following information... - A clear and concise description of the problem - RabbitMQ version - amqplib version + - Node.js version If you include code snippets, please format them so they are easier to read and keep them to the bare minimum that demonstrates the problem. From 15992487f3a16b5bfe81eb040db0ea4e47d86583 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Sat, 3 Sep 2022 06:01:07 +0100 Subject: [PATCH 079/112] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ee4e226..b157108e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ git log v0.10.0..v0.10.1 - * Allow servername to be specified via socket options as discussed in as discussed in + * Allow servername to be specified via socket options as discussed in [issue 697](https://github.com/squaremo/amqp.node/issues/697) ## Changes in v0.10.0 From a9a41e564018cd17ed5368e46c28cfa17fb80218 Mon Sep 17 00:00:00 2001 From: Caio Augusto Date: Mon, 31 Oct 2022 20:19:41 -0300 Subject: [PATCH 080/112] fix(docs): typo Change from "Recieved" to "Received" --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bccaa2ed..afde787b 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ const amqplib = require('amqplib'); // Listener ch1.consume(queue, (msg) => { if (msg !== null) { - console.log('Recieved:', msg.content.toString()); + console.log('Received:', msg.content.toString()); ch1.ack(msg); } else { console.log('Consumer cancelled by server'); From c5699ff4f659b1680de2f68b78954bceeeda47b5 Mon Sep 17 00:00:00 2001 From: Steve Cresswell <229672+cressie176@users.noreply.github.com> Date: Fri, 9 Dec 2022 19:17:04 +0000 Subject: [PATCH 081/112] Update examples --- examples/tutorials/emit_log.js | 35 +++++----- examples/tutorials/emit_log_direct.js | 38 ++++++----- examples/tutorials/emit_log_topic.js | 37 ++++++----- examples/tutorials/new_task.js | 33 ++++++---- examples/tutorials/receive.js | 32 ++++----- examples/tutorials/receive_logs.js | 46 ++++++------- examples/tutorials/receive_logs_direct.js | 64 ++++++++---------- examples/tutorials/receive_logs_topic.js | 60 ++++++++--------- examples/tutorials/rpc_client.js | 79 +++++++++++------------ examples/tutorials/rpc_server.js | 56 +++++++++------- examples/tutorials/send.js | 44 +++++++------ examples/tutorials/worker.js | 48 ++++++++------ 12 files changed, 299 insertions(+), 273 deletions(-) diff --git a/examples/tutorials/emit_log.js b/examples/tutorials/emit_log.js index 2bf7e142..9cb71d38 100755 --- a/examples/tutorials/emit_log.js +++ b/examples/tutorials/emit_log.js @@ -1,19 +1,24 @@ #!/usr/bin/env node -var amqp = require('amqplib'); +const amqp = require('amqplib'); -amqp.connect('amqp://localhost').then(function(conn) { - return conn.createChannel().then(function(ch) { - var ex = 'logs'; - var ok = ch.assertExchange(ex, 'fanout', {durable: false}) +const exchange = 'logs'; +const text = process.argv.slice(2).join(' ') || 'info: Hello World!'; - var message = process.argv.slice(2).join(' ') || - 'info: Hello World!'; - - return ok.then(function() { - ch.publish(ex, '', Buffer.from(message)); - console.log(" [x] Sent '%s'", message); - return ch.close(); - }); - }).finally(function() { conn.close(); }); -}).catch(console.warn); +(async () => { + let connection; + try { + connection = await amqp.connect('amqp://localhost'); + const channel = await connection.createChannel(); + await channel.assertExchange(exchange, 'fanout', { durable: false }); + channel.publish(exchange, '', Buffer.from(text)); + console.log(" [x] Sent '%s'", text); + await channel.close(); + } + catch (err) { + console.warn(err); + } + finally { + if (connection) await connection.close(); + }; +})(); diff --git a/examples/tutorials/emit_log_direct.js b/examples/tutorials/emit_log_direct.js index 0846edfe..8f593e39 100755 --- a/examples/tutorials/emit_log_direct.js +++ b/examples/tutorials/emit_log_direct.js @@ -1,20 +1,26 @@ #!/usr/bin/env node -var amqp = require('amqplib'); +const amqp = require('amqplib'); -var args = process.argv.slice(2); -var severity = (args.length > 0) ? args[0] : 'info'; -var message = args.slice(1).join(' ') || 'Hello World!'; +const exchange = 'direct_logs'; +const args = process.argv.slice(2); +const routingKey = (args.length > 0) ? args[0] : 'info'; +const text = args.slice(1).join(' ') || 'Hello World!'; -amqp.connect('amqp://localhost').then(function(conn) { - return conn.createChannel().then(function(ch) { - var ex = 'direct_logs'; - var ok = ch.assertExchange(ex, 'direct', {durable: false}); - - return ok.then(function() { - ch.publish(ex, severity, Buffer.from(message)); - console.log(" [x] Sent %s:'%s'", severity, message); - return ch.close(); - }); - }).finally(function() { conn.close(); }); -}).catch(console.warn); +(async () => { + let connection; + try { + connection = await amqp.connect('amqp://localhost'); + const channel = await connection.createChannel(); + await channel.assertExchange(exchange, 'direct', { durable: false }); + channel.publish(exchange, routingKey, Buffer.from(text)); + console.log(" [x] Sent %s:'%s'", routingKey, text); + await channel.close(); + } + catch (err) { + console.warn(err); + } + finally { + if (connection) await connection.close(); + }; +})(); diff --git a/examples/tutorials/emit_log_topic.js b/examples/tutorials/emit_log_topic.js index 5f643a31..484010ee 100755 --- a/examples/tutorials/emit_log_topic.js +++ b/examples/tutorials/emit_log_topic.js @@ -1,19 +1,26 @@ #!/usr/bin/env node -var amqp = require('amqplib'); +const amqp = require('amqplib'); -var args = process.argv.slice(2); -var key = (args.length > 0) ? args[0] : 'info'; -var message = args.slice(1).join(' ') || 'Hello World!'; +const exchange = 'topic_logs'; +const args = process.argv.slice(2); +const routingKeys = (args.length > 0) ? args[0] : 'info'; +const text = args.slice(1).join(' ') || 'Hello World!'; -amqp.connect('amqp://localhost').then(function(conn) { - return conn.createChannel().then(function(ch) { - var ex = 'topic_logs'; - var ok = ch.assertExchange(ex, 'topic', {durable: false}); - return ok.then(function() { - ch.publish(ex, key, Buffer.from(message)); - console.log(" [x] Sent %s:'%s'", key, message); - return ch.close(); - }); - }).finally(function() { conn.close(); }) -}).catch(console.log); +(async () => { + let connection; + try { + connection = await amqp.connect('amqp://localhost'); + const channel = await connection.createChannel(); + await channel.assertExchange(exchange, 'topic', { durable: false }); + channel.publish(exchange, routingKeys, Buffer.from(text)); + console.log(" [x] Sent %s:'%s'", routingKeys, text); + await channel.close(); + } + catch (err) { + console.warn(err); + } + finally { + if (connection) await connection.close(); + }; +})(); diff --git a/examples/tutorials/new_task.js b/examples/tutorials/new_task.js index c25cfbcc..0c6a5e67 100755 --- a/examples/tutorials/new_task.js +++ b/examples/tutorials/new_task.js @@ -1,18 +1,25 @@ #!/usr/bin/env node // Post a new task to the work queue -var amqp = require('amqplib'); +const amqp = require('amqplib'); -amqp.connect('amqp://localhost').then(function(conn) { - return conn.createChannel().then(function(ch) { - var q = 'task_queue'; - var ok = ch.assertQueue(q, {durable: true}); +const queue = 'task_queue'; +const text = process.argv.slice(2).join(' ') || "Hello World!"; - return ok.then(function() { - var msg = process.argv.slice(2).join(' ') || "Hello World!"; - ch.sendToQueue(q, Buffer.from(msg), {deliveryMode: true}); - console.log(" [x] Sent '%s'", msg); - return ch.close(); - }); - }).finally(function() { conn.close(); }); -}).catch(console.warn); +(async () => { + let connection; + try { + connection = await amqp.connect('amqp://localhost'); + const channel = await connection.createChannel(); + await channel.assertQueue(queue, { durable: true }); + channel.sendToQueue(queue, Buffer.from(text), { persistent: true }); + console.log(" [x] Sent '%s'", text); + await channel.close(); + } + catch (err) { + console.warn(err); + } + finally { + await connection.close(); + }; +})(); diff --git a/examples/tutorials/receive.js b/examples/tutorials/receive.js index b7a7975c..f7f4f7fe 100755 --- a/examples/tutorials/receive.js +++ b/examples/tutorials/receive.js @@ -1,21 +1,21 @@ #!/usr/bin/env node -var amqp = require('amqplib'); +const amqp = require('amqplib'); -amqp.connect('amqp://localhost').then(function(conn) { - process.once('SIGINT', function() { conn.close(); }); - return conn.createChannel().then(function(ch) { - - var ok = ch.assertQueue('hello', {durable: false}); - - ok = ok.then(function(_qok) { - return ch.consume('hello', function(msg) { - console.log(" [x] Received '%s'", msg.content.toString()); - }, {noAck: true}); +(async () => { + try { + const connection = await amqp.connect('amqp://localhost'); + process.once('SIGINT', async () => { + await connection.close(); }); + const channel = await connection.createChannel(); + await channel.assertQueue('hello', { durable: false }); + await channel.consume('hello', (message) => { + console.log(" [x] Received '%s'", message.content.toString()); + }, { noAck: true }); - return ok.then(function(_consumeOk) { - console.log(' [*] Waiting for messages. To exit press CTRL+C'); - }); - }); -}).catch(console.warn); + console.log(' [*] Waiting for messages. To exit press CTRL+C'); + } catch (err) { + console.warn(err); + } +})(); diff --git a/examples/tutorials/receive_logs.js b/examples/tutorials/receive_logs.js index d592af96..648f425d 100755 --- a/examples/tutorials/receive_logs.js +++ b/examples/tutorials/receive_logs.js @@ -1,28 +1,28 @@ #!/usr/bin/env node -var amqp = require('amqplib'); +const amqp = require('amqplib'); -amqp.connect('amqp://localhost').then(function(conn) { - process.once('SIGINT', function() { conn.close(); }); - return conn.createChannel().then(function(ch) { - var ok = ch.assertExchange('logs', 'fanout', {durable: false}); - ok = ok.then(function() { - return ch.assertQueue('', {exclusive: true}); - }); - ok = ok.then(function(qok) { - return ch.bindQueue(qok.queue, 'logs', '').then(function() { - return qok.queue; - }); - }); - ok = ok.then(function(queue) { - return ch.consume(queue, logMessage, {noAck: true}); - }); - return ok.then(function() { - console.log(' [*] Waiting for logs. To exit press CTRL+C'); +const exchange = 'logs'; + +(async () => { + try { + const connection = await amqp.connect('amqp://localhost'); + process.once('SIGINT', async () => { + await connection.close(); }); - function logMessage(msg) { - console.log(" [x] '%s'", msg.content.toString()); - } - }); -}).catch(console.warn); + const channel = await connection.createChannel(); + await channel.assertExchange(exchange, 'fanout', { durable: false }); + const { queue } = await channel.assertQueue('', { exclusive: true }); + await channel.bindQueue(queue, exchange, '') + + await channel.consume(queue, (message) => { + if (message) console.log(" [x] '%s'", message.content.toString()); + else console.warn(' [x] Consumer cancelled'); + }, { noAck: true }); + + console.log(' [*] Waiting for logs. To exit press CTRL+C'); + } catch (err) { + console.warn(err); + } +})(); diff --git a/examples/tutorials/receive_logs_direct.js b/examples/tutorials/receive_logs_direct.js index f1e77f95..7677f9b0 100755 --- a/examples/tutorials/receive_logs_direct.js +++ b/examples/tutorials/receive_logs_direct.js @@ -1,44 +1,36 @@ #!/usr/bin/env node -var amqp = require('amqplib'); -var basename = require('path').basename; +const amqp = require('../..'); +const { basename } = require('path'); -var severities = process.argv.slice(2); -if (severities.length < 1) { - console.warn('Usage: %s [info] [warning] [error]', - basename(process.argv[1])); +const exchange = 'direct_logs'; +const bindingKeys = process.argv.slice(2); +if (bindingKeys.length < 1) { + console.warn('Usage: %s [info] [warning] [error]', basename(process.argv[1])); process.exit(1); } -amqp.connect('amqp://localhost').then(function(conn) { - process.once('SIGINT', function() { conn.close(); }); - return conn.createChannel().then(function(ch) { - var ex = 'direct_logs'; - - var ok = ch.assertExchange(ex, 'direct', {durable: false}); - - ok = ok.then(function() { - return ch.assertQueue('', {exclusive: true}); - }); - - ok = ok.then(function(qok) { - var queue = qok.queue; - return Promise.all(severities.map(function(sev) { - ch.bindQueue(queue, ex, sev); - })).then(function() { return queue; }); - }); - - ok = ok.then(function(queue) { - return ch.consume(queue, logMessage, {noAck: true}); - }); - return ok.then(function() { - console.log(' [*] Waiting for logs. To exit press CTRL+C.'); +(async () => { + try { + const connection = await amqp.connect('amqp://localhost'); + process.once('SIGINT', async () => { + await connection.close(); }); - function logMessage(msg) { - console.log(" [x] %s:'%s'", - msg.fields.routingKey, - msg.content.toString()); - } - }); -}).catch(console.warn); + const channel = await connection.createChannel(); + await channel.assertExchange(exchange, 'direct', { durable: false }); + const { queue } = await channel.assertQueue('', { exclusive: true }); + await Promise.all(bindingKeys.map(async (bindingKey) => { + await channel.bindQueue(queue, exchange, bindingKey); + })); + + await channel.consume(queue, (message) => { + if (message) console.log(" [x] %s:'%s'", message.fields.routingKey, message.content.toString()); + else console.warn(' [x] Consumer cancelled'); + }, { noAck: true }); + + console.log(' [*] Waiting for logs. To exit press CTRL+C.'); + } catch(err) { + console.warn(err); + } +})(); \ No newline at end of file diff --git a/examples/tutorials/receive_logs_topic.js b/examples/tutorials/receive_logs_topic.js index cc8e47f1..a436fd3c 100755 --- a/examples/tutorials/receive_logs_topic.js +++ b/examples/tutorials/receive_logs_topic.js @@ -1,43 +1,37 @@ #!/usr/bin/env node -var amqp = require('amqplib'); -var basename = require('path').basename; +const amqp = require('../..'); +const { basename } = require('path'); -var keys = process.argv.slice(2); -if (keys.length < 1) { - console.log('Usage: %s pattern [pattern...]', - basename(process.argv[1])); +const exchange = 'topic_logs'; +const bindingKeys = process.argv.slice(2); +if (bindingKeys.length < 1) { + console.log('Usage: %s pattern [pattern...]', basename(process.argv[1])); process.exit(1); } -amqp.connect('amqp://localhost').then(function(conn) { - process.once('SIGINT', function() { conn.close(); }); - return conn.createChannel().then(function(ch) { - var ex = 'topic_logs'; - var ok = ch.assertExchange(ex, 'topic', {durable: false}); - - ok = ok.then(function() { - return ch.assertQueue('', {exclusive: true}); +(async () => { + try { + const connection = await amqp.connect('amqp://localhost'); + process.once('SIGINT', async () => { + await connection.close(); }); - ok = ok.then(function(qok) { - var queue = qok.queue; - return Promise.all(keys.map(function(rk) { - ch.bindQueue(queue, ex, rk); - })).then(function() { return queue; }); - }); + const channel = await connection.createChannel(); + await channel.assertExchange(exchange, 'topic', { durable: false }); + const { queue } = await channel.assertQueue('', { exclusive: true }); + await Promise.all(bindingKeys.map(async (bindingKey) => { + await channel.bindQueue(queue, exchange, bindingKey); + })); - ok = ok.then(function(queue) { - return ch.consume(queue, logMessage, {noAck: true}); - }); - return ok.then(function() { - console.log(' [*] Waiting for logs. To exit press CTRL+C.'); - }); + await channel.consume(queue, (message) => { + if (message) console.log(" [x] %s:'%s'", message.fields.routingKey, message.content.toString()); + else console.warn(' [x] Consumer cancelled'); + }, { noAck: true }); - function logMessage(msg) { - console.log(" [x] %s:'%s'", - msg.fields.routingKey, - msg.content.toString()); - } - }); -}).catch(console.warn); + console.log(' [*] Waiting for logs. To exit press CTRL+C.'); + } + catch (err) { + console.warn(err); + } +})(); diff --git a/examples/tutorials/rpc_client.js b/examples/tutorials/rpc_client.js index 88cc72a4..8f48a70a 100755 --- a/examples/tutorials/rpc_client.js +++ b/examples/tutorials/rpc_client.js @@ -1,52 +1,47 @@ #!/usr/bin/env node -var amqp = require('amqplib'); -var basename = require('path').basename; -var uuid = require('node-uuid'); - -// I've departed from the form of the original RPC tutorial, which -// needlessly introduces a class definition, and doesn't even -// parameterise the request. - -var n; -try { - if (process.argv.length < 3) throw Error('Too few args'); - n = parseInt(process.argv[2]); -} -catch (e) { - console.error(e); +const amqp = require('amqplib'); +const { basename } = require('path'); +const { v4: uuid } = require('uuid'); + +const queue = 'rpc_queue'; + +const n = parseInt(process.argv[2], 10); +if (isNaN(n)) { console.warn('Usage: %s number', basename(process.argv[1])); process.exit(1); } -amqp.connect('amqp://localhost').then(function(conn) { - return conn.createChannel().then(function(ch) { - return new Promise(function(resolve) { - var corrId = uuid(); - function maybeAnswer(msg) { - if (msg.properties.correlationId === corrId) { - resolve(msg.content.toString()); - } - } - - var ok = ch.assertQueue('', {exclusive: true}) - .then(function(qok) { return qok.queue; }); - - ok = ok.then(function(queue) { - return ch.consume(queue, maybeAnswer, {noAck: true}) - .then(function() { return queue; }); - }); +(async () => { + let connection; + try { + connection = await amqp.connect('amqp://localhost'); + const channel = await connection.createChannel(); + const correlationId = uuid(); - ok = ok.then(function(queue) { - console.log(' [x] Requesting fib(%d)', n); - ch.sendToQueue('rpc_queue', Buffer.from(n.toString()), { - correlationId: corrId, replyTo: queue - }); + const requestFib = new Promise(async (resolve) => { + const { queue: replyTo } = await channel.assertQueue('', { exclusive: true }); + + await channel.consume(replyTo, (message) => { + if (message.properties.correlationId === correlationId) { + resolve(message.content.toString()); + } + }, { noAck: true }); + + console.log(' [x] Requesting fib(%d)', n); + channel.sendToQueue(queue, Buffer.from(n.toString()), { + correlationId, + replyTo, }); }); - }) - .then(function(fibN) { + + const fibN = await requestFib; console.log(' [.] Got %d', fibN); - }) - .finally(function() { conn.close(); }); -}).catch(console.warn); + } + catch (err) { + console.warn(err); + } + finally { + if (connection) await connection.close(); + }; +})(); diff --git a/examples/tutorials/rpc_server.js b/examples/tutorials/rpc_server.js index 84101ce9..990c5b3d 100755 --- a/examples/tutorials/rpc_server.js +++ b/examples/tutorials/rpc_server.js @@ -1,39 +1,45 @@ #!/usr/bin/env node -var amqp = require('amqplib'); +const amqp = require('amqplib'); + +const queue = 'rpc_queue'; function fib(n) { // Do it the ridiculous, but not most ridiculous, way. For better, // see http://nayuki.eigenstate.org/page/fast-fibonacci-algorithms - var a = 0, b = 1; - for (var i=0; i < n; i++) { - var c = a + b; + let a = 0, b = 1; + for (let i=0; i < n; i++) { + let c = a + b; a = b; b = c; } return a; } -amqp.connect('amqp://localhost').then(function(conn) { - process.once('SIGINT', function() { conn.close(); }); - return conn.createChannel().then(function(ch) { - var q = 'rpc_queue'; - var ok = ch.assertQueue(q, {durable: false}); - var ok = ok.then(function() { - ch.prefetch(1); - return ch.consume(q, reply); - }); - return ok.then(function() { - console.log(' [x] Awaiting RPC requests'); +(async () => { + try { + const connection = await amqp.connect('amqp://localhost'); + process.once('SIGINT', async () => { + await connection.close(); }); - function reply(msg) { - var n = parseInt(msg.content.toString()); + const channel = await connection.createChannel(); + await channel.assertQueue(queue, { durable: false }); + + channel.prefetch(1); + await channel.consume(queue, (message) => { + const n = parseInt(message.content.toString(), 10); console.log(' [.] fib(%d)', n); - var response = fib(n); - ch.sendToQueue(msg.properties.replyTo, - Buffer.from(response.toString()), - {correlationId: msg.properties.correlationId}); - ch.ack(msg); - } - }); -}).catch(console.warn); + const response = fib(n); + channel.sendToQueue(message.properties.replyTo, Buffer.from(response.toString()), { + correlationId: message.properties.correlationId + }); + channel.ack(message); + }); + + console.log(' [x] Awaiting RPC requests'); + } + catch (err) { + console.warn(err); + } +})(); + diff --git a/examples/tutorials/send.js b/examples/tutorials/send.js index 59f846ef..159cd593 100755 --- a/examples/tutorials/send.js +++ b/examples/tutorials/send.js @@ -1,23 +1,31 @@ #!/usr/bin/env node -var amqp = require('amqplib'); +const amqp = require('amqplib'); -amqp.connect('amqp://localhost').then(function(conn) { - return conn.createChannel().then(function(ch) { - var q = 'hello'; - var msg = 'Hello World!'; +const queue = 'hello'; +const text = 'Hello World!'; - var ok = ch.assertQueue(q, {durable: false}); +(async () => { + let connection; + try { + connection = await amqp.connect('amqp://localhost'); + const channel = await connection.createChannel(); - return ok.then(function(_qok) { - // NB: `sentToQueue` and `publish` both return a boolean - // indicating whether it's OK to send again straight away, or - // (when `false`) that you should wait for the event `'drain'` - // to fire before writing again. We're just doing the one write, - // so we'll ignore it. - ch.sendToQueue(q, Buffer.from(msg)); - console.log(" [x] Sent '%s'", msg); - return ch.close(); - }); - }).finally(function() { conn.close(); }); -}).catch(console.warn); + await channel.assertQueue(queue, { durable: false }); + + // NB: `sentToQueue` and `publish` both return a boolean + // indicating whether it's OK to send again straight away, or + // (when `false`) that you should wait for the event `'drain'` + // to fire before writing again. We're just doing the one write, + // so we'll ignore it. + channel.sendToQueue(queue, Buffer.from(text)); + console.log(" [x] Sent '%s'", text); + await channel.close(); + } + catch (err) { + console.warn(err); + } + finally { + if (connection) await connection.close(); + }; +})(); diff --git a/examples/tutorials/worker.js b/examples/tutorials/worker.js index fdb72dfd..13cc4423 100755 --- a/examples/tutorials/worker.js +++ b/examples/tutorials/worker.js @@ -1,28 +1,34 @@ #!/usr/bin/env node // Process tasks from the work queue -var amqp = require('amqplib'); +const amqp = require('amqplib'); -amqp.connect('amqp://localhost').then(function(conn) { - process.once('SIGINT', function() { conn.close(); }); - return conn.createChannel().then(function(ch) { - var ok = ch.assertQueue('task_queue', {durable: true}); - ok = ok.then(function() { ch.prefetch(1); }); - ok = ok.then(function() { - ch.consume('task_queue', doWork, {noAck: false}); - console.log(" [*] Waiting for messages. To exit press CTRL+C"); +const queue = 'task_queue'; + +(async () => { + try { + const connection = await amqp.connect('amqp://localhost'); + process.once('SIGINT', async () => { + await connection.close(); }); - return ok; - function doWork(msg) { - var body = msg.content.toString(); - console.log(" [x] Received '%s'", body); - var secs = body.split('.').length - 1; - //console.log(" [x] Task takes %d seconds", secs); - setTimeout(function() { + const channel = await connection.createChannel(); + await channel.assertQueue(queue, { durable: true }); + + channel.prefetch(1); + await channel.consume(queue, (message) => { + const text = message.content.toString(); + console.log(" [x] Received '%s'", text); + const seconds = text.split('.').length - 1; + setTimeout(() => { console.log(" [x] Done"); - ch.ack(msg); - }, secs * 1000); - } - }); -}).catch(console.warn); + channel.ack(message); + }, seconds * 1000); + }, { noAck: false }); + + console.log(" [*] Waiting for messages. To exit press CTRL+C"); + } + catch (err) { + console.warn(err); + } +})(); \ No newline at end of file From dd1c9fb770d0660711616edbd72b5d71b33cc26e Mon Sep 17 00:00:00 2001 From: Steve Cresswell <229672+cressie176@users.noreply.github.com> Date: Sat, 10 Dec 2022 00:35:45 +0000 Subject: [PATCH 082/112] Update callback examples --- examples/tutorials/callback_api/emit_log.js | 44 +++++----- .../tutorials/callback_api/emit_log_direct.js | 48 +++++------ .../tutorials/callback_api/emit_log_topic.js | 43 +++++----- examples/tutorials/callback_api/new_task.js | 41 ++++----- examples/tutorials/callback_api/receive.js | 48 ++++++----- .../tutorials/callback_api/receive_logs.js | 58 +++++++------ .../callback_api/receive_logs_direct.js | 83 ++++++++++--------- .../callback_api/receive_logs_topic.js | 83 ++++++++++--------- examples/tutorials/callback_api/rpc_client.js | 76 ++++++++--------- examples/tutorials/callback_api/rpc_server.js | 74 ++++++++++------- examples/tutorials/callback_api/send.js | 43 +++++----- examples/tutorials/callback_api/worker.js | 54 ++++++------ examples/tutorials/receive.js | 11 ++- examples/tutorials/receive_logs.js | 4 +- examples/tutorials/receive_logs_direct.js | 6 +- examples/tutorials/receive_logs_topic.js | 4 +- examples/tutorials/rpc_client.js | 6 +- examples/tutorials/rpc_server.js | 25 +++--- examples/tutorials/worker.js | 2 +- 19 files changed, 401 insertions(+), 352 deletions(-) diff --git a/examples/tutorials/callback_api/emit_log.js b/examples/tutorials/callback_api/emit_log.js index 9ea353d3..e79cae38 100755 --- a/examples/tutorials/callback_api/emit_log.js +++ b/examples/tutorials/callback_api/emit_log.js @@ -1,28 +1,28 @@ #!/usr/bin/env node -var amqp = require('amqplib/callback_api'); +const amqp = require('amqplib/callback_api'); -function bail(err, conn) { - console.error(err); - if (conn) conn.close(function() { process.exit(1); }); -} - -function on_connect(err, conn) { - if (err !== null) return bail(err); +const exchange = 'logs'; +const text = process.argv.slice(2).join(' ') || 'info: Hello World!'; - var ex = 'logs'; +amqp.connect((err, connection) => { + if (err) return bail(err); + connection.createChannel((err, channel) => { + if (err) return bail(err, connection); + channel.assertExchange(exchange, 'fanout', { durable: false }, (err) => { + if (err) return bail(err, connection); + channel.publish(exchange, '', Buffer.from(text)); + console.log(" [x] Sent '%s'", text); + channel.close(() => { + connection.close(); + }); + }); + }); +}); - function on_channel_open(err, ch) { - if (err !== null) return bail(err, conn); - ch.assertExchange(ex, 'fanout', {durable: false}); - var msg = process.argv.slice(2).join(' ') || - 'info: Hello World!'; - ch.publish(ex, '', Buffer.from(msg)); - console.log(" [x] Sent '%s'", msg); - ch.close(function() { conn.close(); }); - } - - conn.createChannel(on_channel_open); +function bail(err, connection) { + console.error(err); + if (connection) connection.close(() => { + process.exit(1); + }); } - -amqp.connect(on_connect); diff --git a/examples/tutorials/callback_api/emit_log_direct.js b/examples/tutorials/callback_api/emit_log_direct.js index bd4e6404..911f1fb2 100755 --- a/examples/tutorials/callback_api/emit_log_direct.js +++ b/examples/tutorials/callback_api/emit_log_direct.js @@ -1,30 +1,30 @@ #!/usr/bin/env node -var amqp = require('amqplib/callback_api'); +const amqp = require('amqplib/callback_api'); -var args = process.argv.slice(2); -var severity = (args.length > 0) ? args[0] : 'info'; -var message = args.slice(1).join(' ') || 'Hello World!'; +const exchange = 'direct_logs'; +const args = process.argv.slice(2); +const routingKey = (args.length > 0) ? args[0] : 'info'; +const text = args.slice(1).join(' ') || 'Hello World!'; -function bail(err, conn) { - console.error(err); - if (conn) conn.close(function() { process.exit(1); }); -} - -function on_connect(err, conn) { - if (err !== null) return bail(err); - - var ex = 'direct_logs'; - var exopts = {durable: false}; - - function on_channel_open(err, ch) { - if (err !== null) return bail(err, conn); - ch.assertExchange(ex, 'direct', exopts, function(err, ok) { - ch.publish(ex, severity, Buffer.from(message)); - ch.close(function() { conn.close(); }); +amqp.connect((err, connection) => { + if (err) return bail(err); + connection.createChannel((err, channel) => { + if (err) return bail(err, connection); + channel.assertExchange(exchange, 'direct', { durable: false }, (err) => { + if (err) return bail(err, connection); + channel.publish(exchange, routingKey, Buffer.from(text)); + console.log(" [x] Sent '%s'", text); + channel.close(() => { + connection.close(); + }); }); - } - conn.createChannel(on_channel_open); -} + }); +}); -amqp.connect(on_connect); +function bail(err, connection) { + console.error(err); + if (connection) connection.close(() => { + process.exit(1); + }); +} diff --git a/examples/tutorials/callback_api/emit_log_topic.js b/examples/tutorials/callback_api/emit_log_topic.js index 7601ecf7..830b6149 100755 --- a/examples/tutorials/callback_api/emit_log_topic.js +++ b/examples/tutorials/callback_api/emit_log_topic.js @@ -1,27 +1,30 @@ #!/usr/bin/env node -var amqp = require('amqplib/callback_api'); +const amqp = require('amqplib/callback_api'); -var args = process.argv.slice(2); -var key = (args.length > 0) ? args[0] : 'info'; -var message = args.slice(1).join(' ') || 'Hello World!'; +const exchange = 'topic_logs'; +const args = process.argv.slice(2); +const routingKey = (args.length > 0) ? args[0] : 'info'; +const text = args.slice(1).join(' ') || 'Hello World!'; -function bail(err, conn) { - console.error(err); - if (conn) conn.close(function() { process.exit(1); }); -} - -function on_connect(err, conn) { - if (err !== null) return bail(err); - var ex = 'topic_logs', exopts = {durable: false}; - conn.createChannel(function(err, ch) { - ch.assertExchange(ex, 'topic', exopts, function(err, ok) { - if (err !== null) return bail(err, conn); - ch.publish(ex, key, Buffer.from(message)); - console.log(" [x] Sent %s:'%s'", key, message); - ch.close(function() { conn.close(); }); +amqp.connect((err, connection) => { + if (err) return bail(err); + connection.createChannel((err, channel) => { + if (err) return bail(err, connection); + channel.assertExchange(exchange, 'topic', { durable: false }, (err) => { + if (err) return bail(err, connection); + channel.publish(exchange, routingKey, Buffer.from(text)); + console.log(" [x] Sent '%s'", text); + channel.close(() => { + connection.close(); + }); }); }); -} +}); -amqp.connect(on_connect); +function bail(err, connection) { + console.error(err); + if (connection) connection.close(() => { + process.exit(1); + }); +} diff --git a/examples/tutorials/callback_api/new_task.js b/examples/tutorials/callback_api/new_task.js index 6122231c..4f33f258 100755 --- a/examples/tutorials/callback_api/new_task.js +++ b/examples/tutorials/callback_api/new_task.js @@ -1,27 +1,28 @@ #!/usr/bin/env node -var amqp = require('amqplib/callback_api'); +const amqp = require('amqplib/callback_api'); -function bail(err, conn) { - console.error(err); - if (conn) conn.close(function() { process.exit(1); }); -} +const queue = 'task_queue'; +const text = process.argv.slice(2).join(' ') || "Hello World!"; -function on_connect(err, conn) { - if (err !== null) return bail(err); - - var q = 'task_queue'; - - conn.createChannel(function(err, ch) { - if (err !== null) return bail(err, conn); - ch.assertQueue(q, {durable: true}, function(err, _ok) { - if (err !== null) return bail(err, conn); - var msg = process.argv.slice(2).join(' ') || "Hello World!"; - ch.sendToQueue(q, Buffer.from(msg), {persistent: true}); - console.log(" [x] Sent '%s'", msg); - ch.close(function() { conn.close(); }); +amqp.connect((err, connection) => { + if (err) return bail(err); + connection.createChannel((err, channel) => { + if (err) return bail(err, connection); + channel.assertQueue(queue, { durable: true }, (err) => { + if (err) return bails(err, connection); + channel.sendToQueue(queue, Buffer.from(text), { persistent: true }); + console.log(" [x] Sent '%s'", text); + channel.close(() => { + connection.close(); + }); }); }); -} +}); -amqp.connect(on_connect); +function bail(err, connection) { + console.error(err); + if (connection) connection.close(() => { + process.exit(1); + }); +} diff --git a/examples/tutorials/callback_api/receive.js b/examples/tutorials/callback_api/receive.js index c6bb056b..0da9b168 100755 --- a/examples/tutorials/callback_api/receive.js +++ b/examples/tutorials/callback_api/receive.js @@ -1,30 +1,36 @@ #!/usr/bin/env node -var amqp = require('amqplib/callback_api'); +const amqp = require('amqplib/callback_api'); -function bail(err, conn) { - console.error(err); - if (conn) conn.close(function() { process.exit(1); }); -} +const queue = 'hello'; -function on_connect(err, conn) { - if (err !== null) return bail(err); - process.once('SIGINT', function() { conn.close(); }); - - var q = 'hello'; +amqp.connect((err, connection) => { + if (err) return bail(err); + connection.createChannel((err, channel) => { + if (err) return bail(err, connection); - function on_channel_open(err, ch) { - ch.assertQueue(q, {durable: false}, function(err, ok) { - if (err !== null) return bail(err, conn); - ch.consume(q, function(msg) { // message callback - console.log(" [x] Received '%s'", msg.content.toString()); - }, {noAck: true}, function(_consumeOk) { // consume callback - console.log(' [*] Waiting for messages. To exit press CTRL+C'); + process.once('SIGINT', () => { + channel.close(() => { + connection.close(); }); }); - } - conn.createChannel(on_channel_open); -} + channel.assertQueue(queue, { durable: false }, (err) => { + if (err) return bail(err, connection); + channel.consume(queue, (message) => { + if (message) console.log(" [x] Received '%s'", message.content.toString()); + else console.warn(' [x] Consumer cancelled'); + }, { noAck: true }, (err) => { + if (err) return bail(err, connection); + console.log(" [*] Waiting for logs. To exit press CTRL+C."); + }); + }); + }); +}); -amqp.connect(on_connect); +function bail(err, connection) { + console.error(err); + if (connection) connection.close(() => { + process.exit(1); + }); +} diff --git a/examples/tutorials/callback_api/receive_logs.js b/examples/tutorials/callback_api/receive_logs.js index 4d024e41..09564080 100755 --- a/examples/tutorials/callback_api/receive_logs.js +++ b/examples/tutorials/callback_api/receive_logs.js @@ -1,36 +1,42 @@ #!/usr/bin/env node -var amqp = require('amqplib/callback_api'); +const amqp = require('amqplib/callback_api'); -function bail(err, conn) { - console.error(err); - if (conn) conn.close(function() { process.exit(1); }); -} +const exchange = 'logs'; -function on_connect(err, conn) { - if (err !== null) return bail(err); - process.once('SIGINT', function() { conn.close(); }); +amqp.connect((err, connection) => { + if (err) return bail(err); + connection.createChannel((err, channel) => { + if (err) return bail(err, connection); - var ex = 'logs'; - - function on_channel_open(err, ch) { - if (err !== null) return bail(err, conn); - ch.assertQueue('', {exclusive: true}, function(err, ok) { - var q = ok.queue; - ch.bindQueue(q, ex, ''); - ch.consume(q, logMessage, {noAck: true}, function(err, ok) { - if (err !== null) return bail(err, conn); - console.log(" [*] Waiting for logs. To exit press CTRL+C."); + process.once('SIGINT', () => { + channel.close(() => { + connection.close(); }); }); - } - function logMessage(msg) { - if (msg) - console.log(" [x] '%s'", msg.content.toString()); - } + channel.assertExchange(exchange, 'fanout', { durable: false }, (err, { queue }) => { + if (err) return bail(err, connection); + channel.assertQueue('', { exclusive: true }, (err, { queue }) => { + if (err) return bail(err, connection); + channel.bindQueue(queue, exchange, '', {}, (err) => { + if (err) return bail(err, connection); + channel.consume(queue, (message) => { + if (message) console.log(" [x] '%s'", message.content.toString()); + else console.warn(' [x] Consumer cancelled'); + }, { noAck: true }, (err) => { + if (err) return bail(err, connection); + console.log(" [*] Waiting for logs. To exit press CTRL+C."); + }); + }); + }); + }); + }); +}); - conn.createChannel(on_channel_open); +function bail(err, connection) { + console.error(err); + if (connection) connection.close(() => { + process.exit(1); + }); } - -amqp.connect(on_connect); diff --git a/examples/tutorials/callback_api/receive_logs_direct.js b/examples/tutorials/callback_api/receive_logs_direct.js index 9bb9f987..0257452e 100755 --- a/examples/tutorials/callback_api/receive_logs_direct.js +++ b/examples/tutorials/callback_api/receive_logs_direct.js @@ -1,56 +1,57 @@ #!/usr/bin/env node -var amqp = require('amqplib/callback_api'); +const amqp = require('amqplib/callback_api'); +const { basename } = require('path'); -var basename = require('path').basename; - -var severities = process.argv.slice(2); +const exchange = 'direct_logs'; +const severities = process.argv.slice(2); if (severities.length < 1) { - console.log('Usage %s [info] [warning] [error]', - basename(process.argv[1])); + console.log('Usage %s [info] [warning] [error]', basename(process.argv[1])); process.exit(1); } -function bail(err, conn) { - console.error(err); - if (conn) conn.close(function() { process.exit(1); }); -} - -function on_connect(err, conn) { - if (err !== null) return bail(err); - process.once('SIGINT', function() { conn.close(); }); - - conn.createChannel(function(err, ch) { - if (err !== null) return bail(err, conn); - var ex = 'direct_logs', exopts = {durable: false}; - - ch.assertExchange(ex, 'direct', exopts); - ch.assertQueue('', {exclusive: true}, function(err, ok) { - if (err !== null) return bail(err, conn); - - var queue = ok.queue, i = 0; +amqp.connect((err, connection) => { + if (err) return bail(err); + connection.createChannel((err, channel) => { + if (err) return bail(err, connection); - function sub(err) { - if (err !== null) return bail(err, conn); - else if (i < severities.length) { - ch.bindQueue(queue, ex, severities[i], {}, sub); - i++; - } - } + process.once('SIGINT', () => { + channel.close(() => { + connection.close(); + }); + }); - ch.consume(queue, logMessage, {noAck: true}, function(err) { - if (err !== null) return bail(err, conn); - console.log(' [*] Waiting for logs. To exit press CTRL+C.'); - sub(null); + channel.assertExchange(exchange, 'direct', { durable: false }, (err) => { + if (err) return bail(err, connection); + channel.assertQueue('', { exclusive: true }, (err, { queue }) => { + if (err) return bail(err, connection); + channel.consume(queue, (message) => { + if (message) console.log(" [x] %s:'%s'", message.fields.routingKey, message.content.toString()); + else console.warn(' [x] Consumer cancelled'); + }, {noAck: true}, function(err) { + if (err) return bail(err, connection); + console.log(' [*] Waiting for logs. To exit press CTRL+C.'); + subscribeAll(channel, queue, severities, (err) => { + if (err) return bail(err, connection); + }); + }); }); }); }); +}); + +function subscribeAll(channel, queue, bindingKeys, cb) { + if (bindingKeys.length === 0) return cb(); + const bindingKey = bindingKeys.shift(); + channel.bindQueue(queue, exchange, bindingKey, {}, (err) => { + if (err) return cb(err); + subscribeAll(channel, queue, bindingKeys, cb); + }); } -function logMessage(msg) { - console.log(" [x] %s:'%s'", - msg.fields.routingKey, - msg.content.toString()); +function bail(err, connection) { + console.error(err); + if (connection) connection.close(() => { + process.exit(1); + }); } - -amqp.connect(on_connect); diff --git a/examples/tutorials/callback_api/receive_logs_topic.js b/examples/tutorials/callback_api/receive_logs_topic.js index 2c827c29..0c95b197 100755 --- a/examples/tutorials/callback_api/receive_logs_topic.js +++ b/examples/tutorials/callback_api/receive_logs_topic.js @@ -1,55 +1,58 @@ #!/usr/bin/env node -var amqp = require('amqplib/callback_api'); -var basename = require('path').basename; +const amqp = require('amqplib/callback_api'); +const { basename } = require('path'); -var keys = process.argv.slice(2); -if (keys.length < 1) { - console.log('Usage %s pattern [pattern...]', - basename(process.argv[1])); +const exchange = 'topic_logs'; +const severities = process.argv.slice(2); +if (severities.length < 1) { + console.log('Usage %s [info] [warning] [error]', basename(process.argv[1])); process.exit(1); } -function bail(err, conn) { - console.error(err); - if (conn) conn.close(function() { process.exit(1); }); -} - -function on_connect(err, conn) { - if (err !== null) return bail(err); - process.once('SIGINT', function() { conn.close(); }); - - conn.createChannel(function(err, ch) { - if (err !== null) return bail(err, conn); - var ex = 'topic_logs', exopts = {durable: false}; - - ch.assertExchange(ex, 'topic', exopts); - ch.assertQueue('', {exclusive: true}, function(err, ok) { - if (err !== null) return bail(err, conn); - - var queue = ok.queue, i = 0; +amqp.connect((err, connection) => { + if (err) return bail(err); + connection.createChannel((err, channel) => { + if (err) return bail(err, connection); - function sub(err) { - if (err !== null) return bail(err, conn); - else if (i < keys.length) { - ch.bindQueue(queue, ex, keys[i], {}, sub); - i++; - } - } + process.once('SIGINT', () => { + channel.close(() => { + connection.close(); + }); + }); - ch.consume(queue, logMessage, {noAck: true}, function(err) { - if (err !== null) return bail(err, conn); - console.log(' [*] Waiting for logs. To exit press CTRL+C.'); - sub(null); + channel.assertExchange(exchange, 'topic', { durable: false }, (err) => { + if (err) return bail(err, connection); + channel.assertQueue('', { exclusive: true }, (err, { queue }) => { + if (err) return bail(err, connection); + channel.consume(queue, (message) => { + if (message) console.log(" [x] %s:'%s'", message.fields.routingKey, message.content.toString()); + else console.warn(' [x] Consumer cancelled'); + }, {noAck: true}, function(err) { + if (err) return bail(err, connection); + console.log(' [*] Waiting for logs. To exit press CTRL+C.'); + subscribeAll(channel, queue, severities, (err) => { + if (err) return bail(err, connection); + }); + }); }); }); }); +}); + +function subscribeAll(channel, queue, bindingKeys, cb) { + if (bindingKeys.length === 0) return cb(); + const bindingKey = bindingKeys.shift(); + channel.bindQueue(queue, exchange, bindingKey, {}, (err) => { + if (err) return cb(err); + subscribeAll(channel, queue, bindingKeys, cb); + }); } -function logMessage(msg) { - console.log(" [x] %s:'%s'", - msg.fields.routingKey, - msg.content.toString()); +function bail(err, connection) { + console.error(err); + if (connection) connection.close(() => { + process.exit(1); + }); } -amqp.connect(on_connect); diff --git a/examples/tutorials/callback_api/rpc_client.js b/examples/tutorials/callback_api/rpc_client.js index abf22a04..85e1630c 100755 --- a/examples/tutorials/callback_api/rpc_client.js +++ b/examples/tutorials/callback_api/rpc_client.js @@ -1,49 +1,51 @@ #!/usr/bin/env node -var amqp = require('amqplib/callback_api'); -var basename = require('path').basename; -var uuid = require('node-uuid'); - -var n; -try { - if (process.argv.length < 3) throw Error('Too few args'); - n = parseInt(process.argv[2]); -} -catch (e) { - console.error(e); +const amqp = require('amqplib/callback_api'); +const { basename } = require('path'); +const { v4: uuid } = require('uuid'); + +const queue = 'rpc_queue'; + +const n = parseInt(process.argv[2], 10); +if (isNaN(n)) { console.warn('Usage: %s number', basename(process.argv[1])); process.exit(1); } -function bail(err, conn) { - console.error(err); - if (conn) conn.close(function() { process.exit(1); }); -} +amqp.connect((err, connection) => { + if (err) return bail(err); + connection.createChannel((err, channel) => { + if (err) return bail(err, connection); + channel.assertQueue('', { exclusive: true }, (err, { queue: replyTo }) => { + if (err) return bail(err, connection); -function on_connect(err, conn) { - if (err !== null) return bail(err); - conn.createChannel(function(err, ch) { - if (err !== null) return bail(err, conn); - - var correlationId = uuid(); - function maybeAnswer(msg) { - if (msg.properties.correlationId === correlationId) { - console.log(' [.] Got %d', msg.content.toString()); - } - else return bail(new Error('Unexpected message'), conn); - ch.close(function() { conn.close(); }); - } - - ch.assertQueue('', {exclusive: true}, function(err, ok) { - if (err !== null) return bail(err, conn); - var queue = ok.queue; - ch.consume(queue, maybeAnswer, {noAck:true}); - console.log(' [x] Requesting fib(%d)', n); - ch.sendToQueue('rpc_queue', Buffer.from(n.toString()), { - replyTo: queue, correlationId: correlationId + const correlationId = uuid(); + channel.consume(replyTo, (message) => { + if (!message) console.warn(' [x] Consumer cancelled'); + else if (message.properties.correlationId === correlationId) { + console.log(' [.] Got %d', message.content.toString()); + channel.close(() => { + connection.close(); + }) + } + }, { noAck: true }); + + channel.assertQueue(queue, { durable: false }, (err) => { + if (err) return bail(err, connection); + console.log(' [x] Requesting fib(%d)', n); + channel.sendToQueue(queue, Buffer.from(n.toString()), { + correlationId, + replyTo + }); }); }); }); +}); + +function bail(err, connection) { + console.error(err); + if (connection) connection.close(() => { + process.exit(1); + }); } -amqp.connect(on_connect); diff --git a/examples/tutorials/callback_api/rpc_server.js b/examples/tutorials/callback_api/rpc_server.js index dae1d9b2..11253bdb 100755 --- a/examples/tutorials/callback_api/rpc_server.js +++ b/examples/tutorials/callback_api/rpc_server.js @@ -1,45 +1,55 @@ #!/usr/bin/env node -var amqp = require('amqplib/callback_api'); +const amqp = require('amqplib/callback_api'); + +const queue = 'rpc_queue'; + +amqp.connect((err, connection) => { + if (err) return bail(err); + connection.createChannel((err, channel) => { + if (err) return bail(err, connection); + + process.once('SIGINT', () => { + channel.close(() => { + connection.close(); + }); + }); + + channel.assertQueue(queue, { durable: false }, (err) => { + if (err) return bail(err, connection); + channel.prefetch(1); + channel.consume(queue, (message) => { + const n = parseInt(message.content.toString(), 10); + console.log(' [.] fib(%d)', n); + const response = fib(n); + channel.sendToQueue(message.properties.replyTo, Buffer.from(response.toString()), { + correlationId: message.properties.correlationId + }); + channel.ack(message); + }, { noAck: false }, function(err) { + if (err) return bail(err, conn); + console.log(' [x] Awaiting RPC requests'); + }); + }); + }); +}); function fib(n) { - var a = 0, b = 1; - for (var i=0; i < n; i++) { - var c = a + b; + // Do it the ridiculous, but not most ridiculous, way. For better, + // see http://nayuki.eigenstate.org/page/fast-fibonacci-algorithms + let a = 0, b = 1; + for (let i=0; i < n; i++) { + let c = a + b; a = b; b = c; } return a; } -function bail(err, conn) { - console.error(err); - if (conn) conn.close(function() { process.exit(1); }); -} - -function on_connect(err, conn) { - if (err !== null) return bail(err); - - process.once('SIGINT', function() { conn.close(); }); - - var q = 'rpc_queue'; - conn.createChannel(function(err, ch) { - ch.assertQueue(q, {durable: false}); - ch.prefetch(1); - ch.consume(q, reply, {noAck:false}, function(err) { - if (err !== null) return bail(err, conn); - console.log(' [x] Awaiting RPC requests'); - }); - - function reply(msg) { - var n = parseInt(msg.content.toString()); - console.log(' [.] fib(%d)', n); - ch.sendToQueue(msg.properties.replyTo, - Buffer.from(fib(n).toString()), - {correlationId: msg.properties.correlationId}); - ch.ack(msg); - } +function bail(err, connection) { + console.error(err); + if (connection) connection.close(() => { + process.exit(1); }); } -amqp.connect(on_connect); diff --git a/examples/tutorials/callback_api/send.js b/examples/tutorials/callback_api/send.js index 8ff0e4b8..1a371e0e 100755 --- a/examples/tutorials/callback_api/send.js +++ b/examples/tutorials/callback_api/send.js @@ -1,29 +1,28 @@ #!/usr/bin/env node -var amqp = require('amqplib/callback_api'); +const amqp = require('amqplib/callback_api'); -function bail(err, conn) { - console.error(err); - if (conn) conn.close(function() { process.exit(1); }); -} - -function on_connect(err, conn) { - if (err !== null) return bail(err); +const queue = 'hello'; +const text = 'Hello World!'; - var q = 'hello'; - var msg = 'Hello World!'; - - function on_channel_open(err, ch) { - if (err !== null) return bail(err, conn); - ch.assertQueue(q, {durable: false}, function(err, ok) { - if (err !== null) return bail(err, conn); - ch.sendToQueue(q, Buffer.from(msg)); - console.log(" [x] Sent '%s'", msg); - ch.close(function() { conn.close(); }); +amqp.connect((err, connection) => { + if (err) return bail(err); + connection.createChannel((err, channel) => { + if (err) return bail(err, connection); + channel.assertQueue(queue, { durable: false }, (err) => { + if (err) return bail(err, connection); + channel.sendToQueue(queue, Buffer.from(text)); + console.log(" [x] Sent '%s'", text); + channel.close(() => { + connection.close(); + }); }); - } + }); +}); - conn.createChannel(on_channel_open); +function bail(err, connection) { + console.error(err); + if (connection) connection.close(() => { + process.exit(1); + }); } - -amqp.connect(on_connect); diff --git a/examples/tutorials/callback_api/worker.js b/examples/tutorials/callback_api/worker.js index ad7d0761..52c33d83 100755 --- a/examples/tutorials/callback_api/worker.js +++ b/examples/tutorials/callback_api/worker.js @@ -1,35 +1,39 @@ #!/usr/bin/env node -var amqp = require('amqplib/callback_api'); +const amqp = require('amqplib/callback_api'); -function bail(err, conn) { - console.error(err); - if (conn) conn.close(function() { process.exit(1); }); -} +const queue = 'task_queue'; -function on_connect(err, conn) { - if (err !== null) return bail(err); - process.once('SIGINT', function() { conn.close(); }); - - var q = 'task_queue'; +amqp.connect((err, connection) => { + if (err) return bail(err); + connection.createChannel((err, channel) => { + if (err) return bail(err, connection); + + process.once('SIGINT', () => { + channel.close(() => { + connection.close(); + }); + }); - conn.createChannel(function(err, ch) { - if (err !== null) return bail(err, conn); - ch.assertQueue(q, {durable: true}, function(err, _ok) { - ch.consume(q, doWork, {noAck: false}); + channel.assertQueue(queue, { durable: true }, (err, { queue }) => { + if (err) return bail(err, connection); + channel.consume(queue, (message) => { + const text = message.content.toString(); + console.log(" [x] Received '%s'", text); + const seconds = text.split('.').length - 1; + setTimeout(() => { + console.log(" [x] Done"); + channel.ack(message); + }, seconds * 1000); + }, { noAck: false }); console.log(" [*] Waiting for messages. To exit press CTRL+C"); }); + }); +}); - function doWork(msg) { - var body = msg.content.toString(); - console.log(" [x] Received '%s'", body); - var secs = body.split('.').length - 1; - setTimeout(function() { - console.log(" [x] Done"); - ch.ack(msg); - }, secs * 1000); - } +function bail(err, connection) { + console.error(err); + if (connection) connection.close(() => { + process.exit(1); }); } - -amqp.connect(on_connect); diff --git a/examples/tutorials/receive.js b/examples/tutorials/receive.js index f7f4f7fe..8716e3f0 100755 --- a/examples/tutorials/receive.js +++ b/examples/tutorials/receive.js @@ -2,15 +2,20 @@ const amqp = require('amqplib'); +const queue = 'hello'; + (async () => { try { const connection = await amqp.connect('amqp://localhost'); + const channel = await connection.createChannel(); + process.once('SIGINT', async () => { + await channel.close(); await connection.close(); }); - const channel = await connection.createChannel(); - await channel.assertQueue('hello', { durable: false }); - await channel.consume('hello', (message) => { + + await channel.assertQueue(queue, { durable: false }); + await channel.consume(queue, (message) => { console.log(" [x] Received '%s'", message.content.toString()); }, { noAck: true }); diff --git a/examples/tutorials/receive_logs.js b/examples/tutorials/receive_logs.js index 648f425d..14abc9a2 100755 --- a/examples/tutorials/receive_logs.js +++ b/examples/tutorials/receive_logs.js @@ -7,11 +7,13 @@ const exchange = 'logs'; (async () => { try { const connection = await amqp.connect('amqp://localhost'); + const channel = await connection.createChannel(); + process.once('SIGINT', async () => { + await channel.close(); await connection.close(); }); - const channel = await connection.createChannel(); await channel.assertExchange(exchange, 'fanout', { durable: false }); const { queue } = await channel.assertQueue('', { exclusive: true }); await channel.bindQueue(queue, exchange, '') diff --git a/examples/tutorials/receive_logs_direct.js b/examples/tutorials/receive_logs_direct.js index 7677f9b0..116fffc4 100755 --- a/examples/tutorials/receive_logs_direct.js +++ b/examples/tutorials/receive_logs_direct.js @@ -13,11 +13,13 @@ if (bindingKeys.length < 1) { (async () => { try { const connection = await amqp.connect('amqp://localhost'); + const channel = await connection.createChannel(); + process.once('SIGINT', async () => { + await channel.close(); await connection.close(); }); - const channel = await connection.createChannel(); await channel.assertExchange(exchange, 'direct', { durable: false }); const { queue } = await channel.assertQueue('', { exclusive: true }); await Promise.all(bindingKeys.map(async (bindingKey) => { @@ -33,4 +35,4 @@ if (bindingKeys.length < 1) { } catch(err) { console.warn(err); } -})(); \ No newline at end of file +})(); diff --git a/examples/tutorials/receive_logs_topic.js b/examples/tutorials/receive_logs_topic.js index a436fd3c..f99aa4ca 100755 --- a/examples/tutorials/receive_logs_topic.js +++ b/examples/tutorials/receive_logs_topic.js @@ -13,11 +13,13 @@ if (bindingKeys.length < 1) { (async () => { try { const connection = await amqp.connect('amqp://localhost'); + const channel = await connection.createChannel(); + process.once('SIGINT', async () => { + await channel.close(); await connection.close(); }); - const channel = await connection.createChannel(); await channel.assertExchange(exchange, 'topic', { durable: false }); const { queue } = await channel.assertQueue('', { exclusive: true }); await Promise.all(bindingKeys.map(async (bindingKey) => { diff --git a/examples/tutorials/rpc_client.js b/examples/tutorials/rpc_client.js index 8f48a70a..be9ceeb9 100755 --- a/examples/tutorials/rpc_client.js +++ b/examples/tutorials/rpc_client.js @@ -23,11 +23,13 @@ if (isNaN(n)) { const { queue: replyTo } = await channel.assertQueue('', { exclusive: true }); await channel.consume(replyTo, (message) => { - if (message.properties.correlationId === correlationId) { + if (!message) console.warn(' [x] Consumer cancelled'); + else if (message.properties.correlationId === correlationId) { resolve(message.content.toString()); - } + } }, { noAck: true }); + await channel.assertQueue(queue, { durable: false }); console.log(' [x] Requesting fib(%d)', n); channel.sendToQueue(queue, Buffer.from(n.toString()), { correlationId, diff --git a/examples/tutorials/rpc_server.js b/examples/tutorials/rpc_server.js index 990c5b3d..4651c0a5 100755 --- a/examples/tutorials/rpc_server.js +++ b/examples/tutorials/rpc_server.js @@ -4,25 +4,16 @@ const amqp = require('amqplib'); const queue = 'rpc_queue'; -function fib(n) { - // Do it the ridiculous, but not most ridiculous, way. For better, - // see http://nayuki.eigenstate.org/page/fast-fibonacci-algorithms - let a = 0, b = 1; - for (let i=0; i < n; i++) { - let c = a + b; - a = b; b = c; - } - return a; -} - (async () => { try { const connection = await amqp.connect('amqp://localhost'); + const channel = await connection.createChannel(); + process.once('SIGINT', async () => { + await channel.close(); await connection.close(); }); - const channel = await connection.createChannel(); await channel.assertQueue(queue, { durable: false }); channel.prefetch(1); @@ -43,3 +34,13 @@ function fib(n) { } })(); +function fib(n) { + // Do it the ridiculous, but not most ridiculous, way. For better, + // see http://nayuki.eigenstate.org/page/fast-fibonacci-algorithms + let a = 0, b = 1; + for (let i=0; i < n; i++) { + let c = a + b; + a = b; b = c; + } + return a; +} diff --git a/examples/tutorials/worker.js b/examples/tutorials/worker.js index 13cc4423..8807f578 100755 --- a/examples/tutorials/worker.js +++ b/examples/tutorials/worker.js @@ -31,4 +31,4 @@ const queue = 'task_queue'; catch (err) { console.warn(err); } -})(); \ No newline at end of file +})(); From 3f53f9747ef5a7117736059d2bc583476984a950 Mon Sep 17 00:00:00 2001 From: Steve Cresswell <229672+cressie176@users.noreply.github.com> Date: Sat, 10 Dec 2022 00:59:29 +0000 Subject: [PATCH 083/112] Update other examples --- examples/headers.js | 58 +++++++++---------- examples/ssl.js | 26 +++++---- examples/tutorials/callback_api/rpc_server.js | 2 +- examples/tutorials/rpc_server.js | 2 +- examples/waitForConfirms.js | 37 ++++++------ 5 files changed, 65 insertions(+), 60 deletions(-) diff --git a/examples/headers.js b/examples/headers.js index e4f7bcc0..13132b1b 100755 --- a/examples/headers.js +++ b/examples/headers.js @@ -2,24 +2,21 @@ // Example of using a headers exchange -var amqp = require('../') - -amqp.connect().then(function(conn) { - return conn.createChannel().then(withChannel); -}, console.error); - -function withChannel(ch) { - // NB the type of the exchange is 'headers' - ch.assertExchange('matching exchange', 'headers').then(function(ex) { - ch.assertQueue().then(function(q) { - bindAndConsume(ch, ex, q).then(function() { - send(ch, ex); - }); - }); +const amqp = require('../'); + +(async () => { + + const connection = await amqp.connect(); + const channel = await connection.createChannel(); + + process.once('SIGINT', async () => { + await channel.close(); + await connection.close(); }); -} -function bindAndConsume(ch, ex, q) { + const { exchange } = await channel.assertExchange('matching exchange', 'headers'); + const { queue } = await channel.assertQueue(); + // When using a headers exchange, the headers to be matched go in // the binding arguments. The routing key is ignore, so best left // empty. @@ -27,16 +24,19 @@ function bindAndConsume(ch, ex, q) { // 'x-match' is 'all' or 'any', meaning "all fields must match" or // "at least one field must match", respectively. The values to be // matched go in subsequent fields. - ch.bindQueue(q.queue, ex.exchange, '', {'x-match': 'any', - 'foo': 'bar', - 'baz': 'boo'}); - return ch.consume(q.queue, function(msg) { - console.log(msg.content.toString()); - }, {noAck: true}); -} - -function send(ch, ex) { - // The headers for a message are given as an option to `publish`: - ch.publish(ex.exchange, '', Buffer.from('hello'), {headers: {baz: 'boo'}}); - ch.publish(ex.exchange, '', Buffer.from('world'), {headers: {foo: 'bar'}}); -} + await channel.bindQueue(queue, exchange, '', { + 'x-match': 'any', + 'foo': 'bar', + 'baz': 'boo' + }); + + await channel.consume(queue, (message) => { + console.log(message.content.toString()); + }, { noAck: true }); + + channel.publish(exchange, '', Buffer.from('hello'), { headers: { baz: 'boo' }}); + channel.publish(exchange, '', Buffer.from('hello'), { headers: { foo: 'bar' }}); + channel.publish(exchange, '', Buffer.from('lost'), { headers: { meh: 'nah' }}); + + console.log(' [x] To exit press CTRL+C.'); +})(); diff --git a/examples/ssl.js b/examples/ssl.js index 07f1ae16..a0a3cd5a 100644 --- a/examples/ssl.js +++ b/examples/ssl.js @@ -18,8 +18,8 @@ // // openssl s_client -connect localhost:5671 -var amqp = require('../'); -var fs = require('fs'); +const amqp = require('../'); +const fs = require('fs'); // Assemble the SSL options; for verification we need at least // * a certificate to present to the server ('cert', in PEM format) @@ -34,7 +34,7 @@ var fs = require('fs'); // to use `rejectUnauthorized: false`. // Options for full client and server verification: -var opts = { +const opts = { cert: fs.readFileSync('../etc/client/cert.pem'), key: fs.readFileSync('../etc/client/key.pem'), // cert and key or @@ -49,16 +49,22 @@ var opts = { // {verify, verify_none}, // {fail_if_no_peer_cert,false} // -// var opts = { ca: [fs.readFileSync('../etc/testca/cacert.pem')] }; +// const opts = { ca: [fs.readFileSync('../etc/testca/cacert.pem')] }; // Option to use the SSL client certificate for authentication // opts.credentials = amqp.credentials.external(); -var open = amqp.connect('amqps://localhost', opts); +(async () => { + const connection = await amqp.connect('amqp://localhost', opts); + const channel = await connection.createChannel(); -open.then(function(conn) { - process.on('SIGINT', conn.close.bind(conn)); - return conn.createChannel().then(function(ch) { - ch.sendToQueue('foo', Buffer.from('Hello World!')); + process.on('SIGINT', async () => { + await channel.close(); + await connection.close(); }); -}).then(null, console.warn); + + channel.sendToQueue('foo', Buffer.from('Hello World!')); + + console.log(' [x] To exit press CTRL+C.'); +})(); + diff --git a/examples/tutorials/callback_api/rpc_server.js b/examples/tutorials/callback_api/rpc_server.js index 11253bdb..208bff4e 100755 --- a/examples/tutorials/callback_api/rpc_server.js +++ b/examples/tutorials/callback_api/rpc_server.js @@ -28,7 +28,7 @@ amqp.connect((err, connection) => { channel.ack(message); }, { noAck: false }, function(err) { if (err) return bail(err, conn); - console.log(' [x] Awaiting RPC requests'); + console.log(' [x] Awaiting RPC requests. To exit press CTRL+C.'); }); }); }); diff --git a/examples/tutorials/rpc_server.js b/examples/tutorials/rpc_server.js index 4651c0a5..13be3a71 100755 --- a/examples/tutorials/rpc_server.js +++ b/examples/tutorials/rpc_server.js @@ -27,7 +27,7 @@ const queue = 'rpc_queue'; channel.ack(message); }); - console.log(' [x] Awaiting RPC requests'); + console.log(' [x] Awaiting RPC requests. To exit press CTRL+C.'); } catch (err) { console.warn(err); diff --git a/examples/waitForConfirms.js b/examples/waitForConfirms.js index d16a1d81..a7fdbb06 100644 --- a/examples/waitForConfirms.js +++ b/examples/waitForConfirms.js @@ -1,22 +1,21 @@ -var amqp = require('../'); +const amqp = require('../'); -var NUM_MSGS = 20; +(async () => { + let connection; + try { + connection = await amqp.connect(); + const channel = await connection.createConfirmChannel(); -function mkCallback(i) { - return (i % 2) === 0 ? function(err) { - if (err !== null) { console.error('Message %d failed!', i); } - else { console.log('Message %d confirmed', i); } - } : null; -} + for (var i=0; i < 20; i++) { + channel.publish('amq.topic', 'whatever', Buffer.from('blah')); + }; -amqp.connect().then(function(c) { - c.createConfirmChannel().then(function(ch) { - for (var i=0; i < NUM_MSGS; i++) { - ch.publish('amq.topic', 'whatever', Buffer.from('blah'), {}, mkCallback(i)); - } - ch.waitForConfirms().then(function() { - console.log('All messages done'); - c.close(); - }).catch(console.error); - }); -}); + await channel.waitForConfirms(); + console.log('All messages done'); + await channel.close(); + } catch (err) { + console.warn(err); + } finally { + if (connection) await connection.close(); + } +})(); From 8aab45663f48caf0dd57f8b5341f1ebf9bed0fba Mon Sep 17 00:00:00 2001 From: Steve Cresswell <229672+cressie176@users.noreply.github.com> Date: Sat, 10 Dec 2022 01:24:47 +0000 Subject: [PATCH 084/112] Update other examples --- examples/headers.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/headers.js b/examples/headers.js index 13132b1b..dce178c4 100755 --- a/examples/headers.js +++ b/examples/headers.js @@ -1,7 +1,5 @@ #!/usr/bin/env node -// Example of using a headers exchange - const amqp = require('../'); (async () => { From 5ff264a27622f47bf20adfd5363bccf2cf954068 Mon Sep 17 00:00:00 2001 From: Steve Cresswell <229672+cressie176@users.noreply.github.com> Date: Sat, 10 Dec 2022 01:25:03 +0000 Subject: [PATCH 085/112] Add direct reply to example --- examples/direct_reply_to_client.js | 22 ++++++++++++++++++++++ examples/direct_reply_to_server.js | 25 +++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 examples/direct_reply_to_client.js create mode 100644 examples/direct_reply_to_server.js diff --git a/examples/direct_reply_to_client.js b/examples/direct_reply_to_client.js new file mode 100644 index 00000000..4c7027c6 --- /dev/null +++ b/examples/direct_reply_to_client.js @@ -0,0 +1,22 @@ +#!/usr/bin/env node + +const amqp = require('../'); + +const queue = 'rpc_queue'; + +(async () => { + const connection = await amqp.connect(); + const channel = await connection.createChannel(); + + await channel.consume('amq.rabbitmq.reply-to', async (message) => { + console.log(message.content.toString()); + await channel.close(); + await connection.close(); + }, { noAck: true }); + + await channel.assertQueue(queue, { durable: false }); + + channel.sendToQueue(queue, Buffer.from(' [X] ping'), { + replyTo: 'amq.rabbitmq.reply-to', + }); +})(); diff --git a/examples/direct_reply_to_server.js b/examples/direct_reply_to_server.js new file mode 100644 index 00000000..394890ec --- /dev/null +++ b/examples/direct_reply_to_server.js @@ -0,0 +1,25 @@ +#!/usr/bin/env node + +const amqp = require('../'); +const { v4: uuid } = require('uuid'); + +const queue = 'rpc_queue'; + +(async () => { + const connection = await amqp.connect(); + const channel = await connection.createChannel(); + + process.once('SIGINT', async () => { + await channel.close(); + await connection.close(); + }); + + await channel.assertQueue(queue, { durable: false }); + await channel.consume(queue, (message) => { + console.log(message.content.toString()); + channel.sendToQueue(message.properties.replyTo, Buffer.from(' [.] pong')); + }, { noAck: true }); + + console.log(' [x] To exit press CTRL+C.'); + +})(); From b9ed9c939b7039204a2a31f61a7b466500da8e48 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Sat, 31 Dec 2022 08:28:25 +0000 Subject: [PATCH 086/112] Update bug_report.md --- .github/ISSUE_TEMPLATE/bug_report.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 1608c52d..163e70e5 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -23,16 +23,16 @@ Before reporting a bug or requesting support please... - https://www.cloudamqp.com/blog/part1-rabbitmq-for-beginners-what-is-rabbitmq.html - https://www.rabbitmq.com/tutorials/amqp-concepts.html -If the above does not help, please provide the following information... +If the above does not help, please provide as much of the following information as is relevant... - A clear and concise description of the problem - RabbitMQ version - amqplib version - Node.js version + - The simplest possible code snippet that demonstrates the problem + - A stack trace -If you include code snippets, please format them so they are easier to read and keep them to the bare minimum that demonstrates the problem. - -- https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks +Please format code snippets and/or stack traces using [GitHub Markdown](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks). Thank you From 222ee77078bb1bd384e3417bcfaa1929f6597d38 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Sat, 31 Dec 2022 08:29:29 +0000 Subject: [PATCH 087/112] Update bug_report.md --- .github/ISSUE_TEMPLATE/bug_report.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 163e70e5..1848532e 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -32,7 +32,9 @@ If the above does not help, please provide as much of the following information - The simplest possible code snippet that demonstrates the problem - A stack trace -Please format code snippets and/or stack traces using [GitHub Markdown](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks). +Please format code snippets and/or stack traces using GitHub Markdown + + - https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks). Thank you From c7b6b1d146357dd78aebf597ee06fd565213e686 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20W=C3=A4rting?= Date: Mon, 16 Jan 2023 22:40:39 +0100 Subject: [PATCH 088/112] classify callback model (#691) --- lib/callback_model.js | 579 +++++++++++++++++++++--------------------- 1 file changed, 290 insertions(+), 289 deletions(-) diff --git a/lib/callback_model.js b/lib/callback_model.js index 3a0b3b3e..598bcf3b 100644 --- a/lib/callback_model.js +++ b/lib/callback_model.js @@ -5,47 +5,271 @@ 'use strict'; var defs = require('./defs'); -var inherits = require('util').inherits; var EventEmitter = require('events').EventEmitter; var BaseChannel = require('./channel').BaseChannel; var acceptMessage = require('./channel').acceptMessage; var Args = require('./api_args'); -function CallbackModel(connection) { - if (!(this instanceof CallbackModel)) - return new CallbackModel(connection); - EventEmitter.call( this ); - this.connection = connection; - var self = this; - ['error', 'close', 'blocked', 'unblocked'].forEach(function(ev) { - connection.on(ev, self.emit.bind(self, ev)); - }); +class CallbackModel extends EventEmitter { + constructor (connection) { + super(); + this.connection = connection; + var self = this; + ['error', 'close', 'blocked', 'unblocked'].forEach(function (ev) { + connection.on(ev, self.emit.bind(self, ev)); + }); + } + + close (cb) { + this.connection.close(cb); + } + + createChannel (cb) { + var ch = new Channel(this.connection); + ch.open(function (err, ok) { + if (err === null) + cb && cb(null, ch); + else + cb && cb(err); + }); + return ch; + } + + createConfirmChannel (cb) { + var ch = new ConfirmChannel(this.connection); + ch.open(function (err) { + if (err !== null) + return cb && cb(err); + else { + ch.rpc(defs.ConfirmSelect, { nowait: false }, + defs.ConfirmSelectOk, function (err, _ok) { + if (err !== null) + return cb && cb(err); + else + cb && cb(null, ch); + }); + } + }); + return ch; + } } -inherits(CallbackModel, EventEmitter); -module.exports.CallbackModel = CallbackModel; +class Channel extends BaseChannel { + constructor (connection) { + super(connection); + this.on('delivery', this.handleDelivery.bind(this)); + this.on('cancel', this.handleCancel.bind(this)); + } + + // This encodes straight-forward RPC: no side-effects and return the + // fields from the server response. It wraps the callback given it, so + // the calling method argument can be passed as-is. For anything that + // needs to have side-effects, or needs to change the server response, + // use `#_rpc(...)` and remember to dereference `.fields` of the + // server response. + rpc (method, fields, expect, cb0) { + var cb = callbackWrapper(this, cb0); + this._rpc(method, fields, expect, function (err, ok) { + cb(err, ok && ok.fields); // in case of an error, ok will be + + // undefined + }); + return this; + } + + // === Public API === + open (cb) { + try { this.allocate(); } + catch (e) { return cb(e); } + + return this.rpc(defs.ChannelOpen, { outOfBand: "" }, + defs.ChannelOpenOk, cb); + } + + close (cb) { + return this.closeBecause("Goodbye", defs.constants.REPLY_SUCCESS, + function () { cb && cb(null); }); + } + + assertQueue (queue, options, cb) { + return this.rpc(defs.QueueDeclare, + Args.assertQueue(queue, options), + defs.QueueDeclareOk, cb); + } + + checkQueue (queue, cb) { + return this.rpc(defs.QueueDeclare, + Args.checkQueue(queue), + defs.QueueDeclareOk, cb); + } + + deleteQueue (queue, options, cb) { + return this.rpc(defs.QueueDelete, + Args.deleteQueue(queue, options), + defs.QueueDeleteOk, cb); + } + + purgeQueue (queue, cb) { + return this.rpc(defs.QueuePurge, + Args.purgeQueue(queue), + defs.QueuePurgeOk, cb); + } + + bindQueue (queue, source, pattern, argt, cb) { + return this.rpc(defs.QueueBind, + Args.bindQueue(queue, source, pattern, argt), + defs.QueueBindOk, cb); + } -CallbackModel.prototype.close = function(cb) { - this.connection.close(cb); -}; + unbindQueue (queue, source, pattern, argt, cb) { + return this.rpc(defs.QueueUnbind, + Args.unbindQueue(queue, source, pattern, argt), + defs.QueueUnbindOk, cb); + } + + assertExchange (ex, type, options, cb0) { + var cb = callbackWrapper(this, cb0); + this._rpc(defs.ExchangeDeclare, + Args.assertExchange(ex, type, options), + defs.ExchangeDeclareOk, + function (e, _) { cb(e, { exchange: ex }); }); + return this; + } + + checkExchange (exchange, cb) { + return this.rpc(defs.ExchangeDeclare, + Args.checkExchange(exchange), + defs.ExchangeDeclareOk, cb); + } + + deleteExchange (exchange, options, cb) { + return this.rpc(defs.ExchangeDelete, + Args.deleteExchange(exchange, options), + defs.ExchangeDeleteOk, cb); + } + + bindExchange (dest, source, pattern, argt, cb) { + return this.rpc(defs.ExchangeBind, + Args.bindExchange(dest, source, pattern, argt), + defs.ExchangeBindOk, cb); + } -function Channel(connection) { - BaseChannel.call(this, connection); - this.on('delivery', this.handleDelivery.bind(this)); - this.on('cancel', this.handleCancel.bind(this)); -} -inherits(Channel, BaseChannel); + unbindExchange (dest, source, pattern, argt, cb) { + return this.rpc(defs.ExchangeUnbind, + Args.unbindExchange(dest, source, pattern, argt), + defs.ExchangeUnbindOk, cb); + } -module.exports.Channel = Channel; + publish (exchange, routingKey, content, options) { + var fieldsAndProps = Args.publish(exchange, routingKey, options); + return this.sendMessage(fieldsAndProps, fieldsAndProps, content); + } + + sendToQueue (queue, content, options) { + return this.publish('', queue, content, options); + } + + consume (queue, callback, options, cb0) { + var cb = callbackWrapper(this, cb0); + var fields = Args.consume(queue, options); + var self = this; + this._rpc( + defs.BasicConsume, fields, defs.BasicConsumeOk, + function (err, ok) { + if (err === null) { + self.registerConsumer(ok.fields.consumerTag, callback); + cb(null, ok.fields); + } + else + cb(err); + }); + return this; + } + + cancel (consumerTag, cb0) { + var cb = callbackWrapper(this, cb0); + var self = this; + this._rpc( + defs.BasicCancel, Args.cancel(consumerTag), defs.BasicCancelOk, + function (err, ok) { + if (err === null) { + self.unregisterConsumer(consumerTag); + cb(null, ok.fields); + } + else + cb(err); + }); + return this; + } + + get (queue, options, cb0) { + var self = this; + var fields = Args.get(queue, options); + var cb = callbackWrapper(this, cb0); + this.sendOrEnqueue(defs.BasicGet, fields, function (err, f) { + if (err === null) { + if (f.id === defs.BasicGetEmpty) { + cb(null, false); + } + else if (f.id === defs.BasicGetOk) { + self.handleMessage = acceptMessage(function (m) { + m.fields = f.fields; + cb(null, m); + }); + } + else { + cb(new Error("Unexpected response to BasicGet: " + + inspect(f))); + } + } + }); + return this; + } + + ack (message, allUpTo) { + this.sendImmediately( + defs.BasicAck, Args.ack(message.fields.deliveryTag, allUpTo)); + return this; + } + + ackAll () { + this.sendImmediately(defs.BasicAck, Args.ack(0, true)); + return this; + } + + nack (message, allUpTo, requeue) { + this.sendImmediately( + defs.BasicNack, + Args.nack(message.fields.deliveryTag, allUpTo, requeue)); + return this; + } + + nackAll (requeue) { + this.sendImmediately( + defs.BasicNack, Args.nack(0, true, requeue)); + return this; + } + + reject (message, requeue) { + this.sendImmediately( + defs.BasicReject, + Args.reject(message.fields.deliveryTag, requeue)); + return this; + } + + prefetch (count, global, cb) { + return this.rpc(defs.BasicQos, + Args.prefetch(count, global), + defs.BasicQosOk, cb); + } + + recover (cb) { + return this.rpc(defs.BasicRecover, + Args.recover(), + defs.BasicRecoverOk, cb); + } +} -CallbackModel.prototype.createChannel = function(cb) { - var ch = new Channel(this.connection); - ch.open(function(err, ok) { - if (err === null) cb && cb(null, ch); - else cb && cb(err); - }); - return ch; -}; // Wrap an RPC callback to make sure the callback is invoked with // either `(null, value)` or `(error)`, i.e., never two non-null @@ -61,267 +285,44 @@ function callbackWrapper(ch, cb) { } : function() {}; } -// This encodes straight-forward RPC: no side-effects and return the -// fields from the server response. It wraps the callback given it, so -// the calling method argument can be passed as-is. For anything that -// needs to have side-effects, or needs to change the server response, -// use `#_rpc(...)` and remember to dereference `.fields` of the -// server response. -Channel.prototype.rpc = function(method, fields, expect, cb0) { - var cb = callbackWrapper(this, cb0); - this._rpc(method, fields, expect, function(err, ok) { - cb(err, ok && ok.fields); // in case of an error, ok will be - // undefined - }); - return this; -}; - -// === Public API === - -Channel.prototype.open = function(cb) { - try { this.allocate(); } - catch (e) { return cb(e); } - - return this.rpc(defs.ChannelOpen, {outOfBand: ""}, - defs.ChannelOpenOk, cb); -}; - -Channel.prototype.close = function(cb) { - return this.closeBecause("Goodbye", defs.constants.REPLY_SUCCESS, - function() { cb && cb(null); }); -}; - -Channel.prototype.assertQueue = function(queue, options, cb) { - return this.rpc(defs.QueueDeclare, - Args.assertQueue(queue, options), - defs.QueueDeclareOk, cb); -}; - -Channel.prototype.checkQueue = function(queue, cb) { - return this.rpc(defs.QueueDeclare, - Args.checkQueue(queue), - defs.QueueDeclareOk, cb); -}; - -Channel.prototype.deleteQueue = function(queue, options, cb) { - return this.rpc(defs.QueueDelete, - Args.deleteQueue(queue, options), - defs.QueueDeleteOk, cb); -}; - -Channel.prototype.purgeQueue = function(queue, cb) { - return this.rpc(defs.QueuePurge, - Args.purgeQueue(queue), - defs.QueuePurgeOk, cb); -}; - -Channel.prototype.bindQueue = - function(queue, source, pattern, argt, cb) { - return this.rpc(defs.QueueBind, - Args.bindQueue(queue, source, pattern, argt), - defs.QueueBindOk, cb); - }; - -Channel.prototype.unbindQueue = - function(queue, source, pattern, argt, cb) { - return this.rpc(defs.QueueUnbind, - Args.unbindQueue(queue, source, pattern, argt), - defs.QueueUnbindOk, cb); - }; - -Channel.prototype.assertExchange = function(ex, type, options, cb0) { - var cb = callbackWrapper(this, cb0); - this._rpc(defs.ExchangeDeclare, - Args.assertExchange(ex, type, options), - defs.ExchangeDeclareOk, - function(e, _) { cb(e, {exchange: ex}); }); - return this; -}; - -Channel.prototype.checkExchange = function(exchange, cb) { - return this.rpc(defs.ExchangeDeclare, - Args.checkExchange(exchange), - defs.ExchangeDeclareOk, cb); -}; - -Channel.prototype.deleteExchange = function(exchange, options, cb) { - return this.rpc(defs.ExchangeDelete, - Args.deleteExchange(exchange, options), - defs.ExchangeDeleteOk, cb); -}; - -Channel.prototype.bindExchange = - function(dest, source, pattern, argt, cb) { - return this.rpc(defs.ExchangeBind, - Args.bindExchange(dest, source, pattern, argt), - defs.ExchangeBindOk, cb); - }; - -Channel.prototype.unbindExchange = - function(dest, source, pattern, argt, cb) { - return this.rpc(defs.ExchangeUnbind, - Args.unbindExchange(dest, source, pattern, argt), - defs.ExchangeUnbindOk, cb); - }; - -Channel.prototype.publish = - function(exchange, routingKey, content, options) { - var fieldsAndProps = Args.publish(exchange, routingKey, options); - return this.sendMessage(fieldsAndProps, fieldsAndProps, content); - }; - -Channel.prototype.sendToQueue = function(queue, content, options) { - return this.publish('', queue, content, options); -}; - -Channel.prototype.consume = function(queue, callback, options, cb0) { - var cb = callbackWrapper(this, cb0); - var fields = Args.consume(queue, options); - var self = this; - this._rpc( - defs.BasicConsume, fields, defs.BasicConsumeOk, - function(err, ok) { - if (err === null) { - self.registerConsumer(ok.fields.consumerTag, callback); - cb(null, ok.fields); - } - else cb(err); - }); - return this; -}; - -Channel.prototype.cancel = function(consumerTag, cb0) { - var cb = callbackWrapper(this, cb0); - var self = this; - this._rpc( - defs.BasicCancel, Args.cancel(consumerTag), defs.BasicCancelOk, - function(err, ok) { - if (err === null) { - self.unregisterConsumer(consumerTag); - cb(null, ok.fields); - } - else cb(err); - }); - return this; -}; - -Channel.prototype.get = function(queue, options, cb0) { - var self = this; - var fields = Args.get(queue, options); - var cb = callbackWrapper(this, cb0); - this.sendOrEnqueue(defs.BasicGet, fields, function(err, f) { - if (err === null) { - if (f.id === defs.BasicGetEmpty) { - cb(null, false); - } - else if (f.id === defs.BasicGetOk) { - self.handleMessage = acceptMessage(function(m) { - m.fields = f.fields; - cb(null, m); - }); - } +class ConfirmChannel extends Channel { + publish (exchange, routingKey, + content, options, cb) { + this.pushConfirmCallback(cb); + return Channel.prototype.publish.call( + this, exchange, routingKey, content, options); + } + + sendToQueue (queue, content, + options, cb) { + return this.publish('', queue, content, options, cb); + } + + waitForConfirms (k) { + var awaiting = []; + var unconfirmed = this.unconfirmed; + unconfirmed.forEach(function (val, index) { + if (val === null) + ; // already confirmed else { - cb(new Error("Unexpected response to BasicGet: " + - inspect(f))); + var confirmed = new Promise(function (resolve, reject) { + unconfirmed[index] = function (err) { + if (val) + val(err); + if (err === null) + resolve(); + else + reject(err); + }; + }); + awaiting.push(confirmed); } - } - }); - return this; -}; - -Channel.prototype.ack = function(message, allUpTo) { - this.sendImmediately( - defs.BasicAck, Args.ack(message.fields.deliveryTag, allUpTo)); - return this; -}; - -Channel.prototype.ackAll = function() { - this.sendImmediately(defs.BasicAck, Args.ack(0, true)); - return this; -}; - -Channel.prototype.nack = function(message, allUpTo, requeue) { - this.sendImmediately( - defs.BasicNack, - Args.nack(message.fields.deliveryTag, allUpTo, requeue)); - return this; -}; - -Channel.prototype.nackAll = function(requeue) { - this.sendImmediately( - defs.BasicNack, Args.nack(0, true, requeue)) - return this; -}; - -Channel.prototype.reject = function(message, requeue) { - this.sendImmediately( - defs.BasicReject, - Args.reject(message.fields.deliveryTag, requeue)); - return this; -}; - -Channel.prototype.prefetch = function(count, global, cb) { - return this.rpc(defs.BasicQos, - Args.prefetch(count, global), - defs.BasicQosOk, cb); -}; - -Channel.prototype.recover = function(cb) { - return this.rpc(defs.BasicRecover, - Args.recover(), - defs.BasicRecoverOk, cb); -}; - -function ConfirmChannel(connection) { - Channel.call(this, connection); + }); + return Promise.all(awaiting).then(function () { k(); }, + function (err) { k(err); }); + } } -inherits(ConfirmChannel, Channel); +module.exports.CallbackModel = CallbackModel; +module.exports.Channel = Channel; module.exports.ConfirmChannel = ConfirmChannel; - -CallbackModel.prototype.createConfirmChannel = function(cb) { - var ch = new ConfirmChannel(this.connection); - ch.open(function(err) { - if (err !== null) return cb && cb(err); - else { - ch.rpc(defs.ConfirmSelect, {nowait: false}, - defs.ConfirmSelectOk, function(err, _ok) { - if (err !== null) return cb && cb(err); - else cb && cb(null, ch); - }); - } - }); - return ch; -}; - -ConfirmChannel.prototype.publish = function(exchange, routingKey, - content, options, cb) { - this.pushConfirmCallback(cb); - return Channel.prototype.publish.call( - this, exchange, routingKey, content, options); -}; - -ConfirmChannel.prototype.sendToQueue = function(queue, content, - options, cb) { - return this.publish('', queue, content, options, cb); -}; - -ConfirmChannel.prototype.waitForConfirms = function(k) { - var awaiting = []; - var unconfirmed = this.unconfirmed; - unconfirmed.forEach(function(val, index) { - if (val === null); // already confirmed - else { - var confirmed = new Promise(function(resolve, reject) { - unconfirmed[index] = function(err) { - if (val) val(err); - if (err === null) resolve(); - else reject(err); - }; - }); - awaiting.push(confirmed); - } - }); - return Promise.all(awaiting).then(function() { k(); }, - function(err) { k(err); }); -}; From 3abcf0dde5105bba2bf5deeeb24dcea7955a0226 Mon Sep 17 00:00:00 2001 From: Gabriele Santomaggio Date: Mon, 16 Jan 2023 22:49:30 +0100 Subject: [PATCH 089/112] Add example for RabbitMQ stream queues (#668) Co-authored-by: Alessandro Attene <74595044+aleattene@users.noreply.github.com> Co-authored-by: Igor Savin --- examples/stream_queues/README.md | 15 ++++++++ examples/stream_queues/receive_stream.js | 47 ++++++++++++++++++++++++ examples/stream_queues/send_stream.js | 41 +++++++++++++++++++++ 3 files changed, 103 insertions(+) create mode 100644 examples/stream_queues/README.md create mode 100755 examples/stream_queues/receive_stream.js create mode 100755 examples/stream_queues/send_stream.js diff --git a/examples/stream_queues/README.md b/examples/stream_queues/README.md new file mode 100644 index 00000000..b72ca917 --- /dev/null +++ b/examples/stream_queues/README.md @@ -0,0 +1,15 @@ +RabbitMQ Stream Examples +--- +The [stream queues](https://www.rabbitmq.com/streams.html) are available starting from RabbitMQ 3.9 + +These examples show how to use stream queues with the lib. + +Send a message to a stream queue +``` +./send_stream.js +``` + +Receive all the messages from stream queue: +``` +./receive_stream.js +``` \ No newline at end of file diff --git a/examples/stream_queues/receive_stream.js b/examples/stream_queues/receive_stream.js new file mode 100755 index 00000000..dfc18b12 --- /dev/null +++ b/examples/stream_queues/receive_stream.js @@ -0,0 +1,47 @@ +#!/usr/bin/env node +const amqp = require('amqplib'); + + +async function receiveStream() { + try { + const connection = await amqp.connect('amqp://localhost'); + process.once('SIGINT', connection.close); + + const channel = await connection.createChannel(); + const queue = 'my_first_stream'; + + // Define the queue stream + // Mandatory: exclusive: false, durable: true autoDelete: false + await channel.assertQueue(queue, { + exclusive: false, + durable: true, + autoDelete: false, + arguments: { + 'x-queue-type': 'stream', // Mandatory to define stream queue + 'x-max-length-bytes': 2_000_000_000 // Set the queue retention to 2GB else the stream doesn't have any limit + } + }); + + channel.qos(100); // This is mandatory + + channel.consume(queue, (msg) => { + console.log(" [x] Received '%s'", msg.content.toString()); + channel.ack(msg); // Mandatory + }, { + noAck: false, + arguments: { + 'x-stream-offset': 'first' // Here you can specify the offset: : first, last, next, and timestamp + // with first start consuming always from the beginning + } + }); + + console.log(' [*] Waiting for messages. To exit press CTRL+C'); + } + // Catch and display any errors in the console + catch(e) { console.log(e) } +} + + +module.exports = { + receiveStream +} \ No newline at end of file diff --git a/examples/stream_queues/send_stream.js b/examples/stream_queues/send_stream.js new file mode 100755 index 00000000..acb8ffae --- /dev/null +++ b/examples/stream_queues/send_stream.js @@ -0,0 +1,41 @@ +#!/usr/bin/env node +const amqp = require('amqplib'); + + +async function sendStream () { + try { + const connection = await amqp.connect('amqp://localhost'); + process.once('SIGINT', connection.close); + + const channel = await connection.createChannel(); + const queue = 'my_first_stream'; + const msg = 'Hello World!'; + + // Define the queue stream + // Mandatory: exclusive: false, durable: true autoDelete: false + await channel.assertQueue(queue, { + exclusive: false, + durable: true, + autoDelete: false, + arguments: { + 'x-queue-type': 'stream', // Mandatory to define stream queue + 'x-max-length-bytes': 2_000_000_000 // Set the queue retention to 2GB else the stream doesn't have any limit + } + }); + + // Send the message to the stream queue + await channel.sendToQueue(queue, Buffer.from(msg)); + console.log(" [x] Sent '%s'", msg); + await channel.close(); + + // Close connection + connection.close(); + } + // Catch and display any errors in the console + catch(e) { console.log(e) } +} + + +module.exports = { + sendStream +} \ No newline at end of file From 678b9dff799a9b7a33209755840fa70333e58537 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Mon, 12 Jun 2023 18:21:43 +0100 Subject: [PATCH 090/112] Improve stream example --- CHANGELOG.md | 4 ++++ examples/stream_queues/.gitignore | 1 + examples/stream_queues/package.json | 14 +++++++++++ examples/stream_queues/receive_stream.js | 30 ++++++++++++++---------- examples/stream_queues/send_stream.js | 15 +++++------- 5 files changed, 43 insertions(+), 21 deletions(-) create mode 100644 examples/stream_queues/.gitignore create mode 100644 examples/stream_queues/package.json diff --git a/CHANGELOG.md b/CHANGELOG.md index b157108e..fca65655 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change log for amqplib +## Unreleased + +- Improve stream example as per https://github.com/amqp-node/amqplib/issues/722 + ## Changes in v0.10.3 git log v0.10.2..v0.10.3 diff --git a/examples/stream_queues/.gitignore b/examples/stream_queues/.gitignore new file mode 100644 index 00000000..d8b83df9 --- /dev/null +++ b/examples/stream_queues/.gitignore @@ -0,0 +1 @@ +package-lock.json diff --git a/examples/stream_queues/package.json b/examples/stream_queues/package.json new file mode 100644 index 00000000..9ed1fe7e --- /dev/null +++ b/examples/stream_queues/package.json @@ -0,0 +1,14 @@ +{ + "name": "stream_queues", + "version": "1.0.0", + "description": "An example demonstrating use of stream queues", + "main": "n", + "dependencies": { + "amqplib": "^0.10.3" + }, + "devDependencies": {}, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "license": "ISC" +} diff --git a/examples/stream_queues/receive_stream.js b/examples/stream_queues/receive_stream.js index dfc18b12..28d5d949 100755 --- a/examples/stream_queues/receive_stream.js +++ b/examples/stream_queues/receive_stream.js @@ -1,8 +1,6 @@ -#!/usr/bin/env node const amqp = require('amqplib'); - -async function receiveStream() { +(async () => { try { const connection = await amqp.connect('amqp://localhost'); process.once('SIGINT', connection.close); @@ -30,18 +28,26 @@ async function receiveStream() { }, { noAck: false, arguments: { - 'x-stream-offset': 'first' // Here you can specify the offset: : first, last, next, and timestamp - // with first start consuming always from the beginning + /* + Here you can specify the offset: : first, last, next, offset and timestamp, i.e. + + 'x-stream-offset': 'first' + 'x-stream-offset': 'last' + 'x-stream-offset': 'next' + 'x-stream-offset': 5 + 'x-stream-offset': { '!': 'timestamp', value: 1686519750 } + + The timestamp must be the desired number of seconds since 00:00:00 UTC, 1970-01-01 + + */ + 'x-stream-offset': 'first' } }); console.log(' [*] Waiting for messages. To exit press CTRL+C'); } // Catch and display any errors in the console - catch(e) { console.log(e) } -} - - -module.exports = { - receiveStream -} \ No newline at end of file + catch(e) { + console.log(e) + } +})(); diff --git a/examples/stream_queues/send_stream.js b/examples/stream_queues/send_stream.js index acb8ffae..3d6991db 100755 --- a/examples/stream_queues/send_stream.js +++ b/examples/stream_queues/send_stream.js @@ -1,15 +1,14 @@ -#!/usr/bin/env node const amqp = require('amqplib'); -async function sendStream () { +(async () => { try { const connection = await amqp.connect('amqp://localhost'); process.once('SIGINT', connection.close); const channel = await connection.createChannel(); const queue = 'my_first_stream'; - const msg = 'Hello World!'; + const msg = `Hello World! ${Date.now()}`; // Define the queue stream // Mandatory: exclusive: false, durable: true autoDelete: false @@ -32,10 +31,8 @@ async function sendStream () { connection.close(); } // Catch and display any errors in the console - catch(e) { console.log(e) } -} - + catch(e) { + console.log(e) + } +})(); -module.exports = { - sendStream -} \ No newline at end of file From d819bcfc1f514d07973bfeb6af7b397b14a060b0 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Mon, 12 Jun 2023 18:39:05 +0100 Subject: [PATCH 091/112] Improve stream example --- examples/stream_queues/README.md | 31 +++++++++++++++++++++--- examples/stream_queues/receive_stream.js | 4 ++- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/examples/stream_queues/README.md b/examples/stream_queues/README.md index b72ca917..b4f5b558 100644 --- a/examples/stream_queues/README.md +++ b/examples/stream_queues/README.md @@ -6,10 +6,35 @@ These examples show how to use stream queues with the lib. Send a message to a stream queue ``` -./send_stream.js +node send_stream.js ``` Receive all the messages from stream queue: ``` -./receive_stream.js -``` \ No newline at end of file +node receive_stream.js +``` + +Consumers can be configured to receive messages using an offset via the `x-stream-offset` argument. e.g. + +```js +channel.consume(queue, onMessage, { + noAck: false, + arguments: { + 'x-stream-offset': 'first' + } +}); +``` + +RabbitMQ supports six different types of offset, however specifying them can be + +| Offset Type | Example Value | Notes | +|-----------|------------------------------------------------------------------|-------| +| First | `{ 'x-stream-offset': 'first' }` | Start from the first message in the log | +| Last | `{ 'x-stream-offset': 'last' }` | Start from the last "chunk" of messages (could be multiple messages) | +| Next | `{ 'x-stream-offset': 'next' }` | Start from the next message (the default) | +| Offset | `{ 'x-stream-offset': 5 }` | a numerical value specifying an exact offset to attach to the log at | +| Timestamp | `{ 'x-stream-offset': { '!': 'timestamp', value: 1686519750 } }` | a timestamp value specifying the point in time to attach to the log at. The timestamp must be the number of seconds since 00:00:00 UTC, 1970-01-01. Consumers can receive messages published a bit before the specified timestamp. | +| Interval | `{ 'x-stream-offset': '1h' }` | the time interval relative to current time to attach the log at. Valid units are Y, M, D, h, m and s | + + +See https://www.rabbitmq.com/streams.html#consuming for more details diff --git a/examples/stream_queues/receive_stream.js b/examples/stream_queues/receive_stream.js index 28d5d949..6144a4d1 100755 --- a/examples/stream_queues/receive_stream.js +++ b/examples/stream_queues/receive_stream.js @@ -29,15 +29,17 @@ const amqp = require('amqplib'); noAck: false, arguments: { /* - Here you can specify the offset: : first, last, next, offset and timestamp, i.e. + Here you can specify the offset: : first, last, next, offset, timestamp and interval, i.e. 'x-stream-offset': 'first' 'x-stream-offset': 'last' 'x-stream-offset': 'next' 'x-stream-offset': 5 'x-stream-offset': { '!': 'timestamp', value: 1686519750 } + 'x-stream-offset': '1h' The timestamp must be the desired number of seconds since 00:00:00 UTC, 1970-01-01 + The interval units can be Y, M, D, h, m, s */ 'x-stream-offset': 'first' From 2288abc78bfff7a5b335aebaf742d9ff77b58ca6 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Mon, 12 Jun 2023 18:46:24 +0100 Subject: [PATCH 092/112] Update README.md --- examples/stream_queues/README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/stream_queues/README.md b/examples/stream_queues/README.md index b4f5b558..10320daf 100644 --- a/examples/stream_queues/README.md +++ b/examples/stream_queues/README.md @@ -27,14 +27,14 @@ channel.consume(queue, onMessage, { RabbitMQ supports six different types of offset, however specifying them can be -| Offset Type | Example Value | Notes | -|-----------|------------------------------------------------------------------|-------| -| First | `{ 'x-stream-offset': 'first' }` | Start from the first message in the log | -| Last | `{ 'x-stream-offset': 'last' }` | Start from the last "chunk" of messages (could be multiple messages) | -| Next | `{ 'x-stream-offset': 'next' }` | Start from the next message (the default) | -| Offset | `{ 'x-stream-offset': 5 }` | a numerical value specifying an exact offset to attach to the log at | -| Timestamp | `{ 'x-stream-offset': { '!': 'timestamp', value: 1686519750 } }` | a timestamp value specifying the point in time to attach to the log at. The timestamp must be the number of seconds since 00:00:00 UTC, 1970-01-01. Consumers can receive messages published a bit before the specified timestamp. | -| Interval | `{ 'x-stream-offset': '1h' }` | the time interval relative to current time to attach the log at. Valid units are Y, M, D, h, m and s | +| Offset Type | Example Value | Notes | +|-----------|----------------------------------------------------------|-------| +| First | `{'x-stream-offset':'first'}` | Start from the first message in the log | +| Last | `{'x-stream-offset':'last'}` | Start from the last "chunk" of messages (could be multiple messages) | +| Next | `{'x-stream-offset':'next'}` | Start from the next message (the default) | +| Offset | `{'x-stream-offset':5}` | a numerical value specifying an exact offset to attach to the log at | +| Timestamp | `{'x-stream-offset':{'!':'timestamp',value:1686519750}}` | a timestamp value specifying the point in time to attach to the log at. The timestamp must be the number of seconds since 00:00:00 UTC, 1970-01-01. Consumers can receive messages published a bit before the specified timestamp. | +| Interval | `{'x-stream-offset':'1h'}` | the time interval relative to current time to attach the log at. Valid units are Y, M, D, h, m and s | See https://www.rabbitmq.com/streams.html#consuming for more details From 2886ca700a6af7057b47125958d597fcc49a3ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20W=C3=A4rting?= Date: Sun, 25 Jun 2023 08:03:08 -0500 Subject: [PATCH 093/112] refactor to es-class (#712) --- lib/channel.js | 697 ++++++++++++++-------------- lib/channel_model.js | 2 +- lib/connection.js | 1056 +++++++++++++++++++++--------------------- lib/format.js | 1 - lib/heartbeat.js | 59 +-- 5 files changed, 914 insertions(+), 901 deletions(-) diff --git a/lib/channel.js b/lib/channel.js index 2f589bfc..235e06b4 100644 --- a/lib/channel.js +++ b/lib/channel.js @@ -11,135 +11,345 @@ var closeMsg = require('./format').closeMessage; var inspect = require('./format').inspect; var methodName = require('./format').methodName; var assert = require('assert'); -var inherits = require('util').inherits; var EventEmitter = require('events').EventEmitter; var fmt = require('util').format; var IllegalOperationError = require('./error').IllegalOperationError; var stackCapture = require('./error').stackCapture; -function Channel(connection) { - EventEmitter.call( this ); - this.connection = connection; - // for the presently outstanding RPC - this.reply = null; - // for the RPCs awaiting action - this.pending = []; - // for unconfirmed messages - this.lwm = 1; // the least, unconfirmed deliveryTag - this.unconfirmed = []; // rolling window of delivery callbacks - this.on('ack', this.handleConfirm.bind(this, function(cb) { - if (cb) cb(null); - })); - this.on('nack', this.handleConfirm.bind(this, function(cb) { - if (cb) cb(new Error('message nacked')); - })); - this.on('close', function () { - var cb; - while (cb = this.unconfirmed.shift()) { - if (cb) cb(new Error('channel closed')); + +class Channel extends EventEmitter { + constructor (connection) { + super(); + + this.connection = connection; + // for the presently outstanding RPC + this.reply = null; + // for the RPCs awaiting action + this.pending = []; + // for unconfirmed messages + this.lwm = 1; // the least, unconfirmed deliveryTag + this.unconfirmed = []; // rolling window of delivery callbacks + this.on('ack', this.handleConfirm.bind(this, function (cb) { + if (cb) + cb(null); + })); + this.on('nack', this.handleConfirm.bind(this, function (cb) { + if (cb) + cb(new Error('message nacked')); + })); + this.on('close', function () { + var cb; + while (cb = this.unconfirmed.shift()) { + if (cb) + cb(new Error('channel closed')); + } + }); + // message frame state machine + this.handleMessage = acceptDeliveryOrReturn; + } + + allocate () { + this.ch = this.connection.freshChannel(this); + return this; + } + + // Incoming frames are either notifications of e.g., message delivery, + // or replies to something we've sent. In general I deal with the + // former by emitting an event, and with the latter by keeping a track + // of what's expecting a reply. + // + // The AMQP specification implies that RPCs can't be pipelined; that + // is, you can have only one outstanding RPC on a channel at a + // time. Certainly that's what RabbitMQ and its clients assume. For + // this reason, I buffer RPCs if the channel is already waiting for a + // reply. + // Just send the damn frame. + sendImmediately (method, fields) { + return this.connection.sendMethod(this.ch, method, fields); + } + + // Invariant: !this.reply -> pending.length == 0. That is, whenever we + // clear a reply, we must send another RPC (and thereby fill + // this.reply) if there is one waiting. The invariant relevant here + // and in `accept`. + sendOrEnqueue (method, fields, reply) { + if (!this.reply) { // if no reply waiting, we can go + assert(this.pending.length === 0); + this.reply = reply; + this.sendImmediately(method, fields); } - }) - // message frame state machine - this.handleMessage = acceptDeliveryOrReturn; -} -inherits(Channel, EventEmitter); + else { + this.pending.push({ + method: method, + fields: fields, + reply: reply + }); + } + } -module.exports.Channel = Channel; -module.exports.acceptMessage = acceptMessage; + sendMessage (fields, properties, content) { + return this.connection.sendMessage( + this.ch, + defs.BasicPublish, fields, + defs.BasicProperties, properties, + content); + } -var C = Channel.prototype; + // Internal, synchronously resolved RPC; the return value is resolved + // with the whole frame. + _rpc (method, fields, expect, cb) { + var self = this; -C.allocate = function() { - this.ch = this.connection.freshChannel(this); - return this; -} + function reply (err, f) { + if (err === null) { + if (f.id === expect) { + return cb(null, f); + } + else { + // We have detected a problem, so it's up to us to close the + // channel + var expectedName = methodName(expect); + + var e = new Error(fmt("Expected %s; got %s", + expectedName, inspect(f, false))); + self.closeWithError(f.id, fmt('Expected %s; got %s', + expectedName, methodName(f.id)), + defs.constants.UNEXPECTED_FRAME, e); + return cb(e); + } + } -// Incoming frames are either notifications of e.g., message delivery, -// or replies to something we've sent. In general I deal with the -// former by emitting an event, and with the latter by keeping a track -// of what's expecting a reply. -// -// The AMQP specification implies that RPCs can't be pipelined; that -// is, you can have only one outstanding RPC on a channel at a -// time. Certainly that's what RabbitMQ and its clients assume. For -// this reason, I buffer RPCs if the channel is already waiting for a -// reply. - -// Just send the damn frame. -C.sendImmediately = function(method, fields) { - return this.connection.sendMethod(this.ch, method, fields); -}; - -// Invariant: !this.reply -> pending.length == 0. That is, whenever we -// clear a reply, we must send another RPC (and thereby fill -// this.reply) if there is one waiting. The invariant relevant here -// and in `accept`. -C.sendOrEnqueue = function(method, fields, reply) { - if (!this.reply) { // if no reply waiting, we can go - assert(this.pending.length === 0); - this.reply = reply; - this.sendImmediately(method, fields); + + // An error will be given if, for example, this is waiting to be + // sent and the connection closes + else if (err instanceof Error) + return cb(err); + + + // A close frame will be given if this is the RPC awaiting reply + // and the channel is closed by the server + else { + // otherwise, it's a close frame + var closeReason = (err.fields.classId << 16) + err.fields.methodId; + var e = (method === closeReason) + ? fmt("Operation failed: %s; %s", + methodName(method), closeMsg(err)) + : fmt("Channel closed by server: %s", closeMsg(err)); + var closeFrameError = new Error(e); + closeFrameError.code = err.fields.replyCode; + closeFrameError.classId = err.fields.classId; + closeFrameError.methodId = err.fields.methodId; + return cb(closeFrameError); + } + } + + this.sendOrEnqueue(method, fields, reply); } - else { - this.pending.push({method: method, - fields: fields, - reply: reply}); + + // Move to entirely closed state. + toClosed (capturedStack) { + this._rejectPending(); + invalidateSend(this, 'Channel closed', capturedStack); + this.accept = invalidOp('Channel closed', capturedStack); + this.connection.releaseChannel(this.ch); + this.emit('close'); + } + + // Stop being able to send and receive methods and content. Used when + // we close the channel. Invokes the continuation once the server has + // acknowledged the close, but before the channel is moved to the + // closed state. + toClosing (capturedStack, k) { + var send = this.sendImmediately.bind(this); + invalidateSend(this, 'Channel closing', capturedStack); + + this.accept = function (f) { + if (f.id === defs.ChannelCloseOk) { + if (k) + k(); + var s = stackCapture('ChannelCloseOk frame received'); + this.toClosed(s); + } + else if (f.id === defs.ChannelClose) { + send(defs.ChannelCloseOk, {}); + } + // else ignore frame + }; + } + + _rejectPending () { + function rej (r) { + r(new Error("Channel ended, no reply will be forthcoming")); + } + if (this.reply !== null) + rej(this.reply); + this.reply = null; + + var discard; + while (discard = this.pending.shift()) + rej(discard.reply); + this.pending = null; // so pushes will break + } + + closeBecause (reason, code, k) { + this.sendImmediately(defs.ChannelClose, { + replyText: reason, + replyCode: code, + methodId: 0, classId: 0 + }); + var s = stackCapture('closeBecause called: ' + reason); + this.toClosing(s, k); } -}; - -C.sendMessage = function(fields, properties, content) { - return this.connection.sendMessage( - this.ch, - defs.BasicPublish, fields, - defs.BasicProperties, properties, - content); -}; - -// Internal, synchronously resolved RPC; the return value is resolved -// with the whole frame. -C._rpc = function(method, fields, expect, cb) { - var self = this; - function reply(err, f) { - if (err === null) { - if (f.id === expect) { - return cb(null, f); + // If we close because there's been an error, we need to distinguish + // between what we tell the server (`reason`) and what we report as + // the cause in the client (`error`). + closeWithError (id, reason, code, error) { + var self = this; + this.closeBecause(reason, code, function () { + error.code = code; + // content frames and consumer errors do not provide a method a class/method ID + if (id) { + error.classId = defs.info(id).classId; + error.methodId = defs.info(id).methodId; + } + self.emit('error', error); + }); + } + + // A trampolining state machine for message frames on a channel. A + // message arrives in at least two frames: first, a method announcing + // the message (either a BasicDeliver or BasicGetOk); then, a message + // header with the message properties; then, zero or more content + // frames. + // Keep the try/catch localised, in an attempt to avoid disabling + // optimisation + acceptMessageFrame (f) { + try { + this.handleMessage = this.handleMessage(f); + } + catch (msg) { + if (typeof msg === 'string') { + this.closeWithError(f.id, msg, defs.constants.UNEXPECTED_FRAME, + new Error(msg)); + } + else if (msg instanceof Error) { + this.closeWithError(f.id, 'Error while processing message', + defs.constants.INTERNAL_ERROR, msg); } else { - // We have detected a problem, so it's up to us to close the - // channel - var expectedName = methodName(expect); - - var e = new Error(fmt("Expected %s; got %s", - expectedName, inspect(f, false))); - self.closeWithError(f.id, fmt('Expected %s; got %s', - expectedName, methodName(f.id)), - defs.constants.UNEXPECTED_FRAME, e); - return cb(e); + this.closeWithError(f.id, 'Internal error while processing message', + defs.constants.INTERNAL_ERROR, + new Error(msg.toString())); } } - // An error will be given if, for example, this is waiting to be - // sent and the connection closes - else if (err instanceof Error) return cb(err); - // A close frame will be given if this is the RPC awaiting reply - // and the channel is closed by the server + } + + handleConfirm (handle, f) { + var tag = f.deliveryTag; + var multi = f.multiple; + + if (multi) { + var confirmed = this.unconfirmed.splice(0, tag - this.lwm + 1); + this.lwm = tag + 1; + confirmed.forEach(handle); + } else { - // otherwise, it's a close frame - var closeReason = - (err.fields.classId << 16) + err.fields.methodId; - var e = (method === closeReason) - ? fmt("Operation failed: %s; %s", - methodName(method), closeMsg(err)) - : fmt("Channel closed by server: %s", closeMsg(err)); - var closeFrameError = new Error(e); - closeFrameError.code = err.fields.replyCode; - closeFrameError.classId = err.fields.classId; - closeFrameError.methodId = err.fields.methodId; - return cb(closeFrameError); + var c; + if (tag === this.lwm) { + c = this.unconfirmed.shift(); + this.lwm++; + // Advance the LWM and the window to the next non-gap, or + // possibly to the end + while (this.unconfirmed[0] === null) { + this.unconfirmed.shift(); + this.lwm++; + } + } + else { + c = this.unconfirmed[tag - this.lwm]; + this.unconfirmed[tag - this.lwm] = null; + } + // Technically, in the single-deliveryTag case, I should report a + // protocol breach if it's already been confirmed. + handle(c); } } - this.sendOrEnqueue(method, fields, reply); -}; + pushConfirmCallback (cb) { + // `null` is used specifically for marking already confirmed slots, + // so I coerce `undefined` and `null` to false; functions are never + // falsey. + this.unconfirmed.push(cb || false); + } + + onBufferDrain () { + this.emit('drain'); + } + + accept(f) { + + switch (f.id) { + + // Message frames + case undefined: // content frame! + case defs.BasicDeliver: + case defs.BasicReturn: + case defs.BasicProperties: + return this.acceptMessageFrame(f); + + // confirmations, need to do confirm.select first + case defs.BasicAck: + return this.emit('ack', f.fields); + case defs.BasicNack: + return this.emit('nack', f.fields); + case defs.BasicCancel: + // The broker can send this if e.g., the queue is deleted. + return this.emit('cancel', f.fields); + + case defs.ChannelClose: + // Any remote closure is an error to us. Reject the pending reply + // with the close frame, so it can see whether it was that + // operation that caused it to close. + if (this.reply) { + var reply = this.reply; this.reply = null; + reply(f); + } + var emsg = "Channel closed by server: " + closeMsg(f); + this.sendImmediately(defs.ChannelCloseOk, {}); + + var error = new Error(emsg); + error.code = f.fields.replyCode; + error.classId = f.fields.classId; + error.methodId = f.fields.methodId; + this.emit('error', error); + + var s = stackCapture(emsg); + this.toClosed(s); + return; + + case defs.BasicFlow: + // RabbitMQ doesn't send this, it just blocks the TCP socket + return this.closeWithError(f.id, "Flow not implemented", + defs.constants.NOT_IMPLEMENTED, + new Error('Flow not implemented')); + + default: // assume all other things are replies + // Resolving the reply may lead to another RPC; to make sure we + // don't hold that up, clear this.reply + var reply = this.reply; this.reply = null; + // however, maybe there's an RPC waiting to go? If so, that'll + // fill this.reply again, restoring the invariant. This does rely + // on any response being recv'ed after resolving the promise, + // below; hence, I use synchronous defer. + if (this.pending.length > 0) { + var send = this.pending.shift(); + this.reply = send.reply; + this.sendImmediately(send.method, send.fields); + } + return reply(null, f); + } + } +} // Shutdown protocol. There's three scenarios: // @@ -165,103 +375,6 @@ function invalidateSend(ch, msg, stack) { invalidOp(msg, stack); } -// Move to entirely closed state. -C.toClosed = function(capturedStack) { - this._rejectPending(); - invalidateSend(this, 'Channel closed', capturedStack); - this.accept = invalidOp('Channel closed', capturedStack); - this.connection.releaseChannel(this.ch); - this.emit('close'); -}; - -// Stop being able to send and receive methods and content. Used when -// we close the channel. Invokes the continuation once the server has -// acknowledged the close, but before the channel is moved to the -// closed state. -C.toClosing = function(capturedStack, k) { - var send = this.sendImmediately.bind(this); - invalidateSend(this, 'Channel closing', capturedStack); - - this.accept = function(f) { - if (f.id === defs.ChannelCloseOk) { - if (k) k(); - var s = stackCapture('ChannelCloseOk frame received'); - this.toClosed(s); - } - else if (f.id === defs.ChannelClose) { - send(defs.ChannelCloseOk, {}); - } - // else ignore frame - }; -}; - -C._rejectPending = function() { - function rej(r) { - r(new Error("Channel ended, no reply will be forthcoming")); - } - if (this.reply !== null) rej(this.reply); - this.reply = null; - - var discard; - while (discard = this.pending.shift()) rej(discard.reply); - this.pending = null; // so pushes will break -}; - -C.closeBecause = function(reason, code, k) { - this.sendImmediately(defs.ChannelClose, { - replyText: reason, - replyCode: code, - methodId:0, classId: 0 - }); - var s = stackCapture('closeBecause called: ' + reason); - this.toClosing(s, k); -}; - -// If we close because there's been an error, we need to distinguish -// between what we tell the server (`reason`) and what we report as -// the cause in the client (`error`). -C.closeWithError = function(id, reason, code, error) { - var self = this; - this.closeBecause(reason, code, function() { - error.code = code; - // content frames and consumer errors do not provide a method a class/method ID - if (id) { - error.classId = defs.info(id).classId; - error.methodId = defs.info(id).methodId; - } - self.emit('error', error); - }); -}; - -// A trampolining state machine for message frames on a channel. A -// message arrives in at least two frames: first, a method announcing -// the message (either a BasicDeliver or BasicGetOk); then, a message -// header with the message properties; then, zero or more content -// frames. - -// Keep the try/catch localised, in an attempt to avoid disabling -// optimisation -C.acceptMessageFrame = function(f) { - try { - this.handleMessage = this.handleMessage(f); - } - catch (msg) { - if (typeof msg === 'string') { - this.closeWithError(f.id, msg, defs.constants.UNEXPECTED_FRAME, - new Error(msg)); - } - else if (msg instanceof Error) { - this.closeWithError(f.id, 'Error while processing message', - defs.constants.INTERNAL_ERROR, msg); - } - else { - this.closeWithError(f.id, 'Internal error while processing message', - defs.constants.INTERNAL_ERROR, - new Error(msg.toString())); - } - } -}; - // Kick off a message delivery given a BasicDeliver or BasicReturn // frame (BasicGet uses the RPC mechanism) function acceptDeliveryOrReturn(f) { @@ -347,153 +460,47 @@ function acceptMessage(continuation) { } } -C.handleConfirm = function(handle, f) { - var tag = f.deliveryTag; - var multi = f.multiple; +// This adds just a bit more stuff useful for the APIs, but not +// low-level machinery. +class BaseChannel extends Channel { + constructor (connection) { + super(connection); + this.consumers = new Map(); + } - if (multi) { - var confirmed = this.unconfirmed.splice(0, tag - this.lwm + 1); - this.lwm = tag + 1; - confirmed.forEach(handle); + // Not sure I like the ff, it's going to be changing hidden classes + // all over the place. On the other hand, whaddya do. + registerConsumer (tag, callback) { + this.consumers.set(tag, callback); } - else { - var c; - if (tag === this.lwm) { - c = this.unconfirmed.shift(); - this.lwm++; - // Advance the LWM and the window to the next non-gap, or - // possibly to the end - while (this.unconfirmed[0] === null) { - this.unconfirmed.shift(); - this.lwm++; - } - } - else { - c = this.unconfirmed[tag - this.lwm]; - this.unconfirmed[tag - this.lwm] = null; - } - // Technically, in the single-deliveryTag case, I should report a - // protocol breach if it's already been confirmed. - handle(c); + + unregisterConsumer (tag) { + this.consumers.delete(tag); } -}; - -C.pushConfirmCallback = function(cb) { - // `null` is used specifically for marking already confirmed slots, - // so I coerce `undefined` and `null` to false; functions are never - // falsey. - this.unconfirmed.push(cb || false); -}; - -// Interface for connection to use - -C.accept = function(f) { - - switch (f.id) { - - // Message frames - case undefined: // content frame! - case defs.BasicDeliver: - case defs.BasicReturn: - case defs.BasicProperties: - return this.acceptMessageFrame(f); - - // confirmations, need to do confirm.select first - case defs.BasicAck: - return this.emit('ack', f.fields); - case defs.BasicNack: - return this.emit('nack', f.fields); - case defs.BasicCancel: - // The broker can send this if e.g., the queue is deleted. - return this.emit('cancel', f.fields); - - case defs.ChannelClose: - // Any remote closure is an error to us. Reject the pending reply - // with the close frame, so it can see whether it was that - // operation that caused it to close. - if (this.reply) { - var reply = this.reply; this.reply = null; - reply(f); + + dispatchMessage (fields, message) { + var consumerTag = fields.consumerTag; + var consumer = this.consumers.get(consumerTag); + if (consumer) { + return consumer(message); } - var emsg = "Channel closed by server: " + closeMsg(f); - this.sendImmediately(defs.ChannelCloseOk, {}); - - var error = new Error(emsg); - error.code = f.fields.replyCode; - error.classId = f.fields.classId; - error.methodId = f.fields.methodId; - this.emit('error', error); - - var s = stackCapture(emsg); - this.toClosed(s); - return; - - case defs.BasicFlow: - // RabbitMQ doesn't send this, it just blocks the TCP socket - return this.closeWithError(f.id, "Flow not implemented", - defs.constants.NOT_IMPLEMENTED, - new Error('Flow not implemented')); - - default: // assume all other things are replies - // Resolving the reply may lead to another RPC; to make sure we - // don't hold that up, clear this.reply - var reply = this.reply; this.reply = null; - // however, maybe there's an RPC waiting to go? If so, that'll - // fill this.reply again, restoring the invariant. This does rely - // on any response being recv'ed after resolving the promise, - // below; hence, I use synchronous defer. - if (this.pending.length > 0) { - var send = this.pending.shift(); - this.reply = send.reply; - this.sendImmediately(send.method, send.fields); + else { + // %%% Surely a race here + throw new Error("Unknown consumer: " + consumerTag); } - return reply(null, f); } -}; - -C.onBufferDrain = function() { - this.emit('drain'); -}; + handleDelivery (message) { + return this.dispatchMessage(message.fields, message); + } -// This adds just a bit more stuff useful for the APIs, but not -// low-level machinery. -function BaseChannel(connection) { - Channel.call(this, connection); - this.consumers = new Map(); + handleCancel (fields) { + var result = this.dispatchMessage(fields, null); + this.unregisterConsumer(fields.consumerTag); + return result; + } } -inherits(BaseChannel, Channel); +module.exports.acceptMessage = acceptMessage; module.exports.BaseChannel = BaseChannel; - -// Not sure I like the ff, it's going to be changing hidden classes -// all over the place. On the other hand, whaddya do. -BaseChannel.prototype.registerConsumer = function(tag, callback) { - this.consumers.set(tag, callback); -}; - -BaseChannel.prototype.unregisterConsumer = function(tag) { - this.consumers.delete(tag); -}; - -BaseChannel.prototype.dispatchMessage = function(fields, message) { - var consumerTag = fields.consumerTag; - var consumer = this.consumers.get(consumerTag); - if (consumer) { - return consumer(message); - } - else { - // %%% Surely a race here - throw new Error("Unknown consumer: " + consumerTag); - } -}; - -BaseChannel.prototype.handleDelivery = function(message) { - return this.dispatchMessage(message.fields, message); -}; - -BaseChannel.prototype.handleCancel = function(fields) { - var result = this.dispatchMessage(fields, null); - this.unregisterConsumer(fields.consumerTag); - return result; -}; +module.exports.Channel = Channel; diff --git a/lib/channel_model.js b/lib/channel_model.js index 383f250a..be38d00c 100644 --- a/lib/channel_model.js +++ b/lib/channel_model.js @@ -264,7 +264,7 @@ Channel.prototype.prefetch = Channel.prototype.qos class ConfirmChannel extends Channel { publish(exchange, routingKey, content, options, cb) { this.pushConfirmCallback(cb); - return Channel.prototype.publish.call(this, exchange, routingKey, content, options); + return super.publish(exchange, routingKey, content, options); } sendToQueue(queue, content, options, cb) { diff --git a/lib/connection.js b/lib/connection.js index c60243ff..d36ea6aa 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -21,7 +21,6 @@ var closeMsg = require('./format').closeMessage; var inspect = require('./format').inspect; var BitSet = require('./bitset').BitSet; -var inherits = require('util').inherits; var fmt = require('util').format; var PassThrough = require('stream').PassThrough || require('readable-stream/passthrough'); @@ -37,25 +36,537 @@ var DEFAULT_WRITE_HWM = 1024; // was greater, we might have to fragment the content. var SINGLE_CHUNK_THRESHOLD = 2048; -function Connection(underlying) { - EventEmitter.call( this ); - var stream = this.stream = wrapStream(underlying); - this.muxer = new Mux(stream); - - // frames - this.rest = Buffer.alloc(0); - this.frameMax = constants.FRAME_MIN_SIZE; - this.sentSinceLastCheck = false; - this.recvSinceLastCheck = false; - - this.expectSocketClose = false; - this.freeChannels = new BitSet(); - this.channels = [{channel: {accept: channel0(this)}, - buffer: underlying}]; -} -inherits(Connection, EventEmitter); +class Connection extends EventEmitter { + constructor (underlying) { + super(); + + var stream = this.stream = wrapStream(underlying); + this.muxer = new Mux(stream); + + // frames + this.rest = Buffer.alloc(0); + this.frameMax = constants.FRAME_MIN_SIZE; + this.sentSinceLastCheck = false; + this.recvSinceLastCheck = false; + + this.expectSocketClose = false; + this.freeChannels = new BitSet(); + this.channels = [{ + channel: { accept: channel0(this) }, + buffer: underlying + }]; + } + + // This changed between versions, as did the codec, methods, etc. AMQP + // 0-9-1 is fairly similar to 0.8, but better, and nothing implements + // 0.8 that doesn't implement 0-9-1. In other words, it doesn't make + // much sense to generalise here. + sendProtocolHeader () { + this.sendBytes(frame.PROTOCOL_HEADER); + } + + /* + The frighteningly complicated opening protocol (spec section 2.2.4): + + Client -> Server + + protocol header -> + <- start + start-ok -> + .. next two zero or more times .. + <- secure + secure-ok -> + <- tune + tune-ok -> + open -> + <- open-ok + + If I'm only supporting SASL's PLAIN mechanism (which I am for the time + being), it gets a bit easier since the server won't in general send + back a `secure`, it'll just send `tune` after the `start-ok`. + (SASL PLAIN: http://tools.ietf.org/html/rfc4616) + + */ + open (allFields, openCallback0) { + var self = this; + var openCallback = openCallback0 || function () { }; + + // This is where we'll put our negotiated values + var tunedOptions = Object.create(allFields); + + function wait (k) { + self.step(function (err, frame) { + if (err !== null) + bail(err); + else if (frame.channel !== 0) { + bail(new Error( + fmt("Frame on channel != 0 during handshake: %s", + inspect(frame, false)))); + } + else + k(frame); + }); + } + + function expect (Method, k) { + wait(function (frame) { + if (frame.id === Method) + k(frame); + else { + bail(new Error( + fmt("Expected %s; got %s", + methodName(Method), inspect(frame, false)))); + } + }); + } + + function bail (err) { + openCallback(err); + } + + function send (Method) { + // This can throw an exception if there's some problem with the + // options; e.g., something is a string instead of a number. + self.sendMethod(0, Method, tunedOptions); + } + + function negotiate (server, desired) { + // We get sent values for channelMax, frameMax and heartbeat, + // which we may accept or lower (subject to a minimum for + // frameMax, but we'll leave that to the server to enforce). In + // all cases, `0` really means "no limit", or rather the highest + // value in the encoding, e.g., unsigned short for channelMax. + if (server === 0 || desired === 0) { + // i.e., whichever places a limit, if either + return Math.max(server, desired); + } + else { + return Math.min(server, desired); + } + } + + function onStart (start) { + var mechanisms = start.fields.mechanisms.toString().split(' '); + if (mechanisms.indexOf(allFields.mechanism) < 0) { + bail(new Error(fmt('SASL mechanism %s is not provided by the server', + allFields.mechanism))); + return; + } + self.serverProperties = start.fields.serverProperties; + try { + send(defs.ConnectionStartOk); + } catch (err) { + bail(err); + return; + } + wait(afterStartOk); + } + + function afterStartOk (reply) { + switch (reply.id) { + case defs.ConnectionSecure: + bail(new Error( + "Wasn't expecting to have to go through secure")); + break; + case defs.ConnectionClose: + bail(new Error(fmt("Handshake terminated by server: %s", + closeMsg(reply)))); + break; + case defs.ConnectionTune: + var fields = reply.fields; + tunedOptions.frameMax = + negotiate(fields.frameMax, allFields.frameMax); + tunedOptions.channelMax = + negotiate(fields.channelMax, allFields.channelMax); + tunedOptions.heartbeat = + negotiate(fields.heartbeat, allFields.heartbeat); + try { + send(defs.ConnectionTuneOk); + send(defs.ConnectionOpen); + } catch (err) { + bail(err); + return; + } + expect(defs.ConnectionOpenOk, onOpenOk); + break; + default: + bail(new Error( + fmt("Expected connection.secure, connection.close, " + + "or connection.tune during handshake; got %s", + inspect(reply, false)))); + break; + } + } + + function onOpenOk (openOk) { + // Impose the maximum of the encoded value, if the negotiated + // value is zero, meaning "no, no limits" + self.channelMax = tunedOptions.channelMax || 0xffff; + self.frameMax = tunedOptions.frameMax || 0xffffffff; + // 0 means "no heartbeat", rather than "maximum period of + // heartbeating" + self.heartbeat = tunedOptions.heartbeat; + self.heartbeater = self.startHeartbeater(); + self.accept = mainAccept; + succeed(openOk); + } + + // If the server closes the connection, it's probably because of + // something we did + function endWhileOpening (err) { + bail(err || new Error('Socket closed abruptly ' + + 'during opening handshake')); + } + + this.stream.on('end', endWhileOpening); + this.stream.on('error', endWhileOpening); + + function succeed (ok) { + self.stream.removeListener('end', endWhileOpening); + self.stream.removeListener('error', endWhileOpening); + self.stream.on('error', self.onSocketError.bind(self)); + self.stream.on('end', self.onSocketError.bind( + self, new Error('Unexpected close'))); + self.on('frameError', self.onSocketError.bind(self)); + self.acceptLoop(); + openCallback(null, ok); + } + + // Now kick off the handshake by prompting the server + this.sendProtocolHeader(); + expect(defs.ConnectionStart, onStart); + } + + // Closing things: AMQP has a closing handshake that applies to + // closing both connects and channels. As the initiating party, I send + // Close, then ignore all frames until I see either CloseOK -- + // which signifies that the other party has seen the Close and shut + // the connection or channel down, so it's fine to free resources; or + // Close, which means the other party also wanted to close the + // whatever, and I should send CloseOk so it can free resources, + // then go back to waiting for the CloseOk. If I receive a Close + // out of the blue, I should throw away any unsent frames (they will + // be ignored anyway) and send CloseOk, then clean up resources. In + // general, Close out of the blue signals an error (or a forced + // closure, which may as well be an error). + // + // RUNNING [1] --- send Close ---> Closing [2] ---> recv Close --+ + // | | [3] + // | +------ send CloseOk ------+ + // recv Close recv CloseOk + // | | + // V V + // Ended [4] ---- send CloseOk ---> Closed [5] + // + // [1] All frames accepted; getting a Close frame from the server + // moves to Ended; client may initiate a close by sending Close + // itself. + // [2] Client has initiated a close; only CloseOk or (simulataneously + // sent) Close is accepted. + // [3] Simultaneous close + // [4] Server won't send any more frames; accept no more frames, send + // CloseOk. + // [5] Fully closed, client will send no more, server will send no + // more. Signal 'close' or 'error'. + // + // There are two signalling mechanisms used in the API. The first is + // that calling `close` will return a promise, that will either + // resolve once the connection or channel is cleanly shut down, or + // will reject if the shutdown times out. + // + // The second is the 'close' and 'error' events. These are + // emitted as above. The events will fire *before* promises are + // resolved. + // Close the connection without even giving a reason. Typical. + close (closeCallback) { + var k = closeCallback && function () { closeCallback(null); }; + this.closeBecause("Cheers, thanks", constants.REPLY_SUCCESS, k); + } + + // Close with a reason and a 'code'. I'm pretty sure RabbitMQ totally + // ignores these; maybe it logs them. The continuation will be invoked + // when the CloseOk has been received, and before the 'close' event. + closeBecause (reason, code, k) { + this.sendMethod(0, defs.ConnectionClose, { + replyText: reason, + replyCode: code, + methodId: 0, classId: 0 + }); + var s = stackCapture('closeBecause called: ' + reason); + this.toClosing(s, k); + } + + closeWithError (reason, code, error) { + this.emit('error', error); + this.closeBecause(reason, code); + } + + onSocketError (err) { + if (!this.expectSocketClose) { + // forestall any more calls to onSocketError, since we're signed + // up for `'error'` *and* `'end'` + this.expectSocketClose = true; + this.emit('error', err); + var s = stackCapture('Socket error'); + this.toClosed(s, err); + } + } + + // A close has been initiated. Repeat: a close has been initiated. + // This means we should not send more frames, anyway they will be + // ignored. We also have to shut down all the channels. + toClosing (capturedStack, k) { + var send = this.sendMethod.bind(this); + + this.accept = function (f) { + if (f.id === defs.ConnectionCloseOk) { + if (k) + k(); + var s = stackCapture('ConnectionCloseOk received'); + this.toClosed(s, undefined); + } + else if (f.id === defs.ConnectionClose) { + send(0, defs.ConnectionCloseOk, {}); + } + // else ignore frame + }; + invalidateSend(this, 'Connection closing', capturedStack); + } + + _closeChannels (capturedStack) { + for (var i = 1; i < this.channels.length; i++) { + var ch = this.channels[i]; + if (ch !== null) { + ch.channel.toClosed(capturedStack); // %%% or with an error? not clear + } + } + } + + // A close has been confirmed. Cease all communication. + toClosed (capturedStack, maybeErr) { + this._closeChannels(capturedStack); + var info = fmt('Connection closed (%s)', + (maybeErr) ? maybeErr.toString() : 'by client'); + // Tidy up, invalidate enverything, dynamite the bridges. + invalidateSend(this, info, capturedStack); + this.accept = invalidOp(info, capturedStack); + this.close = function (cb) { + cb && cb(new IllegalOperationError(info, capturedStack)); + }; + if (this.heartbeater) + this.heartbeater.clear(); + // This is certainly true now, if it wasn't before + this.expectSocketClose = true; + this.stream.end(); + this.emit('close', maybeErr); + } + + // === + startHeartbeater () { + if (this.heartbeat === 0) + return null; + else { + var self = this; + var hb = new Heart(this.heartbeat, + this.checkSend.bind(this), + this.checkRecv.bind(this)); + hb.on('timeout', function () { + var hberr = new Error("Heartbeat timeout"); + self.emit('error', hberr); + var s = stackCapture('Heartbeat timeout'); + self.toClosed(s, hberr); + }); + hb.on('beat', function () { + self.sendHeartbeat(); + }); + return hb; + } + } + + // I use an array to keep track of the channels, rather than an + // object. The channel identifiers are numbers, and allocated by the + // connection. If I try to allocate low numbers when they are + // available (which I do, by looking from the start of the bitset), + // this ought to keep the array small, and out of 'sparse array + // storage'. I also set entries to null, rather than deleting them, in + // the expectation that the next channel allocation will fill the slot + // again rather than growing the array. See + // http://www.html5rocks.com/en/tutorials/speed/v8/ + freshChannel (channel, options) { + var next = this.freeChannels.nextClearBit(1); + if (next < 0 || next > this.channelMax) + throw new Error("No channels left to allocate"); + this.freeChannels.set(next); + + var hwm = (options && options.highWaterMark) || DEFAULT_WRITE_HWM; + var writeBuffer = new PassThrough({ + objectMode: true, highWaterMark: hwm + }); + this.channels[next] = { channel: channel, buffer: writeBuffer }; + writeBuffer.on('drain', function () { + channel.onBufferDrain(); + }); + this.muxer.pipeFrom(writeBuffer); + return next; + } + + releaseChannel (channel) { + this.freeChannels.clear(channel); + var buffer = this.channels[channel].buffer; + buffer.end(); // will also cause it to be unpiped + this.channels[channel] = null; + } + + acceptLoop () { + var self = this; + + function go () { + try { + var f; while (f = self.recvFrame()) + self.accept(f); + } + catch (e) { + self.emit('frameError', e); + } + } + self.stream.on('readable', go); + go(); + } + + step (cb) { + var self = this; + function recv () { + var f; + try { + f = self.recvFrame(); + } + catch (e) { + cb(e, null); + return; + } + if (f) + cb(null, f); + else + self.stream.once('readable', recv); + } + recv(); + } + + checkSend () { + var check = this.sentSinceLastCheck; + this.sentSinceLastCheck = false; + return check; + } + + checkRecv () { + var check = this.recvSinceLastCheck; + this.recvSinceLastCheck = false; + return check; + } + + sendBytes (bytes) { + this.sentSinceLastCheck = true; + this.stream.write(bytes); + } + + sendHeartbeat () { + return this.sendBytes(frame.HEARTBEAT_BUF); + } + + sendMethod (channel, Method, fields) { + var frame = encodeMethod(Method, channel, fields); + this.sentSinceLastCheck = true; + var buffer = this.channels[channel].buffer; + return buffer.write(frame); + } + + sendMessage (channel, Method, fields, Properties, props, content) { + if (!Buffer.isBuffer(content)) + throw new TypeError('content is not a buffer'); + + var mframe = encodeMethod(Method, channel, fields); + var pframe = encodeProperties(Properties, channel, + content.length, props); + var buffer = this.channels[channel].buffer; + this.sentSinceLastCheck = true; + + var methodHeaderLen = mframe.length + pframe.length; + var bodyLen = (content.length > 0) ? + content.length + FRAME_OVERHEAD : 0; + var allLen = methodHeaderLen + bodyLen; + + if (allLen < SINGLE_CHUNK_THRESHOLD) { + // Use `allocUnsafe` to avoid excessive allocations and CPU usage + // from zeroing. The returned Buffer is not zeroed and so must be + // completely filled to be used safely. + // See https://github.com/amqp-node/amqplib/pull/695 + var all = Buffer.allocUnsafe(allLen); + var offset = mframe.copy(all, 0); + offset += pframe.copy(all, offset); + + if (bodyLen > 0) + makeBodyFrame(channel, content).copy(all, offset); + return buffer.write(all); + } + else { + if (methodHeaderLen < SINGLE_CHUNK_THRESHOLD) { + // Use `allocUnsafe` to avoid excessive allocations and CPU usage + // from zeroing. The returned Buffer is not zeroed and so must be + // completely filled to be used safely. + // See https://github.com/amqp-node/amqplib/pull/695 + var both = Buffer.allocUnsafe(methodHeaderLen); + var offset = mframe.copy(both, 0); + pframe.copy(both, offset); + buffer.write(both); + } + else { + buffer.write(mframe); + buffer.write(pframe); + } + return this.sendContent(channel, content); + } + } + + sendContent (channel, body) { + if (!Buffer.isBuffer(body)) { + throw new TypeError(fmt("Expected buffer; got %s", body)); + } + var writeResult = true; + var buffer = this.channels[channel].buffer; + + var maxBody = this.frameMax - FRAME_OVERHEAD; + + for (var offset = 0; offset < body.length; offset += maxBody) { + var end = offset + maxBody; + var slice = (end > body.length) ? body.slice(offset) : body.slice(offset, end); + var bodyFrame = makeBodyFrame(channel, slice); + writeResult = buffer.write(bodyFrame); + } + this.sentSinceLastCheck = true; + return writeResult; + } -var C = Connection.prototype; + recvFrame () { + // %%% identifying invariants might help here? + var frame = parseFrame(this.rest, this.frameMax); + + if (!frame) { + var incoming = this.stream.read(); + if (incoming === null) { + return false; + } + else { + this.recvSinceLastCheck = true; + this.rest = Buffer.concat([this.rest, incoming]); + return this.recvFrame(); + } + } + else { + this.rest = frame.rest; + return decodeFrame(frame); + } + } +} // Usual frame accept mode function mainAccept(frame) { @@ -110,260 +621,6 @@ function channel0(connection) { }; } -// This changed between versions, as did the codec, methods, etc. AMQP -// 0-9-1 is fairly similar to 0.8, but better, and nothing implements -// 0.8 that doesn't implement 0-9-1. In other words, it doesn't make -// much sense to generalise here. -C.sendProtocolHeader = function() { - this.sendBytes(frame.PROTOCOL_HEADER); -}; - -/* - The frighteningly complicated opening protocol (spec section 2.2.4): - - Client -> Server - - protocol header -> - <- start - start-ok -> - .. next two zero or more times .. - <- secure - secure-ok -> - <- tune - tune-ok -> - open -> - <- open-ok - -If I'm only supporting SASL's PLAIN mechanism (which I am for the time -being), it gets a bit easier since the server won't in general send -back a `secure`, it'll just send `tune` after the `start-ok`. -(SASL PLAIN: http://tools.ietf.org/html/rfc4616) - -*/ - -C.open = function(allFields, openCallback0) { - var self = this; - var openCallback = openCallback0 || function() {}; - - // This is where we'll put our negotiated values - var tunedOptions = Object.create(allFields); - - function wait(k) { - self.step(function(err, frame) { - if (err !== null) bail(err); - else if (frame.channel !== 0) { - bail(new Error( - fmt("Frame on channel != 0 during handshake: %s", - inspect(frame, false)))); - } - else k(frame); - }); - } - - function expect(Method, k) { - wait(function(frame) { - if (frame.id === Method) k(frame); - else { - bail(new Error( - fmt("Expected %s; got %s", - methodName(Method), inspect(frame, false)))); - } - }); - } - - function bail(err) { - openCallback(err); - } - - function send(Method) { - // This can throw an exception if there's some problem with the - // options; e.g., something is a string instead of a number. - self.sendMethod(0, Method, tunedOptions); - } - - function negotiate(server, desired) { - // We get sent values for channelMax, frameMax and heartbeat, - // which we may accept or lower (subject to a minimum for - // frameMax, but we'll leave that to the server to enforce). In - // all cases, `0` really means "no limit", or rather the highest - // value in the encoding, e.g., unsigned short for channelMax. - if (server === 0 || desired === 0) { - // i.e., whichever places a limit, if either - return Math.max(server, desired); - } - else { - return Math.min(server, desired); - } - } - - function onStart(start) { - var mechanisms = start.fields.mechanisms.toString().split(' '); - if (mechanisms.indexOf(allFields.mechanism) < 0) { - bail(new Error(fmt('SASL mechanism %s is not provided by the server', - allFields.mechanism))); - return; - } - self.serverProperties = start.fields.serverProperties; - try { - send(defs.ConnectionStartOk); - } catch (err) { - bail(err); - return; - } - wait(afterStartOk); - } - - function afterStartOk(reply) { - switch (reply.id) { - case defs.ConnectionSecure: - bail(new Error( - "Wasn't expecting to have to go through secure")); - break; - case defs.ConnectionClose: - bail(new Error(fmt("Handshake terminated by server: %s", - closeMsg(reply)))); - break; - case defs.ConnectionTune: - var fields = reply.fields; - tunedOptions.frameMax = - negotiate(fields.frameMax, allFields.frameMax); - tunedOptions.channelMax = - negotiate(fields.channelMax, allFields.channelMax); - tunedOptions.heartbeat = - negotiate(fields.heartbeat, allFields.heartbeat); - try { - send(defs.ConnectionTuneOk); - send(defs.ConnectionOpen); - } catch (err) { - bail(err); - return; - } - expect(defs.ConnectionOpenOk, onOpenOk); - break; - default: - bail(new Error( - fmt("Expected connection.secure, connection.close, " + - "or connection.tune during handshake; got %s", - inspect(reply, false)))); - break; - } - } - - function onOpenOk(openOk) { - // Impose the maximum of the encoded value, if the negotiated - // value is zero, meaning "no, no limits" - self.channelMax = tunedOptions.channelMax || 0xffff; - self.frameMax = tunedOptions.frameMax || 0xffffffff; - // 0 means "no heartbeat", rather than "maximum period of - // heartbeating" - self.heartbeat = tunedOptions.heartbeat; - self.heartbeater = self.startHeartbeater(); - self.accept = mainAccept; - succeed(openOk); - } - - // If the server closes the connection, it's probably because of - // something we did - function endWhileOpening(err) { - bail(err || new Error('Socket closed abruptly ' + - 'during opening handshake')); - } - - this.stream.on('end', endWhileOpening); - this.stream.on('error', endWhileOpening); - - function succeed(ok) { - self.stream.removeListener('end', endWhileOpening); - self.stream.removeListener('error', endWhileOpening); - self.stream.on('error', self.onSocketError.bind(self)); - self.stream.on('end', self.onSocketError.bind( - self, new Error('Unexpected close'))); - self.on('frameError', self.onSocketError.bind(self)); - self.acceptLoop(); - openCallback(null, ok); - } - - // Now kick off the handshake by prompting the server - this.sendProtocolHeader(); - expect(defs.ConnectionStart, onStart); -}; - -// Closing things: AMQP has a closing handshake that applies to -// closing both connects and channels. As the initiating party, I send -// Close, then ignore all frames until I see either CloseOK -- -// which signifies that the other party has seen the Close and shut -// the connection or channel down, so it's fine to free resources; or -// Close, which means the other party also wanted to close the -// whatever, and I should send CloseOk so it can free resources, -// then go back to waiting for the CloseOk. If I receive a Close -// out of the blue, I should throw away any unsent frames (they will -// be ignored anyway) and send CloseOk, then clean up resources. In -// general, Close out of the blue signals an error (or a forced -// closure, which may as well be an error). -// -// RUNNING [1] --- send Close ---> Closing [2] ---> recv Close --+ -// | | [3] -// | +------ send CloseOk ------+ -// recv Close recv CloseOk -// | | -// V V -// Ended [4] ---- send CloseOk ---> Closed [5] -// -// [1] All frames accepted; getting a Close frame from the server -// moves to Ended; client may initiate a close by sending Close -// itself. -// [2] Client has initiated a close; only CloseOk or (simulataneously -// sent) Close is accepted. -// [3] Simultaneous close -// [4] Server won't send any more frames; accept no more frames, send -// CloseOk. -// [5] Fully closed, client will send no more, server will send no -// more. Signal 'close' or 'error'. -// -// There are two signalling mechanisms used in the API. The first is -// that calling `close` will return a promise, that will either -// resolve once the connection or channel is cleanly shut down, or -// will reject if the shutdown times out. -// -// The second is the 'close' and 'error' events. These are -// emitted as above. The events will fire *before* promises are -// resolved. - -// Close the connection without even giving a reason. Typical. -C.close = function(closeCallback) { - var k = closeCallback && function() { closeCallback(null); }; - this.closeBecause("Cheers, thanks", constants.REPLY_SUCCESS, k); -}; - -// Close with a reason and a 'code'. I'm pretty sure RabbitMQ totally -// ignores these; maybe it logs them. The continuation will be invoked -// when the CloseOk has been received, and before the 'close' event. -C.closeBecause = function(reason, code, k) { - this.sendMethod(0, defs.ConnectionClose, { - replyText: reason, - replyCode: code, - methodId: 0, classId: 0 - }); - var s = stackCapture('closeBecause called: ' + reason); - this.toClosing(s, k); -}; - -C.closeWithError = function(reason, code, error) { - this.emit('error', error); - this.closeBecause(reason, code); -}; - -C.onSocketError = function(err) { - if (!this.expectSocketClose) { - // forestall any more calls to onSocketError, since we're signed - // up for `'error'` *and* `'end'` - this.expectSocketClose = true; - this.emit('error', err); - var s = stackCapture('Socket error'); - this.toClosed(s, err); - } -}; - function invalidOp(msg, stack) { return function() { throw new IllegalOperationError(msg, stack); @@ -375,268 +632,15 @@ function invalidateSend(conn, msg, stack) { invalidOp(msg, stack); } -// A close has been initiated. Repeat: a close has been initiated. -// This means we should not send more frames, anyway they will be -// ignored. We also have to shut down all the channels. -C.toClosing = function(capturedStack, k) { - var send = this.sendMethod.bind(this); - - this.accept = function(f) { - if (f.id === defs.ConnectionCloseOk) { - if (k) k(); - var s = stackCapture('ConnectionCloseOk received'); - this.toClosed(s, undefined); - } - else if (f.id === defs.ConnectionClose) { - send(0, defs.ConnectionCloseOk, {}); - } - // else ignore frame - }; - invalidateSend(this, 'Connection closing', capturedStack); -}; - -C._closeChannels = function(capturedStack) { - for (var i = 1; i < this.channels.length; i++) { - var ch = this.channels[i]; - if (ch !== null) { - ch.channel.toClosed(capturedStack); // %%% or with an error? not clear - } - } -}; - -// A close has been confirmed. Cease all communication. -C.toClosed = function(capturedStack, maybeErr) { - this._closeChannels(capturedStack); - var info = fmt('Connection closed (%s)', - (maybeErr) ? maybeErr.toString() : 'by client'); - // Tidy up, invalidate enverything, dynamite the bridges. - invalidateSend(this, info, capturedStack); - this.accept = invalidOp(info, capturedStack); - this.close = function(cb) { - cb && cb(new IllegalOperationError(info, capturedStack)); - }; - if (this.heartbeater) this.heartbeater.clear(); - // This is certainly true now, if it wasn't before - this.expectSocketClose = true; - this.stream.end(); - this.emit('close', maybeErr); -}; - -// === - -C.startHeartbeater = function() { - if (this.heartbeat === 0) return null; - else { - var self = this; - var hb = new Heart(this.heartbeat, - this.checkSend.bind(this), - this.checkRecv.bind(this)); - hb.on('timeout', function() { - var hberr = new Error("Heartbeat timeout"); - self.emit('error', hberr); - var s = stackCapture('Heartbeat timeout'); - self.toClosed(s, hberr); - }); - hb.on('beat', function() { - self.sendHeartbeat(); - }); - return hb; - } -}; - -// I use an array to keep track of the channels, rather than an -// object. The channel identifiers are numbers, and allocated by the -// connection. If I try to allocate low numbers when they are -// available (which I do, by looking from the start of the bitset), -// this ought to keep the array small, and out of 'sparse array -// storage'. I also set entries to null, rather than deleting them, in -// the expectation that the next channel allocation will fill the slot -// again rather than growing the array. See -// http://www.html5rocks.com/en/tutorials/speed/v8/ -C.freshChannel = function(channel, options) { - var next = this.freeChannels.nextClearBit(1); - if (next < 0 || next > this.channelMax) - throw new Error("No channels left to allocate"); - this.freeChannels.set(next); - - var hwm = (options && options.highWaterMark) || DEFAULT_WRITE_HWM; - var writeBuffer = new PassThrough({ - objectMode: true, highWaterMark: hwm - }); - this.channels[next] = {channel: channel, buffer: writeBuffer}; - writeBuffer.on('drain', function() { - channel.onBufferDrain(); - }); - this.muxer.pipeFrom(writeBuffer); - return next; -}; - -C.releaseChannel = function(channel) { - this.freeChannels.clear(channel); - var buffer = this.channels[channel].buffer; - buffer.end(); // will also cause it to be unpiped - this.channels[channel] = null; -}; - -C.acceptLoop = function() { - var self = this; - - function go() { - try { - var f; while (f = self.recvFrame()) self.accept(f); - } - catch (e) { - self.emit('frameError', e); - } - } - self.stream.on('readable', go); - go(); -}; - -C.step = function(cb) { - var self = this; - function recv() { - var f; - try { - f = self.recvFrame(); - } - catch (e) { - cb(e, null); - return; - } - if (f) cb(null, f); - else self.stream.once('readable', recv); - } - recv(); -}; - -C.checkSend = function() { - var check = this.sentSinceLastCheck; - this.sentSinceLastCheck = false; - return check; -} - -C.checkRecv = function() { - var check = this.recvSinceLastCheck; - this.recvSinceLastCheck = false; - return check; -} - -C.sendBytes = function(bytes) { - this.sentSinceLastCheck = true; - this.stream.write(bytes); -}; - -C.sendHeartbeat = function() { - return this.sendBytes(frame.HEARTBEAT_BUF); -}; - var encodeMethod = defs.encodeMethod; var encodeProperties = defs.encodeProperties; -C.sendMethod = function(channel, Method, fields) { - var frame = encodeMethod(Method, channel, fields); - this.sentSinceLastCheck = true; - var buffer = this.channels[channel].buffer; - return buffer.write(frame); -}; - -C.sendMessage = function(channel, - Method, fields, - Properties, props, - content) { - if (!Buffer.isBuffer(content)) - throw new TypeError('content is not a buffer'); - - var mframe = encodeMethod(Method, channel, fields); - var pframe = encodeProperties(Properties, channel, - content.length, props); - var buffer = this.channels[channel].buffer; - this.sentSinceLastCheck = true; - - var methodHeaderLen = mframe.length + pframe.length; - var bodyLen = (content.length > 0) ? - content.length + FRAME_OVERHEAD : 0; - var allLen = methodHeaderLen + bodyLen; - - if (allLen < SINGLE_CHUNK_THRESHOLD) { - // Use `allocUnsafe` to avoid excessive allocations and CPU usage - // from zeroing. The returned Buffer is not zeroed and so must be - // completely filled to be used safely. - // See https://github.com/amqp-node/amqplib/pull/695 - var all = Buffer.allocUnsafe(allLen); - var offset = mframe.copy(all, 0); - offset += pframe.copy(all, offset); - - if (bodyLen > 0) - makeBodyFrame(channel, content).copy(all, offset); - return buffer.write(all); - } - else { - if (methodHeaderLen < SINGLE_CHUNK_THRESHOLD) { - // Use `allocUnsafe` to avoid excessive allocations and CPU usage - // from zeroing. The returned Buffer is not zeroed and so must be - // completely filled to be used safely. - // See https://github.com/amqp-node/amqplib/pull/695 - var both = Buffer.allocUnsafe(methodHeaderLen); - var offset = mframe.copy(both, 0); - pframe.copy(both, offset); - buffer.write(both); - } - else { - buffer.write(mframe); - buffer.write(pframe); - } - return this.sendContent(channel, content); - } -}; - var FRAME_OVERHEAD = defs.FRAME_OVERHEAD; var makeBodyFrame = frame.makeBodyFrame; -C.sendContent = function(channel, body) { - if (!Buffer.isBuffer(body)) { - throw new TypeError(fmt("Expected buffer; got %s", body)); - } - var writeResult = true; - var buffer = this.channels[channel].buffer; - - var maxBody = this.frameMax - FRAME_OVERHEAD; - - for (var offset = 0; offset < body.length; offset += maxBody) { - var end = offset + maxBody; - var slice = (end > body.length) ? body.slice(offset) : body.slice(offset, end); - var bodyFrame = makeBodyFrame(channel, slice); - writeResult = buffer.write(bodyFrame); - } - this.sentSinceLastCheck = true; - return writeResult; -}; - var parseFrame = frame.parseFrame; var decodeFrame = frame.decodeFrame; -C.recvFrame = function() { - // %%% identifying invariants might help here? - var frame = parseFrame(this.rest, this.frameMax); - - if (!frame) { - var incoming = this.stream.read(); - if (incoming === null) { - return false; - } - else { - this.recvSinceLastCheck = true; - this.rest = Buffer.concat([this.rest, incoming]); - return this.recvFrame(); - } - } - else { - this.rest = frame.rest; - return decodeFrame(frame); - } -}; - function wrapStream(s) { if (s instanceof Duplex) return s; else { diff --git a/lib/format.js b/lib/format.js index 2966a6d2..f9fcc3d0 100644 --- a/lib/format.js +++ b/lib/format.js @@ -8,7 +8,6 @@ var defs = require('./defs'); var format = require('util').format; -var inherits = require('util').inherits; var HEARTBEAT = require('./frame').HEARTBEAT; module.exports.closeMessage = function(close) { diff --git a/lib/heartbeat.js b/lib/heartbeat.js index a9c9fb26..9c6c2e69 100644 --- a/lib/heartbeat.js +++ b/lib/heartbeat.js @@ -47,43 +47,46 @@ 'use strict'; -var inherits = require('util').inherits; var EventEmitter = require('events').EventEmitter; // Exported so that we can mess with it in tests module.exports.UNITS_TO_MS = 1000; -function Heart(interval, checkSend, checkRecv) { - EventEmitter.call(this); - this.interval = interval; +class Heart extends EventEmitter { + constructor (interval, checkSend, checkRecv) { + super(); - var intervalMs = interval * module.exports.UNITS_TO_MS; - // Function#bind is my new best friend - var beat = this.emit.bind(this, 'beat'); - var timeout = this.emit.bind(this, 'timeout'); + this.interval = interval; - this.sendTimer = setInterval( - this.runHeartbeat.bind(this, checkSend, beat), intervalMs / 2); + var intervalMs = interval * module.exports.UNITS_TO_MS; + // Function#bind is my new best friend + var beat = this.emit.bind(this, 'beat'); + var timeout = this.emit.bind(this, 'timeout'); - // A timeout occurs if I see nothing for *two consecutive* intervals - var recvMissed = 0; - function missedTwo() { - if (!checkRecv()) return (++recvMissed < 2); - else { recvMissed = 0; return true; } + this.sendTimer = setInterval( + this.runHeartbeat.bind(this, checkSend, beat), intervalMs / 2); + + // A timeout occurs if I see nothing for *two consecutive* intervals + var recvMissed = 0; + function missedTwo () { + if (!checkRecv()) + return (++recvMissed < 2); + else { recvMissed = 0; return true; } + } + this.recvTimer = setInterval( + this.runHeartbeat.bind(this, missedTwo, timeout), intervalMs); } - this.recvTimer = setInterval( - this.runHeartbeat.bind(this, missedTwo, timeout), intervalMs); -} -inherits(Heart, EventEmitter); -module.exports.Heart = Heart; + clear () { + clearInterval(this.sendTimer); + clearInterval(this.recvTimer); + } -Heart.prototype.clear = function() { - clearInterval(this.sendTimer); - clearInterval(this.recvTimer); -}; + runHeartbeat (check, fail) { + // Have we seen activity? + if (!check()) + fail(); + } +} -Heart.prototype.runHeartbeat = function(check, fail) { - // Have we seen activity? - if (!check()) fail(); -}; +module.exports.Heart = Heart; From a87f240fef1e481f7f9527c0ec8291a8cd608d19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20W=C3=A4rting?= Date: Sun, 25 Jun 2023 15:26:29 -0500 Subject: [PATCH 094/112] chore: classify mux (#731) --- lib/mux.js | 195 ++++++++++++++++++++++++++--------------------------- 1 file changed, 96 insertions(+), 99 deletions(-) diff --git a/lib/mux.js b/lib/mux.js index 433622fe..c712cd77 100644 --- a/lib/mux.js +++ b/lib/mux.js @@ -13,117 +13,114 @@ var assert = require('assert'); var schedule = (typeof setImmediate === 'function') ? setImmediate : process.nextTick; -function Mux(downstream) { - this.newStreams = []; - this.oldStreams = []; - this.blocked = false; - this.scheduledRead = false; - - this.out = downstream; - var self = this; - downstream.on('drain', function() { - self.blocked = false; - self._readIncoming(); - }); -} - -// There are 2 states we can be in: - -// - waiting for outbound capacity, which will be signalled by a -// - 'drain' event on the downstream; or, - -// - no packets to send, waiting for an inbound buffer to have -// packets, which will be signalled by a 'readable' event - -// If we write all packets available whenever there is outbound -// capacity, we will either run out of outbound capacity (`#write` -// returns false), or run out of packets (all calls to an -// `inbound.read()` have returned null). +class Mux { + constructor (downstream) { + this.newStreams = []; + this.oldStreams = []; + this.blocked = false; + this.scheduledRead = false; + + this.out = downstream; + var self = this; + downstream.on('drain', function () { + self.blocked = false; + self._readIncoming(); + }); + } -Mux.prototype._readIncoming = function() { + // There are 2 states we can be in: + // - waiting for outbound capacity, which will be signalled by a + // - 'drain' event on the downstream; or, + // - no packets to send, waiting for an inbound buffer to have + // packets, which will be signalled by a 'readable' event + // If we write all packets available whenever there is outbound + // capacity, we will either run out of outbound capacity (`#write` + // returns false), or run out of packets (all calls to an + // `inbound.read()` have returned null). + _readIncoming () { + + // We may be sent here speculatively, if an incoming stream has + // become readable + if (this.blocked) return; + + var accepting = true; + var out = this.out; + + // Try to read a chunk from each stream in turn, until all streams + // are empty, or we exhaust our ability to accept chunks. + function roundrobin (streams) { + var s; + while (accepting && (s = streams.shift())) { + var chunk = s.read(); + if (chunk !== null) { + accepting = out.write(chunk); + streams.push(s); + } + } + } - // We may be sent here speculatively, if an incoming stream has - // become readable - if (this.blocked) return; + roundrobin(this.newStreams); + + // Either we exhausted the new queues, or we ran out of capacity. If + // we ran out of capacity, all the remaining new streams (i.e., + // those with packets left) become old streams. This effectively + // prioritises streams that keep their buffers close to empty over + // those that are constantly near full. + if (accepting) { // all new queues are exhausted, write as many as + // we can from the old streams + assert.equal(0, this.newStreams.length); + roundrobin(this.oldStreams); + } + else { // ran out of room + assert(this.newStreams.length > 0, "Expect some new streams to remain"); + Array.prototype.push.apply(this.oldStreams, this.newStreams); + this.newStreams = []; + } + // We may have exhausted all the old queues, or run out of room; + // either way, all we need to do is record whether we have capacity + // or not, so any speculative reads will know + this.blocked = !accepting; + } - var accepting = true; - var out = this.out; + _scheduleRead () { + var self = this; - // Try to read a chunk from each stream in turn, until all streams - // are empty, or we exhaust our ability to accept chunks. - function roundrobin(streams) { - var s; - while (accepting && (s = streams.shift())) { - var chunk = s.read(); - if (chunk !== null) { - accepting = out.write(chunk); - streams.push(s); - } + if (!self.scheduledRead) { + schedule(function () { + self.scheduledRead = false; + self._readIncoming(); + }); + self.scheduledRead = true; } } - roundrobin(this.newStreams); + pipeFrom (readable) { + var self = this; - // Either we exhausted the new queues, or we ran out of capacity. If - // we ran out of capacity, all the remaining new streams (i.e., - // those with packets left) become old streams. This effectively - // prioritises streams that keep their buffers close to empty over - // those that are constantly near full. - - if (accepting) { // all new queues are exhausted, write as many as - // we can from the old streams - assert.equal(0, this.newStreams.length); - roundrobin(this.oldStreams); - } - else { // ran out of room - assert(this.newStreams.length > 0, "Expect some new streams to remain"); - Array.prototype.push.apply(this.oldStreams, this.newStreams); - this.newStreams = []; - } - // We may have exhausted all the old queues, or run out of room; - // either way, all we need to do is record whether we have capacity - // or not, so any speculative reads will know - this.blocked = !accepting; -}; - -Mux.prototype._scheduleRead = function() { - var self = this; - - if (!self.scheduledRead) { - schedule(function() { - self.scheduledRead = false; - self._readIncoming(); - }); - self.scheduledRead = true; - } -}; + function enqueue () { + self.newStreams.push(readable); + self._scheduleRead(); + } -Mux.prototype.pipeFrom = function(readable) { - var self = this; + function cleanup () { + readable.removeListener('readable', enqueue); + readable.removeListener('error', cleanup); + readable.removeListener('end', cleanup); + readable.removeListener('unpipeFrom', cleanupIfMe); + } + function cleanupIfMe (dest) { + if (dest === self) cleanup(); + } - function enqueue() { - self.newStreams.push(readable); - self._scheduleRead(); + readable.on('unpipeFrom', cleanupIfMe); + readable.on('end', cleanup); + readable.on('error', cleanup); + readable.on('readable', enqueue); } - function cleanup() { - readable.removeListener('readable', enqueue); - readable.removeListener('error', cleanup); - readable.removeListener('end', cleanup); - readable.removeListener('unpipeFrom', cleanupIfMe); - } - function cleanupIfMe(dest) { - if (dest === self) cleanup(); + unpipeFrom (readable) { + readable.emit('unpipeFrom', this); } - - readable.on('unpipeFrom', cleanupIfMe); - readable.on('end', cleanup); - readable.on('error', cleanup); - readable.on('readable', enqueue); -}; - -Mux.prototype.unpipeFrom = function(readable) { - readable.emit('unpipeFrom', this); -}; +} module.exports.Mux = Mux; From ad2af4429d886f80b0c655043578581b8d0f3196 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Tue, 28 Nov 2023 00:22:28 +0000 Subject: [PATCH 095/112] Make CI more robust --- .github/workflows/test.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f451d1a0..140df220 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,13 +14,13 @@ jobs: runs-on: ubuntu-latest services: rabbitmq: - image: rabbitmq + image: rabbitmq:3.12-alpine ports: - 5672:5672 strategy: matrix: - node-version: [10.x, 12.x, 14.x, 16.x, 18.x] + node-version: [10.x, 12.x, 14.x, 16.x, 18.x, 20.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: @@ -34,5 +34,18 @@ jobs: # Install all prerequisites - run: npm ci + # Ensure RabbitMQ is available before continuing + - run: | + n=0 + while : + do + sleep 5 + echo 'HELO\n\n\n\n' | nc localhost 5672 | grep AMQP + [[ $? = 0 ]] && break || ((n++)) + (( n >= 5 )) && break + done + + - run: echo 'HELO\n\n\n\n' | nc localhost 5672 | grep AMQP + # Run the tests - run: make test From c89c0e3ffd1bea46b21e1bfa95fead1a074b7bbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20W=C3=A4rting?= Date: Tue, 28 Nov 2023 01:29:32 +0100 Subject: [PATCH 096/112] chore: remove circular ref (#732) --- lib/callback_model.js | 2 +- lib/channel.js | 2 +- lib/connection.js | 2 +- lib/heartbeat.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/callback_model.js b/lib/callback_model.js index 598bcf3b..aad24150 100644 --- a/lib/callback_model.js +++ b/lib/callback_model.js @@ -5,7 +5,7 @@ 'use strict'; var defs = require('./defs'); -var EventEmitter = require('events').EventEmitter; +var EventEmitter = require('events'); var BaseChannel = require('./channel').BaseChannel; var acceptMessage = require('./channel').acceptMessage; var Args = require('./api_args'); diff --git a/lib/channel.js b/lib/channel.js index 235e06b4..1db2af25 100644 --- a/lib/channel.js +++ b/lib/channel.js @@ -11,7 +11,7 @@ var closeMsg = require('./format').closeMessage; var inspect = require('./format').inspect; var methodName = require('./format').methodName; var assert = require('assert'); -var EventEmitter = require('events').EventEmitter; +var EventEmitter = require('events'); var fmt = require('util').format; var IllegalOperationError = require('./error').IllegalOperationError; var stackCapture = require('./error').stackCapture; diff --git a/lib/connection.js b/lib/connection.js index d36ea6aa..93dee755 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -13,7 +13,7 @@ var Mux = require('./mux').Mux; var Duplex = require('stream').Duplex || require('readable-stream/duplex'); -var EventEmitter = require('events').EventEmitter; +var EventEmitter = require('events'); var Heart = require('./heartbeat').Heart; var methodName = require('./format').methodName; diff --git a/lib/heartbeat.js b/lib/heartbeat.js index 9c6c2e69..e5f373ab 100644 --- a/lib/heartbeat.js +++ b/lib/heartbeat.js @@ -47,7 +47,7 @@ 'use strict'; -var EventEmitter = require('events').EventEmitter; +var EventEmitter = require('events'); // Exported so that we can mess with it in tests module.exports.UNITS_TO_MS = 1000; From 85be2eca4f2fcc695eb19b136e8214e0bf180b16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20W=C3=A4rting?= Date: Tue, 28 Nov 2023 01:30:58 +0100 Subject: [PATCH 097/112] chore: slice -> subarray (#730) --- bin/generate-defs.js | 10 +++++----- lib/codec.js | 4 ++-- lib/connection.js | 2 +- lib/credentials.js | 2 +- test/codec.js | 8 ++++---- test/frame.js | 10 +++++----- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/bin/generate-defs.js b/bin/generate-defs.js index ac7c71b5..6f71e018 100644 --- a/bin/generate-defs.js +++ b/bin/generate-defs.js @@ -495,7 +495,7 @@ function decoderFn(method) { break; case 'longstr': println('len = buffer.readUInt32BE(offset); offset += 4;'); - println('val = buffer.slice(offset, offset + len);'); + println('val = buffer.subarray(offset, offset + len);'); println('offset += len;'); break; case 'shortstr': @@ -505,7 +505,7 @@ function decoderFn(method) { break; case 'table': println('len = buffer.readUInt32BE(offset); offset += 4;'); - println('val = decodeFields(buffer.slice(offset, offset + len));'); + println('val = decodeFields(buffer.subarray(offset, offset + len));'); println('offset += len;'); break; default: @@ -657,7 +657,7 @@ function encodePropsFn(props) { // size does not include the frame header or frame end byte println('buffer.writeUInt32BE(offset - 7, 3);'); println('buffer.writeUInt16BE(flags, 19);'); - println('return buffer.slice(0, offset + 1);'); + println('return buffer.subarray(0, offset + 1);'); println('}'); } @@ -697,7 +697,7 @@ function decodePropsFn(props) { break; case 'longstr': println('len = buffer.readUInt32BE(offset); offset += 4;'); - println('val = buffer.slice(offset, offset + len);'); + println('val = buffer.subarray(offset, offset + len);'); println('offset += len;'); break; case 'shortstr': @@ -707,7 +707,7 @@ function decodePropsFn(props) { break; case 'table': println('len = buffer.readUInt32BE(offset); offset += 4;'); - println('val = decodeFields(buffer.slice(offset, offset + len));'); + println('val = decodeFields(buffer.subarray(offset, offset + len));'); println('offset += len;'); break; default: diff --git a/lib/codec.js b/lib/codec.js index 817b099d..b6ea1a20 100644 --- a/lib/codec.js +++ b/lib/codec.js @@ -262,7 +262,7 @@ function decodeFields(slice) { break; case 'F': len = slice.readUInt32BE(offset); offset += 4; - val = decodeFields(slice.slice(offset, offset + len)); + val = decodeFields(slice.subarray(offset, offset + len)); offset += len; break; case 'A': @@ -294,7 +294,7 @@ function decodeFields(slice) { break; case 'x': len = slice.readUInt32BE(offset); offset += 4; - val = slice.slice(offset, offset + len); + val = slice.subarray(offset, offset + len); offset += len; break; default: diff --git a/lib/connection.js b/lib/connection.js index 93dee755..f3cae69c 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -538,7 +538,7 @@ class Connection extends EventEmitter { for (var offset = 0; offset < body.length; offset += maxBody) { var end = offset + maxBody; - var slice = (end > body.length) ? body.slice(offset) : body.slice(offset, end); + var slice = (end > body.length) ? body.subarray(offset) : body.subarray(offset, end); var bodyFrame = makeBodyFrame(channel, slice); writeResult = buffer.write(bodyFrame); } diff --git a/lib/credentials.js b/lib/credentials.js index 194659a8..a9452845 100644 --- a/lib/credentials.js +++ b/lib/credentials.js @@ -27,7 +27,7 @@ module.exports.amqplain = function(user, passwd) { response: function() { const buffer = Buffer.alloc(16384); const size = codec.encodeTable(buffer, { LOGIN: user, PASSWORD: passwd}, 0); - return buffer.slice(4, size); + return buffer.subarray(4, size); }, username: user, password: passwd diff --git a/test/codec.js b/test/codec.js index 8a668c42..2acc773d 100644 --- a/test/codec.js +++ b/test/codec.js @@ -70,7 +70,7 @@ suite("Implicit encodings", function() { test(name, function() { var buffer = Buffer.alloc(1000); var size = codec.encodeTable(buffer, val, 0); - var result = buffer.slice(4, size); + var result = buffer.subarray(4, size); assert.deepEqual(expect, bufferToArray(result)); }); }); @@ -83,7 +83,7 @@ var amqp = require('./data'); function roundtrip_table(t) { var buf = Buffer.alloc(4096); var size = codec.encodeTable(buf, t, 0); - var decoded = codec.decodeFields(buf.slice(4, size)); // ignore the length-prefix + var decoded = codec.decodeFields(buf.subarray(4, size)); // ignore the length-prefix try { assert.deepEqual(removeExplicitTypes(t), decoded); } @@ -204,7 +204,7 @@ function roundtripMethod(Method) { return forAll(Method).satisfy(function(method) { var buf = defs.encodeMethod(method.id, 0, method.fields); // FIXME depends on framing, ugh - var fs1 = defs.decode(method.id, buf.slice(11, buf.length)); + var fs1 = defs.decode(method.id, buf.subarray(11, buf.length)); assertEqualModuloDefaults(method, fs1); return true; }); @@ -215,7 +215,7 @@ function roundtripProperties(Properties) { var buf = defs.encodeProperties(properties.id, 0, properties.size, properties.fields); // FIXME depends on framing, ugh - var fs1 = defs.decode(properties.id, buf.slice(19, buf.length)); + var fs1 = defs.decode(properties.id, buf.subarray(19, buf.length)); assert.equal(properties.size, ints.readUInt64BE(buf, 11)); assertEqualModuloDefaults(properties, fs1); return true; diff --git a/test/frame.js b/test/frame.js index 602ca3c0..53551afc 100644 --- a/test/frame.js +++ b/test/frame.js @@ -38,9 +38,9 @@ suite("Explicit parsing", function() { test('Parse partitioned', function() { var input = inputs(); var frames = new Frames(input); - input.write(HB.slice(0, 3)); + input.write(HB.subarray(0, 3)); assert(!frames.recvFrame()); - input.write(HB.slice(3)); + input.write(HB.subarray(3)); assert(frames.recvFrame() === HEARTBEAT); assert(!frames.recvFrame()); }); @@ -143,9 +143,9 @@ suite("Parsing", function() { var onethird = Math.floor(full.length / 3); var twothirds = 2 * onethird; return [ - full.slice(0, onethird), - full.slice(onethird, twothirds), - full.slice(twothirds) + full.subarray(0, onethird), + full.subarray(onethird, twothirds), + full.subarray(twothirds) ]; })); }); From 312e3f7c5df9ba364ab10586cf3a0d0a0d5fd7ea Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Tue, 28 Nov 2023 00:39:33 +0000 Subject: [PATCH 098/112] Test using Node 20 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a48005f3..db94e70a 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ JSON=amqp-rabbitmq-0.9.1.json RABBITMQ_CODEGEN=https://raw.githubusercontent.com/rabbitmq/rabbitmq-codegen AMQP_JSON=$(RABBITMQ_CODEGEN)/$(RABBITMQ_SRC_VERSION)/$(JSON) -NODEJS_VERSIONS='10.21' '11.15' '12.18' '13.14' '14.5' '15.8' '16.3.0' '18.1.0' +NODEJS_VERSIONS='10.21' '11.15' '12.18' '13.14' '14.5' '15.8' '16.3.0' '18.1.0' '20.10.0' MOCHA=./node_modules/.bin/mocha _MOCHA=./node_modules/.bin/_mocha From a5f1f1788acae281d80749ece70a175dc4d5bbc4 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Thu, 22 Feb 2024 08:26:47 +0000 Subject: [PATCH 099/112] Add connection-update-secret --- Makefile | 5 +- lib/callback_model.js | 4 + lib/channel_model.js | 4 + lib/connection.js | 11 + test/callback_api.js | 356 +++++++++-------- test/channel_api.js | 900 +++++++++++++++++++++--------------------- 6 files changed, 658 insertions(+), 622 deletions(-) diff --git a/Makefile b/Makefile index db94e70a..a3d87428 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,6 @@ -RABBITMQ_SRC_VERSION=rabbitmq_v3_2_1 +RABBITMQ_SRC_VERSION=v3.12.13 JSON=amqp-rabbitmq-0.9.1.json -RABBITMQ_CODEGEN=https://raw.githubusercontent.com/rabbitmq/rabbitmq-codegen -AMQP_JSON=$(RABBITMQ_CODEGEN)/$(RABBITMQ_SRC_VERSION)/$(JSON) +AMQP_JSON=https://raw.githubusercontent.com/rabbitmq/rabbitmq-server/$(RABBITMQ_SRC_VERSION)/deps/rabbitmq_codegen/$(JSON) NODEJS_VERSIONS='10.21' '11.15' '12.18' '13.14' '14.5' '15.8' '16.3.0' '18.1.0' '20.10.0' diff --git a/lib/callback_model.js b/lib/callback_model.js index aad24150..45b5de0f 100644 --- a/lib/callback_model.js +++ b/lib/callback_model.js @@ -24,6 +24,10 @@ class CallbackModel extends EventEmitter { this.connection.close(cb); } + updateSecret(newSecret, reason, cb) { + this.connection._updateSecret(newSecret, reason, cb); + } + createChannel (cb) { var ch = new Channel(this.connection); ch.open(function (err, ok) { diff --git a/lib/channel_model.js b/lib/channel_model.js index be38d00c..f95b0192 100644 --- a/lib/channel_model.js +++ b/lib/channel_model.js @@ -26,6 +26,10 @@ class ChannelModel extends EventEmitter { return promisify(this.connection.close.bind(this.connection))(); } + updateSecret(newSecret, reason) { + return promisify(this.connection._updateSecret.bind(this.connection))(newSecret, reason); + } + async createChannel() { const channel = new Channel(this.connection); await channel.open(); diff --git a/lib/connection.js b/lib/connection.js index f3cae69c..3586fdfd 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -361,6 +361,14 @@ class Connection extends EventEmitter { this.emit('close', maybeErr); } + _updateSecret(newSecret, reason, cb) { + this.sendMethod(0, defs.ConnectionUpdateSecret, { + newSecret, + reason + }); + this.on('update-secret-ok', cb); + } + // === startHeartbeater () { if (this.heartbeat === 0) @@ -611,6 +619,9 @@ function channel0(connection) { else if (f.id === defs.ConnectionUnblocked) { connection.emit('unblocked'); } + else if (f.id === defs.ConnectionUpdateSecretOk) { + connection.emit('update-secret-ok'); + } else { connection.closeWithError( fmt("Unexpected frame on channel 0"), diff --git a/test/callback_api.js b/test/callback_api.js index 21f3a900..29a9f409 100644 --- a/test/callback_api.js +++ b/test/callback_api.js @@ -57,10 +57,18 @@ function waitForMessages(ch, q, k) { suite('connect', function() { -test('at all', function(done) { - connect(doneCallback(done)); + test('at all', function(done) { + connect(doneCallback(done)); + }); + }); +suite('updateSecret', function() { + test('updateSecret', function(done) { + connect(kCallback(function(c) { + c.updateSecret(Buffer.from('new secret'), 'no reason', doneCallback(done)); + })); + }); }); function channel_test_fn(method) { @@ -79,234 +87,234 @@ var confirm_channel_test = channel_test_fn('createConfirmChannel'); suite('channel open', function() { -channel_test('at all', function(ch, done) { - done(); -}); + channel_test('at all', function(ch, done) { + done(); + }); -channel_test('open and close', function(ch, done) { - ch.close(doneCallback(done)); -}); + channel_test('open and close', function(ch, done) { + ch.close(doneCallback(done)); + }); }); suite('assert, check, delete', function() { -channel_test('assert, check, delete queue', function(ch, done) { - ch.assertQueue('test.cb.queue', {}, kCallback(function(q) { - ch.checkQueue('test.cb.queue', kCallback(function(ok) { - ch.deleteQueue('test.cb.queue', {}, doneCallback(done)); + channel_test('assert, check, delete queue', function(ch, done) { + ch.assertQueue('test.cb.queue', {}, kCallback(function(q) { + ch.checkQueue('test.cb.queue', kCallback(function(ok) { + ch.deleteQueue('test.cb.queue', {}, doneCallback(done)); + }, done)); }, done)); - }, done)); -}); + }); -channel_test('assert, check, delete exchange', function(ch, done) { - ch.assertExchange( - 'test.cb.exchange', 'topic', {}, kCallback(function(ex) { - ch.checkExchange('test.cb.exchange', kCallback(function(ok) { - ch.deleteExchange('test.cb.exchange', {}, doneCallback(done)); + channel_test('assert, check, delete exchange', function(ch, done) { + ch.assertExchange( + 'test.cb.exchange', 'topic', {}, kCallback(function(ex) { + ch.checkExchange('test.cb.exchange', kCallback(function(ok) { + ch.deleteExchange('test.cb.exchange', {}, doneCallback(done)); + }, done)); }, done)); - }, done)); -}); + }); -channel_test('fail on check non-queue', function(ch, done) { - var both = twice(done); - ch.on('error', failCallback(both.first)); - ch.checkQueue('test.cb.nothere', failCallback(both.second)); -}); + channel_test('fail on check non-queue', function(ch, done) { + var both = twice(done); + ch.on('error', failCallback(both.first)); + ch.checkQueue('test.cb.nothere', failCallback(both.second)); + }); -channel_test('fail on check non-exchange', function(ch, done) { - var both = twice(done); - ch.on('error', failCallback(both.first)); - ch.checkExchange('test.cb.nothere', failCallback(both.second)); -}); + channel_test('fail on check non-exchange', function(ch, done) { + var both = twice(done); + ch.on('error', failCallback(both.first)); + ch.checkExchange('test.cb.nothere', failCallback(both.second)); + }); }); suite('bindings', function() { -channel_test('bind queue', function(ch, done) { - ch.assertQueue('test.cb.bindq', {}, kCallback(function(q) { - ch.assertExchange( - 'test.cb.bindex', 'fanout', {}, kCallback(function(ex) { - ch.bindQueue(q.queue, ex.exchange, '', {}, - doneCallback(done)); - }, done)); - }, done)); -}); - -channel_test('bind exchange', function(ch, done) { - ch.assertExchange( - 'test.cb.bindex1', 'fanout', {}, kCallback(function(ex1) { + channel_test('bind queue', function(ch, done) { + ch.assertQueue('test.cb.bindq', {}, kCallback(function(q) { ch.assertExchange( - 'test.cb.bindex2', 'fanout', {}, kCallback(function(ex2) { - ch.bindExchange(ex1.exchange, - ex2.exchange, '', {}, - doneCallback(done)); + 'test.cb.bindex', 'fanout', {}, kCallback(function(ex) { + ch.bindQueue(q.queue, ex.exchange, '', {}, + doneCallback(done)); }, done)); }, done)); -}); + }); + + channel_test('bind exchange', function(ch, done) { + ch.assertExchange( + 'test.cb.bindex1', 'fanout', {}, kCallback(function(ex1) { + ch.assertExchange( + 'test.cb.bindex2', 'fanout', {}, kCallback(function(ex2) { + ch.bindExchange(ex1.exchange, + ex2.exchange, '', {}, + doneCallback(done)); + }, done)); + }, done)); + }); }); suite('sending messages', function() { -channel_test('send to queue and consume noAck', function(ch, done) { - var msg = randomString(); - ch.assertQueue('', {exclusive: true}, function(e, q) { - if (e !== null) return done(e); - ch.consume(q.queue, function(m) { - if (m.content.toString() == msg) done(); - else done(new Error("message content doesn't match:" + - msg + " =/= " + m.content.toString())); - }, {noAck: true, exclusive: true}); - ch.sendToQueue(q.queue, Buffer.from(msg)); + channel_test('send to queue and consume noAck', function(ch, done) { + var msg = randomString(); + ch.assertQueue('', {exclusive: true}, function(e, q) { + if (e !== null) return done(e); + ch.consume(q.queue, function(m) { + if (m.content.toString() == msg) done(); + else done(new Error("message content doesn't match:" + + msg + " =/= " + m.content.toString())); + }, {noAck: true, exclusive: true}); + ch.sendToQueue(q.queue, Buffer.from(msg)); + }); }); -}); -channel_test('send to queue and consume ack', function(ch, done) { - var msg = randomString(); - ch.assertQueue('', {exclusive: true}, function(e, q) { - if (e !== null) return done(e); - ch.consume(q.queue, function(m) { - if (m.content.toString() == msg) { - ch.ack(m); - done(); - } - else done(new Error("message content doesn't match:" + - msg + " =/= " + m.content.toString())); - }, {noAck: false, exclusive: true}); - ch.sendToQueue(q.queue, Buffer.from(msg)); + channel_test('send to queue and consume ack', function(ch, done) { + var msg = randomString(); + ch.assertQueue('', {exclusive: true}, function(e, q) { + if (e !== null) return done(e); + ch.consume(q.queue, function(m) { + if (m.content.toString() == msg) { + ch.ack(m); + done(); + } + else done(new Error("message content doesn't match:" + + msg + " =/= " + m.content.toString())); + }, {noAck: false, exclusive: true}); + ch.sendToQueue(q.queue, Buffer.from(msg)); + }); }); -}); -channel_test('send to and get from queue', function(ch, done) { - ch.assertQueue('', {exclusive: true}, function(e, q) { - if (e != null) return done(e); - var msg = randomString(); - ch.sendToQueue(q.queue, Buffer.from(msg)); - waitForMessages(ch, q.queue, function(e, _) { + channel_test('send to and get from queue', function(ch, done) { + ch.assertQueue('', {exclusive: true}, function(e, q) { if (e != null) return done(e); - ch.get(q.queue, {noAck: true}, function(e, m) { - if (e != null) - return done(e); - else if (!m) - return done(new Error('Empty (false) not expected')); - else if (m.content.toString() == msg) - return done(); - else - return done( - new Error('Messages do not match: ' + - msg + ' =/= ' + m.content.toString())); + var msg = randomString(); + ch.sendToQueue(q.queue, Buffer.from(msg)); + waitForMessages(ch, q.queue, function(e, _) { + if (e != null) return done(e); + ch.get(q.queue, {noAck: true}, function(e, m) { + if (e != null) + return done(e); + else if (!m) + return done(new Error('Empty (false) not expected')); + else if (m.content.toString() == msg) + return done(); + else + return done( + new Error('Messages do not match: ' + + msg + ' =/= ' + m.content.toString())); + }); }); }); }); -}); }); suite('ConfirmChannel', function() { -confirm_channel_test('Receive confirmation', function(ch, done) { - // An unroutable message, on the basis that you're not allowed a - // queue with an empty name, and you can't make bindings to the - // default exchange. Tricky eh? - ch.publish('', '', Buffer.from('foo'), {}, done); -}); + confirm_channel_test('Receive confirmation', function(ch, done) { + // An unroutable message, on the basis that you're not allowed a + // queue with an empty name, and you can't make bindings to the + // default exchange. Tricky eh? + ch.publish('', '', Buffer.from('foo'), {}, done); + }); -confirm_channel_test('Wait for confirms', function(ch, done) { - for (var i=0; i < 1000; i++) { - ch.publish('', '', Buffer.from('foo'), {}); - } - ch.waitForConfirms(done); -}); + confirm_channel_test('Wait for confirms', function(ch, done) { + for (var i=0; i < 1000; i++) { + ch.publish('', '', Buffer.from('foo'), {}); + } + ch.waitForConfirms(done); + }); }); suite("Error handling", function() { -/* -I don't like having to do this, but there appears to be something -broken about domains in Node.JS v0.8 and mocha. Apparently it has to -do with how mocha and domains hook into error propogation: -https://github.com/visionmedia/mocha/issues/513 (summary: domains in -Node.JS v0.8 don't prevent uncaughtException from firing, and that's -what mocha uses to detect .. an uncaught exception). - -Using domains with amqplib *does* work in practice in Node.JS v0.8: -that is, it's possible to throw an exception in a callback and deal -with it in the active domain, and thereby avoid it crashing the -program. - */ -if (util.versionGreaterThan(process.versions.node, '0.8')) { - test('Throw error in connection open callback', function(done) { - var dom = domain.createDomain(); - dom.on('error', failCallback(done)); - connect(dom.bind(function(err, conn) { - throw new Error('Spurious connection open callback error'); - })); - }); -} + /* + I don't like having to do this, but there appears to be something + broken about domains in Node.JS v0.8 and mocha. Apparently it has to + do with how mocha and domains hook into error propogation: + https://github.com/visionmedia/mocha/issues/513 (summary: domains in + Node.JS v0.8 don't prevent uncaughtException from firing, and that's + what mocha uses to detect .. an uncaught exception). + + Using domains with amqplib *does* work in practice in Node.JS v0.8: + that is, it's possible to throw an exception in a callback and deal + with it in the active domain, and thereby avoid it crashing the + program. + */ + if (util.versionGreaterThan(process.versions.node, '0.8')) { + test('Throw error in connection open callback', function(done) { + var dom = domain.createDomain(); + dom.on('error', failCallback(done)); + connect(dom.bind(function(err, conn) { + throw new Error('Spurious connection open callback error'); + })); + }); + } -// TODO: refactor {error_test, channel_test} -function error_test(name, fun) { - test(name, function(done) { - var dom = domain.createDomain(); - dom.run(function() { - connect(kCallback(function(c) { - // Seems like there were some unironed wrinkles in 0.8's - // implementation of domains; explicitly adding the connection - // to the domain makes sure any exception thrown in the course - // of processing frames is handled by the domain. For other - // versions of Node.JS, this ends up being belt-and-braces. - dom.add(c); - c.createChannel(kCallback(function(ch) { - fun(ch, done, dom); + // TODO: refactor {error_test, channel_test} + function error_test(name, fun) { + test(name, function(done) { + var dom = domain.createDomain(); + dom.run(function() { + connect(kCallback(function(c) { + // Seems like there were some unironed wrinkles in 0.8's + // implementation of domains; explicitly adding the connection + // to the domain makes sure any exception thrown in the course + // of processing frames is handled by the domain. For other + // versions of Node.JS, this ends up being belt-and-braces. + dom.add(c); + c.createChannel(kCallback(function(ch) { + fun(ch, done, dom); + }, done)); }, done)); - }, done)); + }); }); - }); -} - -error_test('Channel open callback throws an error', function(ch, done, dom) { - dom.on('error', failCallback(done)); - throw new Error('Error in open callback'); -}); + } -error_test('RPC callback throws error', function(ch, done, dom) { - dom.on('error', failCallback(done)); - ch.prefetch(0, false, function(err, ok) { - throw new Error('Spurious callback error'); + error_test('Channel open callback throws an error', function(ch, done, dom) { + dom.on('error', failCallback(done)); + throw new Error('Error in open callback'); }); -}); -error_test('Get callback throws error', function(ch, done, dom) { - dom.on('error', failCallback(done)); - ch.assertQueue('test.cb.get-with-error', {}, function(err, ok) { - ch.get('test.cb.get-with-error', {noAck: true}, function() { + error_test('RPC callback throws error', function(ch, done, dom) { + dom.on('error', failCallback(done)); + ch.prefetch(0, false, function(err, ok) { throw new Error('Spurious callback error'); }); }); -}); -error_test('Consume callback throws error', function(ch, done, dom) { - dom.on('error', failCallback(done)); - ch.assertQueue('test.cb.consume-with-error', {}, function(err, ok) { - ch.consume('test.cb.consume-with-error', ignore, {noAck: true}, function() { - throw new Error('Spurious callback error'); + error_test('Get callback throws error', function(ch, done, dom) { + dom.on('error', failCallback(done)); + ch.assertQueue('test.cb.get-with-error', {}, function(err, ok) { + ch.get('test.cb.get-with-error', {noAck: true}, function() { + throw new Error('Spurious callback error'); + }); }); }); -}); -error_test('Get from non-queue invokes error k', function(ch, done, dom) { - var both = twice(failCallback(done)); - dom.on('error', both.first); - ch.get('', {}, both.second); -}); + error_test('Consume callback throws error', function(ch, done, dom) { + dom.on('error', failCallback(done)); + ch.assertQueue('test.cb.consume-with-error', {}, function(err, ok) { + ch.consume('test.cb.consume-with-error', ignore, {noAck: true}, function() { + throw new Error('Spurious callback error'); + }); + }); + }); -error_test('Consume from non-queue invokes error k', function(ch, done, dom) { - var both = twice(failCallback(done)); - dom.on('error', both.first); - ch.consume('', both.second); -}); + error_test('Get from non-queue invokes error k', function(ch, done, dom) { + var both = twice(failCallback(done)); + dom.on('error', both.first); + ch.get('', {}, both.second); + }); + + error_test('Consume from non-queue invokes error k', function(ch, done, dom) { + var both = twice(failCallback(done)); + dom.on('error', both.first); + ch.consume('', both.second); + }); }); diff --git a/test/channel_api.js b/test/channel_api.js index b4952e27..77ed496a 100644 --- a/test/channel_api.js +++ b/test/channel_api.js @@ -49,94 +49,104 @@ var chtest = channel_test.bind(null, 'createChannel'); suite("connect", function() { -test("at all", function(done) { - connect(URL).then(function(c) { - return c.close() - ;}).then(succeed(done), fail(done)); -}); + test("at all", function(done) { + connect(URL).then(function(c) { + return c.close() + ;}).then(succeed(done), fail(done)); + }); -chtest("create channel", ignore); // i.e., just don't bork + chtest("create channel", ignore); // i.e., just don't bork }); +suite('updateSecret', function() { + test('updateSecret', function(done) { + connect().then(function(c) { + c.updateSecret(Buffer.from('new secret'), 'no reason') + .then(succeed(done), fail(done)) + .finally(function() { c.close(); }); + }); + }); +}); + var QUEUE_OPTS = {durable: false}; var EX_OPTS = {durable: false}; suite("assert, check, delete", function() { -chtest("assert and check queue", function(ch) { - return ch.assertQueue('test.check-queue', QUEUE_OPTS) - .then(function(qok) { - return ch.checkQueue('test.check-queue'); - }); -}); + chtest("assert and check queue", function(ch) { + return ch.assertQueue('test.check-queue', QUEUE_OPTS) + .then(function(qok) { + return ch.checkQueue('test.check-queue'); + }); + }); -chtest("assert and check exchange", function(ch) { - return ch.assertExchange('test.check-exchange', 'direct', EX_OPTS) - .then(function(eok) { - assert.equal('test.check-exchange', eok.exchange); - return ch.checkExchange('test.check-exchange'); - }); -}); + chtest("assert and check exchange", function(ch) { + return ch.assertExchange('test.check-exchange', 'direct', EX_OPTS) + .then(function(eok) { + assert.equal('test.check-exchange', eok.exchange); + return ch.checkExchange('test.check-exchange'); + }); + }); -chtest("fail on reasserting queue with different options", - function(ch) { - var q = 'test.reassert-queue'; - return ch.assertQueue( - q, {durable: false, autoDelete: true}) - .then(function() { - return expectFail( - ch.assertQueue(q, {durable: false, - autoDelete: false})); - }); - }); - -chtest("fail on checking a queue that's not there", function(ch) { - return expectFail(ch.checkQueue('test.random-' + randomString())); -}); + chtest("fail on reasserting queue with different options", + function(ch) { + var q = 'test.reassert-queue'; + return ch.assertQueue( + q, {durable: false, autoDelete: true}) + .then(function() { + return expectFail( + ch.assertQueue(q, {durable: false, + autoDelete: false})); + }); + }); + + chtest("fail on checking a queue that's not there", function(ch) { + return expectFail(ch.checkQueue('test.random-' + randomString())); + }); -chtest("fail on checking an exchange that's not there", function(ch) { - return expectFail(ch.checkExchange('test.random-' + randomString())); -}); + chtest("fail on checking an exchange that's not there", function(ch) { + return expectFail(ch.checkExchange('test.random-' + randomString())); + }); -chtest("fail on reasserting exchange with different type", - function(ch) { - var ex = 'test.reassert-ex'; - return ch.assertExchange(ex, 'fanout', EX_OPTS) - .then(function() { - return expectFail( - ch.assertExchange(ex, 'direct', EX_OPTS)); - }); - }); - -chtest("channel break on publishing to non-exchange", function(ch) { - return new Promise(function(resolve) { - ch.on('error', resolve); - ch.publish(randomString(), '', Buffer.from('foobar')); + chtest("fail on reasserting exchange with different type", + function(ch) { + var ex = 'test.reassert-ex'; + return ch.assertExchange(ex, 'fanout', EX_OPTS) + .then(function() { + return expectFail( + ch.assertExchange(ex, 'direct', EX_OPTS)); + }); + }); + + chtest("channel break on publishing to non-exchange", function(ch) { + return new Promise(function(resolve) { + ch.on('error', resolve); + ch.publish(randomString(), '', Buffer.from('foobar')); + }); }); -}); -chtest("delete queue", function(ch) { - var q = 'test.delete-queue'; - return Promise.all([ - ch.assertQueue(q, QUEUE_OPTS), - ch.checkQueue(q)]) - .then(function() { - return ch.deleteQueue(q);}) - .then(function() { - return expectFail(ch.checkQueue(q));}); -}); + chtest("delete queue", function(ch) { + var q = 'test.delete-queue'; + return Promise.all([ + ch.assertQueue(q, QUEUE_OPTS), + ch.checkQueue(q)]) + .then(function() { + return ch.deleteQueue(q);}) + .then(function() { + return expectFail(ch.checkQueue(q));}); + }); -chtest("delete exchange", function(ch) { - var ex = 'test.delete-exchange'; - return Promise.all([ - ch.assertExchange(ex, 'fanout', EX_OPTS), - ch.checkExchange(ex)]) - .then(function() { - return ch.deleteExchange(ex);}) - .then(function() { - return expectFail(ch.checkExchange(ex));}); -}); + chtest("delete exchange", function(ch) { + var ex = 'test.delete-exchange'; + return Promise.all([ + ch.assertExchange(ex, 'fanout', EX_OPTS), + ch.checkExchange(ex)]) + .then(function() { + return ch.deleteExchange(ex);}) + .then(function() { + return expectFail(ch.checkExchange(ex));}); + }); }); @@ -173,347 +183,347 @@ function waitForMessages(q, num) { suite("sendMessage", function() { -// publish different size messages -chtest("send to queue and get from queue", function(ch) { - var q = 'test.send-to-q'; - var msg = randomString(); - return Promise.all([ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q)]) - .then(function() { - ch.sendToQueue(q, Buffer.from(msg)); - return waitForMessages(q); - }) - .then(function() { - return ch.get(q, {noAck: true}); - }) - .then(function(m) { - assert(m); - assert.equal(msg, m.content.toString()); - }); -}); + // publish different size messages + chtest("send to queue and get from queue", function(ch) { + var q = 'test.send-to-q'; + var msg = randomString(); + return Promise.all([ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q)]) + .then(function() { + ch.sendToQueue(q, Buffer.from(msg)); + return waitForMessages(q); + }) + .then(function() { + return ch.get(q, {noAck: true}); + }) + .then(function(m) { + assert(m); + assert.equal(msg, m.content.toString()); + }); + }); -chtest("send (and get) zero content to queue", function(ch) { - var q = 'test.send-to-q'; - var msg = Buffer.alloc(0); - return Promise.all([ - ch.assertQueue(q, QUEUE_OPTS), - ch.purgeQueue(q)]) - .then(function() { - ch.sendToQueue(q, msg); - return waitForMessages(q);}) - .then(function() { - return ch.get(q, {noAck: true});}) - .then(function(m) { - assert(m); - assert.deepEqual(msg, m.content); - }); -}); + chtest("send (and get) zero content to queue", function(ch) { + var q = 'test.send-to-q'; + var msg = Buffer.alloc(0); + return Promise.all([ + ch.assertQueue(q, QUEUE_OPTS), + ch.purgeQueue(q)]) + .then(function() { + ch.sendToQueue(q, msg); + return waitForMessages(q);}) + .then(function() { + return ch.get(q, {noAck: true});}) + .then(function(m) { + assert(m); + assert.deepEqual(msg, m.content); + }); + }); }); suite("binding, consuming", function() { -// bind, publish, get -chtest("route message", function(ch) { - var ex = 'test.route-message'; - var q = 'test.route-message-q'; - var msg = randomString(); - - return Promise.all([ - ch.assertExchange(ex, 'fanout', EX_OPTS), - ch.assertQueue(q, QUEUE_OPTS), - ch.purgeQueue(q), - ch.bindQueue(q, ex, '', {})]) - .then(function() { - ch.publish(ex, '', Buffer.from(msg)); - return waitForMessages(q);}) - .then(function() { - return ch.get(q, {noAck: true});}) - .then(function(m) { - assert(m); - assert.equal(msg, m.content.toString()); - }); -}); + // bind, publish, get + chtest("route message", function(ch) { + var ex = 'test.route-message'; + var q = 'test.route-message-q'; + var msg = randomString(); -// send to queue, purge, get-empty -chtest("purge queue", function(ch) { - var q = 'test.purge-queue'; - return ch.assertQueue(q, {durable: false}) - .then(function() { - ch.sendToQueue(q, Buffer.from('foobar')); - return waitForMessages(q);}) - .then(function() { - ch.purgeQueue(q); - return ch.get(q, {noAck: true});}) - .then(function(m) { - assert(!m); // get-empty - }); -}); - -// bind again, unbind, publish, get-empty -chtest("unbind queue", function(ch) { - var ex = 'test.unbind-queue-ex'; - var q = 'test.unbind-queue'; - var viabinding = randomString(); - var direct = randomString(); - - return Promise.all([ - ch.assertExchange(ex, 'fanout', EX_OPTS), - ch.assertQueue(q, QUEUE_OPTS), - ch.purgeQueue(q), - ch.bindQueue(q, ex, '', {})]) - .then(function() { - ch.publish(ex, '', Buffer.from('foobar')); - return waitForMessages(q);}) - .then(function() { // message got through! - return ch.get(q, {noAck:true}) - .then(function(m) {assert(m);});}) - .then(function() { - return ch.unbindQueue(q, ex, '', {});}) - .then(function() { - // via the no-longer-existing binding - ch.publish(ex, '', Buffer.from(viabinding)); - // direct to the queue - ch.sendToQueue(q, Buffer.from(direct)); - return waitForMessages(q);}) - .then(function() {return ch.get(q)}) - .then(function(m) { - // the direct to queue message got through, the via-binding - // message (sent first) did not - assert.equal(direct, m.content.toString()); - }); -}); - -// To some extent this is now just testing semantics of the server, -// but we can at least try out a few settings, and consume. -chtest("consume via exchange-exchange binding", function(ch) { - var ex1 = 'test.ex-ex-binding1', ex2 = 'test.ex-ex-binding2'; - var q = 'test.ex-ex-binding-q'; - var rk = 'test.routing.key', msg = randomString(); - return Promise.all([ - ch.assertExchange(ex1, 'direct', EX_OPTS), - ch.assertExchange(ex2, 'fanout', - {durable: false, internal: true}), - ch.assertQueue(q, QUEUE_OPTS), - ch.purgeQueue(q), - ch.bindExchange(ex2, ex1, rk, {}), - ch.bindQueue(q, ex2, '', {})]) - .then(function() { - return new Promise(function(resolve, reject) { - function delivery(m) { - if (m.content.toString() === msg) resolve(); - else reject(new Error("Wrong message")); - } - ch.consume(q, delivery, {noAck: true}) - .then(function() { - ch.publish(ex1, rk, Buffer.from(msg)); - }); + return Promise.all([ + ch.assertExchange(ex, 'fanout', EX_OPTS), + ch.assertQueue(q, QUEUE_OPTS), + ch.purgeQueue(q), + ch.bindQueue(q, ex, '', {})]) + .then(function() { + ch.publish(ex, '', Buffer.from(msg)); + return waitForMessages(q);}) + .then(function() { + return ch.get(q, {noAck: true});}) + .then(function(m) { + assert(m); + assert.equal(msg, m.content.toString()); }); - }); -}); - -// bind again, unbind, publish, get-empty -chtest("unbind exchange", function(ch) { - var source = 'test.unbind-ex-source'; - var dest = 'test.unbind-ex-dest'; - var q = 'test.unbind-ex-queue'; - var viabinding = randomString(); - var direct = randomString(); - - return Promise.all([ - ch.assertExchange(source, 'fanout', EX_OPTS), - ch.assertExchange(dest, 'fanout', EX_OPTS), - ch.assertQueue(q, QUEUE_OPTS), - ch.purgeQueue(q), - ch.bindExchange(dest, source, '', {}), - ch.bindQueue(q, dest, '', {})]) - .then(function() { - ch.publish(source, '', Buffer.from('foobar')); - return waitForMessages(q);}) - .then(function() { // message got through! - return ch.get(q, {noAck:true}) - .then(function(m) {assert(m);});}) - .then(function() { - return ch.unbindExchange(dest, source, '', {});}) - .then(function() { - // via the no-longer-existing binding - ch.publish(source, '', Buffer.from(viabinding)); - // direct to the queue - ch.sendToQueue(q, Buffer.from(direct)); - return waitForMessages(q);}) - .then(function() {return ch.get(q)}) - .then(function(m) { - // the direct to queue message got through, the via-binding - // message (sent first) did not - assert.equal(direct, m.content.toString()); - }); -}); + }); -// This is a bit convoluted. Sorry. -chtest("cancel consumer", function(ch) { - var q = 'test.consumer-cancel'; - var ctag; - var recv1 = new Promise(function (resolve, reject) { - Promise.all([ - ch.assertQueue(q, QUEUE_OPTS), - ch.purgeQueue(q), - // My callback is 'resolve the promise in `arrived`' - ch.consume(q, resolve, {noAck:true}) - .then(function(ok) { - ctag = ok.consumerTag; - ch.sendToQueue(q, Buffer.from('foo')); - })]); + // send to queue, purge, get-empty + chtest("purge queue", function(ch) { + var q = 'test.purge-queue'; + return ch.assertQueue(q, {durable: false}) + .then(function() { + ch.sendToQueue(q, Buffer.from('foobar')); + return waitForMessages(q);}) + .then(function() { + ch.purgeQueue(q); + return ch.get(q, {noAck: true});}) + .then(function(m) { + assert(!m); // get-empty + }); }); - // A message should arrive because of the consume - return recv1.then(function() { - var recv2 = Promise.all([ - ch.cancel(ctag).then(function() { - return ch.sendToQueue(q, Buffer.from('bar')); - }), - // but check a message did arrive in the queue - waitForMessages(q)]) + // bind again, unbind, publish, get-empty + chtest("unbind queue", function(ch) { + var ex = 'test.unbind-queue-ex'; + var q = 'test.unbind-queue'; + var viabinding = randomString(); + var direct = randomString(); + + return Promise.all([ + ch.assertExchange(ex, 'fanout', EX_OPTS), + ch.assertQueue(q, QUEUE_OPTS), + ch.purgeQueue(q), + ch.bindQueue(q, ex, '', {})]) .then(function() { - return ch.get(q, {noAck:true}); - }) + ch.publish(ex, '', Buffer.from('foobar')); + return waitForMessages(q);}) + .then(function() { // message got through! + return ch.get(q, {noAck:true}) + .then(function(m) {assert(m);});}) + .then(function() { + return ch.unbindQueue(q, ex, '', {});}) + .then(function() { + // via the no-longer-existing binding + ch.publish(ex, '', Buffer.from(viabinding)); + // direct to the queue + ch.sendToQueue(q, Buffer.from(direct)); + return waitForMessages(q);}) + .then(function() {return ch.get(q)}) .then(function(m) { - // I'm going to reject it, because I flip succeed/fail - // just below - if (m.content.toString() === 'bar') { - throw new Error(); - } + // the direct to queue message got through, the via-binding + // message (sent first) did not + assert.equal(direct, m.content.toString()); }); + }); - return expectFail(recv2); + // To some extent this is now just testing semantics of the server, + // but we can at least try out a few settings, and consume. + chtest("consume via exchange-exchange binding", function(ch) { + var ex1 = 'test.ex-ex-binding1', ex2 = 'test.ex-ex-binding2'; + var q = 'test.ex-ex-binding-q'; + var rk = 'test.routing.key', msg = randomString(); + return Promise.all([ + ch.assertExchange(ex1, 'direct', EX_OPTS), + ch.assertExchange(ex2, 'fanout', + {durable: false, internal: true}), + ch.assertQueue(q, QUEUE_OPTS), + ch.purgeQueue(q), + ch.bindExchange(ex2, ex1, rk, {}), + ch.bindQueue(q, ex2, '', {})]) + .then(function() { + return new Promise(function(resolve, reject) { + function delivery(m) { + if (m.content.toString() === msg) resolve(); + else reject(new Error("Wrong message")); + } + ch.consume(q, delivery, {noAck: true}) + .then(function() { + ch.publish(ex1, rk, Buffer.from(msg)); + }); + }); + }); }); -}); -chtest("cancelled consumer", function(ch) { - var q = 'test.cancelled-consumer'; - return new Promise(function(resolve, reject) { + // bind again, unbind, publish, get-empty + chtest("unbind exchange", function(ch) { + var source = 'test.unbind-ex-source'; + var dest = 'test.unbind-ex-dest'; + var q = 'test.unbind-ex-queue'; + var viabinding = randomString(); + var direct = randomString(); + return Promise.all([ - ch.assertQueue(q), + ch.assertExchange(source, 'fanout', EX_OPTS), + ch.assertExchange(dest, 'fanout', EX_OPTS), + ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q), - ch.consume(q, function(msg) { - if (msg === null) resolve(); - else reject(new Error('Message not expected')); - })]) + ch.bindExchange(dest, source, '', {}), + ch.bindQueue(q, dest, '', {})]) .then(function() { - return ch.deleteQueue(q); + ch.publish(source, '', Buffer.from('foobar')); + return waitForMessages(q);}) + .then(function() { // message got through! + return ch.get(q, {noAck:true}) + .then(function(m) {assert(m);});}) + .then(function() { + return ch.unbindExchange(dest, source, '', {});}) + .then(function() { + // via the no-longer-existing binding + ch.publish(source, '', Buffer.from(viabinding)); + // direct to the queue + ch.sendToQueue(q, Buffer.from(direct)); + return waitForMessages(q);}) + .then(function() {return ch.get(q)}) + .then(function(m) { + // the direct to queue message got through, the via-binding + // message (sent first) did not + assert.equal(direct, m.content.toString()); }); }); -}); -// ack, by default, removes a single message from the queue -chtest("ack", function(ch) { - var q = 'test.ack'; - var msg1 = randomString(), msg2 = randomString(); - - return Promise.all([ - ch.assertQueue(q, QUEUE_OPTS), - ch.purgeQueue(q)]) - .then(function() { - ch.sendToQueue(q, Buffer.from(msg1)); - ch.sendToQueue(q, Buffer.from(msg2)); - return waitForMessages(q, 2); - }) - .then(function() { - return ch.get(q, {noAck: false}) - }) - .then(function(m) { - assert.equal(msg1, m.content.toString()); - ch.ack(m); - // %%% is there a race here? may depend on - // rabbitmq-sepcific semantics - return ch.get(q); - }) - .then(function(m) { - assert(m); - assert.equal(msg2, m.content.toString()); + // This is a bit convoluted. Sorry. + chtest("cancel consumer", function(ch) { + var q = 'test.consumer-cancel'; + var ctag; + var recv1 = new Promise(function (resolve, reject) { + Promise.all([ + ch.assertQueue(q, QUEUE_OPTS), + ch.purgeQueue(q), + // My callback is 'resolve the promise in `arrived`' + ch.consume(q, resolve, {noAck:true}) + .then(function(ok) { + ctag = ok.consumerTag; + ch.sendToQueue(q, Buffer.from('foo')); + })]); }); -}); -// Nack, by default, puts a message back on the queue (where in the -// queue is up to the server) -chtest("nack", function(ch) { - var q = 'test.nack'; - var msg1 = randomString(); - - return Promise.all([ - ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q)]) - .then(function() { - ch.sendToQueue(q, Buffer.from(msg1)); - return waitForMessages(q);}) - .then(function() { - return ch.get(q, {noAck: false})}) - .then(function(m) { - assert.equal(msg1, m.content.toString()); - ch.nack(m); - return waitForMessages(q);}) - .then(function() { - return ch.get(q);}) - .then(function(m) { - assert(m); - assert.equal(msg1, m.content.toString()); + // A message should arrive because of the consume + return recv1.then(function() { + var recv2 = Promise.all([ + ch.cancel(ctag).then(function() { + return ch.sendToQueue(q, Buffer.from('bar')); + }), + // but check a message did arrive in the queue + waitForMessages(q)]) + .then(function() { + return ch.get(q, {noAck:true}); + }) + .then(function(m) { + // I'm going to reject it, because I flip succeed/fail + // just below + if (m.content.toString() === 'bar') { + throw new Error(); + } + }); + + return expectFail(recv2); }); -}); + }); -// reject is a near-synonym for nack, the latter of which is not -// available in earlier RabbitMQ (or in AMQP proper). -chtest("reject", function(ch) { - var q = 'test.reject'; - var msg1 = randomString(); - - return Promise.all([ - ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q)]) - .then(function() { - ch.sendToQueue(q, Buffer.from(msg1)); - return waitForMessages(q);}) - .then(function() { - return ch.get(q, {noAck: false})}) - .then(function(m) { - assert.equal(msg1, m.content.toString()); - ch.reject(m); - return waitForMessages(q);}) - .then(function() { - return ch.get(q);}) - .then(function(m) { - assert(m); - assert.equal(msg1, m.content.toString()); + chtest("cancelled consumer", function(ch) { + var q = 'test.cancelled-consumer'; + return new Promise(function(resolve, reject) { + return Promise.all([ + ch.assertQueue(q), + ch.purgeQueue(q), + ch.consume(q, function(msg) { + if (msg === null) resolve(); + else reject(new Error('Message not expected')); + })]) + .then(function() { + return ch.deleteQueue(q); + }); }); -}); + }); + + // ack, by default, removes a single message from the queue + chtest("ack", function(ch) { + var q = 'test.ack'; + var msg1 = randomString(), msg2 = randomString(); + + return Promise.all([ + ch.assertQueue(q, QUEUE_OPTS), + ch.purgeQueue(q)]) + .then(function() { + ch.sendToQueue(q, Buffer.from(msg1)); + ch.sendToQueue(q, Buffer.from(msg2)); + return waitForMessages(q, 2); + }) + .then(function() { + return ch.get(q, {noAck: false}) + }) + .then(function(m) { + assert.equal(msg1, m.content.toString()); + ch.ack(m); + // %%% is there a race here? may depend on + // rabbitmq-sepcific semantics + return ch.get(q); + }) + .then(function(m) { + assert(m); + assert.equal(msg2, m.content.toString()); + }); + }); + + // Nack, by default, puts a message back on the queue (where in the + // queue is up to the server) + chtest("nack", function(ch) { + var q = 'test.nack'; + var msg1 = randomString(); + + return Promise.all([ + ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q)]) + .then(function() { + ch.sendToQueue(q, Buffer.from(msg1)); + return waitForMessages(q);}) + .then(function() { + return ch.get(q, {noAck: false})}) + .then(function(m) { + assert.equal(msg1, m.content.toString()); + ch.nack(m); + return waitForMessages(q);}) + .then(function() { + return ch.get(q);}) + .then(function(m) { + assert(m); + assert.equal(msg1, m.content.toString()); + }); + }); -chtest("prefetch", function(ch) { - var q = 'test.prefetch'; - return Promise.all([ - ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q), - ch.prefetch(1)]) - .then(function() { - ch.sendToQueue(q, Buffer.from('foobar')); - ch.sendToQueue(q, Buffer.from('foobar')); - return waitForMessages(q, 2); - }) - .then(function() { - return new Promise(function(resolve) { - var messageCount = 0; - function receive(msg) { - ch.ack(msg); - if (++messageCount > 1) { - resolve(messageCount); + // reject is a near-synonym for nack, the latter of which is not + // available in earlier RabbitMQ (or in AMQP proper). + chtest("reject", function(ch) { + var q = 'test.reject'; + var msg1 = randomString(); + + return Promise.all([ + ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q)]) + .then(function() { + ch.sendToQueue(q, Buffer.from(msg1)); + return waitForMessages(q);}) + .then(function() { + return ch.get(q, {noAck: false})}) + .then(function(m) { + assert.equal(msg1, m.content.toString()); + ch.reject(m); + return waitForMessages(q);}) + .then(function() { + return ch.get(q);}) + .then(function(m) { + assert(m); + assert.equal(msg1, m.content.toString()); + }); + }); + + chtest("prefetch", function(ch) { + var q = 'test.prefetch'; + return Promise.all([ + ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q), + ch.prefetch(1)]) + .then(function() { + ch.sendToQueue(q, Buffer.from('foobar')); + ch.sendToQueue(q, Buffer.from('foobar')); + return waitForMessages(q, 2); + }) + .then(function() { + return new Promise(function(resolve) { + var messageCount = 0; + function receive(msg) { + ch.ack(msg); + if (++messageCount > 1) { + resolve(messageCount); + } } - } - return ch.consume(q, receive, {noAck: false}) + return ch.consume(q, receive, {noAck: false}) + }); + }) + .then(function(c) { + return assert.equal(2, c); }); - }) - .then(function(c) { - return assert.equal(2, c); - }); -}); + }); -chtest('close', function(ch) { - // Resolving promise guarantees - // channel is closed - return ch.close(); -}); + chtest('close', function(ch) { + // Resolving promise guarantees + // channel is closed + return ch.close(); + }); }); @@ -521,76 +531,76 @@ var confirmtest = channel_test.bind(null, 'createConfirmChannel'); suite("confirms", function() { -confirmtest('message is confirmed', function(ch) { - var q = 'test.confirm-message'; - return Promise.all([ - ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q)]) - .then(function() { - return ch.sendToQueue(q, Buffer.from('bleep')); - }); -}); - -// Usually one can provoke the server into confirming more than one -// message in an ack by simply sending a few messages in quick -// succession; a bit unscientific I know. Luckily we can eavesdrop on -// the acknowledgements coming through to see if we really did get a -// multi-ack. -confirmtest('multiple confirms', function(ch) { - var q = 'test.multiple-confirms'; - return Promise.all([ - ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q)]) - .then(function() { - var multipleRainbows = false; - ch.on('ack', function(a) { - if (a.multiple) multipleRainbows = true; + confirmtest('message is confirmed', function(ch) { + var q = 'test.confirm-message'; + return Promise.all([ + ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q)]) + .then(function() { + return ch.sendToQueue(q, Buffer.from('bleep')); }); + }); - function prod(num) { - var cs = []; + // Usually one can provoke the server into confirming more than one + // message in an ack by simply sending a few messages in quick + // succession; a bit unscientific I know. Luckily we can eavesdrop on + // the acknowledgements coming through to see if we really did get a + // multi-ack. + confirmtest('multiple confirms', function(ch) { + var q = 'test.multiple-confirms'; + return Promise.all([ + ch.assertQueue(q, QUEUE_OPTS), ch.purgeQueue(q)]) + .then(function() { + var multipleRainbows = false; + ch.on('ack', function(a) { + if (a.multiple) multipleRainbows = true; + }); - function sendAndPushPromise() { - var conf = promisify(function(cb) { - return ch.sendToQueue(q, Buffer.from('bleep'), {}, cb); - })(); - cs.push(conf); - } + function prod(num) { + var cs = []; - for (var i=0; i < num; i++) sendAndPushPromise(); - - return Promise.all(cs).then(function() { - if (multipleRainbows) return true; - else if (num > 500) throw new Error( - "Couldn't provoke the server" + - " into multi-acking with " + num + - " messages; giving up"); - else { - //console.warn("Failed with " + num + "; trying " + num * 2); - return prod(num * 2); + function sendAndPushPromise() { + var conf = promisify(function(cb) { + return ch.sendToQueue(q, Buffer.from('bleep'), {}, cb); + })(); + cs.push(conf); } - }); - } - return prod(5); - }); -}); -confirmtest('wait for confirms', function(ch) { - for (var i=0; i < 1000; i++) { - ch.publish('', '', Buffer.from('foobar'), {}); - } - return ch.waitForConfirms(); -}) - -confirmtest('works when channel is closed', function(ch) { - for (var i=0; i < 1000; i++) { - ch.publish('', '', Buffer.from('foobar'), {}); - } - return ch.close().then(function () { - return ch.waitForConfirms() - }).then(function () { - assert.strictEqual(true, false, 'Wait should have failed.') - }, function (e) { - assert.strictEqual(e.message, 'channel closed') + for (var i=0; i < num; i++) sendAndPushPromise(); + + return Promise.all(cs).then(function() { + if (multipleRainbows) return true; + else if (num > 500) throw new Error( + "Couldn't provoke the server" + + " into multi-acking with " + num + + " messages; giving up"); + else { + //console.warn("Failed with " + num + "; trying " + num * 2); + return prod(num * 2); + } + }); + } + return prod(5); + }); + }); + + confirmtest('wait for confirms', function(ch) { + for (var i=0; i < 1000; i++) { + ch.publish('', '', Buffer.from('foobar'), {}); + } + return ch.waitForConfirms(); + }) + + confirmtest('works when channel is closed', function(ch) { + for (var i=0; i < 1000; i++) { + ch.publish('', '', Buffer.from('foobar'), {}); + } + return ch.close().then(function () { + return ch.waitForConfirms() + }).then(function () { + assert.strictEqual(true, false, 'Wait should have failed.') + }, function (e) { + assert.strictEqual(e.message, 'channel closed') + }); }); -}); }); From cb8d2db935b420e6d21c6870c8d61cc04d973d67 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Thu, 22 Feb 2024 08:39:01 +0000 Subject: [PATCH 100/112] Automatically remove update-secret-ok event handler --- lib/connection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/connection.js b/lib/connection.js index 3586fdfd..1c58ac5f 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -366,7 +366,7 @@ class Connection extends EventEmitter { newSecret, reason }); - this.on('update-secret-ok', cb); + this.once('update-secret-ok', cb); } // === From d76a142036e22c10c475d63caf55f3dac127e277 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Thu, 22 Feb 2024 08:49:32 +0000 Subject: [PATCH 101/112] Make quotes in updateSecret consistent with other tests --- test/channel_api.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/channel_api.js b/test/channel_api.js index 77ed496a..f3a1691d 100644 --- a/test/channel_api.js +++ b/test/channel_api.js @@ -59,10 +59,10 @@ suite("connect", function() { }); -suite('updateSecret', function() { - test('updateSecret', function(done) { +suite("updateSecret", function() { + test("updateSecret", function(done) { connect().then(function(c) { - c.updateSecret(Buffer.from('new secret'), 'no reason') + c.updateSecret(Buffer.from("new secret"), "no reason") .then(succeed(done), fail(done)) .finally(function() { c.close(); }); }); From 676cb243fe9fa902a293cf97a265ad4aeeb8dd04 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Thu, 11 Apr 2024 19:07:30 +0100 Subject: [PATCH 102/112] Update changelog in preparation for release --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fca65655..a9378a3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,9 @@ # Change log for amqplib -## Unreleased +## Changes in v0.10.4 - Improve stream example as per https://github.com/amqp-node/amqplib/issues/722 +- Added support for RabbitMQ's connection update-secret operation. See https://github.com/amqp-node/amqplib/issues/755 ## Changes in v0.10.3 From 48552eda8694dee46839cf26c9c69b245cd00165 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Thu, 11 Apr 2024 19:10:14 +0100 Subject: [PATCH 103/112] 0.10.4 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1b2ba950..6024ad5a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "amqplib", - "version": "0.10.3", + "version": "0.10.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "amqplib", - "version": "0.10.3", + "version": "0.10.4", "license": "MIT", "dependencies": { "@acuminous/bitsyntax": "^0.1.2", diff --git a/package.json b/package.json index ef301e41..987139f9 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "amqplib", "homepage": "http://amqp-node.github.io/amqplib/", "main": "./channel_api.js", - "version": "0.10.3", + "version": "0.10.4", "description": "An AMQP 0-9-1 (e.g., RabbitMQ) library and client.", "repository": { "type": "git", From b2d80ab5d3d50dc7de2e7d331a8a4eff698ed511 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Thu, 11 Apr 2024 19:57:55 +0100 Subject: [PATCH 104/112] Touch readme --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index afde787b..6314f1f3 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,6 @@ * [Troubleshooting][gh-pages-trouble] * [Examples from RabbitMQ tutorials][tutes] - A library for making AMQP 0-9-1 clients for Node.JS, and an AMQP 0-9-1 client for Node.JS v10+. This library does not implement [AMQP From 38c4d59b6cb94aecdc1337419031c1cd3c675cb9 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Thu, 11 Apr 2024 20:27:16 +0100 Subject: [PATCH 105/112] Update repo url --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 987139f9..841a5b09 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "description": "An AMQP 0-9-1 (e.g., RabbitMQ) library and client.", "repository": { "type": "git", - "url": "https://github.com/amqp-node/amqplib.git" + "url": "git+https://github.com/amqp-node/amqplib.git" }, "engines": { "node": ">=10" From 03b42400eb8da93c3f6e3b46663e8d3bb29966c1 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Thu, 11 Apr 2024 20:29:34 +0100 Subject: [PATCH 106/112] Add publish workflow --- .github/workflows/publish.yml | 59 +++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..2693ce10 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,59 @@ +name: Publish + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + services: + rabbitmq: + image: rabbitmq:3-alpine + ports: + - 5672:5672 + + strategy: + matrix: + node-version: [10.x, 12.x, 14.x, 16.x, 18.x, 20.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: "npm" + + - run: npm ci + + - run: | + n=0 + while : + do + sleep 5 + echo 'HELO\n\n\n\n' | nc localhost 5672 | grep AMQP + [[ $? = 0 ]] && break || ((n++)) + (( n >= 5 )) && break + done + + - run: echo 'HELO\n\n\n\n' | nc localhost 5672 | grep AMQP + + - run: make test + + publish: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: '20.x' + cache: "npm" + registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: npm publish --dry-run + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} From 115e52ab326c6f418fd4592a048ce864c41798f2 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Thu, 11 Apr 2024 21:02:25 +0100 Subject: [PATCH 107/112] Commit defs --- .gitignore | 2 - .npmignore | 1 - Makefile | 35 +- bin/amqp-rabbitmq-0.9.1.json | 483 ++++ lib/defs.js | 5077 ++++++++++++++++++++++++++++++++++ 5 files changed, 5579 insertions(+), 19 deletions(-) create mode 100644 bin/amqp-rabbitmq-0.9.1.json create mode 100644 lib/defs.js diff --git a/.gitignore b/.gitignore index 266a9a78..d1964000 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,6 @@ *~ -lib/defs.js scratch node_modules/ -bin/amqp-rabbitmq-0.9.1.json etc/ coverage/ /.idea/ diff --git a/.npmignore b/.npmignore index 4ec93971..1db5f675 100644 --- a/.npmignore +++ b/.npmignore @@ -3,6 +3,5 @@ scratch # do not ignore lib/defs.js, we need that # node_modules is ignored anyway .travis.yml -bin/amqp-rabbitmq-0.9.1.json etc/ coverage/ diff --git a/Makefile b/Makefile index a3d87428..41f212f8 100644 --- a/Makefile +++ b/Makefile @@ -9,33 +9,36 @@ _MOCHA=./node_modules/.bin/_mocha UGLIFY=./node_modules/.bin/uglifyjs NYC=./node_modules/.bin/nyc -.PHONY: test test-all-nodejs all clean coverage +.PHONY: test test-all-nodejs coverage lib/defs.js -all: lib/defs.js +error: + @echo "Please choose one of the following targets: test, test-all-nodejs, coverage, lib/defs.js" + @exit 1 -clean: - rm lib/defs.js bin/amqp-rabbitmq-0.9.1.json - rm -rf ./coverage - -lib/defs.js: $(UGLIFY) bin/generate-defs.js bin/amqp-rabbitmq-0.9.1.json - (cd bin; node ./generate-defs.js > ../lib/defs.js) - $(UGLIFY) ./lib/defs.js -o ./lib/defs.js \ - -c 'sequences=false' --comments \ - -b 'indent-level=2' 2>&1 | (grep -v 'WARN' || true) - -test: lib/defs.js +test: $(MOCHA) --check-leaks -u tdd --exit test/ -test-all-nodejs: lib/defs.js +test-all-nodejs: for v in $(NODEJS_VERSIONS); \ do echo "-- Node version $$v --"; \ nave use $$v $(MOCHA) -u tdd --exit -R progress test; \ done -coverage: $(NYC) lib/defs.js - $(NYC) --reporter=lcov --reporter=text $(_MOCHA) -u tdd -R progress test/ +coverage: $(NYC) + $(NYC) --clean --reporter=lcov --reporter=text $(_MOCHA) -u tdd --exit -R progress test/ @echo "HTML report at file://$$(pwd)/coverage/lcov-report/index.html" +lib/defs.js: clean bin/generate-defs test + +clean: + rm -f lib/defs.js bin/amqp-rabbitmq-0.9.1.json + +bin/generate-defs: $(UGLIFY) bin/generate-defs.js bin/amqp-rabbitmq-0.9.1.json + (cd bin; node ./generate-defs.js > ../lib/defs.js) + $(UGLIFY) ./lib/defs.js -o ./lib/defs.js \ + -c 'sequences=false' --comments \ + -b 'indent-level=2' 2>&1 | (grep -v 'WARN' || true) + bin/amqp-rabbitmq-0.9.1.json: curl -L $(AMQP_JSON) > $@ diff --git a/bin/amqp-rabbitmq-0.9.1.json b/bin/amqp-rabbitmq-0.9.1.json new file mode 100644 index 00000000..43f3cf64 --- /dev/null +++ b/bin/amqp-rabbitmq-0.9.1.json @@ -0,0 +1,483 @@ +{ + "name": "AMQP", + "major-version": 0, + "minor-version": 9, + "revision": 1, + "port": 5672, + "copyright": [ + "Copyright (C) 2008-2020 VMware, Inc. or its affiliates.\n", + "\n", + "Permission is hereby granted, free of charge, to any person\n", + "obtaining a copy of this file (the \"Software\"), to deal in the\n", + "Software without restriction, including without limitation the \n", + "rights to use, copy, modify, merge, publish, distribute, \n", + "sublicense, and/or sell copies of the Software, and to permit \n", + "persons to whom the Software is furnished to do so, subject to \n", + "the following conditions:\n", + "\n", + "The above copyright notice and this permission notice shall be\n", + "included in all copies or substantial portions of the Software.\n", + "\n", + "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n", + "EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n", + "OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n", + "NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n", + "HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n", + "WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n", + "FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n", + "OTHER DEALINGS IN THE SOFTWARE.\n", + "\n", + "Class information entered from amqp_xml0-8.pdf and domain types from amqp-xml-doc0-9.pdf\n", + "Updated for 0-9-1 by Tony Garnock-Jones\n", + "\n", + "b3cb053f15e7b98808c0ccc67f23cb3e amqp_xml0-8.pdf\n", + "http://twiststandards.org/?option=com_docman&task=cat_view&gid=28&Itemid=90\n", + "8444db91e2949dbecfb2585e9eef6d64 amqp-xml-doc0-9.pdf\n", + "https://jira.amqp.org/confluence/download/attachments/720900/amqp-xml-doc0-9.pdf?version=1\n"], + + "domains": [ + ["bit", "bit"], + ["channel-id", "longstr"], + ["class-id", "short"], + ["consumer-tag", "shortstr"], + ["delivery-tag", "longlong"], + ["destination", "shortstr"], + ["duration", "longlong"], + ["exchange-name", "shortstr"], + ["long", "long"], + ["longlong", "longlong"], + ["longstr", "longstr"], + ["message-count", "long"], + ["method-id", "short"], + ["no-ack", "bit"], + ["no-local", "bit"], + ["octet", "octet"], + ["offset", "longlong"], + ["path", "shortstr"], + ["peer-properties", "table"], + ["queue-name", "shortstr"], + ["redelivered", "bit"], + ["reference", "longstr"], + ["reject-code", "short"], + ["reject-text", "shortstr"], + ["reply-code", "short"], + ["reply-text", "shortstr"], + ["security-token", "longstr"], + ["short", "short"], + ["shortstr", "shortstr"], + ["table", "table"], + ["timestamp", "timestamp"] + ], + + "constants": [ + {"name": "FRAME-METHOD", "value": 1}, + {"name": "FRAME-HEADER", "value": 2}, + {"name": "FRAME-BODY", "value": 3}, + {"name": "FRAME-HEARTBEAT", "value": 8}, + {"name": "FRAME-MIN-SIZE", "value": 4096}, + {"name": "FRAME-END", "value": 206}, + {"name": "REPLY-SUCCESS", "value": 200}, + {"name": "CONTENT-TOO-LARGE", "value": 311, "class": "soft-error"}, + {"name": "NO-ROUTE", "value": 312, "class": "soft-error"}, + {"name": "NO-CONSUMERS", "value": 313, "class": "soft-error"}, + {"name": "ACCESS-REFUSED", "value": 403, "class": "soft-error"}, + {"name": "NOT-FOUND", "value": 404, "class": "soft-error"}, + {"name": "RESOURCE-LOCKED", "value": 405, "class": "soft-error"}, + {"name": "PRECONDITION-FAILED", "value": 406, "class": "soft-error"}, + {"name": "CONNECTION-FORCED", "value": 320, "class": "hard-error"}, + {"name": "INVALID-PATH", "value": 402, "class": "hard-error"}, + {"name": "FRAME-ERROR", "value": 501, "class": "hard-error"}, + {"name": "SYNTAX-ERROR", "value": 502, "class": "hard-error"}, + {"name": "COMMAND-INVALID", "value": 503, "class": "hard-error"}, + {"name": "CHANNEL-ERROR", "value": 504, "class": "hard-error"}, + {"name": "UNEXPECTED-FRAME", "value": 505, "class": "hard-error"}, + {"name": "RESOURCE-ERROR", "value": 506, "class": "hard-error"}, + {"name": "NOT-ALLOWED", "value": 530, "class": "hard-error"}, + {"name": "NOT-IMPLEMENTED", "value": 540, "class": "hard-error"}, + {"name": "INTERNAL-ERROR", "value": 541, "class": "hard-error"} + ], + + "classes": [ + { + "id": 60, + "methods": [{"id": 10, + "arguments": [{"type": "long", "name": "prefetch-size", "default-value": 0}, + {"type": "short", "name": "prefetch-count", "default-value": 0}, + {"type": "bit", "name": "global", "default-value": false}], + "name": "qos", + "synchronous" : true}, + {"id": 11, + "arguments": [], + "name": "qos-ok"}, + {"id": 20, + "arguments": [{"domain": "short", "name": "ticket", "default-value": 0}, + {"domain": "queue-name", "name": "queue", "default-value": ""}, + {"type": "shortstr", "name": "consumer-tag", "default-value": ""}, + {"type": "bit", "name": "no-local", "default-value": false}, + {"type": "bit", "name": "no-ack", "default-value": false}, + {"type": "bit", "name": "exclusive", "default-value": false}, + {"type": "bit", "name": "nowait", "default-value": false}, + {"type": "table", "name": "arguments", "default-value": {}}], + "name": "consume", + "synchronous" : true}, + {"id": 21, + "arguments": [{"type": "shortstr", "name": "consumer-tag"}], + "name": "consume-ok"}, + {"id": 30, + "arguments": [{"type": "shortstr", "name": "consumer-tag"}, + {"type": "bit", "name": "nowait", "default-value": false}], + "name": "cancel", + "synchronous" : true}, + {"id": 31, + "arguments": [{"type": "shortstr", "name": "consumer-tag"}], + "name": "cancel-ok"}, + {"content": true, + "id": 40, + "arguments": [{"type": "short", "name": "ticket", "default-value": 0}, + {"domain": "exchange-name", "name": "exchange", "default-value": ""}, + {"type": "shortstr", "name": "routing-key", "default-value": ""}, + {"type": "bit", "name": "mandatory", "default-value": false}, + {"type": "bit", "name": "immediate", "default-value": false}], + "name": "publish"}, + {"content": true, + "id": 50, + "arguments": [{"type": "short", "name": "reply-code"}, + {"type": "shortstr", "name": "reply-text", "default-value": ""}, + {"domain": "exchange-name", "name": "exchange"}, + {"type": "shortstr", "name": "routing-key"}], + "name": "return"}, + {"content": true, + "id": 60, + "arguments": [{"type": "shortstr", "name": "consumer-tag"}, + {"type": "longlong", "name": "delivery-tag"}, + {"type": "bit", "name": "redelivered", "default-value": false}, + {"domain": "exchange-name", "name": "exchange"}, + {"type": "shortstr", "name": "routing-key"}], + "name": "deliver"}, + {"id": 70, + "arguments": [{"type": "short", "name": "ticket", "default-value": 0}, + {"domain": "queue-name", "name": "queue", "default-value": ""}, + {"type": "bit", "name": "no-ack", "default-value": false}], + "name": "get", + "synchronous" : true}, + {"content": true, + "id": 71, + "arguments": [{"type": "longlong", "name": "delivery-tag"}, + {"type": "bit", "name": "redelivered", "default-value": false}, + {"domain": "exchange-name", "name": "exchange"}, + {"type": "shortstr", "name": "routing-key"}, + {"domain": "message-count", "name": "message-count"}], + "name": "get-ok"}, + {"id": 72, + "arguments": [{"type": "shortstr", "name": "cluster-id", "default-value": ""}], + "name": "get-empty"}, + {"id": 80, + "arguments": [{"type": "longlong", "name": "delivery-tag", "default-value": 0}, + {"type": "bit", "name": "multiple", "default-value": false}], + "name": "ack"}, + {"id": 90, + "arguments": [{"type": "longlong", "name": "delivery-tag"}, + {"type": "bit", "name": "requeue", "default-value": true}], + "name": "reject"}, + {"id": 100, + "arguments": [{"type": "bit", "name": "requeue", "default-value": false}], + "name": "recover-async"}, + {"id": 110, + "arguments": [{"type": "bit", "name": "requeue", "default-value": false}], + "name": "recover", + "synchronous" : true}, + {"id": 111, + "arguments": [], + "name": "recover-ok"}, + {"id": 120, + "arguments": [{"type": "longlong", "name": "delivery-tag", "default-value": 0}, + {"type": "bit", "name": "multiple", "default-value": false}, + {"type": "bit", "name": "requeue", "default-value": true}], + "name": "nack"}], + "name": "basic", + "properties": [{"type": "shortstr", "name": "content-type"}, + {"type": "shortstr", "name": "content-encoding"}, + {"type": "table", "name": "headers"}, + {"type": "octet", "name": "delivery-mode"}, + {"type": "octet", "name": "priority"}, + {"type": "shortstr", "name": "correlation-id"}, + {"type": "shortstr", "name": "reply-to"}, + {"type": "shortstr", "name": "expiration"}, + {"type": "shortstr", "name": "message-id"}, + {"type": "timestamp", "name": "timestamp"}, + {"type": "shortstr", "name": "type"}, + {"type": "shortstr", "name": "user-id"}, + {"type": "shortstr", "name": "app-id"}, + {"type": "shortstr", "name": "cluster-id"}] + }, + { + "id": 10, + "methods": [{"id": 10, + "arguments": [{"type": "octet", "name": "version-major", "default-value": 0}, + {"type": "octet", "name": "version-minor", "default-value": 9}, + {"domain": "peer-properties", "name": "server-properties"}, + {"type": "longstr", "name": "mechanisms", "default-value": "PLAIN"}, + {"type": "longstr", "name": "locales", "default-value": "en_US"}], + "name": "start", + "synchronous" : true}, + {"id": 11, + "arguments": [{"domain": "peer-properties", "name": "client-properties"}, + {"type": "shortstr", "name": "mechanism", "default-value": "PLAIN"}, + {"type": "longstr", "name": "response"}, + {"type": "shortstr", "name": "locale", "default-value": "en_US"}], + "name": "start-ok"}, + {"id": 20, + "arguments": [{"type": "longstr", "name": "challenge"}], + "name": "secure", + "synchronous" : true}, + {"id": 21, + "arguments": [{"type": "longstr", "name": "response"}], + "name": "secure-ok"}, + {"id": 30, + "arguments": [{"type": "short", "name": "channel-max", "default-value": 0}, + {"type": "long", "name": "frame-max", "default-value": 0}, + {"type": "short", "name": "heartbeat", "default-value": 0}], + "name": "tune", + "synchronous" : true}, + {"id": 31, + "arguments": [{"type": "short", "name": "channel-max", "default-value": 0}, + {"type": "long", "name": "frame-max", "default-value": 0}, + {"type": "short", "name": "heartbeat", "default-value": 0}], + "name": "tune-ok"}, + {"id": 40, + "arguments": [{"type": "shortstr", "name": "virtual-host", "default-value": "/"}, + {"type": "shortstr", "name": "capabilities", "default-value": ""}, + {"type": "bit", "name": "insist", "default-value": false}], + "name": "open", + "synchronous" : true}, + {"id": 41, + "arguments": [{"type": "shortstr", "name": "known-hosts", "default-value": ""}], + "name": "open-ok"}, + {"id": 50, + "arguments": [{"type": "short", "name": "reply-code"}, + {"type": "shortstr", "name": "reply-text", "default-value": ""}, + {"type": "short", "name": "class-id"}, + {"type": "short", "name": "method-id"}], + "name": "close", + "synchronous" : true}, + {"id": 51, + "arguments": [], + "name": "close-ok"}, + {"id": 60, + "arguments": [{"type": "shortstr", "name": "reason", "default-value": ""}], + "name": "blocked"}, + {"id": 61, + "arguments": [], + "name": "unblocked"}, + {"id": 70, + "arguments": [{"type": "longstr", "name": "new-secret"}, + {"type": "shortstr", "name": "reason"}], + "name": "update-secret", + "synchronous" : true}, + {"id": 71, + "arguments": [], + "name": "update-secret-ok"} + ], + "name": "connection", + "properties": [] + }, + { + "id": 20, + "methods": [{"id": 10, + "arguments": [{"type": "shortstr", "name": "out-of-band", "default-value": ""}], + "name": "open", + "synchronous" : true}, + {"id": 11, + "arguments": [{"type": "longstr", "name": "channel-id", "default-value": ""}], + "name": "open-ok"}, + {"id": 20, + "arguments": [{"type": "bit", "name": "active"}], + "name": "flow", + "synchronous" : true}, + {"id": 21, + "arguments": [{"type": "bit", "name": "active"}], + "name": "flow-ok"}, + {"id": 40, + "arguments": [{"type": "short", "name": "reply-code"}, + {"type": "shortstr", "name": "reply-text", "default-value": ""}, + {"type": "short", "name": "class-id"}, + {"type": "short", "name": "method-id"}], + "name": "close", + "synchronous" : true}, + {"id": 41, + "arguments": [], + "name": "close-ok"}], + "name": "channel" + }, + { + "id": 30, + "methods": [{"id": 10, + "arguments": [{"type": "shortstr", "name": "realm", "default-value": "/data"}, + {"type": "bit", "name": "exclusive", "default-value": false}, + {"type": "bit", "name": "passive", "default-value": true}, + {"type": "bit", "name": "active", "default-value": true}, + {"type": "bit", "name": "write", "default-value": true}, + {"type": "bit", "name": "read", "default-value": true}], + "name": "request", + "synchronous" : true}, + {"id": 11, + "arguments": [{"type": "short", "name": "ticket", "default-value": 1}], + "name": "request-ok"}], + "name": "access" + }, + { + "id": 40, + "methods": [{"id": 10, + "arguments": [{"type": "short", "name": "ticket", "default-value": 0}, + {"domain": "exchange-name", "name": "exchange"}, + {"type": "shortstr", "name": "type", "default-value": "direct"}, + {"type": "bit", "name": "passive", "default-value": false}, + {"type": "bit", "name": "durable", "default-value": false}, + {"type": "bit", "name": "auto-delete", "default-value": false}, + {"type": "bit", "name": "internal", "default-value": false}, + {"type": "bit", "name": "nowait", "default-value": false}, + {"type": "table", "name": "arguments", "default-value": {}}], + "name": "declare", + "synchronous" : true}, + {"id": 11, + "arguments": [], + "name": "declare-ok"}, + {"id": 20, + "arguments": [{"type": "short", "name": "ticket", "default-value": 0}, + {"domain": "exchange-name", "name": "exchange"}, + {"type": "bit", "name": "if-unused", "default-value": false}, + {"type": "bit", "name": "nowait", "default-value": false}], + "name": "delete", + "synchronous" : true}, + {"id": 21, + "arguments": [], + "name": "delete-ok"}, + {"id": 30, + "arguments": [{"type": "short", "name": "ticket", "default-value": 0}, + {"domain": "exchange-name", "name": "destination"}, + {"domain": "exchange-name", "name": "source"}, + {"type": "shortstr", "name": "routing-key", "default-value": ""}, + {"type": "bit", "name": "nowait", "default-value": false}, + {"type": "table", "name": "arguments", "default-value": {}}], + "name": "bind", + "synchronous" : true}, + {"id": 31, + "arguments": [], + "name": "bind-ok"}, + {"id": 40, + "arguments": [{"type": "short", "name": "ticket", "default-value": 0}, + {"domain": "exchange-name", "name": "destination"}, + {"domain": "exchange-name", "name": "source"}, + {"type": "shortstr", "name": "routing-key", "default-value": ""}, + {"type": "bit", "name": "nowait", "default-value": false}, + {"type": "table", "name": "arguments", "default-value": {}}], + "name": "unbind", + "synchronous" : true}, + {"id": 51, + "arguments": [], + "name": "unbind-ok"}], + "name": "exchange" + }, + { + "id": 50, + "methods": [{"id": 10, + "arguments": [{"type": "short", "name": "ticket", "default-value": 0}, + {"domain": "queue-name", "name": "queue", "default-value": ""}, + {"type": "bit", "name": "passive", "default-value": false}, + {"type": "bit", "name": "durable", "default-value": false}, + {"type": "bit", "name": "exclusive", "default-value": false}, + {"type": "bit", "name": "auto-delete", "default-value": false}, + {"type": "bit", "name": "nowait", "default-value": false}, + {"type": "table", "name": "arguments", "default-value": {}}], + "name": "declare", + "synchronous" : true}, + {"id": 11, + "arguments": [{"domain": "queue-name", "name": "queue"}, + {"domain": "message-count", "name": "message-count"}, + {"type": "long", "name": "consumer-count"}], + "name": "declare-ok"}, + {"id": 20, + "arguments": [{"type": "short", "name": "ticket", "default-value": 0}, + {"domain": "queue-name", "name": "queue", "default-value": ""}, + {"domain": "exchange-name", "name": "exchange"}, + {"type": "shortstr", "name": "routing-key", "default-value": ""}, + {"type": "bit", "name": "nowait", "default-value": false}, + {"type": "table", "name": "arguments", "default-value": {}}], + "name": "bind", + "synchronous" : true}, + {"id": 21, + "arguments": [], + "name": "bind-ok"}, + {"id": 30, + "arguments": [{"type": "short", "name": "ticket", "default-value": 0}, + {"domain": "queue-name", "name": "queue", "default-value": ""}, + {"type": "bit", "name": "nowait", "default-value": false}], + "name": "purge", + "synchronous" : true}, + {"id": 31, + "arguments": [{"domain": "message-count", "name": "message-count"}], + "name": "purge-ok"}, + {"id": 40, + "arguments": [{"type": "short", "name": "ticket", "default-value": 0}, + {"domain": "queue-name", "name": "queue", "default-value": ""}, + {"type": "bit", "name": "if-unused", "default-value": false}, + {"type": "bit", "name": "if-empty", "default-value": false}, + {"type": "bit", "name": "nowait", "default-value": false}], + "name": "delete", + "synchronous" : true}, + {"id": 41, + "arguments": [{"domain": "message-count", "name": "message-count"}], + "name": "delete-ok"}, + {"id": 50, + "arguments": [{"type": "short", "name": "ticket", "default-value": 0}, + {"domain": "queue-name", "name": "queue", "default-value": ""}, + {"domain": "exchange-name", "name": "exchange"}, + {"type": "shortstr", "name": "routing-key", "default-value": ""}, + {"type": "table", "name": "arguments", "default-value": {}}], + "name": "unbind", + "synchronous" : true}, + {"id": 51, + "arguments": [], + "name": "unbind-ok"} + ], + "name": "queue" + }, + { + "id": 90, + "methods": [{"id": 10, + "arguments": [], + "name": "select", + "synchronous" : true}, + {"id": 11, + "arguments": [], + "name": "select-ok"}, + {"id": 20, + "arguments": [], + "name": "commit", + "synchronous" : true}, + {"id": 21, + "arguments": [], + "name": "commit-ok"}, + {"id": 30, + "arguments": [], + "name": "rollback", + "synchronous" : true}, + {"id": 31, + "arguments": [], + "name": "rollback-ok"}], + "name": "tx" + }, + { + "id": 85, + "methods": [{"id": 10, + "arguments": [ + {"type": "bit", "name": "nowait", "default-value": false}], + "name": "select", + "synchronous": true}, + {"id": 11, + "arguments": [], + "name": "select-ok"}], + "name": "confirm" + } + ] +} diff --git a/lib/defs.js b/lib/defs.js new file mode 100644 index 00000000..6b3102dc --- /dev/null +++ b/lib/defs.js @@ -0,0 +1,5077 @@ +/** @preserve This file is generated by the script + * ../bin/generate-defs.js, which is not in general included in a + * distribution, but is available in the source repository e.g. at + * https://github.com/squaremo/amqp.node/ + */ +"use strict"; + +function decodeBasicQos(buffer) { + var val, offset = 0, fields = { + prefetchSize: void 0, + prefetchCount: void 0, + global: void 0 + }; + val = buffer.readUInt32BE(offset); + offset += 4; + fields.prefetchSize = val; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.prefetchCount = val; + val = !!(1 & buffer[offset]); + fields.global = val; + return fields; +} + +function encodeBasicQos(channel, fields) { + var offset = 0, val = null, bits = 0, buffer = Buffer.alloc(19); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3932170, 7); + offset = 11; + val = fields.prefetchSize; + if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'prefetchSize' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt32BE(val, offset); + offset += 4; + val = fields.prefetchCount; + if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'prefetchCount' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + val = fields.global; + void 0 === val && (val = !1); + val && (bits += 1); + buffer[offset] = bits; + offset++; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeBasicQosOk(buffer) { + return {}; +} + +function encodeBasicQosOk(channel, fields) { + var offset = 0, buffer = Buffer.alloc(12); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3932171, 7); + offset = 11; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeBasicConsume(buffer) { + var val, len, offset = 0, fields = { + ticket: void 0, + queue: void 0, + consumerTag: void 0, + noLocal: void 0, + noAck: void 0, + exclusive: void 0, + nowait: void 0, + arguments: void 0 + }; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.ticket = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.queue = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.consumerTag = val; + val = !!(1 & buffer[offset]); + fields.noLocal = val; + val = !!(2 & buffer[offset]); + fields.noAck = val; + val = !!(4 & buffer[offset]); + fields.exclusive = val; + val = !!(8 & buffer[offset]); + fields.nowait = val; + offset++; + len = buffer.readUInt32BE(offset); + offset += 4; + val = decodeFields(buffer.subarray(offset, offset + len)); + offset += len; + fields.arguments = val; + return fields; +} + +function encodeBasicConsume(channel, fields) { + var len, offset = 0, val = null, bits = 0, varyingSize = 0, scratchOffset = 0; + val = fields.queue; + if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'queue' is the wrong type; must be a string (up to 255 chars)"); + var queue_len = Buffer.byteLength(val, "utf8"); + varyingSize += queue_len; + val = fields.consumerTag; + if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'consumerTag' is the wrong type; must be a string (up to 255 chars)"); + var consumerTag_len = Buffer.byteLength(val, "utf8"); + varyingSize += consumerTag_len; + val = fields.arguments; + if (void 0 === val) val = {}; else if ("object" != typeof val) throw new TypeError("Field 'arguments' is the wrong type; must be an object"); + len = encodeTable(SCRATCH, val, scratchOffset); + var arguments_encoded = SCRATCH.slice(scratchOffset, scratchOffset + len); + scratchOffset += len; + varyingSize += arguments_encoded.length; + var buffer = Buffer.alloc(17 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3932180, 7); + offset = 11; + val = fields.ticket; + if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + val = fields.queue; + void 0 === val && (val = ""); + buffer[offset] = queue_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += queue_len; + val = fields.consumerTag; + void 0 === val && (val = ""); + buffer[offset] = consumerTag_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += consumerTag_len; + val = fields.noLocal; + void 0 === val && (val = !1); + val && (bits += 1); + val = fields.noAck; + void 0 === val && (val = !1); + val && (bits += 2); + val = fields.exclusive; + void 0 === val && (val = !1); + val && (bits += 4); + val = fields.nowait; + void 0 === val && (val = !1); + val && (bits += 8); + buffer[offset] = bits; + offset++; + bits = 0; + offset += arguments_encoded.copy(buffer, offset); + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeBasicConsumeOk(buffer) { + var val, len, offset = 0, fields = { + consumerTag: void 0 + }; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.consumerTag = val; + return fields; +} + +function encodeBasicConsumeOk(channel, fields) { + var offset = 0, val = null, varyingSize = 0; + val = fields.consumerTag; + if (void 0 === val) throw new Error("Missing value for mandatory field 'consumerTag'"); + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'consumerTag' is the wrong type; must be a string (up to 255 chars)"); + var consumerTag_len = Buffer.byteLength(val, "utf8"); + varyingSize += consumerTag_len; + var buffer = Buffer.alloc(13 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3932181, 7); + offset = 11; + val = fields.consumerTag; + void 0 === val && (val = void 0); + buffer[offset] = consumerTag_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += consumerTag_len; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeBasicCancel(buffer) { + var val, len, offset = 0, fields = { + consumerTag: void 0, + nowait: void 0 + }; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.consumerTag = val; + val = !!(1 & buffer[offset]); + fields.nowait = val; + return fields; +} + +function encodeBasicCancel(channel, fields) { + var offset = 0, val = null, bits = 0, varyingSize = 0; + val = fields.consumerTag; + if (void 0 === val) throw new Error("Missing value for mandatory field 'consumerTag'"); + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'consumerTag' is the wrong type; must be a string (up to 255 chars)"); + var consumerTag_len = Buffer.byteLength(val, "utf8"); + varyingSize += consumerTag_len; + var buffer = Buffer.alloc(14 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3932190, 7); + offset = 11; + val = fields.consumerTag; + void 0 === val && (val = void 0); + buffer[offset] = consumerTag_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += consumerTag_len; + val = fields.nowait; + void 0 === val && (val = !1); + val && (bits += 1); + buffer[offset] = bits; + offset++; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeBasicCancelOk(buffer) { + var val, len, offset = 0, fields = { + consumerTag: void 0 + }; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.consumerTag = val; + return fields; +} + +function encodeBasicCancelOk(channel, fields) { + var offset = 0, val = null, varyingSize = 0; + val = fields.consumerTag; + if (void 0 === val) throw new Error("Missing value for mandatory field 'consumerTag'"); + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'consumerTag' is the wrong type; must be a string (up to 255 chars)"); + var consumerTag_len = Buffer.byteLength(val, "utf8"); + varyingSize += consumerTag_len; + var buffer = Buffer.alloc(13 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3932191, 7); + offset = 11; + val = fields.consumerTag; + void 0 === val && (val = void 0); + buffer[offset] = consumerTag_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += consumerTag_len; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeBasicPublish(buffer) { + var val, len, offset = 0, fields = { + ticket: void 0, + exchange: void 0, + routingKey: void 0, + mandatory: void 0, + immediate: void 0 + }; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.ticket = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.exchange = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.routingKey = val; + val = !!(1 & buffer[offset]); + fields.mandatory = val; + val = !!(2 & buffer[offset]); + fields.immediate = val; + return fields; +} + +function encodeBasicPublish(channel, fields) { + var offset = 0, val = null, bits = 0, varyingSize = 0; + val = fields.exchange; + if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'exchange' is the wrong type; must be a string (up to 255 chars)"); + var exchange_len = Buffer.byteLength(val, "utf8"); + varyingSize += exchange_len; + val = fields.routingKey; + if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'routingKey' is the wrong type; must be a string (up to 255 chars)"); + var routingKey_len = Buffer.byteLength(val, "utf8"); + varyingSize += routingKey_len; + var buffer = Buffer.alloc(17 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3932200, 7); + offset = 11; + val = fields.ticket; + if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + val = fields.exchange; + void 0 === val && (val = ""); + buffer[offset] = exchange_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += exchange_len; + val = fields.routingKey; + void 0 === val && (val = ""); + buffer[offset] = routingKey_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += routingKey_len; + val = fields.mandatory; + void 0 === val && (val = !1); + val && (bits += 1); + val = fields.immediate; + void 0 === val && (val = !1); + val && (bits += 2); + buffer[offset] = bits; + offset++; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeBasicReturn(buffer) { + var val, len, offset = 0, fields = { + replyCode: void 0, + replyText: void 0, + exchange: void 0, + routingKey: void 0 + }; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.replyCode = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.replyText = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.exchange = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.routingKey = val; + return fields; +} + +function encodeBasicReturn(channel, fields) { + var offset = 0, val = null, varyingSize = 0; + val = fields.replyText; + if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'replyText' is the wrong type; must be a string (up to 255 chars)"); + var replyText_len = Buffer.byteLength(val, "utf8"); + varyingSize += replyText_len; + val = fields.exchange; + if (void 0 === val) throw new Error("Missing value for mandatory field 'exchange'"); + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'exchange' is the wrong type; must be a string (up to 255 chars)"); + var exchange_len = Buffer.byteLength(val, "utf8"); + varyingSize += exchange_len; + val = fields.routingKey; + if (void 0 === val) throw new Error("Missing value for mandatory field 'routingKey'"); + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'routingKey' is the wrong type; must be a string (up to 255 chars)"); + var routingKey_len = Buffer.byteLength(val, "utf8"); + varyingSize += routingKey_len; + var buffer = Buffer.alloc(17 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3932210, 7); + offset = 11; + val = fields.replyCode; + if (void 0 === val) throw new Error("Missing value for mandatory field 'replyCode'"); + if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'replyCode' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + val = fields.replyText; + void 0 === val && (val = ""); + buffer[offset] = replyText_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += replyText_len; + val = fields.exchange; + void 0 === val && (val = void 0); + buffer[offset] = exchange_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += exchange_len; + val = fields.routingKey; + void 0 === val && (val = void 0); + buffer[offset] = routingKey_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += routingKey_len; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeBasicDeliver(buffer) { + var val, len, offset = 0, fields = { + consumerTag: void 0, + deliveryTag: void 0, + redelivered: void 0, + exchange: void 0, + routingKey: void 0 + }; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.consumerTag = val; + val = ints.readUInt64BE(buffer, offset); + offset += 8; + fields.deliveryTag = val; + val = !!(1 & buffer[offset]); + fields.redelivered = val; + offset++; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.exchange = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.routingKey = val; + return fields; +} + +function encodeBasicDeliver(channel, fields) { + var offset = 0, val = null, bits = 0, varyingSize = 0; + val = fields.consumerTag; + if (void 0 === val) throw new Error("Missing value for mandatory field 'consumerTag'"); + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'consumerTag' is the wrong type; must be a string (up to 255 chars)"); + var consumerTag_len = Buffer.byteLength(val, "utf8"); + varyingSize += consumerTag_len; + val = fields.exchange; + if (void 0 === val) throw new Error("Missing value for mandatory field 'exchange'"); + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'exchange' is the wrong type; must be a string (up to 255 chars)"); + var exchange_len = Buffer.byteLength(val, "utf8"); + varyingSize += exchange_len; + val = fields.routingKey; + if (void 0 === val) throw new Error("Missing value for mandatory field 'routingKey'"); + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'routingKey' is the wrong type; must be a string (up to 255 chars)"); + var routingKey_len = Buffer.byteLength(val, "utf8"); + varyingSize += routingKey_len; + var buffer = Buffer.alloc(24 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3932220, 7); + offset = 11; + val = fields.consumerTag; + void 0 === val && (val = void 0); + buffer[offset] = consumerTag_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += consumerTag_len; + val = fields.deliveryTag; + if (void 0 === val) throw new Error("Missing value for mandatory field 'deliveryTag'"); + if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'deliveryTag' is the wrong type; must be a number (but not NaN)"); + ints.writeUInt64BE(buffer, val, offset); + offset += 8; + val = fields.redelivered; + void 0 === val && (val = !1); + val && (bits += 1); + buffer[offset] = bits; + offset++; + bits = 0; + val = fields.exchange; + void 0 === val && (val = void 0); + buffer[offset] = exchange_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += exchange_len; + val = fields.routingKey; + void 0 === val && (val = void 0); + buffer[offset] = routingKey_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += routingKey_len; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeBasicGet(buffer) { + var val, len, offset = 0, fields = { + ticket: void 0, + queue: void 0, + noAck: void 0 + }; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.ticket = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.queue = val; + val = !!(1 & buffer[offset]); + fields.noAck = val; + return fields; +} + +function encodeBasicGet(channel, fields) { + var offset = 0, val = null, bits = 0, varyingSize = 0; + val = fields.queue; + if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'queue' is the wrong type; must be a string (up to 255 chars)"); + var queue_len = Buffer.byteLength(val, "utf8"); + varyingSize += queue_len; + var buffer = Buffer.alloc(16 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3932230, 7); + offset = 11; + val = fields.ticket; + if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + val = fields.queue; + void 0 === val && (val = ""); + buffer[offset] = queue_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += queue_len; + val = fields.noAck; + void 0 === val && (val = !1); + val && (bits += 1); + buffer[offset] = bits; + offset++; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeBasicGetOk(buffer) { + var val, len, offset = 0, fields = { + deliveryTag: void 0, + redelivered: void 0, + exchange: void 0, + routingKey: void 0, + messageCount: void 0 + }; + val = ints.readUInt64BE(buffer, offset); + offset += 8; + fields.deliveryTag = val; + val = !!(1 & buffer[offset]); + fields.redelivered = val; + offset++; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.exchange = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.routingKey = val; + val = buffer.readUInt32BE(offset); + offset += 4; + fields.messageCount = val; + return fields; +} + +function encodeBasicGetOk(channel, fields) { + var offset = 0, val = null, bits = 0, varyingSize = 0; + val = fields.exchange; + if (void 0 === val) throw new Error("Missing value for mandatory field 'exchange'"); + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'exchange' is the wrong type; must be a string (up to 255 chars)"); + var exchange_len = Buffer.byteLength(val, "utf8"); + varyingSize += exchange_len; + val = fields.routingKey; + if (void 0 === val) throw new Error("Missing value for mandatory field 'routingKey'"); + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'routingKey' is the wrong type; must be a string (up to 255 chars)"); + var routingKey_len = Buffer.byteLength(val, "utf8"); + varyingSize += routingKey_len; + var buffer = Buffer.alloc(27 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3932231, 7); + offset = 11; + val = fields.deliveryTag; + if (void 0 === val) throw new Error("Missing value for mandatory field 'deliveryTag'"); + if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'deliveryTag' is the wrong type; must be a number (but not NaN)"); + ints.writeUInt64BE(buffer, val, offset); + offset += 8; + val = fields.redelivered; + void 0 === val && (val = !1); + val && (bits += 1); + buffer[offset] = bits; + offset++; + bits = 0; + val = fields.exchange; + void 0 === val && (val = void 0); + buffer[offset] = exchange_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += exchange_len; + val = fields.routingKey; + void 0 === val && (val = void 0); + buffer[offset] = routingKey_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += routingKey_len; + val = fields.messageCount; + if (void 0 === val) throw new Error("Missing value for mandatory field 'messageCount'"); + if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'messageCount' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt32BE(val, offset); + offset += 4; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeBasicGetEmpty(buffer) { + var val, len, offset = 0, fields = { + clusterId: void 0 + }; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.clusterId = val; + return fields; +} + +function encodeBasicGetEmpty(channel, fields) { + var offset = 0, val = null, varyingSize = 0; + val = fields.clusterId; + if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'clusterId' is the wrong type; must be a string (up to 255 chars)"); + var clusterId_len = Buffer.byteLength(val, "utf8"); + varyingSize += clusterId_len; + var buffer = Buffer.alloc(13 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3932232, 7); + offset = 11; + val = fields.clusterId; + void 0 === val && (val = ""); + buffer[offset] = clusterId_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += clusterId_len; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeBasicAck(buffer) { + var val, offset = 0, fields = { + deliveryTag: void 0, + multiple: void 0 + }; + val = ints.readUInt64BE(buffer, offset); + offset += 8; + fields.deliveryTag = val; + val = !!(1 & buffer[offset]); + fields.multiple = val; + return fields; +} + +function encodeBasicAck(channel, fields) { + var offset = 0, val = null, bits = 0, buffer = Buffer.alloc(21); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3932240, 7); + offset = 11; + val = fields.deliveryTag; + if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'deliveryTag' is the wrong type; must be a number (but not NaN)"); + ints.writeUInt64BE(buffer, val, offset); + offset += 8; + val = fields.multiple; + void 0 === val && (val = !1); + val && (bits += 1); + buffer[offset] = bits; + offset++; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeBasicReject(buffer) { + var val, offset = 0, fields = { + deliveryTag: void 0, + requeue: void 0 + }; + val = ints.readUInt64BE(buffer, offset); + offset += 8; + fields.deliveryTag = val; + val = !!(1 & buffer[offset]); + fields.requeue = val; + return fields; +} + +function encodeBasicReject(channel, fields) { + var offset = 0, val = null, bits = 0, buffer = Buffer.alloc(21); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3932250, 7); + offset = 11; + val = fields.deliveryTag; + if (void 0 === val) throw new Error("Missing value for mandatory field 'deliveryTag'"); + if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'deliveryTag' is the wrong type; must be a number (but not NaN)"); + ints.writeUInt64BE(buffer, val, offset); + offset += 8; + val = fields.requeue; + void 0 === val && (val = !0); + val && (bits += 1); + buffer[offset] = bits; + offset++; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeBasicRecoverAsync(buffer) { + var val, fields = { + requeue: void 0 + }; + val = !!(1 & buffer[0]); + fields.requeue = val; + return fields; +} + +function encodeBasicRecoverAsync(channel, fields) { + var offset = 0, val = null, bits = 0, buffer = Buffer.alloc(13); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3932260, 7); + offset = 11; + val = fields.requeue; + void 0 === val && (val = !1); + val && (bits += 1); + buffer[offset] = bits; + offset++; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeBasicRecover(buffer) { + var val, fields = { + requeue: void 0 + }; + val = !!(1 & buffer[0]); + fields.requeue = val; + return fields; +} + +function encodeBasicRecover(channel, fields) { + var offset = 0, val = null, bits = 0, buffer = Buffer.alloc(13); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3932270, 7); + offset = 11; + val = fields.requeue; + void 0 === val && (val = !1); + val && (bits += 1); + buffer[offset] = bits; + offset++; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeBasicRecoverOk(buffer) { + return {}; +} + +function encodeBasicRecoverOk(channel, fields) { + var offset = 0, buffer = Buffer.alloc(12); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3932271, 7); + offset = 11; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeBasicNack(buffer) { + var val, offset = 0, fields = { + deliveryTag: void 0, + multiple: void 0, + requeue: void 0 + }; + val = ints.readUInt64BE(buffer, offset); + offset += 8; + fields.deliveryTag = val; + val = !!(1 & buffer[offset]); + fields.multiple = val; + val = !!(2 & buffer[offset]); + fields.requeue = val; + return fields; +} + +function encodeBasicNack(channel, fields) { + var offset = 0, val = null, bits = 0, buffer = Buffer.alloc(21); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3932280, 7); + offset = 11; + val = fields.deliveryTag; + if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'deliveryTag' is the wrong type; must be a number (but not NaN)"); + ints.writeUInt64BE(buffer, val, offset); + offset += 8; + val = fields.multiple; + void 0 === val && (val = !1); + val && (bits += 1); + val = fields.requeue; + void 0 === val && (val = !0); + val && (bits += 2); + buffer[offset] = bits; + offset++; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeConnectionStart(buffer) { + var val, len, offset = 0, fields = { + versionMajor: void 0, + versionMinor: void 0, + serverProperties: void 0, + mechanisms: void 0, + locales: void 0 + }; + val = buffer[offset]; + offset++; + fields.versionMajor = val; + val = buffer[offset]; + offset++; + fields.versionMinor = val; + len = buffer.readUInt32BE(offset); + offset += 4; + val = decodeFields(buffer.subarray(offset, offset + len)); + offset += len; + fields.serverProperties = val; + len = buffer.readUInt32BE(offset); + offset += 4; + val = buffer.subarray(offset, offset + len); + offset += len; + fields.mechanisms = val; + len = buffer.readUInt32BE(offset); + offset += 4; + val = buffer.subarray(offset, offset + len); + offset += len; + fields.locales = val; + return fields; +} + +function encodeConnectionStart(channel, fields) { + var len, offset = 0, val = null, varyingSize = 0, scratchOffset = 0; + val = fields.serverProperties; + if (void 0 === val) throw new Error("Missing value for mandatory field 'serverProperties'"); + if ("object" != typeof val) throw new TypeError("Field 'serverProperties' is the wrong type; must be an object"); + len = encodeTable(SCRATCH, val, scratchOffset); + var serverProperties_encoded = SCRATCH.slice(scratchOffset, scratchOffset + len); + scratchOffset += len; + varyingSize += serverProperties_encoded.length; + val = fields.mechanisms; + if (void 0 === val) val = Buffer.from("PLAIN"); else if (!Buffer.isBuffer(val)) throw new TypeError("Field 'mechanisms' is the wrong type; must be a Buffer"); + varyingSize += val.length; + val = fields.locales; + if (void 0 === val) val = Buffer.from("en_US"); else if (!Buffer.isBuffer(val)) throw new TypeError("Field 'locales' is the wrong type; must be a Buffer"); + varyingSize += val.length; + var buffer = Buffer.alloc(22 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(655370, 7); + offset = 11; + val = fields.versionMajor; + if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'versionMajor' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt8(val, offset); + offset++; + val = fields.versionMinor; + if (void 0 === val) val = 9; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'versionMinor' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt8(val, offset); + offset++; + offset += serverProperties_encoded.copy(buffer, offset); + val = fields.mechanisms; + void 0 === val && (val = Buffer.from("PLAIN")); + len = val.length; + buffer.writeUInt32BE(len, offset); + offset += 4; + val.copy(buffer, offset); + offset += len; + val = fields.locales; + void 0 === val && (val = Buffer.from("en_US")); + len = val.length; + buffer.writeUInt32BE(len, offset); + offset += 4; + val.copy(buffer, offset); + offset += len; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeConnectionStartOk(buffer) { + var val, len, offset = 0, fields = { + clientProperties: void 0, + mechanism: void 0, + response: void 0, + locale: void 0 + }; + len = buffer.readUInt32BE(offset); + offset += 4; + val = decodeFields(buffer.subarray(offset, offset + len)); + offset += len; + fields.clientProperties = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.mechanism = val; + len = buffer.readUInt32BE(offset); + offset += 4; + val = buffer.subarray(offset, offset + len); + offset += len; + fields.response = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.locale = val; + return fields; +} + +function encodeConnectionStartOk(channel, fields) { + var len, offset = 0, val = null, varyingSize = 0, scratchOffset = 0; + val = fields.clientProperties; + if (void 0 === val) throw new Error("Missing value for mandatory field 'clientProperties'"); + if ("object" != typeof val) throw new TypeError("Field 'clientProperties' is the wrong type; must be an object"); + len = encodeTable(SCRATCH, val, scratchOffset); + var clientProperties_encoded = SCRATCH.slice(scratchOffset, scratchOffset + len); + scratchOffset += len; + varyingSize += clientProperties_encoded.length; + val = fields.mechanism; + if (void 0 === val) val = "PLAIN"; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'mechanism' is the wrong type; must be a string (up to 255 chars)"); + var mechanism_len = Buffer.byteLength(val, "utf8"); + varyingSize += mechanism_len; + val = fields.response; + if (void 0 === val) throw new Error("Missing value for mandatory field 'response'"); + if (!Buffer.isBuffer(val)) throw new TypeError("Field 'response' is the wrong type; must be a Buffer"); + varyingSize += val.length; + val = fields.locale; + if (void 0 === val) val = "en_US"; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'locale' is the wrong type; must be a string (up to 255 chars)"); + var locale_len = Buffer.byteLength(val, "utf8"); + varyingSize += locale_len; + var buffer = Buffer.alloc(18 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(655371, 7); + offset = 11; + offset += clientProperties_encoded.copy(buffer, offset); + val = fields.mechanism; + void 0 === val && (val = "PLAIN"); + buffer[offset] = mechanism_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += mechanism_len; + val = fields.response; + void 0 === val && (val = Buffer.from(void 0)); + len = val.length; + buffer.writeUInt32BE(len, offset); + offset += 4; + val.copy(buffer, offset); + offset += len; + val = fields.locale; + void 0 === val && (val = "en_US"); + buffer[offset] = locale_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += locale_len; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeConnectionSecure(buffer) { + var val, len, offset = 0, fields = { + challenge: void 0 + }; + len = buffer.readUInt32BE(offset); + offset += 4; + val = buffer.subarray(offset, offset + len); + offset += len; + fields.challenge = val; + return fields; +} + +function encodeConnectionSecure(channel, fields) { + var len, offset = 0, val = null, varyingSize = 0; + val = fields.challenge; + if (void 0 === val) throw new Error("Missing value for mandatory field 'challenge'"); + if (!Buffer.isBuffer(val)) throw new TypeError("Field 'challenge' is the wrong type; must be a Buffer"); + varyingSize += val.length; + var buffer = Buffer.alloc(16 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(655380, 7); + offset = 11; + val = fields.challenge; + void 0 === val && (val = Buffer.from(void 0)); + len = val.length; + buffer.writeUInt32BE(len, offset); + offset += 4; + val.copy(buffer, offset); + offset += len; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeConnectionSecureOk(buffer) { + var val, len, offset = 0, fields = { + response: void 0 + }; + len = buffer.readUInt32BE(offset); + offset += 4; + val = buffer.subarray(offset, offset + len); + offset += len; + fields.response = val; + return fields; +} + +function encodeConnectionSecureOk(channel, fields) { + var len, offset = 0, val = null, varyingSize = 0; + val = fields.response; + if (void 0 === val) throw new Error("Missing value for mandatory field 'response'"); + if (!Buffer.isBuffer(val)) throw new TypeError("Field 'response' is the wrong type; must be a Buffer"); + varyingSize += val.length; + var buffer = Buffer.alloc(16 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(655381, 7); + offset = 11; + val = fields.response; + void 0 === val && (val = Buffer.from(void 0)); + len = val.length; + buffer.writeUInt32BE(len, offset); + offset += 4; + val.copy(buffer, offset); + offset += len; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeConnectionTune(buffer) { + var val, offset = 0, fields = { + channelMax: void 0, + frameMax: void 0, + heartbeat: void 0 + }; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.channelMax = val; + val = buffer.readUInt32BE(offset); + offset += 4; + fields.frameMax = val; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.heartbeat = val; + return fields; +} + +function encodeConnectionTune(channel, fields) { + var offset = 0, val = null, buffer = Buffer.alloc(20); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(655390, 7); + offset = 11; + val = fields.channelMax; + if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'channelMax' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + val = fields.frameMax; + if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'frameMax' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt32BE(val, offset); + offset += 4; + val = fields.heartbeat; + if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'heartbeat' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeConnectionTuneOk(buffer) { + var val, offset = 0, fields = { + channelMax: void 0, + frameMax: void 0, + heartbeat: void 0 + }; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.channelMax = val; + val = buffer.readUInt32BE(offset); + offset += 4; + fields.frameMax = val; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.heartbeat = val; + return fields; +} + +function encodeConnectionTuneOk(channel, fields) { + var offset = 0, val = null, buffer = Buffer.alloc(20); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(655391, 7); + offset = 11; + val = fields.channelMax; + if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'channelMax' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + val = fields.frameMax; + if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'frameMax' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt32BE(val, offset); + offset += 4; + val = fields.heartbeat; + if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'heartbeat' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeConnectionOpen(buffer) { + var val, len, offset = 0, fields = { + virtualHost: void 0, + capabilities: void 0, + insist: void 0 + }; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.virtualHost = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.capabilities = val; + val = !!(1 & buffer[offset]); + fields.insist = val; + return fields; +} + +function encodeConnectionOpen(channel, fields) { + var offset = 0, val = null, bits = 0, varyingSize = 0; + val = fields.virtualHost; + if (void 0 === val) val = "/"; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'virtualHost' is the wrong type; must be a string (up to 255 chars)"); + var virtualHost_len = Buffer.byteLength(val, "utf8"); + varyingSize += virtualHost_len; + val = fields.capabilities; + if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'capabilities' is the wrong type; must be a string (up to 255 chars)"); + var capabilities_len = Buffer.byteLength(val, "utf8"); + varyingSize += capabilities_len; + var buffer = Buffer.alloc(15 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(655400, 7); + offset = 11; + val = fields.virtualHost; + void 0 === val && (val = "/"); + buffer[offset] = virtualHost_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += virtualHost_len; + val = fields.capabilities; + void 0 === val && (val = ""); + buffer[offset] = capabilities_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += capabilities_len; + val = fields.insist; + void 0 === val && (val = !1); + val && (bits += 1); + buffer[offset] = bits; + offset++; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeConnectionOpenOk(buffer) { + var val, len, offset = 0, fields = { + knownHosts: void 0 + }; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.knownHosts = val; + return fields; +} + +function encodeConnectionOpenOk(channel, fields) { + var offset = 0, val = null, varyingSize = 0; + val = fields.knownHosts; + if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'knownHosts' is the wrong type; must be a string (up to 255 chars)"); + var knownHosts_len = Buffer.byteLength(val, "utf8"); + varyingSize += knownHosts_len; + var buffer = Buffer.alloc(13 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(655401, 7); + offset = 11; + val = fields.knownHosts; + void 0 === val && (val = ""); + buffer[offset] = knownHosts_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += knownHosts_len; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeConnectionClose(buffer) { + var val, len, offset = 0, fields = { + replyCode: void 0, + replyText: void 0, + classId: void 0, + methodId: void 0 + }; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.replyCode = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.replyText = val; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.classId = val; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.methodId = val; + return fields; +} + +function encodeConnectionClose(channel, fields) { + var offset = 0, val = null, varyingSize = 0; + val = fields.replyText; + if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'replyText' is the wrong type; must be a string (up to 255 chars)"); + var replyText_len = Buffer.byteLength(val, "utf8"); + varyingSize += replyText_len; + var buffer = Buffer.alloc(19 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(655410, 7); + offset = 11; + val = fields.replyCode; + if (void 0 === val) throw new Error("Missing value for mandatory field 'replyCode'"); + if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'replyCode' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + val = fields.replyText; + void 0 === val && (val = ""); + buffer[offset] = replyText_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += replyText_len; + val = fields.classId; + if (void 0 === val) throw new Error("Missing value for mandatory field 'classId'"); + if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'classId' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + val = fields.methodId; + if (void 0 === val) throw new Error("Missing value for mandatory field 'methodId'"); + if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'methodId' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeConnectionCloseOk(buffer) { + return {}; +} + +function encodeConnectionCloseOk(channel, fields) { + var offset = 0, buffer = Buffer.alloc(12); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(655411, 7); + offset = 11; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeConnectionBlocked(buffer) { + var val, len, offset = 0, fields = { + reason: void 0 + }; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.reason = val; + return fields; +} + +function encodeConnectionBlocked(channel, fields) { + var offset = 0, val = null, varyingSize = 0; + val = fields.reason; + if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'reason' is the wrong type; must be a string (up to 255 chars)"); + var reason_len = Buffer.byteLength(val, "utf8"); + varyingSize += reason_len; + var buffer = Buffer.alloc(13 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(655420, 7); + offset = 11; + val = fields.reason; + void 0 === val && (val = ""); + buffer[offset] = reason_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += reason_len; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeConnectionUnblocked(buffer) { + return {}; +} + +function encodeConnectionUnblocked(channel, fields) { + var offset = 0, buffer = Buffer.alloc(12); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(655421, 7); + offset = 11; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeConnectionUpdateSecret(buffer) { + var val, len, offset = 0, fields = { + newSecret: void 0, + reason: void 0 + }; + len = buffer.readUInt32BE(offset); + offset += 4; + val = buffer.subarray(offset, offset + len); + offset += len; + fields.newSecret = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.reason = val; + return fields; +} + +function encodeConnectionUpdateSecret(channel, fields) { + var len, offset = 0, val = null, varyingSize = 0; + val = fields.newSecret; + if (void 0 === val) throw new Error("Missing value for mandatory field 'newSecret'"); + if (!Buffer.isBuffer(val)) throw new TypeError("Field 'newSecret' is the wrong type; must be a Buffer"); + varyingSize += val.length; + val = fields.reason; + if (void 0 === val) throw new Error("Missing value for mandatory field 'reason'"); + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'reason' is the wrong type; must be a string (up to 255 chars)"); + var reason_len = Buffer.byteLength(val, "utf8"); + varyingSize += reason_len; + var buffer = Buffer.alloc(17 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(655430, 7); + offset = 11; + val = fields.newSecret; + void 0 === val && (val = Buffer.from(void 0)); + len = val.length; + buffer.writeUInt32BE(len, offset); + offset += 4; + val.copy(buffer, offset); + offset += len; + val = fields.reason; + void 0 === val && (val = void 0); + buffer[offset] = reason_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += reason_len; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeConnectionUpdateSecretOk(buffer) { + return {}; +} + +function encodeConnectionUpdateSecretOk(channel, fields) { + var offset = 0, buffer = Buffer.alloc(12); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(655431, 7); + offset = 11; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeChannelOpen(buffer) { + var val, len, offset = 0, fields = { + outOfBand: void 0 + }; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.outOfBand = val; + return fields; +} + +function encodeChannelOpen(channel, fields) { + var offset = 0, val = null, varyingSize = 0; + val = fields.outOfBand; + if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'outOfBand' is the wrong type; must be a string (up to 255 chars)"); + var outOfBand_len = Buffer.byteLength(val, "utf8"); + varyingSize += outOfBand_len; + var buffer = Buffer.alloc(13 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(1310730, 7); + offset = 11; + val = fields.outOfBand; + void 0 === val && (val = ""); + buffer[offset] = outOfBand_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += outOfBand_len; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeChannelOpenOk(buffer) { + var val, len, offset = 0, fields = { + channelId: void 0 + }; + len = buffer.readUInt32BE(offset); + offset += 4; + val = buffer.subarray(offset, offset + len); + offset += len; + fields.channelId = val; + return fields; +} + +function encodeChannelOpenOk(channel, fields) { + var len, offset = 0, val = null, varyingSize = 0; + val = fields.channelId; + if (void 0 === val) val = Buffer.from(""); else if (!Buffer.isBuffer(val)) throw new TypeError("Field 'channelId' is the wrong type; must be a Buffer"); + varyingSize += val.length; + var buffer = Buffer.alloc(16 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(1310731, 7); + offset = 11; + val = fields.channelId; + void 0 === val && (val = Buffer.from("")); + len = val.length; + buffer.writeUInt32BE(len, offset); + offset += 4; + val.copy(buffer, offset); + offset += len; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeChannelFlow(buffer) { + var val, fields = { + active: void 0 + }; + val = !!(1 & buffer[0]); + fields.active = val; + return fields; +} + +function encodeChannelFlow(channel, fields) { + var offset = 0, val = null, bits = 0, buffer = Buffer.alloc(13); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(1310740, 7); + offset = 11; + val = fields.active; + if (void 0 === val) throw new Error("Missing value for mandatory field 'active'"); + val && (bits += 1); + buffer[offset] = bits; + offset++; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeChannelFlowOk(buffer) { + var val, fields = { + active: void 0 + }; + val = !!(1 & buffer[0]); + fields.active = val; + return fields; +} + +function encodeChannelFlowOk(channel, fields) { + var offset = 0, val = null, bits = 0, buffer = Buffer.alloc(13); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(1310741, 7); + offset = 11; + val = fields.active; + if (void 0 === val) throw new Error("Missing value for mandatory field 'active'"); + val && (bits += 1); + buffer[offset] = bits; + offset++; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeChannelClose(buffer) { + var val, len, offset = 0, fields = { + replyCode: void 0, + replyText: void 0, + classId: void 0, + methodId: void 0 + }; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.replyCode = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.replyText = val; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.classId = val; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.methodId = val; + return fields; +} + +function encodeChannelClose(channel, fields) { + var offset = 0, val = null, varyingSize = 0; + val = fields.replyText; + if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'replyText' is the wrong type; must be a string (up to 255 chars)"); + var replyText_len = Buffer.byteLength(val, "utf8"); + varyingSize += replyText_len; + var buffer = Buffer.alloc(19 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(1310760, 7); + offset = 11; + val = fields.replyCode; + if (void 0 === val) throw new Error("Missing value for mandatory field 'replyCode'"); + if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'replyCode' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + val = fields.replyText; + void 0 === val && (val = ""); + buffer[offset] = replyText_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += replyText_len; + val = fields.classId; + if (void 0 === val) throw new Error("Missing value for mandatory field 'classId'"); + if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'classId' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + val = fields.methodId; + if (void 0 === val) throw new Error("Missing value for mandatory field 'methodId'"); + if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'methodId' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeChannelCloseOk(buffer) { + return {}; +} + +function encodeChannelCloseOk(channel, fields) { + var offset = 0, buffer = Buffer.alloc(12); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(1310761, 7); + offset = 11; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeAccessRequest(buffer) { + var val, len, offset = 0, fields = { + realm: void 0, + exclusive: void 0, + passive: void 0, + active: void 0, + write: void 0, + read: void 0 + }; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.realm = val; + val = !!(1 & buffer[offset]); + fields.exclusive = val; + val = !!(2 & buffer[offset]); + fields.passive = val; + val = !!(4 & buffer[offset]); + fields.active = val; + val = !!(8 & buffer[offset]); + fields.write = val; + val = !!(16 & buffer[offset]); + fields.read = val; + return fields; +} + +function encodeAccessRequest(channel, fields) { + var offset = 0, val = null, bits = 0, varyingSize = 0; + val = fields.realm; + if (void 0 === val) val = "/data"; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'realm' is the wrong type; must be a string (up to 255 chars)"); + var realm_len = Buffer.byteLength(val, "utf8"); + varyingSize += realm_len; + var buffer = Buffer.alloc(14 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(1966090, 7); + offset = 11; + val = fields.realm; + void 0 === val && (val = "/data"); + buffer[offset] = realm_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += realm_len; + val = fields.exclusive; + void 0 === val && (val = !1); + val && (bits += 1); + val = fields.passive; + void 0 === val && (val = !0); + val && (bits += 2); + val = fields.active; + void 0 === val && (val = !0); + val && (bits += 4); + val = fields.write; + void 0 === val && (val = !0); + val && (bits += 8); + val = fields.read; + void 0 === val && (val = !0); + val && (bits += 16); + buffer[offset] = bits; + offset++; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeAccessRequestOk(buffer) { + var val, offset = 0, fields = { + ticket: void 0 + }; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.ticket = val; + return fields; +} + +function encodeAccessRequestOk(channel, fields) { + var offset = 0, val = null, buffer = Buffer.alloc(14); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(1966091, 7); + offset = 11; + val = fields.ticket; + if (void 0 === val) val = 1; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeExchangeDeclare(buffer) { + var val, len, offset = 0, fields = { + ticket: void 0, + exchange: void 0, + type: void 0, + passive: void 0, + durable: void 0, + autoDelete: void 0, + internal: void 0, + nowait: void 0, + arguments: void 0 + }; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.ticket = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.exchange = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.type = val; + val = !!(1 & buffer[offset]); + fields.passive = val; + val = !!(2 & buffer[offset]); + fields.durable = val; + val = !!(4 & buffer[offset]); + fields.autoDelete = val; + val = !!(8 & buffer[offset]); + fields.internal = val; + val = !!(16 & buffer[offset]); + fields.nowait = val; + offset++; + len = buffer.readUInt32BE(offset); + offset += 4; + val = decodeFields(buffer.subarray(offset, offset + len)); + offset += len; + fields.arguments = val; + return fields; +} + +function encodeExchangeDeclare(channel, fields) { + var len, offset = 0, val = null, bits = 0, varyingSize = 0, scratchOffset = 0; + val = fields.exchange; + if (void 0 === val) throw new Error("Missing value for mandatory field 'exchange'"); + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'exchange' is the wrong type; must be a string (up to 255 chars)"); + var exchange_len = Buffer.byteLength(val, "utf8"); + varyingSize += exchange_len; + val = fields.type; + if (void 0 === val) val = "direct"; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'type' is the wrong type; must be a string (up to 255 chars)"); + var type_len = Buffer.byteLength(val, "utf8"); + varyingSize += type_len; + val = fields.arguments; + if (void 0 === val) val = {}; else if ("object" != typeof val) throw new TypeError("Field 'arguments' is the wrong type; must be an object"); + len = encodeTable(SCRATCH, val, scratchOffset); + var arguments_encoded = SCRATCH.slice(scratchOffset, scratchOffset + len); + scratchOffset += len; + varyingSize += arguments_encoded.length; + var buffer = Buffer.alloc(17 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(2621450, 7); + offset = 11; + val = fields.ticket; + if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + val = fields.exchange; + void 0 === val && (val = void 0); + buffer[offset] = exchange_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += exchange_len; + val = fields.type; + void 0 === val && (val = "direct"); + buffer[offset] = type_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += type_len; + val = fields.passive; + void 0 === val && (val = !1); + val && (bits += 1); + val = fields.durable; + void 0 === val && (val = !1); + val && (bits += 2); + val = fields.autoDelete; + void 0 === val && (val = !1); + val && (bits += 4); + val = fields.internal; + void 0 === val && (val = !1); + val && (bits += 8); + val = fields.nowait; + void 0 === val && (val = !1); + val && (bits += 16); + buffer[offset] = bits; + offset++; + bits = 0; + offset += arguments_encoded.copy(buffer, offset); + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeExchangeDeclareOk(buffer) { + return {}; +} + +function encodeExchangeDeclareOk(channel, fields) { + var offset = 0, buffer = Buffer.alloc(12); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(2621451, 7); + offset = 11; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeExchangeDelete(buffer) { + var val, len, offset = 0, fields = { + ticket: void 0, + exchange: void 0, + ifUnused: void 0, + nowait: void 0 + }; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.ticket = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.exchange = val; + val = !!(1 & buffer[offset]); + fields.ifUnused = val; + val = !!(2 & buffer[offset]); + fields.nowait = val; + return fields; +} + +function encodeExchangeDelete(channel, fields) { + var offset = 0, val = null, bits = 0, varyingSize = 0; + val = fields.exchange; + if (void 0 === val) throw new Error("Missing value for mandatory field 'exchange'"); + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'exchange' is the wrong type; must be a string (up to 255 chars)"); + var exchange_len = Buffer.byteLength(val, "utf8"); + varyingSize += exchange_len; + var buffer = Buffer.alloc(16 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(2621460, 7); + offset = 11; + val = fields.ticket; + if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + val = fields.exchange; + void 0 === val && (val = void 0); + buffer[offset] = exchange_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += exchange_len; + val = fields.ifUnused; + void 0 === val && (val = !1); + val && (bits += 1); + val = fields.nowait; + void 0 === val && (val = !1); + val && (bits += 2); + buffer[offset] = bits; + offset++; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeExchangeDeleteOk(buffer) { + return {}; +} + +function encodeExchangeDeleteOk(channel, fields) { + var offset = 0, buffer = Buffer.alloc(12); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(2621461, 7); + offset = 11; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeExchangeBind(buffer) { + var val, len, offset = 0, fields = { + ticket: void 0, + destination: void 0, + source: void 0, + routingKey: void 0, + nowait: void 0, + arguments: void 0 + }; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.ticket = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.destination = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.source = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.routingKey = val; + val = !!(1 & buffer[offset]); + fields.nowait = val; + offset++; + len = buffer.readUInt32BE(offset); + offset += 4; + val = decodeFields(buffer.subarray(offset, offset + len)); + offset += len; + fields.arguments = val; + return fields; +} + +function encodeExchangeBind(channel, fields) { + var len, offset = 0, val = null, bits = 0, varyingSize = 0, scratchOffset = 0; + val = fields.destination; + if (void 0 === val) throw new Error("Missing value for mandatory field 'destination'"); + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'destination' is the wrong type; must be a string (up to 255 chars)"); + var destination_len = Buffer.byteLength(val, "utf8"); + varyingSize += destination_len; + val = fields.source; + if (void 0 === val) throw new Error("Missing value for mandatory field 'source'"); + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'source' is the wrong type; must be a string (up to 255 chars)"); + var source_len = Buffer.byteLength(val, "utf8"); + varyingSize += source_len; + val = fields.routingKey; + if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'routingKey' is the wrong type; must be a string (up to 255 chars)"); + var routingKey_len = Buffer.byteLength(val, "utf8"); + varyingSize += routingKey_len; + val = fields.arguments; + if (void 0 === val) val = {}; else if ("object" != typeof val) throw new TypeError("Field 'arguments' is the wrong type; must be an object"); + len = encodeTable(SCRATCH, val, scratchOffset); + var arguments_encoded = SCRATCH.slice(scratchOffset, scratchOffset + len); + scratchOffset += len; + varyingSize += arguments_encoded.length; + var buffer = Buffer.alloc(18 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(2621470, 7); + offset = 11; + val = fields.ticket; + if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + val = fields.destination; + void 0 === val && (val = void 0); + buffer[offset] = destination_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += destination_len; + val = fields.source; + void 0 === val && (val = void 0); + buffer[offset] = source_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += source_len; + val = fields.routingKey; + void 0 === val && (val = ""); + buffer[offset] = routingKey_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += routingKey_len; + val = fields.nowait; + void 0 === val && (val = !1); + val && (bits += 1); + buffer[offset] = bits; + offset++; + bits = 0; + offset += arguments_encoded.copy(buffer, offset); + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeExchangeBindOk(buffer) { + return {}; +} + +function encodeExchangeBindOk(channel, fields) { + var offset = 0, buffer = Buffer.alloc(12); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(2621471, 7); + offset = 11; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeExchangeUnbind(buffer) { + var val, len, offset = 0, fields = { + ticket: void 0, + destination: void 0, + source: void 0, + routingKey: void 0, + nowait: void 0, + arguments: void 0 + }; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.ticket = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.destination = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.source = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.routingKey = val; + val = !!(1 & buffer[offset]); + fields.nowait = val; + offset++; + len = buffer.readUInt32BE(offset); + offset += 4; + val = decodeFields(buffer.subarray(offset, offset + len)); + offset += len; + fields.arguments = val; + return fields; +} + +function encodeExchangeUnbind(channel, fields) { + var len, offset = 0, val = null, bits = 0, varyingSize = 0, scratchOffset = 0; + val = fields.destination; + if (void 0 === val) throw new Error("Missing value for mandatory field 'destination'"); + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'destination' is the wrong type; must be a string (up to 255 chars)"); + var destination_len = Buffer.byteLength(val, "utf8"); + varyingSize += destination_len; + val = fields.source; + if (void 0 === val) throw new Error("Missing value for mandatory field 'source'"); + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'source' is the wrong type; must be a string (up to 255 chars)"); + var source_len = Buffer.byteLength(val, "utf8"); + varyingSize += source_len; + val = fields.routingKey; + if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'routingKey' is the wrong type; must be a string (up to 255 chars)"); + var routingKey_len = Buffer.byteLength(val, "utf8"); + varyingSize += routingKey_len; + val = fields.arguments; + if (void 0 === val) val = {}; else if ("object" != typeof val) throw new TypeError("Field 'arguments' is the wrong type; must be an object"); + len = encodeTable(SCRATCH, val, scratchOffset); + var arguments_encoded = SCRATCH.slice(scratchOffset, scratchOffset + len); + scratchOffset += len; + varyingSize += arguments_encoded.length; + var buffer = Buffer.alloc(18 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(2621480, 7); + offset = 11; + val = fields.ticket; + if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + val = fields.destination; + void 0 === val && (val = void 0); + buffer[offset] = destination_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += destination_len; + val = fields.source; + void 0 === val && (val = void 0); + buffer[offset] = source_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += source_len; + val = fields.routingKey; + void 0 === val && (val = ""); + buffer[offset] = routingKey_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += routingKey_len; + val = fields.nowait; + void 0 === val && (val = !1); + val && (bits += 1); + buffer[offset] = bits; + offset++; + bits = 0; + offset += arguments_encoded.copy(buffer, offset); + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeExchangeUnbindOk(buffer) { + return {}; +} + +function encodeExchangeUnbindOk(channel, fields) { + var offset = 0, buffer = Buffer.alloc(12); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(2621491, 7); + offset = 11; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeQueueDeclare(buffer) { + var val, len, offset = 0, fields = { + ticket: void 0, + queue: void 0, + passive: void 0, + durable: void 0, + exclusive: void 0, + autoDelete: void 0, + nowait: void 0, + arguments: void 0 + }; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.ticket = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.queue = val; + val = !!(1 & buffer[offset]); + fields.passive = val; + val = !!(2 & buffer[offset]); + fields.durable = val; + val = !!(4 & buffer[offset]); + fields.exclusive = val; + val = !!(8 & buffer[offset]); + fields.autoDelete = val; + val = !!(16 & buffer[offset]); + fields.nowait = val; + offset++; + len = buffer.readUInt32BE(offset); + offset += 4; + val = decodeFields(buffer.subarray(offset, offset + len)); + offset += len; + fields.arguments = val; + return fields; +} + +function encodeQueueDeclare(channel, fields) { + var len, offset = 0, val = null, bits = 0, varyingSize = 0, scratchOffset = 0; + val = fields.queue; + if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'queue' is the wrong type; must be a string (up to 255 chars)"); + var queue_len = Buffer.byteLength(val, "utf8"); + varyingSize += queue_len; + val = fields.arguments; + if (void 0 === val) val = {}; else if ("object" != typeof val) throw new TypeError("Field 'arguments' is the wrong type; must be an object"); + len = encodeTable(SCRATCH, val, scratchOffset); + var arguments_encoded = SCRATCH.slice(scratchOffset, scratchOffset + len); + scratchOffset += len; + varyingSize += arguments_encoded.length; + var buffer = Buffer.alloc(16 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3276810, 7); + offset = 11; + val = fields.ticket; + if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + val = fields.queue; + void 0 === val && (val = ""); + buffer[offset] = queue_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += queue_len; + val = fields.passive; + void 0 === val && (val = !1); + val && (bits += 1); + val = fields.durable; + void 0 === val && (val = !1); + val && (bits += 2); + val = fields.exclusive; + void 0 === val && (val = !1); + val && (bits += 4); + val = fields.autoDelete; + void 0 === val && (val = !1); + val && (bits += 8); + val = fields.nowait; + void 0 === val && (val = !1); + val && (bits += 16); + buffer[offset] = bits; + offset++; + bits = 0; + offset += arguments_encoded.copy(buffer, offset); + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeQueueDeclareOk(buffer) { + var val, len, offset = 0, fields = { + queue: void 0, + messageCount: void 0, + consumerCount: void 0 + }; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.queue = val; + val = buffer.readUInt32BE(offset); + offset += 4; + fields.messageCount = val; + val = buffer.readUInt32BE(offset); + offset += 4; + fields.consumerCount = val; + return fields; +} + +function encodeQueueDeclareOk(channel, fields) { + var offset = 0, val = null, varyingSize = 0; + val = fields.queue; + if (void 0 === val) throw new Error("Missing value for mandatory field 'queue'"); + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'queue' is the wrong type; must be a string (up to 255 chars)"); + var queue_len = Buffer.byteLength(val, "utf8"); + varyingSize += queue_len; + var buffer = Buffer.alloc(21 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3276811, 7); + offset = 11; + val = fields.queue; + void 0 === val && (val = void 0); + buffer[offset] = queue_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += queue_len; + val = fields.messageCount; + if (void 0 === val) throw new Error("Missing value for mandatory field 'messageCount'"); + if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'messageCount' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt32BE(val, offset); + offset += 4; + val = fields.consumerCount; + if (void 0 === val) throw new Error("Missing value for mandatory field 'consumerCount'"); + if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'consumerCount' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt32BE(val, offset); + offset += 4; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeQueueBind(buffer) { + var val, len, offset = 0, fields = { + ticket: void 0, + queue: void 0, + exchange: void 0, + routingKey: void 0, + nowait: void 0, + arguments: void 0 + }; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.ticket = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.queue = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.exchange = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.routingKey = val; + val = !!(1 & buffer[offset]); + fields.nowait = val; + offset++; + len = buffer.readUInt32BE(offset); + offset += 4; + val = decodeFields(buffer.subarray(offset, offset + len)); + offset += len; + fields.arguments = val; + return fields; +} + +function encodeQueueBind(channel, fields) { + var len, offset = 0, val = null, bits = 0, varyingSize = 0, scratchOffset = 0; + val = fields.queue; + if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'queue' is the wrong type; must be a string (up to 255 chars)"); + var queue_len = Buffer.byteLength(val, "utf8"); + varyingSize += queue_len; + val = fields.exchange; + if (void 0 === val) throw new Error("Missing value for mandatory field 'exchange'"); + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'exchange' is the wrong type; must be a string (up to 255 chars)"); + var exchange_len = Buffer.byteLength(val, "utf8"); + varyingSize += exchange_len; + val = fields.routingKey; + if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'routingKey' is the wrong type; must be a string (up to 255 chars)"); + var routingKey_len = Buffer.byteLength(val, "utf8"); + varyingSize += routingKey_len; + val = fields.arguments; + if (void 0 === val) val = {}; else if ("object" != typeof val) throw new TypeError("Field 'arguments' is the wrong type; must be an object"); + len = encodeTable(SCRATCH, val, scratchOffset); + var arguments_encoded = SCRATCH.slice(scratchOffset, scratchOffset + len); + scratchOffset += len; + varyingSize += arguments_encoded.length; + var buffer = Buffer.alloc(18 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3276820, 7); + offset = 11; + val = fields.ticket; + if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + val = fields.queue; + void 0 === val && (val = ""); + buffer[offset] = queue_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += queue_len; + val = fields.exchange; + void 0 === val && (val = void 0); + buffer[offset] = exchange_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += exchange_len; + val = fields.routingKey; + void 0 === val && (val = ""); + buffer[offset] = routingKey_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += routingKey_len; + val = fields.nowait; + void 0 === val && (val = !1); + val && (bits += 1); + buffer[offset] = bits; + offset++; + bits = 0; + offset += arguments_encoded.copy(buffer, offset); + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeQueueBindOk(buffer) { + return {}; +} + +function encodeQueueBindOk(channel, fields) { + var offset = 0, buffer = Buffer.alloc(12); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3276821, 7); + offset = 11; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeQueuePurge(buffer) { + var val, len, offset = 0, fields = { + ticket: void 0, + queue: void 0, + nowait: void 0 + }; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.ticket = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.queue = val; + val = !!(1 & buffer[offset]); + fields.nowait = val; + return fields; +} + +function encodeQueuePurge(channel, fields) { + var offset = 0, val = null, bits = 0, varyingSize = 0; + val = fields.queue; + if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'queue' is the wrong type; must be a string (up to 255 chars)"); + var queue_len = Buffer.byteLength(val, "utf8"); + varyingSize += queue_len; + var buffer = Buffer.alloc(16 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3276830, 7); + offset = 11; + val = fields.ticket; + if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + val = fields.queue; + void 0 === val && (val = ""); + buffer[offset] = queue_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += queue_len; + val = fields.nowait; + void 0 === val && (val = !1); + val && (bits += 1); + buffer[offset] = bits; + offset++; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeQueuePurgeOk(buffer) { + var val, offset = 0, fields = { + messageCount: void 0 + }; + val = buffer.readUInt32BE(offset); + offset += 4; + fields.messageCount = val; + return fields; +} + +function encodeQueuePurgeOk(channel, fields) { + var offset = 0, val = null, buffer = Buffer.alloc(16); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3276831, 7); + offset = 11; + val = fields.messageCount; + if (void 0 === val) throw new Error("Missing value for mandatory field 'messageCount'"); + if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'messageCount' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt32BE(val, offset); + offset += 4; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeQueueDelete(buffer) { + var val, len, offset = 0, fields = { + ticket: void 0, + queue: void 0, + ifUnused: void 0, + ifEmpty: void 0, + nowait: void 0 + }; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.ticket = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.queue = val; + val = !!(1 & buffer[offset]); + fields.ifUnused = val; + val = !!(2 & buffer[offset]); + fields.ifEmpty = val; + val = !!(4 & buffer[offset]); + fields.nowait = val; + return fields; +} + +function encodeQueueDelete(channel, fields) { + var offset = 0, val = null, bits = 0, varyingSize = 0; + val = fields.queue; + if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'queue' is the wrong type; must be a string (up to 255 chars)"); + var queue_len = Buffer.byteLength(val, "utf8"); + varyingSize += queue_len; + var buffer = Buffer.alloc(16 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3276840, 7); + offset = 11; + val = fields.ticket; + if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + val = fields.queue; + void 0 === val && (val = ""); + buffer[offset] = queue_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += queue_len; + val = fields.ifUnused; + void 0 === val && (val = !1); + val && (bits += 1); + val = fields.ifEmpty; + void 0 === val && (val = !1); + val && (bits += 2); + val = fields.nowait; + void 0 === val && (val = !1); + val && (bits += 4); + buffer[offset] = bits; + offset++; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeQueueDeleteOk(buffer) { + var val, offset = 0, fields = { + messageCount: void 0 + }; + val = buffer.readUInt32BE(offset); + offset += 4; + fields.messageCount = val; + return fields; +} + +function encodeQueueDeleteOk(channel, fields) { + var offset = 0, val = null, buffer = Buffer.alloc(16); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3276841, 7); + offset = 11; + val = fields.messageCount; + if (void 0 === val) throw new Error("Missing value for mandatory field 'messageCount'"); + if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'messageCount' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt32BE(val, offset); + offset += 4; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeQueueUnbind(buffer) { + var val, len, offset = 0, fields = { + ticket: void 0, + queue: void 0, + exchange: void 0, + routingKey: void 0, + arguments: void 0 + }; + val = buffer.readUInt16BE(offset); + offset += 2; + fields.ticket = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.queue = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.exchange = val; + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.routingKey = val; + len = buffer.readUInt32BE(offset); + offset += 4; + val = decodeFields(buffer.subarray(offset, offset + len)); + offset += len; + fields.arguments = val; + return fields; +} + +function encodeQueueUnbind(channel, fields) { + var len, offset = 0, val = null, varyingSize = 0, scratchOffset = 0; + val = fields.queue; + if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'queue' is the wrong type; must be a string (up to 255 chars)"); + var queue_len = Buffer.byteLength(val, "utf8"); + varyingSize += queue_len; + val = fields.exchange; + if (void 0 === val) throw new Error("Missing value for mandatory field 'exchange'"); + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'exchange' is the wrong type; must be a string (up to 255 chars)"); + var exchange_len = Buffer.byteLength(val, "utf8"); + varyingSize += exchange_len; + val = fields.routingKey; + if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'routingKey' is the wrong type; must be a string (up to 255 chars)"); + var routingKey_len = Buffer.byteLength(val, "utf8"); + varyingSize += routingKey_len; + val = fields.arguments; + if (void 0 === val) val = {}; else if ("object" != typeof val) throw new TypeError("Field 'arguments' is the wrong type; must be an object"); + len = encodeTable(SCRATCH, val, scratchOffset); + var arguments_encoded = SCRATCH.slice(scratchOffset, scratchOffset + len); + scratchOffset += len; + varyingSize += arguments_encoded.length; + var buffer = Buffer.alloc(17 + varyingSize); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3276850, 7); + offset = 11; + val = fields.ticket; + if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)"); + buffer.writeUInt16BE(val, offset); + offset += 2; + val = fields.queue; + void 0 === val && (val = ""); + buffer[offset] = queue_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += queue_len; + val = fields.exchange; + void 0 === val && (val = void 0); + buffer[offset] = exchange_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += exchange_len; + val = fields.routingKey; + void 0 === val && (val = ""); + buffer[offset] = routingKey_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += routingKey_len; + offset += arguments_encoded.copy(buffer, offset); + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeQueueUnbindOk(buffer) { + return {}; +} + +function encodeQueueUnbindOk(channel, fields) { + var offset = 0, buffer = Buffer.alloc(12); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3276851, 7); + offset = 11; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeTxSelect(buffer) { + return {}; +} + +function encodeTxSelect(channel, fields) { + var offset = 0, buffer = Buffer.alloc(12); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(5898250, 7); + offset = 11; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeTxSelectOk(buffer) { + return {}; +} + +function encodeTxSelectOk(channel, fields) { + var offset = 0, buffer = Buffer.alloc(12); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(5898251, 7); + offset = 11; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeTxCommit(buffer) { + return {}; +} + +function encodeTxCommit(channel, fields) { + var offset = 0, buffer = Buffer.alloc(12); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(5898260, 7); + offset = 11; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeTxCommitOk(buffer) { + return {}; +} + +function encodeTxCommitOk(channel, fields) { + var offset = 0, buffer = Buffer.alloc(12); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(5898261, 7); + offset = 11; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeTxRollback(buffer) { + return {}; +} + +function encodeTxRollback(channel, fields) { + var offset = 0, buffer = Buffer.alloc(12); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(5898270, 7); + offset = 11; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeTxRollbackOk(buffer) { + return {}; +} + +function encodeTxRollbackOk(channel, fields) { + var offset = 0, buffer = Buffer.alloc(12); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(5898271, 7); + offset = 11; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeConfirmSelect(buffer) { + var val, fields = { + nowait: void 0 + }; + val = !!(1 & buffer[0]); + fields.nowait = val; + return fields; +} + +function encodeConfirmSelect(channel, fields) { + var offset = 0, val = null, bits = 0, buffer = Buffer.alloc(13); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(5570570, 7); + offset = 11; + val = fields.nowait; + void 0 === val && (val = !1); + val && (bits += 1); + buffer[offset] = bits; + offset++; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function decodeConfirmSelectOk(buffer) { + return {}; +} + +function encodeConfirmSelectOk(channel, fields) { + var offset = 0, buffer = Buffer.alloc(12); + buffer[0] = 1; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(5570571, 7); + offset = 11; + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + return buffer; +} + +function encodeBasicProperties(channel, size, fields) { + var val, len, offset = 0, flags = 0, scratchOffset = 0, varyingSize = 0; + val = fields.contentType; + if (void 0 != val) { + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'contentType' is the wrong type; must be a string (up to 255 chars)"); + var contentType_len = Buffer.byteLength(val, "utf8"); + varyingSize += 1; + varyingSize += contentType_len; + } + val = fields.contentEncoding; + if (void 0 != val) { + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'contentEncoding' is the wrong type; must be a string (up to 255 chars)"); + var contentEncoding_len = Buffer.byteLength(val, "utf8"); + varyingSize += 1; + varyingSize += contentEncoding_len; + } + val = fields.headers; + if (void 0 != val) { + if ("object" != typeof val) throw new TypeError("Field 'headers' is the wrong type; must be an object"); + len = encodeTable(SCRATCH, val, scratchOffset); + var headers_encoded = SCRATCH.slice(scratchOffset, scratchOffset + len); + scratchOffset += len; + varyingSize += headers_encoded.length; + } + val = fields.deliveryMode; + if (void 0 != val) { + if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'deliveryMode' is the wrong type; must be a number (but not NaN)"); + varyingSize += 1; + } + val = fields.priority; + if (void 0 != val) { + if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'priority' is the wrong type; must be a number (but not NaN)"); + varyingSize += 1; + } + val = fields.correlationId; + if (void 0 != val) { + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'correlationId' is the wrong type; must be a string (up to 255 chars)"); + var correlationId_len = Buffer.byteLength(val, "utf8"); + varyingSize += 1; + varyingSize += correlationId_len; + } + val = fields.replyTo; + if (void 0 != val) { + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'replyTo' is the wrong type; must be a string (up to 255 chars)"); + var replyTo_len = Buffer.byteLength(val, "utf8"); + varyingSize += 1; + varyingSize += replyTo_len; + } + val = fields.expiration; + if (void 0 != val) { + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'expiration' is the wrong type; must be a string (up to 255 chars)"); + var expiration_len = Buffer.byteLength(val, "utf8"); + varyingSize += 1; + varyingSize += expiration_len; + } + val = fields.messageId; + if (void 0 != val) { + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'messageId' is the wrong type; must be a string (up to 255 chars)"); + var messageId_len = Buffer.byteLength(val, "utf8"); + varyingSize += 1; + varyingSize += messageId_len; + } + val = fields.timestamp; + if (void 0 != val) { + if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'timestamp' is the wrong type; must be a number (but not NaN)"); + varyingSize += 8; + } + val = fields.type; + if (void 0 != val) { + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'type' is the wrong type; must be a string (up to 255 chars)"); + var type_len = Buffer.byteLength(val, "utf8"); + varyingSize += 1; + varyingSize += type_len; + } + val = fields.userId; + if (void 0 != val) { + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'userId' is the wrong type; must be a string (up to 255 chars)"); + var userId_len = Buffer.byteLength(val, "utf8"); + varyingSize += 1; + varyingSize += userId_len; + } + val = fields.appId; + if (void 0 != val) { + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'appId' is the wrong type; must be a string (up to 255 chars)"); + var appId_len = Buffer.byteLength(val, "utf8"); + varyingSize += 1; + varyingSize += appId_len; + } + val = fields.clusterId; + if (void 0 != val) { + if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'clusterId' is the wrong type; must be a string (up to 255 chars)"); + var clusterId_len = Buffer.byteLength(val, "utf8"); + varyingSize += 1; + varyingSize += clusterId_len; + } + var buffer = Buffer.alloc(22 + varyingSize); + buffer[0] = 2; + buffer.writeUInt16BE(channel, 1); + buffer.writeUInt32BE(3932160, 7); + ints.writeUInt64BE(buffer, size, 11); + flags = 0; + offset = 21; + val = fields.contentType; + if (void 0 != val) { + flags += 32768; + buffer[offset] = contentType_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += contentType_len; + } + val = fields.contentEncoding; + if (void 0 != val) { + flags += 16384; + buffer[offset] = contentEncoding_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += contentEncoding_len; + } + val = fields.headers; + if (void 0 != val) { + flags += 8192; + offset += headers_encoded.copy(buffer, offset); + } + val = fields.deliveryMode; + if (void 0 != val) { + flags += 4096; + buffer.writeUInt8(val, offset); + offset++; + } + val = fields.priority; + if (void 0 != val) { + flags += 2048; + buffer.writeUInt8(val, offset); + offset++; + } + val = fields.correlationId; + if (void 0 != val) { + flags += 1024; + buffer[offset] = correlationId_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += correlationId_len; + } + val = fields.replyTo; + if (void 0 != val) { + flags += 512; + buffer[offset] = replyTo_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += replyTo_len; + } + val = fields.expiration; + if (void 0 != val) { + flags += 256; + buffer[offset] = expiration_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += expiration_len; + } + val = fields.messageId; + if (void 0 != val) { + flags += 128; + buffer[offset] = messageId_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += messageId_len; + } + val = fields.timestamp; + if (void 0 != val) { + flags += 64; + ints.writeUInt64BE(buffer, val, offset); + offset += 8; + } + val = fields.type; + if (void 0 != val) { + flags += 32; + buffer[offset] = type_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += type_len; + } + val = fields.userId; + if (void 0 != val) { + flags += 16; + buffer[offset] = userId_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += userId_len; + } + val = fields.appId; + if (void 0 != val) { + flags += 8; + buffer[offset] = appId_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += appId_len; + } + val = fields.clusterId; + if (void 0 != val) { + flags += 4; + buffer[offset] = clusterId_len; + offset++; + buffer.write(val, offset, "utf8"); + offset += clusterId_len; + } + buffer[offset] = 206; + buffer.writeUInt32BE(offset - 7, 3); + buffer.writeUInt16BE(flags, 19); + return buffer.subarray(0, offset + 1); +} + +function decodeBasicProperties(buffer) { + var flags, val, len, offset = 2; + flags = buffer.readUInt16BE(0); + if (0 === flags) return {}; + var fields = { + contentType: void 0, + contentEncoding: void 0, + headers: void 0, + deliveryMode: void 0, + priority: void 0, + correlationId: void 0, + replyTo: void 0, + expiration: void 0, + messageId: void 0, + timestamp: void 0, + type: void 0, + userId: void 0, + appId: void 0, + clusterId: void 0 + }; + if (32768 & flags) { + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.contentType = val; + } + if (16384 & flags) { + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.contentEncoding = val; + } + if (8192 & flags) { + len = buffer.readUInt32BE(offset); + offset += 4; + val = decodeFields(buffer.subarray(offset, offset + len)); + offset += len; + fields.headers = val; + } + if (4096 & flags) { + val = buffer[offset]; + offset++; + fields.deliveryMode = val; + } + if (2048 & flags) { + val = buffer[offset]; + offset++; + fields.priority = val; + } + if (1024 & flags) { + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.correlationId = val; + } + if (512 & flags) { + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.replyTo = val; + } + if (256 & flags) { + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.expiration = val; + } + if (128 & flags) { + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.messageId = val; + } + if (64 & flags) { + val = ints.readUInt64BE(buffer, offset); + offset += 8; + fields.timestamp = val; + } + if (32 & flags) { + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.type = val; + } + if (16 & flags) { + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.userId = val; + } + if (8 & flags) { + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.appId = val; + } + if (4 & flags) { + len = buffer.readUInt8(offset); + offset++; + val = buffer.toString("utf8", offset, offset + len); + offset += len; + fields.clusterId = val; + } + return fields; +} + +var codec = require("./codec"), ints = require("buffer-more-ints"), encodeTable = codec.encodeTable, decodeFields = codec.decodeFields, SCRATCH = Buffer.alloc(65536), EMPTY_OBJECT = Object.freeze({}); + +module.exports.constants = { + FRAME_METHOD: 1, + FRAME_HEADER: 2, + FRAME_BODY: 3, + FRAME_HEARTBEAT: 8, + FRAME_MIN_SIZE: 4096, + FRAME_END: 206, + REPLY_SUCCESS: 200, + CONTENT_TOO_LARGE: 311, + NO_ROUTE: 312, + NO_CONSUMERS: 313, + ACCESS_REFUSED: 403, + NOT_FOUND: 404, + RESOURCE_LOCKED: 405, + PRECONDITION_FAILED: 406, + CONNECTION_FORCED: 320, + INVALID_PATH: 402, + FRAME_ERROR: 501, + SYNTAX_ERROR: 502, + COMMAND_INVALID: 503, + CHANNEL_ERROR: 504, + UNEXPECTED_FRAME: 505, + RESOURCE_ERROR: 506, + NOT_ALLOWED: 530, + NOT_IMPLEMENTED: 540, + INTERNAL_ERROR: 541 +}; + +module.exports.constant_strs = { + "1": "FRAME-METHOD", + "2": "FRAME-HEADER", + "3": "FRAME-BODY", + "8": "FRAME-HEARTBEAT", + "200": "REPLY-SUCCESS", + "206": "FRAME-END", + "311": "CONTENT-TOO-LARGE", + "312": "NO-ROUTE", + "313": "NO-CONSUMERS", + "320": "CONNECTION-FORCED", + "402": "INVALID-PATH", + "403": "ACCESS-REFUSED", + "404": "NOT-FOUND", + "405": "RESOURCE-LOCKED", + "406": "PRECONDITION-FAILED", + "501": "FRAME-ERROR", + "502": "SYNTAX-ERROR", + "503": "COMMAND-INVALID", + "504": "CHANNEL-ERROR", + "505": "UNEXPECTED-FRAME", + "506": "RESOURCE-ERROR", + "530": "NOT-ALLOWED", + "540": "NOT-IMPLEMENTED", + "541": "INTERNAL-ERROR", + "4096": "FRAME-MIN-SIZE" +}; + +module.exports.FRAME_OVERHEAD = 8; + +module.exports.decode = function(id, buf) { + switch (id) { + case 3932170: + return decodeBasicQos(buf); + + case 3932171: + return decodeBasicQosOk(buf); + + case 3932180: + return decodeBasicConsume(buf); + + case 3932181: + return decodeBasicConsumeOk(buf); + + case 3932190: + return decodeBasicCancel(buf); + + case 3932191: + return decodeBasicCancelOk(buf); + + case 3932200: + return decodeBasicPublish(buf); + + case 3932210: + return decodeBasicReturn(buf); + + case 3932220: + return decodeBasicDeliver(buf); + + case 3932230: + return decodeBasicGet(buf); + + case 3932231: + return decodeBasicGetOk(buf); + + case 3932232: + return decodeBasicGetEmpty(buf); + + case 3932240: + return decodeBasicAck(buf); + + case 3932250: + return decodeBasicReject(buf); + + case 3932260: + return decodeBasicRecoverAsync(buf); + + case 3932270: + return decodeBasicRecover(buf); + + case 3932271: + return decodeBasicRecoverOk(buf); + + case 3932280: + return decodeBasicNack(buf); + + case 655370: + return decodeConnectionStart(buf); + + case 655371: + return decodeConnectionStartOk(buf); + + case 655380: + return decodeConnectionSecure(buf); + + case 655381: + return decodeConnectionSecureOk(buf); + + case 655390: + return decodeConnectionTune(buf); + + case 655391: + return decodeConnectionTuneOk(buf); + + case 655400: + return decodeConnectionOpen(buf); + + case 655401: + return decodeConnectionOpenOk(buf); + + case 655410: + return decodeConnectionClose(buf); + + case 655411: + return decodeConnectionCloseOk(buf); + + case 655420: + return decodeConnectionBlocked(buf); + + case 655421: + return decodeConnectionUnblocked(buf); + + case 655430: + return decodeConnectionUpdateSecret(buf); + + case 655431: + return decodeConnectionUpdateSecretOk(buf); + + case 1310730: + return decodeChannelOpen(buf); + + case 1310731: + return decodeChannelOpenOk(buf); + + case 1310740: + return decodeChannelFlow(buf); + + case 1310741: + return decodeChannelFlowOk(buf); + + case 1310760: + return decodeChannelClose(buf); + + case 1310761: + return decodeChannelCloseOk(buf); + + case 1966090: + return decodeAccessRequest(buf); + + case 1966091: + return decodeAccessRequestOk(buf); + + case 2621450: + return decodeExchangeDeclare(buf); + + case 2621451: + return decodeExchangeDeclareOk(buf); + + case 2621460: + return decodeExchangeDelete(buf); + + case 2621461: + return decodeExchangeDeleteOk(buf); + + case 2621470: + return decodeExchangeBind(buf); + + case 2621471: + return decodeExchangeBindOk(buf); + + case 2621480: + return decodeExchangeUnbind(buf); + + case 2621491: + return decodeExchangeUnbindOk(buf); + + case 3276810: + return decodeQueueDeclare(buf); + + case 3276811: + return decodeQueueDeclareOk(buf); + + case 3276820: + return decodeQueueBind(buf); + + case 3276821: + return decodeQueueBindOk(buf); + + case 3276830: + return decodeQueuePurge(buf); + + case 3276831: + return decodeQueuePurgeOk(buf); + + case 3276840: + return decodeQueueDelete(buf); + + case 3276841: + return decodeQueueDeleteOk(buf); + + case 3276850: + return decodeQueueUnbind(buf); + + case 3276851: + return decodeQueueUnbindOk(buf); + + case 5898250: + return decodeTxSelect(buf); + + case 5898251: + return decodeTxSelectOk(buf); + + case 5898260: + return decodeTxCommit(buf); + + case 5898261: + return decodeTxCommitOk(buf); + + case 5898270: + return decodeTxRollback(buf); + + case 5898271: + return decodeTxRollbackOk(buf); + + case 5570570: + return decodeConfirmSelect(buf); + + case 5570571: + return decodeConfirmSelectOk(buf); + + case 60: + return decodeBasicProperties(buf); + + default: + throw new Error("Unknown class/method ID"); + } +}; + +module.exports.encodeMethod = function(id, channel, fields) { + switch (id) { + case 3932170: + return encodeBasicQos(channel, fields); + + case 3932171: + return encodeBasicQosOk(channel, fields); + + case 3932180: + return encodeBasicConsume(channel, fields); + + case 3932181: + return encodeBasicConsumeOk(channel, fields); + + case 3932190: + return encodeBasicCancel(channel, fields); + + case 3932191: + return encodeBasicCancelOk(channel, fields); + + case 3932200: + return encodeBasicPublish(channel, fields); + + case 3932210: + return encodeBasicReturn(channel, fields); + + case 3932220: + return encodeBasicDeliver(channel, fields); + + case 3932230: + return encodeBasicGet(channel, fields); + + case 3932231: + return encodeBasicGetOk(channel, fields); + + case 3932232: + return encodeBasicGetEmpty(channel, fields); + + case 3932240: + return encodeBasicAck(channel, fields); + + case 3932250: + return encodeBasicReject(channel, fields); + + case 3932260: + return encodeBasicRecoverAsync(channel, fields); + + case 3932270: + return encodeBasicRecover(channel, fields); + + case 3932271: + return encodeBasicRecoverOk(channel, fields); + + case 3932280: + return encodeBasicNack(channel, fields); + + case 655370: + return encodeConnectionStart(channel, fields); + + case 655371: + return encodeConnectionStartOk(channel, fields); + + case 655380: + return encodeConnectionSecure(channel, fields); + + case 655381: + return encodeConnectionSecureOk(channel, fields); + + case 655390: + return encodeConnectionTune(channel, fields); + + case 655391: + return encodeConnectionTuneOk(channel, fields); + + case 655400: + return encodeConnectionOpen(channel, fields); + + case 655401: + return encodeConnectionOpenOk(channel, fields); + + case 655410: + return encodeConnectionClose(channel, fields); + + case 655411: + return encodeConnectionCloseOk(channel, fields); + + case 655420: + return encodeConnectionBlocked(channel, fields); + + case 655421: + return encodeConnectionUnblocked(channel, fields); + + case 655430: + return encodeConnectionUpdateSecret(channel, fields); + + case 655431: + return encodeConnectionUpdateSecretOk(channel, fields); + + case 1310730: + return encodeChannelOpen(channel, fields); + + case 1310731: + return encodeChannelOpenOk(channel, fields); + + case 1310740: + return encodeChannelFlow(channel, fields); + + case 1310741: + return encodeChannelFlowOk(channel, fields); + + case 1310760: + return encodeChannelClose(channel, fields); + + case 1310761: + return encodeChannelCloseOk(channel, fields); + + case 1966090: + return encodeAccessRequest(channel, fields); + + case 1966091: + return encodeAccessRequestOk(channel, fields); + + case 2621450: + return encodeExchangeDeclare(channel, fields); + + case 2621451: + return encodeExchangeDeclareOk(channel, fields); + + case 2621460: + return encodeExchangeDelete(channel, fields); + + case 2621461: + return encodeExchangeDeleteOk(channel, fields); + + case 2621470: + return encodeExchangeBind(channel, fields); + + case 2621471: + return encodeExchangeBindOk(channel, fields); + + case 2621480: + return encodeExchangeUnbind(channel, fields); + + case 2621491: + return encodeExchangeUnbindOk(channel, fields); + + case 3276810: + return encodeQueueDeclare(channel, fields); + + case 3276811: + return encodeQueueDeclareOk(channel, fields); + + case 3276820: + return encodeQueueBind(channel, fields); + + case 3276821: + return encodeQueueBindOk(channel, fields); + + case 3276830: + return encodeQueuePurge(channel, fields); + + case 3276831: + return encodeQueuePurgeOk(channel, fields); + + case 3276840: + return encodeQueueDelete(channel, fields); + + case 3276841: + return encodeQueueDeleteOk(channel, fields); + + case 3276850: + return encodeQueueUnbind(channel, fields); + + case 3276851: + return encodeQueueUnbindOk(channel, fields); + + case 5898250: + return encodeTxSelect(channel, fields); + + case 5898251: + return encodeTxSelectOk(channel, fields); + + case 5898260: + return encodeTxCommit(channel, fields); + + case 5898261: + return encodeTxCommitOk(channel, fields); + + case 5898270: + return encodeTxRollback(channel, fields); + + case 5898271: + return encodeTxRollbackOk(channel, fields); + + case 5570570: + return encodeConfirmSelect(channel, fields); + + case 5570571: + return encodeConfirmSelectOk(channel, fields); + + default: + throw new Error("Unknown class/method ID"); + } +}; + +module.exports.encodeProperties = function(id, channel, size, fields) { + switch (id) { + case 60: + return encodeBasicProperties(channel, size, fields); + + default: + throw new Error("Unknown class/properties ID"); + } +}; + +module.exports.info = function(id) { + switch (id) { + case 3932170: + return methodInfoBasicQos; + + case 3932171: + return methodInfoBasicQosOk; + + case 3932180: + return methodInfoBasicConsume; + + case 3932181: + return methodInfoBasicConsumeOk; + + case 3932190: + return methodInfoBasicCancel; + + case 3932191: + return methodInfoBasicCancelOk; + + case 3932200: + return methodInfoBasicPublish; + + case 3932210: + return methodInfoBasicReturn; + + case 3932220: + return methodInfoBasicDeliver; + + case 3932230: + return methodInfoBasicGet; + + case 3932231: + return methodInfoBasicGetOk; + + case 3932232: + return methodInfoBasicGetEmpty; + + case 3932240: + return methodInfoBasicAck; + + case 3932250: + return methodInfoBasicReject; + + case 3932260: + return methodInfoBasicRecoverAsync; + + case 3932270: + return methodInfoBasicRecover; + + case 3932271: + return methodInfoBasicRecoverOk; + + case 3932280: + return methodInfoBasicNack; + + case 655370: + return methodInfoConnectionStart; + + case 655371: + return methodInfoConnectionStartOk; + + case 655380: + return methodInfoConnectionSecure; + + case 655381: + return methodInfoConnectionSecureOk; + + case 655390: + return methodInfoConnectionTune; + + case 655391: + return methodInfoConnectionTuneOk; + + case 655400: + return methodInfoConnectionOpen; + + case 655401: + return methodInfoConnectionOpenOk; + + case 655410: + return methodInfoConnectionClose; + + case 655411: + return methodInfoConnectionCloseOk; + + case 655420: + return methodInfoConnectionBlocked; + + case 655421: + return methodInfoConnectionUnblocked; + + case 655430: + return methodInfoConnectionUpdateSecret; + + case 655431: + return methodInfoConnectionUpdateSecretOk; + + case 1310730: + return methodInfoChannelOpen; + + case 1310731: + return methodInfoChannelOpenOk; + + case 1310740: + return methodInfoChannelFlow; + + case 1310741: + return methodInfoChannelFlowOk; + + case 1310760: + return methodInfoChannelClose; + + case 1310761: + return methodInfoChannelCloseOk; + + case 1966090: + return methodInfoAccessRequest; + + case 1966091: + return methodInfoAccessRequestOk; + + case 2621450: + return methodInfoExchangeDeclare; + + case 2621451: + return methodInfoExchangeDeclareOk; + + case 2621460: + return methodInfoExchangeDelete; + + case 2621461: + return methodInfoExchangeDeleteOk; + + case 2621470: + return methodInfoExchangeBind; + + case 2621471: + return methodInfoExchangeBindOk; + + case 2621480: + return methodInfoExchangeUnbind; + + case 2621491: + return methodInfoExchangeUnbindOk; + + case 3276810: + return methodInfoQueueDeclare; + + case 3276811: + return methodInfoQueueDeclareOk; + + case 3276820: + return methodInfoQueueBind; + + case 3276821: + return methodInfoQueueBindOk; + + case 3276830: + return methodInfoQueuePurge; + + case 3276831: + return methodInfoQueuePurgeOk; + + case 3276840: + return methodInfoQueueDelete; + + case 3276841: + return methodInfoQueueDeleteOk; + + case 3276850: + return methodInfoQueueUnbind; + + case 3276851: + return methodInfoQueueUnbindOk; + + case 5898250: + return methodInfoTxSelect; + + case 5898251: + return methodInfoTxSelectOk; + + case 5898260: + return methodInfoTxCommit; + + case 5898261: + return methodInfoTxCommitOk; + + case 5898270: + return methodInfoTxRollback; + + case 5898271: + return methodInfoTxRollbackOk; + + case 5570570: + return methodInfoConfirmSelect; + + case 5570571: + return methodInfoConfirmSelectOk; + + case 60: + return propertiesInfoBasicProperties; + + default: + throw new Error("Unknown class/method ID"); + } +}; + +module.exports.BasicQos = 3932170; + +var methodInfoBasicQos = module.exports.methodInfoBasicQos = { + id: 3932170, + classId: 60, + methodId: 10, + name: "BasicQos", + args: [ { + type: "long", + name: "prefetchSize", + default: 0 + }, { + type: "short", + name: "prefetchCount", + default: 0 + }, { + type: "bit", + name: "global", + default: !1 + } ] +}; + +module.exports.BasicQosOk = 3932171; + +var methodInfoBasicQosOk = module.exports.methodInfoBasicQosOk = { + id: 3932171, + classId: 60, + methodId: 11, + name: "BasicQosOk", + args: [] +}; + +module.exports.BasicConsume = 3932180; + +var methodInfoBasicConsume = module.exports.methodInfoBasicConsume = { + id: 3932180, + classId: 60, + methodId: 20, + name: "BasicConsume", + args: [ { + type: "short", + name: "ticket", + default: 0 + }, { + type: "shortstr", + name: "queue", + default: "" + }, { + type: "shortstr", + name: "consumerTag", + default: "" + }, { + type: "bit", + name: "noLocal", + default: !1 + }, { + type: "bit", + name: "noAck", + default: !1 + }, { + type: "bit", + name: "exclusive", + default: !1 + }, { + type: "bit", + name: "nowait", + default: !1 + }, { + type: "table", + name: "arguments", + default: {} + } ] +}; + +module.exports.BasicConsumeOk = 3932181; + +var methodInfoBasicConsumeOk = module.exports.methodInfoBasicConsumeOk = { + id: 3932181, + classId: 60, + methodId: 21, + name: "BasicConsumeOk", + args: [ { + type: "shortstr", + name: "consumerTag" + } ] +}; + +module.exports.BasicCancel = 3932190; + +var methodInfoBasicCancel = module.exports.methodInfoBasicCancel = { + id: 3932190, + classId: 60, + methodId: 30, + name: "BasicCancel", + args: [ { + type: "shortstr", + name: "consumerTag" + }, { + type: "bit", + name: "nowait", + default: !1 + } ] +}; + +module.exports.BasicCancelOk = 3932191; + +var methodInfoBasicCancelOk = module.exports.methodInfoBasicCancelOk = { + id: 3932191, + classId: 60, + methodId: 31, + name: "BasicCancelOk", + args: [ { + type: "shortstr", + name: "consumerTag" + } ] +}; + +module.exports.BasicPublish = 3932200; + +var methodInfoBasicPublish = module.exports.methodInfoBasicPublish = { + id: 3932200, + classId: 60, + methodId: 40, + name: "BasicPublish", + args: [ { + type: "short", + name: "ticket", + default: 0 + }, { + type: "shortstr", + name: "exchange", + default: "" + }, { + type: "shortstr", + name: "routingKey", + default: "" + }, { + type: "bit", + name: "mandatory", + default: !1 + }, { + type: "bit", + name: "immediate", + default: !1 + } ] +}; + +module.exports.BasicReturn = 3932210; + +var methodInfoBasicReturn = module.exports.methodInfoBasicReturn = { + id: 3932210, + classId: 60, + methodId: 50, + name: "BasicReturn", + args: [ { + type: "short", + name: "replyCode" + }, { + type: "shortstr", + name: "replyText", + default: "" + }, { + type: "shortstr", + name: "exchange" + }, { + type: "shortstr", + name: "routingKey" + } ] +}; + +module.exports.BasicDeliver = 3932220; + +var methodInfoBasicDeliver = module.exports.methodInfoBasicDeliver = { + id: 3932220, + classId: 60, + methodId: 60, + name: "BasicDeliver", + args: [ { + type: "shortstr", + name: "consumerTag" + }, { + type: "longlong", + name: "deliveryTag" + }, { + type: "bit", + name: "redelivered", + default: !1 + }, { + type: "shortstr", + name: "exchange" + }, { + type: "shortstr", + name: "routingKey" + } ] +}; + +module.exports.BasicGet = 3932230; + +var methodInfoBasicGet = module.exports.methodInfoBasicGet = { + id: 3932230, + classId: 60, + methodId: 70, + name: "BasicGet", + args: [ { + type: "short", + name: "ticket", + default: 0 + }, { + type: "shortstr", + name: "queue", + default: "" + }, { + type: "bit", + name: "noAck", + default: !1 + } ] +}; + +module.exports.BasicGetOk = 3932231; + +var methodInfoBasicGetOk = module.exports.methodInfoBasicGetOk = { + id: 3932231, + classId: 60, + methodId: 71, + name: "BasicGetOk", + args: [ { + type: "longlong", + name: "deliveryTag" + }, { + type: "bit", + name: "redelivered", + default: !1 + }, { + type: "shortstr", + name: "exchange" + }, { + type: "shortstr", + name: "routingKey" + }, { + type: "long", + name: "messageCount" + } ] +}; + +module.exports.BasicGetEmpty = 3932232; + +var methodInfoBasicGetEmpty = module.exports.methodInfoBasicGetEmpty = { + id: 3932232, + classId: 60, + methodId: 72, + name: "BasicGetEmpty", + args: [ { + type: "shortstr", + name: "clusterId", + default: "" + } ] +}; + +module.exports.BasicAck = 3932240; + +var methodInfoBasicAck = module.exports.methodInfoBasicAck = { + id: 3932240, + classId: 60, + methodId: 80, + name: "BasicAck", + args: [ { + type: "longlong", + name: "deliveryTag", + default: 0 + }, { + type: "bit", + name: "multiple", + default: !1 + } ] +}; + +module.exports.BasicReject = 3932250; + +var methodInfoBasicReject = module.exports.methodInfoBasicReject = { + id: 3932250, + classId: 60, + methodId: 90, + name: "BasicReject", + args: [ { + type: "longlong", + name: "deliveryTag" + }, { + type: "bit", + name: "requeue", + default: !0 + } ] +}; + +module.exports.BasicRecoverAsync = 3932260; + +var methodInfoBasicRecoverAsync = module.exports.methodInfoBasicRecoverAsync = { + id: 3932260, + classId: 60, + methodId: 100, + name: "BasicRecoverAsync", + args: [ { + type: "bit", + name: "requeue", + default: !1 + } ] +}; + +module.exports.BasicRecover = 3932270; + +var methodInfoBasicRecover = module.exports.methodInfoBasicRecover = { + id: 3932270, + classId: 60, + methodId: 110, + name: "BasicRecover", + args: [ { + type: "bit", + name: "requeue", + default: !1 + } ] +}; + +module.exports.BasicRecoverOk = 3932271; + +var methodInfoBasicRecoverOk = module.exports.methodInfoBasicRecoverOk = { + id: 3932271, + classId: 60, + methodId: 111, + name: "BasicRecoverOk", + args: [] +}; + +module.exports.BasicNack = 3932280; + +var methodInfoBasicNack = module.exports.methodInfoBasicNack = { + id: 3932280, + classId: 60, + methodId: 120, + name: "BasicNack", + args: [ { + type: "longlong", + name: "deliveryTag", + default: 0 + }, { + type: "bit", + name: "multiple", + default: !1 + }, { + type: "bit", + name: "requeue", + default: !0 + } ] +}; + +module.exports.ConnectionStart = 655370; + +var methodInfoConnectionStart = module.exports.methodInfoConnectionStart = { + id: 655370, + classId: 10, + methodId: 10, + name: "ConnectionStart", + args: [ { + type: "octet", + name: "versionMajor", + default: 0 + }, { + type: "octet", + name: "versionMinor", + default: 9 + }, { + type: "table", + name: "serverProperties" + }, { + type: "longstr", + name: "mechanisms", + default: "PLAIN" + }, { + type: "longstr", + name: "locales", + default: "en_US" + } ] +}; + +module.exports.ConnectionStartOk = 655371; + +var methodInfoConnectionStartOk = module.exports.methodInfoConnectionStartOk = { + id: 655371, + classId: 10, + methodId: 11, + name: "ConnectionStartOk", + args: [ { + type: "table", + name: "clientProperties" + }, { + type: "shortstr", + name: "mechanism", + default: "PLAIN" + }, { + type: "longstr", + name: "response" + }, { + type: "shortstr", + name: "locale", + default: "en_US" + } ] +}; + +module.exports.ConnectionSecure = 655380; + +var methodInfoConnectionSecure = module.exports.methodInfoConnectionSecure = { + id: 655380, + classId: 10, + methodId: 20, + name: "ConnectionSecure", + args: [ { + type: "longstr", + name: "challenge" + } ] +}; + +module.exports.ConnectionSecureOk = 655381; + +var methodInfoConnectionSecureOk = module.exports.methodInfoConnectionSecureOk = { + id: 655381, + classId: 10, + methodId: 21, + name: "ConnectionSecureOk", + args: [ { + type: "longstr", + name: "response" + } ] +}; + +module.exports.ConnectionTune = 655390; + +var methodInfoConnectionTune = module.exports.methodInfoConnectionTune = { + id: 655390, + classId: 10, + methodId: 30, + name: "ConnectionTune", + args: [ { + type: "short", + name: "channelMax", + default: 0 + }, { + type: "long", + name: "frameMax", + default: 0 + }, { + type: "short", + name: "heartbeat", + default: 0 + } ] +}; + +module.exports.ConnectionTuneOk = 655391; + +var methodInfoConnectionTuneOk = module.exports.methodInfoConnectionTuneOk = { + id: 655391, + classId: 10, + methodId: 31, + name: "ConnectionTuneOk", + args: [ { + type: "short", + name: "channelMax", + default: 0 + }, { + type: "long", + name: "frameMax", + default: 0 + }, { + type: "short", + name: "heartbeat", + default: 0 + } ] +}; + +module.exports.ConnectionOpen = 655400; + +var methodInfoConnectionOpen = module.exports.methodInfoConnectionOpen = { + id: 655400, + classId: 10, + methodId: 40, + name: "ConnectionOpen", + args: [ { + type: "shortstr", + name: "virtualHost", + default: "/" + }, { + type: "shortstr", + name: "capabilities", + default: "" + }, { + type: "bit", + name: "insist", + default: !1 + } ] +}; + +module.exports.ConnectionOpenOk = 655401; + +var methodInfoConnectionOpenOk = module.exports.methodInfoConnectionOpenOk = { + id: 655401, + classId: 10, + methodId: 41, + name: "ConnectionOpenOk", + args: [ { + type: "shortstr", + name: "knownHosts", + default: "" + } ] +}; + +module.exports.ConnectionClose = 655410; + +var methodInfoConnectionClose = module.exports.methodInfoConnectionClose = { + id: 655410, + classId: 10, + methodId: 50, + name: "ConnectionClose", + args: [ { + type: "short", + name: "replyCode" + }, { + type: "shortstr", + name: "replyText", + default: "" + }, { + type: "short", + name: "classId" + }, { + type: "short", + name: "methodId" + } ] +}; + +module.exports.ConnectionCloseOk = 655411; + +var methodInfoConnectionCloseOk = module.exports.methodInfoConnectionCloseOk = { + id: 655411, + classId: 10, + methodId: 51, + name: "ConnectionCloseOk", + args: [] +}; + +module.exports.ConnectionBlocked = 655420; + +var methodInfoConnectionBlocked = module.exports.methodInfoConnectionBlocked = { + id: 655420, + classId: 10, + methodId: 60, + name: "ConnectionBlocked", + args: [ { + type: "shortstr", + name: "reason", + default: "" + } ] +}; + +module.exports.ConnectionUnblocked = 655421; + +var methodInfoConnectionUnblocked = module.exports.methodInfoConnectionUnblocked = { + id: 655421, + classId: 10, + methodId: 61, + name: "ConnectionUnblocked", + args: [] +}; + +module.exports.ConnectionUpdateSecret = 655430; + +var methodInfoConnectionUpdateSecret = module.exports.methodInfoConnectionUpdateSecret = { + id: 655430, + classId: 10, + methodId: 70, + name: "ConnectionUpdateSecret", + args: [ { + type: "longstr", + name: "newSecret" + }, { + type: "shortstr", + name: "reason" + } ] +}; + +module.exports.ConnectionUpdateSecretOk = 655431; + +var methodInfoConnectionUpdateSecretOk = module.exports.methodInfoConnectionUpdateSecretOk = { + id: 655431, + classId: 10, + methodId: 71, + name: "ConnectionUpdateSecretOk", + args: [] +}; + +module.exports.ChannelOpen = 1310730; + +var methodInfoChannelOpen = module.exports.methodInfoChannelOpen = { + id: 1310730, + classId: 20, + methodId: 10, + name: "ChannelOpen", + args: [ { + type: "shortstr", + name: "outOfBand", + default: "" + } ] +}; + +module.exports.ChannelOpenOk = 1310731; + +var methodInfoChannelOpenOk = module.exports.methodInfoChannelOpenOk = { + id: 1310731, + classId: 20, + methodId: 11, + name: "ChannelOpenOk", + args: [ { + type: "longstr", + name: "channelId", + default: "" + } ] +}; + +module.exports.ChannelFlow = 1310740; + +var methodInfoChannelFlow = module.exports.methodInfoChannelFlow = { + id: 1310740, + classId: 20, + methodId: 20, + name: "ChannelFlow", + args: [ { + type: "bit", + name: "active" + } ] +}; + +module.exports.ChannelFlowOk = 1310741; + +var methodInfoChannelFlowOk = module.exports.methodInfoChannelFlowOk = { + id: 1310741, + classId: 20, + methodId: 21, + name: "ChannelFlowOk", + args: [ { + type: "bit", + name: "active" + } ] +}; + +module.exports.ChannelClose = 1310760; + +var methodInfoChannelClose = module.exports.methodInfoChannelClose = { + id: 1310760, + classId: 20, + methodId: 40, + name: "ChannelClose", + args: [ { + type: "short", + name: "replyCode" + }, { + type: "shortstr", + name: "replyText", + default: "" + }, { + type: "short", + name: "classId" + }, { + type: "short", + name: "methodId" + } ] +}; + +module.exports.ChannelCloseOk = 1310761; + +var methodInfoChannelCloseOk = module.exports.methodInfoChannelCloseOk = { + id: 1310761, + classId: 20, + methodId: 41, + name: "ChannelCloseOk", + args: [] +}; + +module.exports.AccessRequest = 1966090; + +var methodInfoAccessRequest = module.exports.methodInfoAccessRequest = { + id: 1966090, + classId: 30, + methodId: 10, + name: "AccessRequest", + args: [ { + type: "shortstr", + name: "realm", + default: "/data" + }, { + type: "bit", + name: "exclusive", + default: !1 + }, { + type: "bit", + name: "passive", + default: !0 + }, { + type: "bit", + name: "active", + default: !0 + }, { + type: "bit", + name: "write", + default: !0 + }, { + type: "bit", + name: "read", + default: !0 + } ] +}; + +module.exports.AccessRequestOk = 1966091; + +var methodInfoAccessRequestOk = module.exports.methodInfoAccessRequestOk = { + id: 1966091, + classId: 30, + methodId: 11, + name: "AccessRequestOk", + args: [ { + type: "short", + name: "ticket", + default: 1 + } ] +}; + +module.exports.ExchangeDeclare = 2621450; + +var methodInfoExchangeDeclare = module.exports.methodInfoExchangeDeclare = { + id: 2621450, + classId: 40, + methodId: 10, + name: "ExchangeDeclare", + args: [ { + type: "short", + name: "ticket", + default: 0 + }, { + type: "shortstr", + name: "exchange" + }, { + type: "shortstr", + name: "type", + default: "direct" + }, { + type: "bit", + name: "passive", + default: !1 + }, { + type: "bit", + name: "durable", + default: !1 + }, { + type: "bit", + name: "autoDelete", + default: !1 + }, { + type: "bit", + name: "internal", + default: !1 + }, { + type: "bit", + name: "nowait", + default: !1 + }, { + type: "table", + name: "arguments", + default: {} + } ] +}; + +module.exports.ExchangeDeclareOk = 2621451; + +var methodInfoExchangeDeclareOk = module.exports.methodInfoExchangeDeclareOk = { + id: 2621451, + classId: 40, + methodId: 11, + name: "ExchangeDeclareOk", + args: [] +}; + +module.exports.ExchangeDelete = 2621460; + +var methodInfoExchangeDelete = module.exports.methodInfoExchangeDelete = { + id: 2621460, + classId: 40, + methodId: 20, + name: "ExchangeDelete", + args: [ { + type: "short", + name: "ticket", + default: 0 + }, { + type: "shortstr", + name: "exchange" + }, { + type: "bit", + name: "ifUnused", + default: !1 + }, { + type: "bit", + name: "nowait", + default: !1 + } ] +}; + +module.exports.ExchangeDeleteOk = 2621461; + +var methodInfoExchangeDeleteOk = module.exports.methodInfoExchangeDeleteOk = { + id: 2621461, + classId: 40, + methodId: 21, + name: "ExchangeDeleteOk", + args: [] +}; + +module.exports.ExchangeBind = 2621470; + +var methodInfoExchangeBind = module.exports.methodInfoExchangeBind = { + id: 2621470, + classId: 40, + methodId: 30, + name: "ExchangeBind", + args: [ { + type: "short", + name: "ticket", + default: 0 + }, { + type: "shortstr", + name: "destination" + }, { + type: "shortstr", + name: "source" + }, { + type: "shortstr", + name: "routingKey", + default: "" + }, { + type: "bit", + name: "nowait", + default: !1 + }, { + type: "table", + name: "arguments", + default: {} + } ] +}; + +module.exports.ExchangeBindOk = 2621471; + +var methodInfoExchangeBindOk = module.exports.methodInfoExchangeBindOk = { + id: 2621471, + classId: 40, + methodId: 31, + name: "ExchangeBindOk", + args: [] +}; + +module.exports.ExchangeUnbind = 2621480; + +var methodInfoExchangeUnbind = module.exports.methodInfoExchangeUnbind = { + id: 2621480, + classId: 40, + methodId: 40, + name: "ExchangeUnbind", + args: [ { + type: "short", + name: "ticket", + default: 0 + }, { + type: "shortstr", + name: "destination" + }, { + type: "shortstr", + name: "source" + }, { + type: "shortstr", + name: "routingKey", + default: "" + }, { + type: "bit", + name: "nowait", + default: !1 + }, { + type: "table", + name: "arguments", + default: {} + } ] +}; + +module.exports.ExchangeUnbindOk = 2621491; + +var methodInfoExchangeUnbindOk = module.exports.methodInfoExchangeUnbindOk = { + id: 2621491, + classId: 40, + methodId: 51, + name: "ExchangeUnbindOk", + args: [] +}; + +module.exports.QueueDeclare = 3276810; + +var methodInfoQueueDeclare = module.exports.methodInfoQueueDeclare = { + id: 3276810, + classId: 50, + methodId: 10, + name: "QueueDeclare", + args: [ { + type: "short", + name: "ticket", + default: 0 + }, { + type: "shortstr", + name: "queue", + default: "" + }, { + type: "bit", + name: "passive", + default: !1 + }, { + type: "bit", + name: "durable", + default: !1 + }, { + type: "bit", + name: "exclusive", + default: !1 + }, { + type: "bit", + name: "autoDelete", + default: !1 + }, { + type: "bit", + name: "nowait", + default: !1 + }, { + type: "table", + name: "arguments", + default: {} + } ] +}; + +module.exports.QueueDeclareOk = 3276811; + +var methodInfoQueueDeclareOk = module.exports.methodInfoQueueDeclareOk = { + id: 3276811, + classId: 50, + methodId: 11, + name: "QueueDeclareOk", + args: [ { + type: "shortstr", + name: "queue" + }, { + type: "long", + name: "messageCount" + }, { + type: "long", + name: "consumerCount" + } ] +}; + +module.exports.QueueBind = 3276820; + +var methodInfoQueueBind = module.exports.methodInfoQueueBind = { + id: 3276820, + classId: 50, + methodId: 20, + name: "QueueBind", + args: [ { + type: "short", + name: "ticket", + default: 0 + }, { + type: "shortstr", + name: "queue", + default: "" + }, { + type: "shortstr", + name: "exchange" + }, { + type: "shortstr", + name: "routingKey", + default: "" + }, { + type: "bit", + name: "nowait", + default: !1 + }, { + type: "table", + name: "arguments", + default: {} + } ] +}; + +module.exports.QueueBindOk = 3276821; + +var methodInfoQueueBindOk = module.exports.methodInfoQueueBindOk = { + id: 3276821, + classId: 50, + methodId: 21, + name: "QueueBindOk", + args: [] +}; + +module.exports.QueuePurge = 3276830; + +var methodInfoQueuePurge = module.exports.methodInfoQueuePurge = { + id: 3276830, + classId: 50, + methodId: 30, + name: "QueuePurge", + args: [ { + type: "short", + name: "ticket", + default: 0 + }, { + type: "shortstr", + name: "queue", + default: "" + }, { + type: "bit", + name: "nowait", + default: !1 + } ] +}; + +module.exports.QueuePurgeOk = 3276831; + +var methodInfoQueuePurgeOk = module.exports.methodInfoQueuePurgeOk = { + id: 3276831, + classId: 50, + methodId: 31, + name: "QueuePurgeOk", + args: [ { + type: "long", + name: "messageCount" + } ] +}; + +module.exports.QueueDelete = 3276840; + +var methodInfoQueueDelete = module.exports.methodInfoQueueDelete = { + id: 3276840, + classId: 50, + methodId: 40, + name: "QueueDelete", + args: [ { + type: "short", + name: "ticket", + default: 0 + }, { + type: "shortstr", + name: "queue", + default: "" + }, { + type: "bit", + name: "ifUnused", + default: !1 + }, { + type: "bit", + name: "ifEmpty", + default: !1 + }, { + type: "bit", + name: "nowait", + default: !1 + } ] +}; + +module.exports.QueueDeleteOk = 3276841; + +var methodInfoQueueDeleteOk = module.exports.methodInfoQueueDeleteOk = { + id: 3276841, + classId: 50, + methodId: 41, + name: "QueueDeleteOk", + args: [ { + type: "long", + name: "messageCount" + } ] +}; + +module.exports.QueueUnbind = 3276850; + +var methodInfoQueueUnbind = module.exports.methodInfoQueueUnbind = { + id: 3276850, + classId: 50, + methodId: 50, + name: "QueueUnbind", + args: [ { + type: "short", + name: "ticket", + default: 0 + }, { + type: "shortstr", + name: "queue", + default: "" + }, { + type: "shortstr", + name: "exchange" + }, { + type: "shortstr", + name: "routingKey", + default: "" + }, { + type: "table", + name: "arguments", + default: {} + } ] +}; + +module.exports.QueueUnbindOk = 3276851; + +var methodInfoQueueUnbindOk = module.exports.methodInfoQueueUnbindOk = { + id: 3276851, + classId: 50, + methodId: 51, + name: "QueueUnbindOk", + args: [] +}; + +module.exports.TxSelect = 5898250; + +var methodInfoTxSelect = module.exports.methodInfoTxSelect = { + id: 5898250, + classId: 90, + methodId: 10, + name: "TxSelect", + args: [] +}; + +module.exports.TxSelectOk = 5898251; + +var methodInfoTxSelectOk = module.exports.methodInfoTxSelectOk = { + id: 5898251, + classId: 90, + methodId: 11, + name: "TxSelectOk", + args: [] +}; + +module.exports.TxCommit = 5898260; + +var methodInfoTxCommit = module.exports.methodInfoTxCommit = { + id: 5898260, + classId: 90, + methodId: 20, + name: "TxCommit", + args: [] +}; + +module.exports.TxCommitOk = 5898261; + +var methodInfoTxCommitOk = module.exports.methodInfoTxCommitOk = { + id: 5898261, + classId: 90, + methodId: 21, + name: "TxCommitOk", + args: [] +}; + +module.exports.TxRollback = 5898270; + +var methodInfoTxRollback = module.exports.methodInfoTxRollback = { + id: 5898270, + classId: 90, + methodId: 30, + name: "TxRollback", + args: [] +}; + +module.exports.TxRollbackOk = 5898271; + +var methodInfoTxRollbackOk = module.exports.methodInfoTxRollbackOk = { + id: 5898271, + classId: 90, + methodId: 31, + name: "TxRollbackOk", + args: [] +}; + +module.exports.ConfirmSelect = 5570570; + +var methodInfoConfirmSelect = module.exports.methodInfoConfirmSelect = { + id: 5570570, + classId: 85, + methodId: 10, + name: "ConfirmSelect", + args: [ { + type: "bit", + name: "nowait", + default: !1 + } ] +}; + +module.exports.ConfirmSelectOk = 5570571; + +var methodInfoConfirmSelectOk = module.exports.methodInfoConfirmSelectOk = { + id: 5570571, + classId: 85, + methodId: 11, + name: "ConfirmSelectOk", + args: [] +}; + +module.exports.BasicProperties = 60; + +var propertiesInfoBasicProperties = module.exports.propertiesInfoBasicProperties = { + id: 60, + name: "BasicProperties", + args: [ { + type: "shortstr", + name: "contentType" + }, { + type: "shortstr", + name: "contentEncoding" + }, { + type: "table", + name: "headers" + }, { + type: "octet", + name: "deliveryMode" + }, { + type: "octet", + name: "priority" + }, { + type: "shortstr", + name: "correlationId" + }, { + type: "shortstr", + name: "replyTo" + }, { + type: "shortstr", + name: "expiration" + }, { + type: "shortstr", + name: "messageId" + }, { + type: "timestamp", + name: "timestamp" + }, { + type: "shortstr", + name: "type" + }, { + type: "shortstr", + name: "userId" + }, { + type: "shortstr", + name: "appId" + }, { + type: "shortstr", + name: "clusterId" + } ] +}; \ No newline at end of file From 89abcb8054ed4ff9cbed6b7c4cb443b75c1f02a1 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Thu, 11 Apr 2024 21:14:04 +0100 Subject: [PATCH 108/112] Nolonger need prepare --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 841a5b09..e610a680 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,7 @@ "uglify-js": "2.8.x" }, "scripts": { - "test": "make test", - "prepare": "make" + "test": "make test" }, "keywords": [ "AMQP", From 22e948ab64f8cb1c559a55d9e8c485b426b7a5e9 Mon Sep 17 00:00:00 2001 From: "E-MEDIA\\e.brinette" Date: Mon, 8 Jul 2024 17:06:30 +0200 Subject: [PATCH 109/112] Add encode and decode support for unsigned short --- lib/codec.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/codec.js b/lib/codec.js index b6ea1a20..a8974401 100644 --- a/lib/codec.js +++ b/lib/codec.js @@ -193,6 +193,10 @@ function encodeFieldValue(buffer, value, offset) { tag('s'); buffer.writeInt16BE(val, offset); offset += 2; break; + case 'unsignedshort': + case 'uint16': + tag('u'); + buffer.writeUInt16BE(val, offset); offset += 2; case 'int': case 'int32': tag('I'); @@ -286,6 +290,9 @@ function decodeFields(slice) { case 's': val = slice.readInt16BE(offset); offset += 2; break; + case 'u': + val = slice.readUInt16BE(offset); offset += 2; + break; case 't': val = slice[offset] != 0; offset++; break; From 0b43ba90a0c83becf75f8ee6cc96c4470d372690 Mon Sep 17 00:00:00 2001 From: "E-MEDIA\\e.brinette" Date: Mon, 8 Jul 2024 17:15:14 +0200 Subject: [PATCH 110/112] Add support for 'B" as unsigned byte and 'i' as unsigned int --- lib/codec.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/codec.js b/lib/codec.js index a8974401..d23da3d8 100644 --- a/lib/codec.js +++ b/lib/codec.js @@ -188,6 +188,11 @@ function encodeFieldValue(buffer, value, offset) { tag('b'); buffer.writeInt8(val, offset); offset++; break; + case 'unsigned byte': + case 'uint8': + tag('B'); + buffer.writeUInt8(val, offset); offset++; + break; case 'short': case 'int16': tag('s'); @@ -202,6 +207,11 @@ function encodeFieldValue(buffer, value, offset) { tag('I'); buffer.writeInt32BE(val, offset); offset += 4; break; + case 'unsignedint': + case 'uint32': + tag('i'); + buffer.writeUInt32BE(val, offset); offset += 4; + break; case 'long': case 'int64': tag('l'); @@ -247,6 +257,9 @@ function decodeFields(slice) { case 'b': val = slice.readInt8(offset); offset++; break; + case 'B': + val = slice.readUInt8(offset); offset++; + break; case 'S': len = slice.readUInt32BE(offset); offset += 4; val = slice.toString('utf8', offset, offset + len); @@ -255,6 +268,9 @@ function decodeFields(slice) { case 'I': val = slice.readInt32BE(offset); offset += 4; break; + case 'i': + val = slice.readUInt32BE(offset); offset += 4; + break; case 'D': // only positive decimals, apparently. var places = slice[offset]; offset++; var digits = slice.readUInt32BE(offset); offset += 4; From 16a7d3372d5d3dc1d2b4c5866002f670120aece6 Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:26:50 +0000 Subject: [PATCH 111/112] Complete support for unsigned integers --- lib/codec.js | 3 ++- test/codec.js | 22 +++++++++++----------- test/data.js | 15 +++++++++++++++ 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/lib/codec.js b/lib/codec.js index d23da3d8..33511a0e 100644 --- a/lib/codec.js +++ b/lib/codec.js @@ -188,7 +188,7 @@ function encodeFieldValue(buffer, value, offset) { tag('b'); buffer.writeInt8(val, offset); offset++; break; - case 'unsigned byte': + case 'unsignedbyte': case 'uint8': tag('B'); buffer.writeUInt8(val, offset); offset++; @@ -202,6 +202,7 @@ function encodeFieldValue(buffer, value, offset) { case 'uint16': tag('u'); buffer.writeUInt16BE(val, offset); offset += 2; + break; case 'int': case 'int32': tag('I'); diff --git a/test/codec.js b/test/codec.js index 2acc773d..6048e9c9 100644 --- a/test/codec.js +++ b/test/codec.js @@ -44,19 +44,16 @@ var testCases = [ ['null', {'void': null}, [4,118,111,105,100,86]], // array, object - ['array', {array: [6, true, "foo"]}, - [5,97,114,114,97,121,65,0,0,0,12,98,6,116,1,83,0,0,0,3,102,111,111]], - ['object', {object: {foo: "bar", baz: 12}}, - [6,111,98,106,101,99,116,70,0,0,0,18,3,102,111,111,83,0, - 0,0,3,98,97,114,3,98,97,122,98,12]], + ['array', {array: [6, true, "foo"]},[5,97,114,114,97,121,65,0,0,0,12,98,6,116,1,83,0,0,0,3,102,111,111]], + ['object', {object: {foo: "bar", baz: 12}},[6,111,98,106,101,99,116,70,0,0,0,18,3,102,111,111,83,0,0,0,3,98,97,114,3,98,97,122,98,12]], // exotic types - ['timestamp', {timestamp: {'!': 'timestamp', value: 1357212277527}}, - [9,116,105,109,101,115,116,97,109,112,84,0,0,1,60,0,39,219,23]], - ['decimal', {decimal: {'!': 'decimal', value: {digits: 2345, places: 2}}}, - [7,100,101,99,105,109,97,108,68,2,0,0,9,41]], - ['float', {float: {'!': 'float', value: 0.1}}, - [5,102,108,111,97,116,102,61,204,204,205]], + ['timestamp', {timestamp: {'!': 'timestamp', value: 1357212277527}},[9,116,105,109,101,115,116,97,109,112,84,0,0,1,60,0,39,219,23]], + ['decimal', {decimal: {'!': 'decimal', value: {digits: 2345, places: 2}}},[7,100,101,99,105,109,97,108,68,2,0,0,9,41]], + ['float', {float: {'!': 'float', value: 0.1}},[5,102,108,111,97,116,102,61,204,204,205]], + ['unsignedbyte', {unsignedbyte:{'!': 'unsignedbyte', value: 255}}, [12,117,110,115,105,103,110,101,100,98,121,116,101,66,255]], + ['unsignedshort', {unsignedshort:{'!': 'unsignedshort', value: 65535}}, [13,117,110,115,105,103,110,101,100,115,104,111,114,116,117,255,255]], + ['unsignedint', {unsignedint:{'!': 'unsignedint', value: 4294967295}}, [11,117,110,115,105,103,110,101,100,105,110,116,105,255,255,255,255]], ]; function bufferToArray(b) { @@ -109,6 +106,9 @@ suite("Roundtrip values", function() { amqp.Bit, amqp.Decimal, amqp.Timestamp, + amqp.UnsignedByte, + amqp.UnsignedShort, + amqp.UnsignedInt, amqp.Double, amqp.Float, amqp.FieldArray, diff --git a/test/data.js b/test/data.js index 45b10716..d2dbe2e5 100644 --- a/test/data.js +++ b/test/data.js @@ -89,6 +89,18 @@ var Decimal = label('decimal', transform( function(args) { return {'!': 'decimal', value: {places: args[1], digits: args[0]}}; }, sequence(arb.UInt, Octet))); +var UnsignedByte = label('unsignedbyte', transform( + function(n) { + return {'!': 'unsignedbyte', value: n}; + }, Octet)); +var UnsignedShort = label('unsignedshort', transform( + function(n) { + return {'!': 'unsignedshort', value: n}; + }, UShort)); +var UnsignedInt = label('unsignedint', transform( + function(n) { + return {'!': 'unsignedint', value: n}; + }, ULong)); // Signed 8 bit int var Byte = rangeInt('byte', -128, 127); @@ -244,6 +256,9 @@ module.exports = { Float: Float, Timestamp: Timestamp, Decimal: Decimal, + UnsignedByte: UnsignedByte, + UnsignedShort: UnsignedShort, + UnsignedInt: UnsignedInt, FieldArray: FieldArray, FieldTable: FieldTable, From 89fdcd04fba35ca3abbcfffe5a594d651e935e8a Mon Sep 17 00:00:00 2001 From: Stephen Cresswell <229672+cressie176@users.noreply.github.com> Date: Sun, 24 Nov 2024 09:35:44 +0000 Subject: [PATCH 112/112] Remove duplicate type tag --- lib/codec.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/codec.js b/lib/codec.js index 33511a0e..9a31e80f 100644 --- a/lib/codec.js +++ b/lib/codec.js @@ -300,9 +300,6 @@ function decodeFields(slice) { case 'l': val = ints.readInt64BE(slice, offset); offset += 8; break; - case 'u': - val = slice.readUInt16BE(offset); offset += 2; - break; case 'U': case 's': val = slice.readInt16BE(offset); offset += 2;