@upstash/redis 1.3.0-alpha.0 → 1.3.0-alpha.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.
@@ -117,8 +117,8 @@ var EchoCommand = class extends Command {
117
117
 
118
118
  // pkg/commands/eval.ts
119
119
  var EvalCommand = class extends Command {
120
- constructor(script, nArgs, ...args) {
121
- super(["eval", script, nArgs, ...args]);
120
+ constructor(script, keys, args) {
121
+ super(["eval", script, keys.length, ...keys, ...args != null ? args : []]);
122
122
  }
123
123
  };
124
124
 
@@ -3,6 +3,7 @@ import {
3
3
  BitCountCommand,
4
4
  BitOpCommand,
5
5
  BitPosCommand,
6
+ Command,
6
7
  DBSizeCommand,
7
8
  DecrByCommand,
8
9
  DecrCommand,
@@ -108,11 +109,50 @@ import {
108
109
  ZScanCommand,
109
110
  ZScoreCommand,
110
111
  ZUnionStoreCommand
111
- } from "./chunk-TLMWNHIZ.mjs";
112
+ } from "./chunk-5567SQFQ.mjs";
112
113
  import {
113
114
  UpstashError
114
115
  } from "./chunk-7YUZYRJS.mjs";
115
116
 
117
+ // pkg/commands/evalsha.ts
118
+ var EvalshaCommand = class extends Command {
119
+ constructor(sha, keys, args) {
120
+ super(["evalsha", sha, keys.length, ...keys, ...args != null ? args : []]);
121
+ }
122
+ };
123
+
124
+ // pkg/commands/script_exists.ts
125
+ var ScriptExistsCommand = class extends Command {
126
+ constructor(...hash) {
127
+ super(["script", "exists", ...hash], {
128
+ deserialize: (result) => {
129
+ const parsed = result;
130
+ return parsed.length === 1 ? parsed[0] : parsed;
131
+ }
132
+ });
133
+ }
134
+ };
135
+
136
+ // pkg/commands/script_flush.ts
137
+ var ScriptFlushCommand = class extends Command {
138
+ constructor(opts) {
139
+ const cmd = ["script", "flush"];
140
+ if (opts == null ? void 0 : opts.sync) {
141
+ cmd.push("sync");
142
+ } else if (opts == null ? void 0 : opts.async) {
143
+ cmd.push("async");
144
+ }
145
+ super(cmd);
146
+ }
147
+ };
148
+
149
+ // pkg/commands/script_load.ts
150
+ var ScriptLoadCommand = class extends Command {
151
+ constructor(script) {
152
+ super(["script", "load", script]);
153
+ }
154
+ };
155
+
116
156
  // pkg/pipeline.ts
117
157
  var Pipeline = class {
118
158
  constructor(client) {
@@ -141,6 +181,7 @@ var Pipeline = class {
141
181
  this.del = (...args) => this.chain(new DelCommand(...args));
142
182
  this.echo = (...args) => this.chain(new EchoCommand(...args));
143
183
  this.eval = (...args) => this.chain(new EvalCommand(...args));
184
+ this.evalsha = (...args) => this.chain(new EvalshaCommand(...args));
144
185
  this.exists = (...args) => this.chain(new ExistsCommand(...args));
145
186
  this.expire = (...args) => this.chain(new ExpireCommand(...args));
146
187
  this.expireat = (...args) => this.chain(new ExpireAtCommand(...args));
@@ -198,6 +239,9 @@ var Pipeline = class {
198
239
  this.sadd = (key, ...members) => this.chain(new SAddCommand(key, ...members));
199
240
  this.scan = (...args) => this.chain(new ScanCommand(...args));
200
241
  this.scard = (...args) => this.chain(new SCardCommand(...args));
242
+ this.scriptExists = (...args) => this.chain(new ScriptExistsCommand(...args));
243
+ this.scriptFlush = (...args) => this.chain(new ScriptFlushCommand(...args));
244
+ this.scriptLoad = (...args) => this.chain(new ScriptLoadCommand(...args));
201
245
  this.sdiff = (...args) => this.chain(new SDiffCommand(...args));
202
246
  this.sdiffstore = (...args) => this.chain(new SDiffStoreCommand(...args));
203
247
  this.set = (key, value, opts) => this.chain(new SetCommand(key, value, opts));
@@ -268,6 +312,7 @@ var Redis = class {
268
312
  this.del = (...args) => new DelCommand(...args).exec(this.client);
269
313
  this.echo = (...args) => new EchoCommand(...args).exec(this.client);
270
314
  this.eval = (...args) => new EvalCommand(...args).exec(this.client);
315
+ this.evalsha = (...args) => new EvalshaCommand(...args).exec(this.client);
271
316
  this.exists = (...args) => new ExistsCommand(...args).exec(this.client);
272
317
  this.expire = (...args) => new ExpireCommand(...args).exec(this.client);
273
318
  this.expireat = (...args) => new ExpireAtCommand(...args).exec(this.client);
@@ -325,6 +370,9 @@ var Redis = class {
325
370
  this.sadd = (key, ...members) => new SAddCommand(key, ...members).exec(this.client);
326
371
  this.scan = (...args) => new ScanCommand(...args).exec(this.client);
327
372
  this.scard = (...args) => new SCardCommand(...args).exec(this.client);
373
+ this.scriptExists = (...args) => new ScriptExistsCommand(...args).exec(this.client);
374
+ this.scriptFlush = (...args) => new ScriptFlushCommand(...args).exec(this.client);
375
+ this.scriptLoad = (...args) => new ScriptLoadCommand(...args).exec(this.client);
328
376
  this.sdiff = (...args) => new SDiffCommand(...args).exec(this.client);
329
377
  this.sdiffstore = (...args) => new SDiffStoreCommand(...args).exec(this.client);
330
378
  this.set = (key, value, opts) => new SetCommand(key, value, opts).exec(this.client);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Redis
3
- } from "./chunk-CWZSFQQQ.mjs";
3
+ } from "./chunk-KI7YOGWS.mjs";
4
4
  import {
5
5
  HttpClient
6
6
  } from "./chunk-HIDCSH5S.mjs";
package/cloudflare.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { R as Redis$1 } from './redis-5b966c20';
1
+ import { R as Redis$1 } from './redis-364a4445';
2
2
  import './http';
3
3
  import './zunionstore-342168a6';
4
4
 
package/cloudflare.js CHANGED
@@ -192,8 +192,8 @@ var EchoCommand = class extends Command {
192
192
 
193
193
  // pkg/commands/eval.ts
194
194
  var EvalCommand = class extends Command {
195
- constructor(script, nArgs, ...args) {
196
- super(["eval", script, nArgs, ...args]);
195
+ constructor(script, keys, args) {
196
+ super(["eval", script, keys.length, ...keys, ...args != null ? args : []]);
197
197
  }
198
198
  };
199
199
 
@@ -1049,6 +1049,45 @@ var ZUnionStoreCommand = class extends Command {
1049
1049
  }
1050
1050
  };
1051
1051
 
1052
+ // pkg/commands/evalsha.ts
1053
+ var EvalshaCommand = class extends Command {
1054
+ constructor(sha, keys, args) {
1055
+ super(["evalsha", sha, keys.length, ...keys, ...args != null ? args : []]);
1056
+ }
1057
+ };
1058
+
1059
+ // pkg/commands/script_exists.ts
1060
+ var ScriptExistsCommand = class extends Command {
1061
+ constructor(...hash) {
1062
+ super(["script", "exists", ...hash], {
1063
+ deserialize: (result) => {
1064
+ const parsed = result;
1065
+ return parsed.length === 1 ? parsed[0] : parsed;
1066
+ }
1067
+ });
1068
+ }
1069
+ };
1070
+
1071
+ // pkg/commands/script_flush.ts
1072
+ var ScriptFlushCommand = class extends Command {
1073
+ constructor(opts) {
1074
+ const cmd = ["script", "flush"];
1075
+ if (opts == null ? void 0 : opts.sync) {
1076
+ cmd.push("sync");
1077
+ } else if (opts == null ? void 0 : opts.async) {
1078
+ cmd.push("async");
1079
+ }
1080
+ super(cmd);
1081
+ }
1082
+ };
1083
+
1084
+ // pkg/commands/script_load.ts
1085
+ var ScriptLoadCommand = class extends Command {
1086
+ constructor(script) {
1087
+ super(["script", "load", script]);
1088
+ }
1089
+ };
1090
+
1052
1091
  // pkg/pipeline.ts
1053
1092
  var Pipeline = class {
1054
1093
  constructor(client) {
@@ -1077,6 +1116,7 @@ var Pipeline = class {
1077
1116
  this.del = (...args) => this.chain(new DelCommand(...args));
1078
1117
  this.echo = (...args) => this.chain(new EchoCommand(...args));
1079
1118
  this.eval = (...args) => this.chain(new EvalCommand(...args));
1119
+ this.evalsha = (...args) => this.chain(new EvalshaCommand(...args));
1080
1120
  this.exists = (...args) => this.chain(new ExistsCommand(...args));
1081
1121
  this.expire = (...args) => this.chain(new ExpireCommand(...args));
1082
1122
  this.expireat = (...args) => this.chain(new ExpireAtCommand(...args));
@@ -1134,6 +1174,9 @@ var Pipeline = class {
1134
1174
  this.sadd = (key, ...members) => this.chain(new SAddCommand(key, ...members));
1135
1175
  this.scan = (...args) => this.chain(new ScanCommand(...args));
1136
1176
  this.scard = (...args) => this.chain(new SCardCommand(...args));
1177
+ this.scriptExists = (...args) => this.chain(new ScriptExistsCommand(...args));
1178
+ this.scriptFlush = (...args) => this.chain(new ScriptFlushCommand(...args));
1179
+ this.scriptLoad = (...args) => this.chain(new ScriptLoadCommand(...args));
1137
1180
  this.sdiff = (...args) => this.chain(new SDiffCommand(...args));
1138
1181
  this.sdiffstore = (...args) => this.chain(new SDiffStoreCommand(...args));
1139
1182
  this.set = (key, value, opts) => this.chain(new SetCommand(key, value, opts));
@@ -1204,6 +1247,7 @@ var Redis = class {
1204
1247
  this.del = (...args) => new DelCommand(...args).exec(this.client);
1205
1248
  this.echo = (...args) => new EchoCommand(...args).exec(this.client);
1206
1249
  this.eval = (...args) => new EvalCommand(...args).exec(this.client);
1250
+ this.evalsha = (...args) => new EvalshaCommand(...args).exec(this.client);
1207
1251
  this.exists = (...args) => new ExistsCommand(...args).exec(this.client);
1208
1252
  this.expire = (...args) => new ExpireCommand(...args).exec(this.client);
1209
1253
  this.expireat = (...args) => new ExpireAtCommand(...args).exec(this.client);
@@ -1261,6 +1305,9 @@ var Redis = class {
1261
1305
  this.sadd = (key, ...members) => new SAddCommand(key, ...members).exec(this.client);
1262
1306
  this.scan = (...args) => new ScanCommand(...args).exec(this.client);
1263
1307
  this.scard = (...args) => new SCardCommand(...args).exec(this.client);
1308
+ this.scriptExists = (...args) => new ScriptExistsCommand(...args).exec(this.client);
1309
+ this.scriptFlush = (...args) => new ScriptFlushCommand(...args).exec(this.client);
1310
+ this.scriptLoad = (...args) => new ScriptLoadCommand(...args).exec(this.client);
1264
1311
  this.sdiff = (...args) => new SDiffCommand(...args).exec(this.client);
1265
1312
  this.sdiffstore = (...args) => new SDiffStoreCommand(...args).exec(this.client);
1266
1313
  this.set = (key, value, opts) => new SetCommand(key, value, opts).exec(this.client);
package/cloudflare.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Redis
3
- } from "./chunk-CWZSFQQQ.mjs";
4
- import "./chunk-TLMWNHIZ.mjs";
3
+ } from "./chunk-KI7YOGWS.mjs";
4
+ import "./chunk-5567SQFQ.mjs";
5
5
  import {
6
6
  HttpClient
7
7
  } from "./chunk-HIDCSH5S.mjs";
package/commands.d.ts CHANGED
@@ -71,7 +71,7 @@ declare class EchoCommand extends Command<string, string> {
71
71
  * @see https://redis.io/commands/eval
72
72
  */
73
73
  declare class EvalCommand<TArgs extends unknown[], TData> extends Command<unknown, TData> {
74
- constructor(script: string, nArgs: number, ...args: TArgs);
74
+ constructor(script: string, keys: string[], args: TArgs);
75
75
  }
76
76
 
77
77
  /**
package/commands.js CHANGED
@@ -259,8 +259,8 @@ var EchoCommand = class extends Command {
259
259
 
260
260
  // pkg/commands/eval.ts
261
261
  var EvalCommand = class extends Command {
262
- constructor(script, nArgs, ...args) {
263
- super(["eval", script, nArgs, ...args]);
262
+ constructor(script, keys, args) {
263
+ super(["eval", script, keys.length, ...keys, ...args != null ? args : []]);
264
264
  }
265
265
  };
266
266
 
package/commands.mjs CHANGED
@@ -109,7 +109,7 @@ import {
109
109
  ZScanCommand,
110
110
  ZScoreCommand,
111
111
  ZUnionStoreCommand
112
- } from "./chunk-TLMWNHIZ.mjs";
112
+ } from "./chunk-5567SQFQ.mjs";
113
113
  import "./chunk-7YUZYRJS.mjs";
114
114
  export {
115
115
  AppendCommand,
package/fastly.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { R as Redis$1 } from './redis-5b966c20';
1
+ import { R as Redis$1 } from './redis-364a4445';
2
2
  import './http';
3
3
  import './zunionstore-342168a6';
4
4
 
package/fastly.js CHANGED
@@ -192,8 +192,8 @@ var EchoCommand = class extends Command {
192
192
 
193
193
  // pkg/commands/eval.ts
194
194
  var EvalCommand = class extends Command {
195
- constructor(script, nArgs, ...args) {
196
- super(["eval", script, nArgs, ...args]);
195
+ constructor(script, keys, args) {
196
+ super(["eval", script, keys.length, ...keys, ...args != null ? args : []]);
197
197
  }
198
198
  };
199
199
 
@@ -1049,6 +1049,45 @@ var ZUnionStoreCommand = class extends Command {
1049
1049
  }
1050
1050
  };
1051
1051
 
1052
+ // pkg/commands/evalsha.ts
1053
+ var EvalshaCommand = class extends Command {
1054
+ constructor(sha, keys, args) {
1055
+ super(["evalsha", sha, keys.length, ...keys, ...args != null ? args : []]);
1056
+ }
1057
+ };
1058
+
1059
+ // pkg/commands/script_exists.ts
1060
+ var ScriptExistsCommand = class extends Command {
1061
+ constructor(...hash) {
1062
+ super(["script", "exists", ...hash], {
1063
+ deserialize: (result) => {
1064
+ const parsed = result;
1065
+ return parsed.length === 1 ? parsed[0] : parsed;
1066
+ }
1067
+ });
1068
+ }
1069
+ };
1070
+
1071
+ // pkg/commands/script_flush.ts
1072
+ var ScriptFlushCommand = class extends Command {
1073
+ constructor(opts) {
1074
+ const cmd = ["script", "flush"];
1075
+ if (opts == null ? void 0 : opts.sync) {
1076
+ cmd.push("sync");
1077
+ } else if (opts == null ? void 0 : opts.async) {
1078
+ cmd.push("async");
1079
+ }
1080
+ super(cmd);
1081
+ }
1082
+ };
1083
+
1084
+ // pkg/commands/script_load.ts
1085
+ var ScriptLoadCommand = class extends Command {
1086
+ constructor(script) {
1087
+ super(["script", "load", script]);
1088
+ }
1089
+ };
1090
+
1052
1091
  // pkg/pipeline.ts
1053
1092
  var Pipeline = class {
1054
1093
  constructor(client) {
@@ -1077,6 +1116,7 @@ var Pipeline = class {
1077
1116
  this.del = (...args) => this.chain(new DelCommand(...args));
1078
1117
  this.echo = (...args) => this.chain(new EchoCommand(...args));
1079
1118
  this.eval = (...args) => this.chain(new EvalCommand(...args));
1119
+ this.evalsha = (...args) => this.chain(new EvalshaCommand(...args));
1080
1120
  this.exists = (...args) => this.chain(new ExistsCommand(...args));
1081
1121
  this.expire = (...args) => this.chain(new ExpireCommand(...args));
1082
1122
  this.expireat = (...args) => this.chain(new ExpireAtCommand(...args));
@@ -1134,6 +1174,9 @@ var Pipeline = class {
1134
1174
  this.sadd = (key, ...members) => this.chain(new SAddCommand(key, ...members));
1135
1175
  this.scan = (...args) => this.chain(new ScanCommand(...args));
1136
1176
  this.scard = (...args) => this.chain(new SCardCommand(...args));
1177
+ this.scriptExists = (...args) => this.chain(new ScriptExistsCommand(...args));
1178
+ this.scriptFlush = (...args) => this.chain(new ScriptFlushCommand(...args));
1179
+ this.scriptLoad = (...args) => this.chain(new ScriptLoadCommand(...args));
1137
1180
  this.sdiff = (...args) => this.chain(new SDiffCommand(...args));
1138
1181
  this.sdiffstore = (...args) => this.chain(new SDiffStoreCommand(...args));
1139
1182
  this.set = (key, value, opts) => this.chain(new SetCommand(key, value, opts));
@@ -1204,6 +1247,7 @@ var Redis = class {
1204
1247
  this.del = (...args) => new DelCommand(...args).exec(this.client);
1205
1248
  this.echo = (...args) => new EchoCommand(...args).exec(this.client);
1206
1249
  this.eval = (...args) => new EvalCommand(...args).exec(this.client);
1250
+ this.evalsha = (...args) => new EvalshaCommand(...args).exec(this.client);
1207
1251
  this.exists = (...args) => new ExistsCommand(...args).exec(this.client);
1208
1252
  this.expire = (...args) => new ExpireCommand(...args).exec(this.client);
1209
1253
  this.expireat = (...args) => new ExpireAtCommand(...args).exec(this.client);
@@ -1261,6 +1305,9 @@ var Redis = class {
1261
1305
  this.sadd = (key, ...members) => new SAddCommand(key, ...members).exec(this.client);
1262
1306
  this.scan = (...args) => new ScanCommand(...args).exec(this.client);
1263
1307
  this.scard = (...args) => new SCardCommand(...args).exec(this.client);
1308
+ this.scriptExists = (...args) => new ScriptExistsCommand(...args).exec(this.client);
1309
+ this.scriptFlush = (...args) => new ScriptFlushCommand(...args).exec(this.client);
1310
+ this.scriptLoad = (...args) => new ScriptLoadCommand(...args).exec(this.client);
1264
1311
  this.sdiff = (...args) => new SDiffCommand(...args).exec(this.client);
1265
1312
  this.sdiffstore = (...args) => new SDiffStoreCommand(...args).exec(this.client);
1266
1313
  this.set = (key, value, opts) => new SetCommand(key, value, opts).exec(this.client);
package/fastly.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Redis
3
- } from "./chunk-CWZSFQQQ.mjs";
4
- import "./chunk-TLMWNHIZ.mjs";
3
+ } from "./chunk-KI7YOGWS.mjs";
4
+ import "./chunk-5567SQFQ.mjs";
5
5
  import {
6
6
  HttpClient
7
7
  } from "./chunk-HIDCSH5S.mjs";
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { Redis, RedisConfigNodejs } from './nodejs';
2
- import './redis-5b966c20';
2
+ import './redis-364a4445';
3
3
  import './http';
4
4
  import './zunionstore-342168a6';
5
5
 
package/index.js CHANGED
@@ -165,8 +165,8 @@ var EchoCommand = class extends Command {
165
165
 
166
166
  // pkg/commands/eval.ts
167
167
  var EvalCommand = class extends Command {
168
- constructor(script, nArgs, ...args) {
169
- super(["eval", script, nArgs, ...args]);
168
+ constructor(script, keys, args) {
169
+ super(["eval", script, keys.length, ...keys, ...args != null ? args : []]);
170
170
  }
171
171
  };
172
172
 
@@ -1022,6 +1022,45 @@ var ZUnionStoreCommand = class extends Command {
1022
1022
  }
1023
1023
  };
1024
1024
 
1025
+ // pkg/commands/evalsha.ts
1026
+ var EvalshaCommand = class extends Command {
1027
+ constructor(sha, keys, args) {
1028
+ super(["evalsha", sha, keys.length, ...keys, ...args != null ? args : []]);
1029
+ }
1030
+ };
1031
+
1032
+ // pkg/commands/script_exists.ts
1033
+ var ScriptExistsCommand = class extends Command {
1034
+ constructor(...hash) {
1035
+ super(["script", "exists", ...hash], {
1036
+ deserialize: (result) => {
1037
+ const parsed = result;
1038
+ return parsed.length === 1 ? parsed[0] : parsed;
1039
+ }
1040
+ });
1041
+ }
1042
+ };
1043
+
1044
+ // pkg/commands/script_flush.ts
1045
+ var ScriptFlushCommand = class extends Command {
1046
+ constructor(opts) {
1047
+ const cmd = ["script", "flush"];
1048
+ if (opts == null ? void 0 : opts.sync) {
1049
+ cmd.push("sync");
1050
+ } else if (opts == null ? void 0 : opts.async) {
1051
+ cmd.push("async");
1052
+ }
1053
+ super(cmd);
1054
+ }
1055
+ };
1056
+
1057
+ // pkg/commands/script_load.ts
1058
+ var ScriptLoadCommand = class extends Command {
1059
+ constructor(script) {
1060
+ super(["script", "load", script]);
1061
+ }
1062
+ };
1063
+
1025
1064
  // pkg/pipeline.ts
1026
1065
  var Pipeline = class {
1027
1066
  constructor(client) {
@@ -1050,6 +1089,7 @@ var Pipeline = class {
1050
1089
  this.del = (...args) => this.chain(new DelCommand(...args));
1051
1090
  this.echo = (...args) => this.chain(new EchoCommand(...args));
1052
1091
  this.eval = (...args) => this.chain(new EvalCommand(...args));
1092
+ this.evalsha = (...args) => this.chain(new EvalshaCommand(...args));
1053
1093
  this.exists = (...args) => this.chain(new ExistsCommand(...args));
1054
1094
  this.expire = (...args) => this.chain(new ExpireCommand(...args));
1055
1095
  this.expireat = (...args) => this.chain(new ExpireAtCommand(...args));
@@ -1107,6 +1147,9 @@ var Pipeline = class {
1107
1147
  this.sadd = (key, ...members) => this.chain(new SAddCommand(key, ...members));
1108
1148
  this.scan = (...args) => this.chain(new ScanCommand(...args));
1109
1149
  this.scard = (...args) => this.chain(new SCardCommand(...args));
1150
+ this.scriptExists = (...args) => this.chain(new ScriptExistsCommand(...args));
1151
+ this.scriptFlush = (...args) => this.chain(new ScriptFlushCommand(...args));
1152
+ this.scriptLoad = (...args) => this.chain(new ScriptLoadCommand(...args));
1110
1153
  this.sdiff = (...args) => this.chain(new SDiffCommand(...args));
1111
1154
  this.sdiffstore = (...args) => this.chain(new SDiffStoreCommand(...args));
1112
1155
  this.set = (key, value, opts) => this.chain(new SetCommand(key, value, opts));
@@ -1177,6 +1220,7 @@ var Redis = class {
1177
1220
  this.del = (...args) => new DelCommand(...args).exec(this.client);
1178
1221
  this.echo = (...args) => new EchoCommand(...args).exec(this.client);
1179
1222
  this.eval = (...args) => new EvalCommand(...args).exec(this.client);
1223
+ this.evalsha = (...args) => new EvalshaCommand(...args).exec(this.client);
1180
1224
  this.exists = (...args) => new ExistsCommand(...args).exec(this.client);
1181
1225
  this.expire = (...args) => new ExpireCommand(...args).exec(this.client);
1182
1226
  this.expireat = (...args) => new ExpireAtCommand(...args).exec(this.client);
@@ -1234,6 +1278,9 @@ var Redis = class {
1234
1278
  this.sadd = (key, ...members) => new SAddCommand(key, ...members).exec(this.client);
1235
1279
  this.scan = (...args) => new ScanCommand(...args).exec(this.client);
1236
1280
  this.scard = (...args) => new SCardCommand(...args).exec(this.client);
1281
+ this.scriptExists = (...args) => new ScriptExistsCommand(...args).exec(this.client);
1282
+ this.scriptFlush = (...args) => new ScriptFlushCommand(...args).exec(this.client);
1283
+ this.scriptLoad = (...args) => new ScriptLoadCommand(...args).exec(this.client);
1237
1284
  this.sdiff = (...args) => new SDiffCommand(...args).exec(this.client);
1238
1285
  this.sdiffstore = (...args) => new SDiffStoreCommand(...args).exec(this.client);
1239
1286
  this.set = (key, value, opts) => new SetCommand(key, value, opts).exec(this.client);
package/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  Redis
3
- } from "./chunk-4PD625HD.mjs";
4
- import "./chunk-CWZSFQQQ.mjs";
5
- import "./chunk-TLMWNHIZ.mjs";
3
+ } from "./chunk-T3BIHZ2F.mjs";
4
+ import "./chunk-KI7YOGWS.mjs";
5
+ import "./chunk-5567SQFQ.mjs";
6
6
  import "./chunk-HIDCSH5S.mjs";
7
7
  import {
8
8
  UpstashError
package/nodejs.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { R as Redis$1 } from './redis-5b966c20';
1
+ import { R as Redis$1 } from './redis-364a4445';
2
2
  import './http';
3
3
  import './zunionstore-342168a6';
4
4
 
package/nodejs.js CHANGED
@@ -164,8 +164,8 @@ var EchoCommand = class extends Command {
164
164
 
165
165
  // pkg/commands/eval.ts
166
166
  var EvalCommand = class extends Command {
167
- constructor(script, nArgs, ...args) {
168
- super(["eval", script, nArgs, ...args]);
167
+ constructor(script, keys, args) {
168
+ super(["eval", script, keys.length, ...keys, ...args != null ? args : []]);
169
169
  }
170
170
  };
171
171
 
@@ -1021,6 +1021,45 @@ var ZUnionStoreCommand = class extends Command {
1021
1021
  }
1022
1022
  };
1023
1023
 
1024
+ // pkg/commands/evalsha.ts
1025
+ var EvalshaCommand = class extends Command {
1026
+ constructor(sha, keys, args) {
1027
+ super(["evalsha", sha, keys.length, ...keys, ...args != null ? args : []]);
1028
+ }
1029
+ };
1030
+
1031
+ // pkg/commands/script_exists.ts
1032
+ var ScriptExistsCommand = class extends Command {
1033
+ constructor(...hash) {
1034
+ super(["script", "exists", ...hash], {
1035
+ deserialize: (result) => {
1036
+ const parsed = result;
1037
+ return parsed.length === 1 ? parsed[0] : parsed;
1038
+ }
1039
+ });
1040
+ }
1041
+ };
1042
+
1043
+ // pkg/commands/script_flush.ts
1044
+ var ScriptFlushCommand = class extends Command {
1045
+ constructor(opts) {
1046
+ const cmd = ["script", "flush"];
1047
+ if (opts == null ? void 0 : opts.sync) {
1048
+ cmd.push("sync");
1049
+ } else if (opts == null ? void 0 : opts.async) {
1050
+ cmd.push("async");
1051
+ }
1052
+ super(cmd);
1053
+ }
1054
+ };
1055
+
1056
+ // pkg/commands/script_load.ts
1057
+ var ScriptLoadCommand = class extends Command {
1058
+ constructor(script) {
1059
+ super(["script", "load", script]);
1060
+ }
1061
+ };
1062
+
1024
1063
  // pkg/pipeline.ts
1025
1064
  var Pipeline = class {
1026
1065
  constructor(client) {
@@ -1049,6 +1088,7 @@ var Pipeline = class {
1049
1088
  this.del = (...args) => this.chain(new DelCommand(...args));
1050
1089
  this.echo = (...args) => this.chain(new EchoCommand(...args));
1051
1090
  this.eval = (...args) => this.chain(new EvalCommand(...args));
1091
+ this.evalsha = (...args) => this.chain(new EvalshaCommand(...args));
1052
1092
  this.exists = (...args) => this.chain(new ExistsCommand(...args));
1053
1093
  this.expire = (...args) => this.chain(new ExpireCommand(...args));
1054
1094
  this.expireat = (...args) => this.chain(new ExpireAtCommand(...args));
@@ -1106,6 +1146,9 @@ var Pipeline = class {
1106
1146
  this.sadd = (key, ...members) => this.chain(new SAddCommand(key, ...members));
1107
1147
  this.scan = (...args) => this.chain(new ScanCommand(...args));
1108
1148
  this.scard = (...args) => this.chain(new SCardCommand(...args));
1149
+ this.scriptExists = (...args) => this.chain(new ScriptExistsCommand(...args));
1150
+ this.scriptFlush = (...args) => this.chain(new ScriptFlushCommand(...args));
1151
+ this.scriptLoad = (...args) => this.chain(new ScriptLoadCommand(...args));
1109
1152
  this.sdiff = (...args) => this.chain(new SDiffCommand(...args));
1110
1153
  this.sdiffstore = (...args) => this.chain(new SDiffStoreCommand(...args));
1111
1154
  this.set = (key, value, opts) => this.chain(new SetCommand(key, value, opts));
@@ -1176,6 +1219,7 @@ var Redis = class {
1176
1219
  this.del = (...args) => new DelCommand(...args).exec(this.client);
1177
1220
  this.echo = (...args) => new EchoCommand(...args).exec(this.client);
1178
1221
  this.eval = (...args) => new EvalCommand(...args).exec(this.client);
1222
+ this.evalsha = (...args) => new EvalshaCommand(...args).exec(this.client);
1179
1223
  this.exists = (...args) => new ExistsCommand(...args).exec(this.client);
1180
1224
  this.expire = (...args) => new ExpireCommand(...args).exec(this.client);
1181
1225
  this.expireat = (...args) => new ExpireAtCommand(...args).exec(this.client);
@@ -1233,6 +1277,9 @@ var Redis = class {
1233
1277
  this.sadd = (key, ...members) => new SAddCommand(key, ...members).exec(this.client);
1234
1278
  this.scan = (...args) => new ScanCommand(...args).exec(this.client);
1235
1279
  this.scard = (...args) => new SCardCommand(...args).exec(this.client);
1280
+ this.scriptExists = (...args) => new ScriptExistsCommand(...args).exec(this.client);
1281
+ this.scriptFlush = (...args) => new ScriptFlushCommand(...args).exec(this.client);
1282
+ this.scriptLoad = (...args) => new ScriptLoadCommand(...args).exec(this.client);
1236
1283
  this.sdiff = (...args) => new SDiffCommand(...args).exec(this.client);
1237
1284
  this.sdiffstore = (...args) => new SDiffStoreCommand(...args).exec(this.client);
1238
1285
  this.set = (key, value, opts) => new SetCommand(key, value, opts).exec(this.client);
package/nodejs.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  Redis
3
- } from "./chunk-4PD625HD.mjs";
4
- import "./chunk-CWZSFQQQ.mjs";
5
- import "./chunk-TLMWNHIZ.mjs";
3
+ } from "./chunk-T3BIHZ2F.mjs";
4
+ import "./chunk-KI7YOGWS.mjs";
5
+ import "./chunk-5567SQFQ.mjs";
6
6
  import "./chunk-HIDCSH5S.mjs";
7
7
  import "./chunk-7YUZYRJS.mjs";
8
8
  export {
package/package.json CHANGED
@@ -1 +1 @@
1
- { "name": "@upstash/redis", "version": "v1.3.0-alpha.0", "engines": { "node": ">=10" }, "description": "An HTTP/REST based Redis client built on top of Upstash REST API.", "main": "./index.js", "module": "./index.mjs", "types": "./index.d.ts", "scripts": { "test": "jest -i", "fmt": "pnpm lint && pnpm prettier --write .", "lint": "eslint --ext .ts --fix --ignore-path .gitignore .", "build": "tsup && cp package.json ./dist/ && pnpm size-limit" }, "repository": { "type": "git", "url": "git+https://github.com/upstash/upstash-redis.git" }, "keywords": [ "redis", "database", "serverless", "edge", "upstash" ], "author": "Andreas Thomas <andreas.thomas@chronark.com>", "license": "MIT", "bugs": { "url": "https://github.com/upstash/upstash-redis/issues" }, "homepage": "https://github.com/upstash/upstash-redis#readme", "directories": { "examples": "examples" }, "devDependencies": { "@jest/globals": "^27.4.6", "@size-limit/preset-small-lib": "^7.0.8", "@trivago/prettier-plugin-sort-imports": "^3.2.0", "@types/jest": "^27.4.0", "@types/node": "^17.0.8", "@typescript-eslint/eslint-plugin": "^5.9.1", "@typescript-eslint/parser": "^5.9.1", "dotenv": "^12.0.3", "eslint": "^8.6.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^4.0.0", "jest": "^27.4.7", "prettier": "^2.5.1", "size-limit": "^7.0.8", "ts-jest": "^27.1.3", "tsup": "^5.11.11", "typescript": "^4.5.5" }, "dependencies": { "isomorphic-fetch": "^3.0.0" }, "browser": { "isomorphic-fetch": false }, "size-limit": [ { "path": "dist/index.js", "limit": "5 KB" }, { "path": "dist/index.mjs", "limit": "5 KB" }, { "path": "dist/cloudflare.js", "limit": "5 KB" }, { "path": "dist/cloudflare.mjs", "limit": "5 KB" }, { "path": "dist/nodejs.js", "limit": "5 KB" }, { "path": "dist/nodejs.mjs", "limit": "5 KB" }, { "path": "dist/fastly.js", "limit": "5 KB" }, { "path": "dist/fastly.mjs", "limit": "5 KB" } ] }
1
+ { "name": "@upstash/redis", "version": "v1.3.0-alpha.1", "engines": { "node": ">=10" }, "description": "An HTTP/REST based Redis client built on top of Upstash REST API.", "main": "./index.js", "module": "./index.mjs", "types": "./index.d.ts", "scripts": { "test": "jest -i", "fmt": "pnpm lint && pnpm prettier --write .", "lint": "eslint --ext .ts --fix --ignore-path .gitignore .", "build": "tsup && cp package.json ./dist/ && pnpm size-limit" }, "repository": { "type": "git", "url": "git+https://github.com/upstash/upstash-redis.git" }, "keywords": [ "redis", "database", "serverless", "edge", "upstash" ], "author": "Andreas Thomas <andreas.thomas@chronark.com>", "license": "MIT", "bugs": { "url": "https://github.com/upstash/upstash-redis/issues" }, "homepage": "https://github.com/upstash/upstash-redis#readme", "directories": { "examples": "examples" }, "devDependencies": { "@jest/globals": "^27.4.6", "@size-limit/preset-small-lib": "^7.0.8", "@trivago/prettier-plugin-sort-imports": "^3.2.0", "@types/jest": "^27.4.0", "@types/node": "^17.0.8", "@typescript-eslint/eslint-plugin": "^5.9.1", "@typescript-eslint/parser": "^5.9.1", "dotenv": "^12.0.3", "eslint": "^8.6.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^4.0.0", "jest": "^27.4.7", "prettier": "^2.5.1", "size-limit": "^7.0.8", "ts-jest": "^27.1.3", "tsup": "^5.11.11", "typescript": "^4.5.5" }, "dependencies": { "isomorphic-fetch": "^3.0.0" }, "browser": { "isomorphic-fetch": false }, "size-limit": [ { "path": "dist/index.js", "limit": "5 KB" }, { "path": "dist/index.mjs", "limit": "5 KB" }, { "path": "dist/cloudflare.js", "limit": "5 KB" }, { "path": "dist/cloudflare.mjs", "limit": "5 KB" }, { "path": "dist/nodejs.js", "limit": "5 KB" }, { "path": "dist/nodejs.mjs", "limit": "5 KB" }, { "path": "dist/fastly.js", "limit": "5 KB" }, { "path": "dist/fastly.mjs", "limit": "5 KB" } ] }
@@ -1,6 +1,14 @@
1
1
  import { HttpClient } from './http';
2
2
  import { S as ScanCommandOptions, a as SetCommandOptions, C as CommandArgs, U as UnlinkCommand, b as ScoreMember, Z as ZAddCommandOptions, c as ZAddCommandOptionsWithIncr, d as ZInterStoreCommandOptions, e as ZRangeCommandOptions, f as ZUnionStoreCommandOptions, T as Type } from './zunionstore-342168a6';
3
3
 
4
+ declare type ScriptFlushCommandOptions = {
5
+ sync: true;
6
+ async?: never;
7
+ } | {
8
+ sync?: never;
9
+ async: true;
10
+ };
11
+
4
12
  /**
5
13
  * Upstash REST API supports command pipelining to send multiple commands in
6
14
  * batch, instead of sending each command one by one and waiting for a response.
@@ -100,9 +108,15 @@ declare class Pipeline {
100
108
  */
101
109
  echo: (message: string) => this;
102
110
  /**
111
+ *
103
112
  * @see https://redis.io/commands/eval
104
113
  */
105
- eval: (script: string, nArgs: number, ...args: unknown[]) => this;
114
+ eval: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => this;
115
+ /**
116
+ *
117
+ * @see https://redis.io/commands/evalsha
118
+ */
119
+ evalsha: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => this;
106
120
  /**
107
121
  * @see https://redis.io/commands/exists
108
122
  */
@@ -343,6 +357,18 @@ declare class Pipeline {
343
357
  * @see https://redis.io/commands/scard
344
358
  */
345
359
  scard: (key: string) => this;
360
+ /**
361
+ * @see https://redis.io/commands/script-exists
362
+ */
363
+ scriptExists: (args_0: string, ...args_1: string[]) => this;
364
+ /**
365
+ * @see https://redis.io/commands/script-flush
366
+ */
367
+ scriptFlush: (opts?: ScriptFlushCommandOptions | undefined) => this;
368
+ /**
369
+ * @see https://redis.io/commands/script-load
370
+ */
371
+ scriptLoad: (script: string) => this;
346
372
  /**
347
373
  * @see https://redis.io/commands/sdiff
348
374
  */
@@ -593,7 +619,12 @@ declare class Redis {
593
619
  *
594
620
  * @see https://redis.io/commands/eval
595
621
  */
596
- eval: (script: string, nArgs: number, ...args: unknown[]) => Promise<unknown>;
622
+ eval: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Promise<unknown>;
623
+ /**
624
+ *
625
+ * @see https://redis.io/commands/evalsha
626
+ */
627
+ evalsha: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Promise<unknown>;
597
628
  /**
598
629
  * @see https://redis.io/commands/exists
599
630
  */
@@ -834,6 +865,18 @@ declare class Redis {
834
865
  * @see https://redis.io/commands/scard
835
866
  */
836
867
  scard: (key: string) => Promise<number>;
868
+ /**
869
+ * @see https://redis.io/commands/script-exists
870
+ */
871
+ scriptExists: (args_0: string, ...args_1: string[]) => Promise<[]>;
872
+ /**
873
+ * @see https://redis.io/commands/script-flush
874
+ */
875
+ scriptFlush: (opts?: ScriptFlushCommandOptions | undefined) => Promise<"OK">;
876
+ /**
877
+ * @see https://redis.io/commands/script-load
878
+ */
879
+ scriptLoad: (script: string) => Promise<string>;
837
880
  /**
838
881
  * @see https://redis.io/commands/sdiff
839
882
  */