amqplib 0.10.2 → 0.10.4

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 (55) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +41 -0
  2. package/.github/workflows/test.yml +15 -2
  3. package/CHANGELOG.md +12 -1
  4. package/Makefile +3 -4
  5. package/README.md +1 -1
  6. package/bin/generate-defs.js +5 -5
  7. package/examples/direct_reply_to_client.js +22 -0
  8. package/examples/direct_reply_to_server.js +25 -0
  9. package/examples/headers.js +29 -31
  10. package/examples/ssl.js +16 -10
  11. package/examples/stream_queues/README.md +40 -0
  12. package/examples/stream_queues/package.json +14 -0
  13. package/examples/stream_queues/receive_stream.js +55 -0
  14. package/examples/stream_queues/send_stream.js +38 -0
  15. package/examples/tutorials/callback_api/emit_log.js +22 -22
  16. package/examples/tutorials/callback_api/emit_log_direct.js +24 -24
  17. package/examples/tutorials/callback_api/emit_log_topic.js +23 -20
  18. package/examples/tutorials/callback_api/new_task.js +21 -20
  19. package/examples/tutorials/callback_api/receive.js +27 -21
  20. package/examples/tutorials/callback_api/receive_logs.js +32 -26
  21. package/examples/tutorials/callback_api/receive_logs_direct.js +42 -41
  22. package/examples/tutorials/callback_api/receive_logs_topic.js +43 -40
  23. package/examples/tutorials/callback_api/rpc_client.js +39 -37
  24. package/examples/tutorials/callback_api/rpc_server.js +42 -32
  25. package/examples/tutorials/callback_api/send.js +21 -22
  26. package/examples/tutorials/callback_api/worker.js +29 -25
  27. package/examples/tutorials/emit_log.js +20 -15
  28. package/examples/tutorials/emit_log_direct.js +22 -16
  29. package/examples/tutorials/emit_log_topic.js +22 -15
  30. package/examples/tutorials/new_task.js +20 -13
  31. package/examples/tutorials/receive.js +19 -14
  32. package/examples/tutorials/receive_logs.js +25 -23
  33. package/examples/tutorials/receive_logs_direct.js +29 -35
  34. package/examples/tutorials/receive_logs_topic.js +28 -32
  35. package/examples/tutorials/rpc_client.js +37 -40
  36. package/examples/tutorials/rpc_server.js +36 -29
  37. package/examples/tutorials/send.js +26 -18
  38. package/examples/tutorials/worker.js +27 -21
  39. package/examples/waitForConfirms.js +18 -19
  40. package/lib/callback_model.js +295 -290
  41. package/lib/channel.js +353 -346
  42. package/lib/channel_model.js +5 -1
  43. package/lib/codec.js +2 -2
  44. package/lib/connection.js +542 -527
  45. package/lib/credentials.js +1 -1
  46. package/lib/defs.js +2568 -2457
  47. package/lib/format.js +0 -1
  48. package/lib/frame.js +1 -1
  49. package/lib/heartbeat.js +32 -29
  50. package/lib/mux.js +96 -99
  51. package/package.json +2 -2
  52. package/test/callback_api.js +182 -174
  53. package/test/channel_api.js +455 -445
  54. package/test/codec.js +4 -4
  55. package/test/frame.js +5 -5
@@ -26,6 +26,10 @@ class ChannelModel extends EventEmitter {
26
26
  return promisify(this.connection.close.bind(this.connection))();
27
27
  }
28
28
 
29
+ updateSecret(newSecret, reason) {
30
+ return promisify(this.connection._updateSecret.bind(this.connection))(newSecret, reason);
31
+ }
32
+
29
33
  async createChannel() {
30
34
  const channel = new Channel(this.connection);
31
35
  await channel.open();
@@ -264,7 +268,7 @@ Channel.prototype.prefetch = Channel.prototype.qos
264
268
  class ConfirmChannel extends Channel {
265
269
  publish(exchange, routingKey, content, options, cb) {
266
270
  this.pushConfirmCallback(cb);
267
- return Channel.prototype.publish.call(this, exchange, routingKey, content, options);
271
+ return super.publish(exchange, routingKey, content, options);
268
272
  }
269
273
 
270
274
  sendToQueue(queue, content, options, cb) {
package/lib/codec.js CHANGED
@@ -262,7 +262,7 @@ function decodeFields(slice) {
262
262
  break;
263
263
  case 'F':
264
264
  len = slice.readUInt32BE(offset); offset += 4;
265
- val = decodeFields(slice.slice(offset, offset + len));
265
+ val = decodeFields(slice.subarray(offset, offset + len));
266
266
  offset += len;
267
267
  break;
268
268
  case 'A':
@@ -290,7 +290,7 @@ function decodeFields(slice) {
290
290
  break;
291
291
  case 'x':
292
292
  len = slice.readUInt32BE(offset); offset += 4;
293
- val = slice.slice(offset, offset + len);
293
+ val = slice.subarray(offset, offset + len);
294
294
  offset += len;
295
295
  break;
296
296
  default: