amqplib 0.10.3 → 0.10.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +7 -4
  2. package/.github/workflows/publish.yml +59 -0
  3. package/.github/workflows/test.yml +15 -2
  4. package/CHANGELOG.md +14 -1
  5. package/Makefile +22 -20
  6. package/README.md +1 -2
  7. package/bin/amqp-rabbitmq-0.9.1.json +483 -0
  8. package/bin/generate-defs.js +5 -5
  9. package/examples/direct_reply_to_client.js +22 -0
  10. package/examples/direct_reply_to_server.js +25 -0
  11. package/examples/headers.js +29 -31
  12. package/examples/ssl.js +16 -10
  13. package/examples/stream_queues/README.md +40 -0
  14. package/examples/stream_queues/package.json +14 -0
  15. package/examples/stream_queues/receive_stream.js +55 -0
  16. package/examples/stream_queues/send_stream.js +38 -0
  17. package/examples/tutorials/callback_api/emit_log.js +22 -22
  18. package/examples/tutorials/callback_api/emit_log_direct.js +24 -24
  19. package/examples/tutorials/callback_api/emit_log_topic.js +23 -20
  20. package/examples/tutorials/callback_api/new_task.js +21 -20
  21. package/examples/tutorials/callback_api/receive.js +27 -21
  22. package/examples/tutorials/callback_api/receive_logs.js +32 -26
  23. package/examples/tutorials/callback_api/receive_logs_direct.js +42 -41
  24. package/examples/tutorials/callback_api/receive_logs_topic.js +43 -40
  25. package/examples/tutorials/callback_api/rpc_client.js +39 -37
  26. package/examples/tutorials/callback_api/rpc_server.js +42 -32
  27. package/examples/tutorials/callback_api/send.js +21 -22
  28. package/examples/tutorials/callback_api/worker.js +29 -25
  29. package/examples/tutorials/emit_log.js +20 -15
  30. package/examples/tutorials/emit_log_direct.js +22 -16
  31. package/examples/tutorials/emit_log_topic.js +22 -15
  32. package/examples/tutorials/new_task.js +20 -13
  33. package/examples/tutorials/receive.js +19 -14
  34. package/examples/tutorials/receive_logs.js +25 -23
  35. package/examples/tutorials/receive_logs_direct.js +29 -35
  36. package/examples/tutorials/receive_logs_topic.js +28 -32
  37. package/examples/tutorials/rpc_client.js +37 -40
  38. package/examples/tutorials/rpc_server.js +36 -29
  39. package/examples/tutorials/send.js +26 -18
  40. package/examples/tutorials/worker.js +27 -21
  41. package/examples/waitForConfirms.js +18 -19
  42. package/lib/callback_model.js +295 -290
  43. package/lib/channel.js +353 -346
  44. package/lib/channel_model.js +5 -1
  45. package/lib/codec.js +26 -2
  46. package/lib/connection.js +544 -532
  47. package/lib/credentials.js +1 -1
  48. package/lib/defs.js +2568 -2457
  49. package/lib/format.js +0 -1
  50. package/lib/heartbeat.js +32 -29
  51. package/lib/mux.js +96 -99
  52. package/package.json +3 -5
  53. package/test/callback_api.js +182 -174
  54. package/test/channel_api.js +455 -445
  55. package/test/codec.js +15 -15
  56. package/test/data.js +15 -0
  57. package/test/frame.js +6 -7
  58. package/test/mux.js +1 -2
  59. package/test/util.js +1 -3
@@ -23,15 +23,18 @@ Before reporting a bug or requesting support please...
23
23
  - https://www.cloudamqp.com/blog/part1-rabbitmq-for-beginners-what-is-rabbitmq.html
24
24
  - https://www.rabbitmq.com/tutorials/amqp-concepts.html
25
25
 
26
- If the above does not help, please provide the following information...
26
+ If the above does not help, please provide as much of the following information as is relevant...
27
27
 
28
- - A clear and concise description of what the bug is.
28
+ - A clear and concise description of the problem
29
29
  - RabbitMQ version
30
30
  - amqplib version
31
+ - Node.js version
32
+ - The simplest possible code snippet that demonstrates the problem
33
+ - A stack trace
31
34
 
32
- If you include code snippets, please format them so they are easier to read
35
+ Please format code snippets and/or stack traces using GitHub Markdown
33
36
 
34
- - https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks
37
+ - https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks).
35
38
 
36
39
  Thank you
37
40
 
@@ -0,0 +1,59 @@
1
+ name: Publish
2
+
3
+ on:
4
+ release:
5
+ types: [created]
6
+
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+ services:
11
+ rabbitmq:
12
+ image: rabbitmq:3-alpine
13
+ ports:
14
+ - 5672:5672
15
+
16
+ strategy:
17
+ matrix:
18
+ node-version: [10.x, 12.x, 14.x, 16.x, 18.x, 20.x]
19
+ # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
20
+
21
+ steps:
22
+ - uses: actions/checkout@v3
23
+
24
+ - name: Use Node.js ${{ matrix.node-version }}
25
+ uses: actions/setup-node@v3
26
+ with:
27
+ node-version: ${{ matrix.node-version }}
28
+ cache: "npm"
29
+
30
+ - run: npm ci
31
+
32
+ - run: |
33
+ n=0
34
+ while :
35
+ do
36
+ sleep 5
37
+ echo 'HELO\n\n\n\n' | nc localhost 5672 | grep AMQP
38
+ [[ $? = 0 ]] && break || ((n++))
39
+ (( n >= 5 )) && break
40
+ done
41
+
42
+ - run: echo 'HELO\n\n\n\n' | nc localhost 5672 | grep AMQP
43
+
44
+ - run: make test
45
+
46
+ publish:
47
+ needs: build
48
+ runs-on: ubuntu-latest
49
+ steps:
50
+ - uses: actions/checkout@v3
51
+ - uses: actions/setup-node@v3
52
+ with:
53
+ node-version: '20.x'
54
+ cache: "npm"
55
+ registry-url: https://registry.npmjs.org/
56
+ - run: npm ci
57
+ - run: npm publish --dry-run
58
+ env:
59
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
@@ -14,13 +14,13 @@ jobs:
14
14
  runs-on: ubuntu-latest
15
15
  services:
16
16
  rabbitmq:
17
- image: rabbitmq
17
+ image: rabbitmq:3.12-alpine
18
18
  ports:
19
19
  - 5672:5672
20
20
 
21
21
  strategy:
22
22
  matrix:
23
- node-version: [10.x, 12.x, 14.x, 16.x, 18.x]
23
+ node-version: [10.x, 12.x, 14.x, 16.x, 18.x, 20.x]
24
24
  # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
25
25
 
26
26
  steps:
@@ -34,5 +34,18 @@ jobs:
34
34
  # Install all prerequisites
35
35
  - run: npm ci
36
36
 
37
+ # Ensure RabbitMQ is available before continuing
38
+ - run: |
39
+ n=0
40
+ while :
41
+ do
42
+ sleep 5
43
+ echo 'HELO\n\n\n\n' | nc localhost 5672 | grep AMQP
44
+ [[ $? = 0 ]] && break || ((n++))
45
+ (( n >= 5 )) && break
46
+ done
47
+
48
+ - run: echo 'HELO\n\n\n\n' | nc localhost 5672 | grep AMQP
49
+
37
50
  # Run the tests
38
51
  - run: make test
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Change log for amqplib
2
2
 
3
+ ## Changes in v0.10.5
4
+
5
+ git log v0.10.4..v0.10.5
6
+
7
+ - Removed readable stream - See https://github.com/amqp-node/amqplib/issues/729
8
+ - Added support for unsigned integers - See https://github.com/amqp-node/amqplib/pull/773
9
+ - Committed protocol definitions - See https://github.com/amqp-node/amqplib/commit/0a87ee480311633cff41e43350a90cb3c1221506
10
+
11
+ ## Changes in v0.10.4
12
+
13
+ - Improve stream example as per https://github.com/amqp-node/amqplib/issues/722
14
+ - Added support for RabbitMQ's connection update-secret operation. See https://github.com/amqp-node/amqplib/issues/755
15
+
3
16
  ## Changes in v0.10.3
4
17
 
5
18
  git log v0.10.2..v0.10.3
@@ -18,7 +31,7 @@
18
31
 
19
32
  git log v0.10.0..v0.10.1
20
33
 
21
- * Allow servername to be specified via socket options as discussed in as discussed in
34
+ * Allow servername to be specified via socket options as discussed in
22
35
  [issue 697](https://github.com/squaremo/amqp.node/issues/697)
23
36
 
24
37
  ## Changes in v0.10.0
package/Makefile CHANGED
@@ -1,42 +1,44 @@
1
- RABBITMQ_SRC_VERSION=rabbitmq_v3_2_1
1
+ RABBITMQ_SRC_VERSION=v3.12.13
2
2
  JSON=amqp-rabbitmq-0.9.1.json
3
- RABBITMQ_CODEGEN=https://raw.githubusercontent.com/rabbitmq/rabbitmq-codegen
4
- AMQP_JSON=$(RABBITMQ_CODEGEN)/$(RABBITMQ_SRC_VERSION)/$(JSON)
3
+ AMQP_JSON=https://raw.githubusercontent.com/rabbitmq/rabbitmq-server/$(RABBITMQ_SRC_VERSION)/deps/rabbitmq_codegen/$(JSON)
5
4
 
6
- NODEJS_VERSIONS='10.21' '11.15' '12.18' '13.14' '14.5' '15.8' '16.3.0' '18.1.0'
5
+ NODEJS_VERSIONS='10.21' '11.15' '12.18' '13.14' '14.5' '15.8' '16.3.0' '18.1.0' '20.10.0'
7
6
 
8
7
  MOCHA=./node_modules/.bin/mocha
9
8
  _MOCHA=./node_modules/.bin/_mocha
10
9
  UGLIFY=./node_modules/.bin/uglifyjs
11
10
  NYC=./node_modules/.bin/nyc
12
11
 
13
- .PHONY: test test-all-nodejs all clean coverage
12
+ .PHONY: test test-all-nodejs coverage lib/defs.js
14
13
 
15
- all: lib/defs.js
14
+ error:
15
+ @echo "Please choose one of the following targets: test, test-all-nodejs, coverage, lib/defs.js"
16
+ @exit 1
16
17
 
17
- clean:
18
- rm lib/defs.js bin/amqp-rabbitmq-0.9.1.json
19
- rm -rf ./coverage
20
-
21
- lib/defs.js: $(UGLIFY) bin/generate-defs.js bin/amqp-rabbitmq-0.9.1.json
22
- (cd bin; node ./generate-defs.js > ../lib/defs.js)
23
- $(UGLIFY) ./lib/defs.js -o ./lib/defs.js \
24
- -c 'sequences=false' --comments \
25
- -b 'indent-level=2' 2>&1 | (grep -v 'WARN' || true)
26
-
27
- test: lib/defs.js
18
+ test:
28
19
  $(MOCHA) --check-leaks -u tdd --exit test/
29
20
 
30
- test-all-nodejs: lib/defs.js
21
+ test-all-nodejs:
31
22
  for v in $(NODEJS_VERSIONS); \
32
23
  do echo "-- Node version $$v --"; \
33
24
  nave use $$v $(MOCHA) -u tdd --exit -R progress test; \
34
25
  done
35
26
 
36
- coverage: $(NYC) lib/defs.js
37
- $(NYC) --reporter=lcov --reporter=text $(_MOCHA) -u tdd -R progress test/
27
+ coverage: $(NYC)
28
+ $(NYC) --clean --reporter=lcov --reporter=text $(_MOCHA) -u tdd --exit -R progress test/
38
29
  @echo "HTML report at file://$$(pwd)/coverage/lcov-report/index.html"
39
30
 
31
+ lib/defs.js: clean bin/generate-defs test
32
+
33
+ clean:
34
+ rm -f lib/defs.js bin/amqp-rabbitmq-0.9.1.json
35
+
36
+ bin/generate-defs: $(UGLIFY) bin/generate-defs.js bin/amqp-rabbitmq-0.9.1.json
37
+ (cd bin; node ./generate-defs.js > ../lib/defs.js)
38
+ $(UGLIFY) ./lib/defs.js -o ./lib/defs.js \
39
+ -c 'sequences=false' --comments \
40
+ -b 'indent-level=2' 2>&1 | (grep -v 'WARN' || true)
41
+
40
42
  bin/amqp-rabbitmq-0.9.1.json:
41
43
  curl -L $(AMQP_JSON) > $@
42
44
 
package/README.md CHANGED
@@ -13,7 +13,6 @@
13
13
  * [Troubleshooting][gh-pages-trouble]
14
14
  * [Examples from RabbitMQ tutorials][tutes]
15
15
 
16
-
17
16
  A library for making AMQP 0-9-1 clients for Node.JS, and an AMQP 0-9-1 client for Node.JS v10+.
18
17
 
19
18
  This library does not implement [AMQP
@@ -87,7 +86,7 @@ const amqplib = require('amqplib');
87
86
  // Listener
88
87
  ch1.consume(queue, (msg) => {
89
88
  if (msg !== null) {
90
- console.log('Recieved:', msg.content.toString());
89
+ console.log('Received:', msg.content.toString());
91
90
  ch1.ack(msg);
92
91
  } else {
93
92
  console.log('Consumer cancelled by server');