redis 3.0.0 → 3.1.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 (54) hide show
  1. package/.deepsource.toml +9 -0
  2. package/CHANGELOG.md +1 -0
  3. package/LICENSE +1 -1
  4. package/README.md +25 -21
  5. package/heroku/index.js +14 -0
  6. package/heroku/node_modules/.package-lock.json +57 -0
  7. package/heroku/node_modules/denque/CHANGELOG.md +4 -0
  8. package/heroku/node_modules/denque/LICENSE +13 -0
  9. package/heroku/node_modules/denque/README.md +362 -0
  10. package/heroku/node_modules/denque/index.d.ts +31 -0
  11. package/heroku/node_modules/denque/index.js +443 -0
  12. package/heroku/node_modules/denque/package.json +55 -0
  13. package/heroku/node_modules/redis/.deepsource.toml +9 -0
  14. package/heroku/node_modules/redis/CHANGELOG.md +880 -0
  15. package/heroku/node_modules/redis/LICENSE +24 -0
  16. package/heroku/node_modules/redis/README.md +1009 -0
  17. package/heroku/node_modules/redis/a.js +12 -0
  18. package/heroku/node_modules/redis/index.js +1039 -0
  19. package/heroku/node_modules/redis/lib/command.js +16 -0
  20. package/heroku/node_modules/redis/lib/commands.js +105 -0
  21. package/heroku/node_modules/redis/lib/createClient.js +88 -0
  22. package/heroku/node_modules/redis/lib/customErrors.js +58 -0
  23. package/heroku/node_modules/redis/lib/debug.js +13 -0
  24. package/heroku/node_modules/redis/lib/extendedApi.js +113 -0
  25. package/heroku/node_modules/redis/lib/individualCommands.js +629 -0
  26. package/heroku/node_modules/redis/lib/multi.js +187 -0
  27. package/heroku/node_modules/redis/lib/utils.js +134 -0
  28. package/heroku/node_modules/redis/npm +0 -0
  29. package/heroku/node_modules/redis/package.json +77 -0
  30. package/heroku/node_modules/redis-commands/LICENSE +22 -0
  31. package/heroku/node_modules/redis-commands/README.md +51 -0
  32. package/heroku/node_modules/redis-commands/changelog.md +83 -0
  33. package/heroku/node_modules/redis-commands/commands.json +2334 -0
  34. package/heroku/node_modules/redis-commands/index.js +168 -0
  35. package/heroku/node_modules/redis-commands/package.json +41 -0
  36. package/heroku/node_modules/redis-commands/tools/build.js +62 -0
  37. package/heroku/node_modules/redis-errors/LICENSE +22 -0
  38. package/heroku/node_modules/redis-errors/README.md +116 -0
  39. package/heroku/node_modules/redis-errors/index.js +7 -0
  40. package/heroku/node_modules/redis-errors/lib/modern.js +59 -0
  41. package/heroku/node_modules/redis-errors/lib/old.js +119 -0
  42. package/heroku/node_modules/redis-errors/package.json +41 -0
  43. package/heroku/node_modules/redis-parser/LICENSE +22 -0
  44. package/heroku/node_modules/redis-parser/README.md +166 -0
  45. package/heroku/node_modules/redis-parser/changelog.md +156 -0
  46. package/heroku/node_modules/redis-parser/index.js +3 -0
  47. package/heroku/node_modules/redis-parser/lib/parser.js +552 -0
  48. package/heroku/node_modules/redis-parser/package.json +53 -0
  49. package/heroku/package.json +9 -0
  50. package/index.js +8 -19
  51. package/lib/createClient.js +5 -1
  52. package/lib/individualCommands.js +19 -7
  53. package/lib/utils.js +1 -1
  54. package/package.json +15 -13
@@ -4,7 +4,7 @@ var utils = require('./utils');
4
4
  var debug = require('./debug');
5
5
  var Multi = require('./multi');
6
6
  var Command = require('./command');
7
- var no_password_is_set = /no password is set/;
7
+ var no_password_is_set = /no password is set|called without any password configured/;
8
8
  var loading = /LOADING/;
9
9
  var RedisClient = require('../').RedisClient;
10
10
 
@@ -180,7 +180,7 @@ Multi.prototype.info = Multi.prototype.INFO = function info (section, callback)
180
180
  return this;
181
181
  };
182
182
 
183
- function auth_callback (self, pass, callback) {
183
+ function auth_callback (self, pass, user, callback) {
184
184
  return function (err, res) {
185
185
  if (err) {
186
186
  if (no_password_is_set.test(err.message)) {
@@ -191,7 +191,7 @@ function auth_callback (self, pass, callback) {
191
191
  // If redis is still loading the db, it will not authenticate and everything else will fail
192
192
  debug('Redis still loading, trying to authenticate later');
193
193
  setTimeout(function () {
194
- self.auth(pass, callback);
194
+ self.auth(pass, user, callback);
195
195
  }, 100);
196
196
  return;
197
197
  }
@@ -200,25 +200,37 @@ function auth_callback (self, pass, callback) {
200
200
  };
201
201
  }
202
202
 
203
- RedisClient.prototype.auth = RedisClient.prototype.AUTH = function auth (pass, callback) {
203
+ RedisClient.prototype.auth = RedisClient.prototype.AUTH = function auth (pass, user, callback) {
204
204
  debug('Sending auth to ' + this.address + ' id ' + this.connection_id);
205
205
 
206
+ // Backward compatibility support for auth with password only
207
+ if (user instanceof Function) {
208
+ callback = user;
209
+ user = null;
210
+ }
206
211
  // Stash auth for connect and reconnect.
207
212
  this.auth_pass = pass;
213
+ this.auth_user = user;
208
214
  var ready = this.ready;
209
215
  this.ready = ready || this.offline_queue.length === 0;
210
- var tmp = this.internal_send_command(new Command('auth', [pass], auth_callback(this, pass, callback)));
216
+ var tmp = this.internal_send_command(new Command('auth', user ? [user, pass] : [pass], auth_callback(this, pass, user, callback)));
211
217
  this.ready = ready;
212
218
  return tmp;
213
219
  };
214
220
 
215
221
  // Only works with batch, not in a transaction
216
- Multi.prototype.auth = Multi.prototype.AUTH = function auth (pass, callback) {
222
+ Multi.prototype.auth = Multi.prototype.AUTH = function auth (pass, user, callback) {
217
223
  debug('Sending auth to ' + this.address + ' id ' + this.connection_id);
218
224
 
225
+ // Backward compatibility support for auth with password only
226
+ if (user instanceof Function) {
227
+ callback = user;
228
+ user = null;
229
+ }
219
230
  // Stash auth for connect and reconnect.
220
231
  this.auth_pass = pass;
221
- this.queue.push(new Command('auth', [pass], auth_callback(this._client, callback)));
232
+ this.auth_user = user;
233
+ this.queue.push(new Command('auth', user ? [user, pass] : [pass], auth_callback(this._client, pass, user, callback)));
222
234
  return this;
223
235
  };
224
236
 
package/lib/utils.js CHANGED
@@ -127,7 +127,7 @@ module.exports = {
127
127
  reply_to_object: replyToObject,
128
128
  print: print,
129
129
  err_code: /^([A-Z]+)\s+(.+)$/,
130
- monitor_regex: /^[0-9]{10,11}\.[0-9]+ \[[0-9]+ .+\]( ".+?")+$/,
130
+ monitor_regex: /^[0-9]{10,11}\.[0-9]+ \[[0-9]+ .+\].*"$/,
131
131
  clone: convenienceClone,
132
132
  callback_or_emit: callbackOrEmit,
133
133
  reply_in_order: replyInOrder
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redis",
3
- "version": "3.0.0",
3
+ "version": "3.1.1",
4
4
  "description": "A high performance Redis client.",
5
5
  "keywords": [
6
6
  "database",
@@ -30,31 +30,33 @@
30
30
  "coveralls": "nyc report --reporter=text-lcov | coveralls",
31
31
  "coverage": "nyc report --reporter=html",
32
32
  "benchmark": "node benchmarks/multi_bench.js",
33
- "test": "nyc --cache mocha ./test/*.js ./test/commands/*.js --timeout=8000",
34
- "lint": "eslint . --fix && npm run coverage",
33
+ "test": "nyc --cache mocha ./test/*.spec.js ./test/commands/*.spec.js --timeout=8000 && npm run coverage",
34
+ "lint": "eslint .",
35
+ "lint:fix": "eslint . --fix",
36
+ "lint:report": "eslint --output-file=eslint-report.json --format=json .",
35
37
  "compare": "node benchmarks/diff_multi_bench_output.js beforeBench.txt afterBench.txt"
36
38
  },
37
39
  "dependencies": {
38
- "denque": "^1.4.1",
39
- "prettier": "^1.19.1",
40
- "redis-commands": "^1.5.0",
40
+ "denque": "^1.5.0",
41
+ "redis-commands": "^1.7.0",
41
42
  "redis-errors": "^1.2.0",
42
43
  "redis-parser": "^3.0.0"
43
44
  },
44
45
  "engines": {
45
- "node": ">=6"
46
+ "node": ">=10"
46
47
  },
47
48
  "devDependencies": {
48
49
  "bluebird": "^3.7.2",
49
- "coveralls": "^2.11.2",
50
- "eslint": "^6.8.0",
50
+ "coveralls": "^3.1.0",
51
+ "cross-spawn": "^7.0.3",
52
+ "eslint": "^7.21.0",
51
53
  "intercept-stdout": "~0.1.2",
52
54
  "metrics": "^0.1.21",
53
- "mocha": "^4.1.0",
54
- "nyc": "^14.1.1",
55
+ "mocha": "^8.3.0",
56
+ "nyc": "^15.1.0",
57
+ "prettier": "^2.2.1",
55
58
  "tcp-port-used": "^1.0.1",
56
- "uuid": "^3.4.0",
57
- "cross-spawn": "^6.0.5"
59
+ "uuid": "^8.3.2"
58
60
  },
59
61
  "repository": {
60
62
  "type": "git",