deepbase-redis 3.0.8 → 3.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepbase-redis",
3
- "version": "3.0.8",
3
+ "version": "3.1.0",
4
4
  "description": "⚡ DeepBase Redis Stack - driver",
5
5
  "type": "module",
6
6
  "main": "src/index.cjs",
@@ -15,7 +15,7 @@
15
15
  "redis": "^4.7.0"
16
16
  },
17
17
  "peerDependencies": {
18
- "deepbase": "^3.0.8"
18
+ "deepbase": "^3.1.0"
19
19
  },
20
20
  "scripts": {
21
21
  "test": "mocha test/test.js"
@@ -30,7 +30,7 @@ export class RedisDriver extends DeepBaseDriver {
30
30
  }
31
31
 
32
32
  const key = args.shift();
33
- const path = args.length == 0 ? "." : args.join(".");
33
+ const path = args.length == 0 ? "." : this._pathToKey(args);
34
34
 
35
35
  try {
36
36
  return await this.client.json.get(this.name + ":" + key, { path });
@@ -46,7 +46,7 @@ export class RedisDriver extends DeepBaseDriver {
46
46
  const value = args[args.length - 1];
47
47
 
48
48
  const key = keys.shift();
49
- const keyPath = keys.length == 0 ? "." : keys.join(".");
49
+ const keyPath = keys.length == 0 ? "." : this._pathToKey(keys);
50
50
  await this._set(key, keyPath, value);
51
51
 
52
52
  return args.slice(0, -1);
@@ -55,7 +55,7 @@ export class RedisDriver extends DeepBaseDriver {
55
55
  async inc(...args) {
56
56
  const i = args.pop();
57
57
  const key = args.shift();
58
- const path = args.length == 0 ? "." : args.join(".");
58
+ const path = args.length == 0 ? "." : this._pathToKey(args);
59
59
 
60
60
  try {
61
61
  await this.client.json.numIncrBy(this.name + ":" + key, path, i);
@@ -81,7 +81,7 @@ export class RedisDriver extends DeepBaseDriver {
81
81
  }
82
82
 
83
83
  const key = args.shift();
84
- const path = args.length == 0 ? "." : args.join(".");
84
+ const path = args.length == 0 ? "." : this._pathToKey(args);
85
85
  await this.client.json.del(this.name + ":" + key, path);
86
86
 
87
87
  return [key, ...args];
@@ -108,9 +108,9 @@ export class RedisDriver extends DeepBaseDriver {
108
108
  try {
109
109
  await this.client.json.set(this.name + ":" + key, path, value);
110
110
  } catch (error) {
111
- const keys = path.split('.');
111
+ const keys = this._keyToPath(path);
112
112
  keys.pop();
113
- const keyPath = keys.length == 0 ? "." : keys.join(".");
113
+ const keyPath = keys.length == 0 ? "." : this._pathToKey(keys);
114
114
  await this._set(key, keyPath, {});
115
115
  await this._set(key, path, value);
116
116
  }