rascal 16.2.0 → 16.3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## 16.3.0 Unreleased
4
+
5
+ - Simplify logic which determines whether ackOrNack should be a callback or a promise
6
+ - Report repeated calls to ackOrNack
7
+ - Bump deps
8
+
3
9
  ## 16.2.0
4
10
 
5
11
  - Disable indirect dependabot updates (they're almost pointless for modules since package-lock.json isn't published)
@@ -203,9 +203,7 @@ function Subscription(broker, vhost, subscriptionConfig, counter) {
203
203
  }
204
204
 
205
205
  function getAckOrNack(session, message) {
206
- if (!broker.promises || subscriptionConfig.promisifyAckOrNack === false) return ackOrNack.bind(null, session, message);
207
- if (subscriptionConfig.promisifyAckOrNack) return ackOrNackP.bind(null, session, message);
208
- return ackOrNack.bind(null, session, message);
206
+ return broker.promises && subscriptionConfig.promisifyAckOrNack ? ackOrNackP.bind(null, session, message) : ackOrNack.bind(null, session, message);
209
207
  }
210
208
 
211
209
  function ackOrNack(session, message, err, options, next) {
@@ -214,6 +212,10 @@ function Subscription(broker, vhost, subscriptionConfig, counter) {
214
212
  if (arguments.length === 3) return ackOrNack(session, message, err, undefined, emitOnError.bind(null, session));
215
213
  if (arguments.length === 4 && _.isFunction(arguments[3])) return ackOrNack(session, message, err, undefined, arguments[3]);
216
214
  if (arguments.length === 4) return ackOrNack(session, message, err, options, emitOnError.bind(null, session));
215
+
216
+ if (message.__rascal_acknowledged) return next(new Error('ackOrNack should only be called once per message'));
217
+ message.__rascal_acknowledged = true;
218
+
217
219
  if (err) return subscriberError.handle(session, message, err, options, next);
218
220
  if (options && options.all) return session._ackAll(message, next);
219
221
  session._ack(message, next);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rascal",
3
- "version": "16.2.0",
3
+ "version": "16.3.0",
4
4
  "description": "A config driven wrapper for amqplib supporting multi-host connections, automatic error recovery, redelivery flood protection, transparent encryption / decryption, channel pooling and publication timeouts",
5
5
  "main": "index.js",
6
6
  "dependencies": {
@@ -12,7 +12,7 @@
12
12
  "lru-cache": "^7.10.1",
13
13
  "safe-json-parse": "^4.0.0",
14
14
  "stashback": "^2.0.1",
15
- "superagent": "^7.1.3",
15
+ "superagent": "^8.0.9",
16
16
  "uuid": "^8.3.2",
17
17
  "xregexp": "^5.1.0"
18
18
  },
@@ -20,10 +20,10 @@
20
20
  "amqplib": "^0.10.2",
21
21
  "chalk": "^4.1.2",
22
22
  "chance": "^1.1.8",
23
- "eslint": "^8.21.0",
23
+ "eslint": "^8.33.0",
24
24
  "eslint-config-airbnb-base": "^15.0.0",
25
25
  "eslint-config-prettier": "^8.3.0",
26
- "eslint-plugin-import": "^2.26.0",
26
+ "eslint-plugin-import": "^2.27.5",
27
27
  "husky": "^8.0.1",
28
28
  "lint-staged": "^11.2.4",
29
29
  "nyc": "^15.1.0",