@upstash/redis 1.0.0-alpha.4 → 1.0.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.
package/commands.js CHANGED
@@ -28,6 +28,7 @@ __export(commands_exports, {
28
28
  BitCountCommand: () => BitCountCommand,
29
29
  BitOpCommand: () => BitOpCommand,
30
30
  BitPosCommand: () => BitPosCommand,
31
+ Command: () => Command,
31
32
  DBSizeCommand: () => DBSizeCommand,
32
33
  DecrByCommand: () => DecrByCommand,
33
34
  DecrCommand: () => DecrCommand,
@@ -143,13 +144,17 @@ var UpstashError = class extends Error {
143
144
 
144
145
  // pkg/util.ts
145
146
  function parseRecursive(obj) {
146
- return Array.isArray(obj) ? obj.map((o) => {
147
+ const parsed = Array.isArray(obj) ? obj.map((o) => {
147
148
  try {
148
149
  return parseRecursive(o);
149
150
  } catch {
150
151
  return o;
151
152
  }
152
153
  }) : JSON.parse(obj);
154
+ if (typeof parsed === "number" && parsed.toString() != obj) {
155
+ return obj;
156
+ }
157
+ return parsed;
153
158
  }
154
159
  function parseResponse(result) {
155
160
  try {
@@ -159,7 +164,7 @@ function parseResponse(result) {
159
164
  }
160
165
  }
161
166
 
162
- // pkg/command.ts
167
+ // pkg/commands/command.ts
163
168
  var Command = class {
164
169
  constructor(command, opts) {
165
170
  var _a;
@@ -439,8 +444,8 @@ var HScanCommand = class extends Command {
439
444
 
440
445
  // pkg/commands/hset.ts
441
446
  var HSetCommand = class extends Command {
442
- constructor(key, field, value) {
443
- super(["hset", key, field, value]);
447
+ constructor(key, kv) {
448
+ super(["hset", key, ...Object.entries(kv).flatMap(([field, value]) => [field, value])]);
444
449
  }
445
450
  };
446
451
 
@@ -1095,6 +1100,7 @@ module.exports = __toCommonJS(commands_exports);
1095
1100
  BitCountCommand,
1096
1101
  BitOpCommand,
1097
1102
  BitPosCommand,
1103
+ Command,
1098
1104
  DBSizeCommand,
1099
1105
  DecrByCommand,
1100
1106
  DecrCommand,
package/commands.mjs CHANGED
@@ -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,
@@ -106,13 +107,14 @@ import {
106
107
  ZScanCommand,
107
108
  ZScoreCommand,
108
109
  ZUnionStoreCommand
109
- } from "./chunk-ZIB6XPPC.mjs";
110
+ } from "./chunk-HGM7M7CJ.mjs";
110
111
  import "./chunk-7YUZYRJS.mjs";
111
112
  export {
112
113
  AppendCommand,
113
114
  BitCountCommand,
114
115
  BitOpCommand,
115
116
  BitPosCommand,
117
+ Command,
116
118
  DBSizeCommand,
117
119
  DecrByCommand,
118
120
  DecrCommand,
package/fastly.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { R as Redis$1 } from './redis-dd052782';
2
- import './zunionstore-dffa797d';
1
+ import { R as Redis$1 } from './redis-05a33429';
3
2
  import './http';
3
+ import './zunionstore-98bb4d18';
4
4
 
5
5
  /**
6
6
  * Connection credentials for upstash redis.