amqplib 0.10.8 → 1.0.0

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 (85) 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/bin/generate-defs.js +382 -369
  10. package/biome.json +51 -0
  11. package/callback_api.js +12 -8
  12. package/channel_api.js +5 -10
  13. package/examples/direct_reply_to_client.js +9 -5
  14. package/examples/direct_reply_to_server.js +8 -6
  15. package/examples/headers.js +13 -10
  16. package/examples/receive_generator.js +13 -20
  17. package/examples/send_generators.js +2 -9
  18. package/examples/ssl.js +2 -3
  19. package/examples/stream_queues/receive_stream.js +39 -36
  20. package/examples/stream_queues/send_stream.js +26 -29
  21. package/examples/tutorials/callback_api/emit_log.js +4 -3
  22. package/examples/tutorials/callback_api/emit_log_direct.js +5 -4
  23. package/examples/tutorials/callback_api/emit_log_topic.js +5 -4
  24. package/examples/tutorials/callback_api/new_task.js +5 -4
  25. package/examples/tutorials/callback_api/receive.js +16 -10
  26. package/examples/tutorials/callback_api/receive_logs.js +17 -11
  27. package/examples/tutorials/callback_api/receive_logs_direct.js +19 -13
  28. package/examples/tutorials/callback_api/receive_logs_topic.js +19 -14
  29. package/examples/tutorials/callback_api/rpc_client.js +20 -16
  30. package/examples/tutorials/callback_api/rpc_server.js +27 -21
  31. package/examples/tutorials/callback_api/send.js +4 -3
  32. package/examples/tutorials/callback_api/worker.js +18 -13
  33. package/examples/tutorials/emit_log.js +4 -6
  34. package/examples/tutorials/emit_log_direct.js +5 -7
  35. package/examples/tutorials/emit_log_topic.js +5 -7
  36. package/examples/tutorials/new_task.js +4 -6
  37. package/examples/tutorials/receive.js +8 -4
  38. package/examples/tutorials/receive_logs.js +10 -6
  39. package/examples/tutorials/receive_logs_direct.js +16 -10
  40. package/examples/tutorials/receive_logs_topic.js +16 -11
  41. package/examples/tutorials/rpc_client.js +17 -15
  42. package/examples/tutorials/rpc_server.js +9 -8
  43. package/examples/tutorials/send.js +4 -6
  44. package/examples/tutorials/worker.js +17 -14
  45. package/examples/waitForConfirms.js +2 -2
  46. package/lefthook.yml +14 -0
  47. package/lib/api_args.js +124 -149
  48. package/lib/bitset.js +28 -18
  49. package/lib/callback_model.js +134 -190
  50. package/lib/channel.js +175 -213
  51. package/lib/channel_model.js +41 -85
  52. package/lib/codec.js +257 -228
  53. package/lib/connect.js +74 -82
  54. package/lib/connection.js +204 -240
  55. package/lib/credentials.js +21 -29
  56. package/lib/defs.js +2559 -1927
  57. package/lib/error.js +5 -6
  58. package/lib/format.js +15 -33
  59. package/lib/frame.js +66 -66
  60. package/lib/heartbeat.js +17 -24
  61. package/lib/mux.js +32 -41
  62. package/package.json +8 -5
  63. package/test/bitset.test.js +65 -0
  64. package/test/callback_api.test.js +438 -0
  65. package/test/channel.test.js +592 -0
  66. package/test/channel_api.test.js +537 -0
  67. package/test/codec.test.js +172 -0
  68. package/test/connect.test.js +196 -0
  69. package/test/connection.test.js +330 -0
  70. package/test/data.test.js +33 -0
  71. package/test/frame.test.js +180 -0
  72. package/test/lib/data.js +249 -0
  73. package/test/lib/util.js +223 -0
  74. package/test/mux.test.js +215 -0
  75. package/test/bitset.js +0 -69
  76. package/test/callback_api.js +0 -379
  77. package/test/channel.js +0 -621
  78. package/test/channel_api.js +0 -606
  79. package/test/codec.js +0 -237
  80. package/test/connect.js +0 -197
  81. package/test/connection.js +0 -390
  82. package/test/data.js +0 -269
  83. package/test/frame.js +0 -191
  84. package/test/mux.js +0 -203
  85. 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.0
4
+ - **BREAKING**: Update minimum Node.js requirement to v18
5
+ - Introduce Biome formatter for consistent code formatting
6
+ - Add automated formatting via pre-commit hooks using Lefthook
7
+ - Format entire codebase with standardised formatting rules
8
+ - Add npm format script for manual code formatting
9
+ - Enable noUnusedFunctionParameters lint rule and fix all violations
10
+ - Enable noUnusedVariables lint rule and remove all unused variables from codebase
11
+ - Replace all var declarations with let/const for modern JavaScript standards
12
+ - Ensure parseInt calls use explicit radix parameter for clarity and reliability
13
+ - Fix precision loss in test data generators by using JavaScript safe integer limits
14
+ - Add block scoping to switch statement cases to prevent variable declaration issues
15
+ - Enforce const usage for variables that are never reassigned
16
+ - Add node: protocol prefix to Node.js builtin module imports for clarity
17
+ - Use modern exponentiation operator (**) instead of Math.pow()
18
+ - Replace string concatenation with modern template literals
19
+ - Remove redundant 'use strict' directives as modules are automatically in strict mode
20
+ - Refactor assignment-in-expression patterns to improve code clarity and readability
21
+ - Replace comma operators with individual statements for clearer, more readable code
22
+ - Split comma-separated variable declarations into individual statements for consistency
23
+ - Replace Object.prototype.hasOwnProperty() with safer Object.hasOwn() method
24
+ - Enforce strict equality checks (=== and !==) instead of loose equality (== and !=)
25
+ - Replace global isNaN with Number.isNaN for safer type checking
26
+ - Ensure no variable redeclarations exist to prevent shadowing issues
27
+ - Replace global isFinite with Number.isFinite for safer numeric validation
28
+ - Enable useArrowFunction lint rule to prefer arrow functions for cleaner syntax
29
+ - Enable noUselessCatch lint rule to prevent useless catch blocks that only rethrow errors
30
+ - Enable noArguments rule to enforce modern rest parameters instead of legacy arguments object
31
+ - Enable bracketSpacing formatting rule to add spaces inside object literals
32
+ - Migrate test suite from Mocha to Node.js built-in test runner
33
+
34
+ ## v0.10.9
35
+ - Add support for IPv6 urls
36
+
3
37
  ## v0.10.8
4
38
  - Updated README
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