amqplib 0.10.9 → 1.0.1

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 (86) hide show
  1. package/.claude/commands/lint-disable.md +9 -0
  2. package/.claude/commands/lint-enable.md +12 -0
  3. package/.claude/settings.local.json +16 -0
  4. package/.github/workflows/publish.yml +1 -1
  5. package/.github/workflows/test.yml +1 -1
  6. package/CHANGELOG.md +34 -0
  7. package/CLAUDE.md +12 -0
  8. package/Makefile +5 -12
  9. package/README.md +0 -5
  10. package/bin/generate-defs.js +382 -369
  11. package/biome.json +51 -0
  12. package/callback_api.js +12 -8
  13. package/channel_api.js +5 -10
  14. package/examples/direct_reply_to_client.js +9 -5
  15. package/examples/direct_reply_to_server.js +8 -6
  16. package/examples/headers.js +13 -10
  17. package/examples/receive_generator.js +13 -20
  18. package/examples/send_generators.js +2 -9
  19. package/examples/ssl.js +2 -3
  20. package/examples/stream_queues/receive_stream.js +39 -36
  21. package/examples/stream_queues/send_stream.js +26 -29
  22. package/examples/tutorials/callback_api/emit_log.js +4 -3
  23. package/examples/tutorials/callback_api/emit_log_direct.js +5 -4
  24. package/examples/tutorials/callback_api/emit_log_topic.js +5 -4
  25. package/examples/tutorials/callback_api/new_task.js +5 -4
  26. package/examples/tutorials/callback_api/receive.js +16 -10
  27. package/examples/tutorials/callback_api/receive_logs.js +17 -11
  28. package/examples/tutorials/callback_api/receive_logs_direct.js +19 -13
  29. package/examples/tutorials/callback_api/receive_logs_topic.js +19 -14
  30. package/examples/tutorials/callback_api/rpc_client.js +20 -16
  31. package/examples/tutorials/callback_api/rpc_server.js +27 -21
  32. package/examples/tutorials/callback_api/send.js +4 -3
  33. package/examples/tutorials/callback_api/worker.js +18 -13
  34. package/examples/tutorials/emit_log.js +4 -6
  35. package/examples/tutorials/emit_log_direct.js +5 -7
  36. package/examples/tutorials/emit_log_topic.js +5 -7
  37. package/examples/tutorials/new_task.js +4 -6
  38. package/examples/tutorials/receive.js +8 -4
  39. package/examples/tutorials/receive_logs.js +10 -6
  40. package/examples/tutorials/receive_logs_direct.js +16 -10
  41. package/examples/tutorials/receive_logs_topic.js +16 -11
  42. package/examples/tutorials/rpc_client.js +17 -15
  43. package/examples/tutorials/rpc_server.js +9 -8
  44. package/examples/tutorials/send.js +4 -6
  45. package/examples/tutorials/worker.js +17 -14
  46. package/examples/waitForConfirms.js +2 -2
  47. package/lefthook.yml +14 -0
  48. package/lib/api_args.js +124 -149
  49. package/lib/bitset.js +28 -18
  50. package/lib/callback_model.js +134 -190
  51. package/lib/channel.js +175 -213
  52. package/lib/channel_model.js +41 -85
  53. package/lib/codec.js +257 -228
  54. package/lib/connect.js +76 -83
  55. package/lib/connection.js +204 -240
  56. package/lib/credentials.js +21 -29
  57. package/lib/defs.js +2559 -1927
  58. package/lib/error.js +5 -6
  59. package/lib/format.js +15 -33
  60. package/lib/frame.js +66 -66
  61. package/lib/heartbeat.js +17 -24
  62. package/lib/mux.js +32 -41
  63. package/package.json +8 -5
  64. package/test/bitset.test.js +65 -0
  65. package/test/callback_api.test.js +438 -0
  66. package/test/channel.test.js +592 -0
  67. package/test/channel_api.test.js +537 -0
  68. package/test/codec.test.js +172 -0
  69. package/test/connect.test.js +196 -0
  70. package/test/connection.test.js +330 -0
  71. package/test/data.test.js +33 -0
  72. package/test/frame.test.js +180 -0
  73. package/test/lib/data.js +249 -0
  74. package/test/lib/util.js +223 -0
  75. package/test/mux.test.js +215 -0
  76. package/test/bitset.js +0 -69
  77. package/test/callback_api.js +0 -379
  78. package/test/channel.js +0 -621
  79. package/test/channel_api.js +0 -606
  80. package/test/codec.js +0 -237
  81. package/test/connect.js +0 -204
  82. package/test/connection.js +0 -390
  83. package/test/data.js +0 -269
  84. package/test/frame.js +0 -191
  85. package/test/mux.js +0 -203
  86. package/test/util.js +0 -217
@@ -0,0 +1,9 @@
1
+ Please follow the following process when I ask you to disable a lint rule using /lint-disable $rule
2
+
3
+ 1. Create and change to a new branch. Ask for the branch name.
4
+ 2. If the rule is off by default, delete it (See https://biomejs.dev/linter/javascript/rules/ for rule details)
5
+ 3. If the rule is on by default, configure it to off in biome.json
6
+ 4. Update the project changelog
7
+ 5. Add the changes
8
+ 6. Commit the changes
9
+ 7. Push the changes
@@ -0,0 +1,12 @@
1
+ Please follow the following process when I ask you to enable a lint rule using /lint-enable $rule
2
+
3
+ 1. Create and change to a new branch. Ask for the branch name.
4
+ 2. Configure the rule to error in biome.json
5
+ 3. Run lint (npm run lint). If there are NO errors, goto step 8
6
+ 4. Use biome to SAFELY auto fix (npm run lint -- --fix). If there are errors stop and ask for instruction.
7
+ 5. Run the tests (npm test). If there are errors, stop and ask for instruction.
8
+ 6. If the rule defaults to error, delete it (See https://biomejs.dev/linter/javascript/rules/ for rule details)
9
+ 7. Update the project changelog
10
+ 8. Add the changes
11
+ 9. Commit the changes
12
+ 10. Push the changes
@@ -0,0 +1,16 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(npx oxlint:*)",
5
+ "Bash(npm t)",
6
+ "Bash(git add:*)",
7
+ "Bash(git commit:*)",
8
+ "Bash(npm run lint:*)",
9
+ "Bash(git checkout:*)",
10
+ "Bash(npx biome lint:*)",
11
+ "Bash(node:*)"
12
+ ],
13
+ "deny": [],
14
+ "ask": []
15
+ }
16
+ }
@@ -15,7 +15,7 @@ jobs:
15
15
 
16
16
  strategy:
17
17
  matrix:
18
- node-version: [10.x, 12.x, 14.x, 16.x, 18.x, 20.x]
18
+ node-version: [18.x, 20.x, 22.x, 24.x]
19
19
  # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
20
20
 
21
21
  steps:
@@ -20,7 +20,7 @@ jobs:
20
20
 
21
21
  strategy:
22
22
  matrix:
23
- node-version: [10.x, 12.x, 14.x, 16.x, 18.x, 20.x]
23
+ node-version: [18.x, 20.x, 22.x, 24.x]
24
24
  # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
25
25
 
26
26
  steps:
package/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # Change log for amqplib
2
2
 
3
+ ## v1.0.1
4
+ - Fix TLS connection failure when connecting to an AMQPS broker using an IP address (IPv4 or IPv6) — setting servername to an IP is not permitted by TLS SNI and throws ERR_INVALID_ARG_VALUE in Node.js 25+
5
+
6
+ ## v1.0.0
7
+ - **BREAKING**: Update minimum Node.js requirement to v18
8
+ - Introduce Biome formatter for consistent code formatting
9
+ - Add automated formatting via pre-commit hooks using Lefthook
10
+ - Format entire codebase with standardised formatting rules
11
+ - Add npm format script for manual code formatting
12
+ - Enable noUnusedFunctionParameters lint rule and fix all violations
13
+ - Enable noUnusedVariables lint rule and remove all unused variables from codebase
14
+ - Replace all var declarations with let/const for modern JavaScript standards
15
+ - Ensure parseInt calls use explicit radix parameter for clarity and reliability
16
+ - Fix precision loss in test data generators by using JavaScript safe integer limits
17
+ - Add block scoping to switch statement cases to prevent variable declaration issues
18
+ - Enforce const usage for variables that are never reassigned
19
+ - Add node: protocol prefix to Node.js builtin module imports for clarity
20
+ - Use modern exponentiation operator (**) instead of Math.pow()
21
+ - Replace string concatenation with modern template literals
22
+ - Remove redundant 'use strict' directives as modules are automatically in strict mode
23
+ - Refactor assignment-in-expression patterns to improve code clarity and readability
24
+ - Replace comma operators with individual statements for clearer, more readable code
25
+ - Split comma-separated variable declarations into individual statements for consistency
26
+ - Replace Object.prototype.hasOwnProperty() with safer Object.hasOwn() method
27
+ - Enforce strict equality checks (=== and !==) instead of loose equality (== and !=)
28
+ - Replace global isNaN with Number.isNaN for safer type checking
29
+ - Ensure no variable redeclarations exist to prevent shadowing issues
30
+ - Replace global isFinite with Number.isFinite for safer numeric validation
31
+ - Enable useArrowFunction lint rule to prefer arrow functions for cleaner syntax
32
+ - Enable noUselessCatch lint rule to prevent useless catch blocks that only rethrow errors
33
+ - Enable noArguments rule to enforce modern rest parameters instead of legacy arguments object
34
+ - Enable bracketSpacing formatting rule to add spaces inside object literals
35
+ - Migrate test suite from Mocha to Node.js built-in test runner
36
+
3
37
  ## v0.10.9
4
38
  - Add support for IPv6 urls
5
39
 
package/CLAUDE.md ADDED
@@ -0,0 +1,12 @@
1
+ # Project-Specific Guidelines for amqplib
2
+
3
+ ## Generated Files - DO NOT EDIT
4
+ - `lib/defs.js` - This file is generated code. NEVER modify it directly.
5
+ - Generated via `make lib/defs.js` from the AMQP specification
6
+ - If linting issues arise, exclude this file from linting rules rather than modifying it
7
+
8
+ ## Commit Requirements
9
+ - NEVER commit when tests are failing
10
+ - NEVER commit when there are lint errors
11
+ - Always run `npm test` and `npm run lint` before committing
12
+ - If tests are failing, investigate and fix the issue before proceeding
package/Makefile CHANGED
@@ -2,12 +2,9 @@ RABBITMQ_SRC_VERSION=v3.12.13
2
2
  JSON=amqp-rabbitmq-0.9.1.json
3
3
  AMQP_JSON=https://raw.githubusercontent.com/rabbitmq/rabbitmq-server/$(RABBITMQ_SRC_VERSION)/deps/rabbitmq_codegen/$(JSON)
4
4
 
5
- NODEJS_VERSIONS='10.21' '11.15' '12.18' '13.14' '14.5' '15.8' '16.3.0' '18.1.0' '20.10.0' '22.14.0'
5
+ NODEJS_VERSIONS='18.1.0' '20.10.0' '22.14.0' '24.7.0'
6
6
 
7
- MOCHA=./node_modules/.bin/mocha
8
- _MOCHA=./node_modules/.bin/_mocha
9
7
  UGLIFY=./node_modules/.bin/uglifyjs
10
- NYC=./node_modules/.bin/nyc
11
8
 
12
9
  .PHONY: test test-all-nodejs coverage lib/defs.js
13
10
 
@@ -16,17 +13,16 @@ error:
16
13
  @exit 1
17
14
 
18
15
  test:
19
- $(MOCHA) --check-leaks -u tdd --exit test/
16
+ node --test
20
17
 
21
18
  test-all-nodejs:
22
19
  for v in $(NODEJS_VERSIONS); \
23
20
  do echo "-- Node version $$v --"; \
24
- nave use $$v $(MOCHA) -u tdd --exit -R progress test; \
21
+ nave use $$v node --test; \
25
22
  done
26
23
 
27
- coverage: $(NYC)
28
- $(NYC) --clean --reporter=lcov --reporter=text $(_MOCHA) -u tdd --exit -R progress test/
29
- @echo "HTML report at file://$$(pwd)/coverage/lcov-report/index.html"
24
+ coverage:
25
+ node --test --test-coverage
30
26
 
31
27
  lib/defs.js: clean bin/generate-defs test
32
28
 
@@ -42,8 +38,5 @@ bin/generate-defs: $(UGLIFY) bin/generate-defs.js bin/amqp-rabbitmq-0.9.1.json
42
38
  bin/amqp-rabbitmq-0.9.1.json:
43
39
  curl -L $(AMQP_JSON) > $@
44
40
 
45
- $(ISTANBUL):
46
- npm install
47
-
48
41
  $(UGLIFY):
49
42
  npm install
package/README.md CHANGED
@@ -9,11 +9,6 @@ A library for making AMQP 0-9-1 clients for Node.JS, and an AMQP 0-9-1 client fo
9
9
 
10
10
  npm install amqplib
11
11
 
12
- ## ❤️ Help Support Jack
13
- One of my close friends, Jack, was recently diagnosed with terminal brain cancer (grade 4 astrocytoma). He’s a young father facing an unimaginably tough road with remarkable courage. Thanks to chemotherapy, radiotherapy, and your support, two of his tumours have stopped showing activity. Donations help Jack continue accessing promising complementary therapies, attend hospital appointments, and spend meaningful time with his children.
14
-
15
- If you’ve benefited from amqplib, please consider supporting Jack’s journey through his [J Crushing Cancer](https://www.gofundme.com/f/j-crushing-cancer) gofundme page. Thank you - @cressie176
16
-
17
12
  ## RabbitMQ Compatibility
18
13
 
19
14
  Only `0.10.7` and later versions of this library are compatible with RabbitMQ 4.1.0 (and later releases).