@upstash/redis 1.35.4 → 1.35.5

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.
@@ -3393,7 +3393,7 @@ var Subscriber = class extends EventTarget {
3393
3393
  const count = Number.parseInt(messageStr);
3394
3394
  this.dispatchToListeners(type, count);
3395
3395
  } else {
3396
- const message = this.opts?.automaticDeserialization === false ? messageStr : JSON.parse(messageStr);
3396
+ const message = this.opts?.automaticDeserialization === false ? messageStr : parseWithTryCatch(messageStr);
3397
3397
  this.dispatchToListeners(type, { channel, message });
3398
3398
  this.dispatchToListeners(`${type}:${channel}`, { channel, message });
3399
3399
  }
@@ -3466,6 +3466,13 @@ var SubscribeCommand = class extends Command {
3466
3466
  });
3467
3467
  }
3468
3468
  };
3469
+ var parseWithTryCatch = (str) => {
3470
+ try {
3471
+ return JSON.parse(str);
3472
+ } catch {
3473
+ return str;
3474
+ }
3475
+ };
3469
3476
 
3470
3477
  // pkg/script.ts
3471
3478
  import { subtle } from "uncrypto";
@@ -4483,7 +4490,7 @@ var Redis = class {
4483
4490
  };
4484
4491
 
4485
4492
  // version.ts
4486
- var VERSION = "v1.35.4";
4493
+ var VERSION = "v1.35.5";
4487
4494
 
4488
4495
  export {
4489
4496
  error_exports,
package/cloudflare.js CHANGED
@@ -2573,7 +2573,7 @@ var Subscriber = class extends EventTarget {
2573
2573
  const count = Number.parseInt(messageStr);
2574
2574
  this.dispatchToListeners(type, count);
2575
2575
  } else {
2576
- const message = this.opts?.automaticDeserialization === false ? messageStr : JSON.parse(messageStr);
2576
+ const message = this.opts?.automaticDeserialization === false ? messageStr : parseWithTryCatch(messageStr);
2577
2577
  this.dispatchToListeners(type, { channel, message });
2578
2578
  this.dispatchToListeners(`${type}:${channel}`, { channel, message });
2579
2579
  }
@@ -2646,6 +2646,13 @@ var SubscribeCommand = class extends Command {
2646
2646
  });
2647
2647
  }
2648
2648
  };
2649
+ var parseWithTryCatch = (str) => {
2650
+ try {
2651
+ return JSON.parse(str);
2652
+ } catch {
2653
+ return str;
2654
+ }
2655
+ };
2649
2656
 
2650
2657
  // pkg/commands/zdiffstore.ts
2651
2658
  var ZDiffStoreCommand = class extends Command {
@@ -4504,7 +4511,7 @@ var Redis = class {
4504
4511
  };
4505
4512
 
4506
4513
  // version.ts
4507
- var VERSION = "v1.35.4";
4514
+ var VERSION = "v1.35.5";
4508
4515
 
4509
4516
  // platforms/cloudflare.ts
4510
4517
  var Redis2 = class _Redis extends Redis {
package/cloudflare.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Redis,
4
4
  VERSION,
5
5
  error_exports
6
- } from "./chunk-XJQAWEWD.mjs";
6
+ } from "./chunk-CXQK4IKU.mjs";
7
7
 
8
8
  // platforms/cloudflare.ts
9
9
  var Redis2 = class _Redis extends Redis {
package/fastly.js CHANGED
@@ -2573,7 +2573,7 @@ var Subscriber = class extends EventTarget {
2573
2573
  const count = Number.parseInt(messageStr);
2574
2574
  this.dispatchToListeners(type, count);
2575
2575
  } else {
2576
- const message = this.opts?.automaticDeserialization === false ? messageStr : JSON.parse(messageStr);
2576
+ const message = this.opts?.automaticDeserialization === false ? messageStr : parseWithTryCatch(messageStr);
2577
2577
  this.dispatchToListeners(type, { channel, message });
2578
2578
  this.dispatchToListeners(`${type}:${channel}`, { channel, message });
2579
2579
  }
@@ -2646,6 +2646,13 @@ var SubscribeCommand = class extends Command {
2646
2646
  });
2647
2647
  }
2648
2648
  };
2649
+ var parseWithTryCatch = (str) => {
2650
+ try {
2651
+ return JSON.parse(str);
2652
+ } catch {
2653
+ return str;
2654
+ }
2655
+ };
2649
2656
 
2650
2657
  // pkg/commands/zdiffstore.ts
2651
2658
  var ZDiffStoreCommand = class extends Command {
@@ -4504,7 +4511,7 @@ var Redis = class {
4504
4511
  };
4505
4512
 
4506
4513
  // version.ts
4507
- var VERSION = "v1.35.4";
4514
+ var VERSION = "v1.35.5";
4508
4515
 
4509
4516
  // platforms/fastly.ts
4510
4517
  var Redis2 = class extends Redis {
package/fastly.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Redis,
4
4
  VERSION,
5
5
  error_exports
6
- } from "./chunk-XJQAWEWD.mjs";
6
+ } from "./chunk-CXQK4IKU.mjs";
7
7
 
8
8
  // platforms/fastly.ts
9
9
  var Redis2 = class extends Redis {
package/nodejs.d.mts CHANGED
@@ -64,8 +64,12 @@ declare class Redis extends Redis$1 {
64
64
  * Use this to automatically load connection secrets from your environment
65
65
  * variables. For instance when using the Vercel integration.
66
66
  *
67
- * This tries to load `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN` from
68
- * your environment using `process.env`.
67
+ * This tries to load connection details from your environment using `process.env`:
68
+ * - URL: `UPSTASH_REDIS_REST_URL` or fallback to `KV_REST_API_URL`
69
+ * - Token: `UPSTASH_REDIS_REST_TOKEN` or fallback to `KV_REST_API_TOKEN`
70
+ *
71
+ * The fallback variables provide compatibility with Vercel KV and other platforms
72
+ * that may use different naming conventions.
69
73
  */
70
74
  static fromEnv(config?: Omit<RedisConfigNodejs, "url" | "token">): Redis;
71
75
  }
package/nodejs.d.ts CHANGED
@@ -64,8 +64,12 @@ declare class Redis extends Redis$1 {
64
64
  * Use this to automatically load connection secrets from your environment
65
65
  * variables. For instance when using the Vercel integration.
66
66
  *
67
- * This tries to load `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN` from
68
- * your environment using `process.env`.
67
+ * This tries to load connection details from your environment using `process.env`:
68
+ * - URL: `UPSTASH_REDIS_REST_URL` or fallback to `KV_REST_API_URL`
69
+ * - Token: `UPSTASH_REDIS_REST_TOKEN` or fallback to `KV_REST_API_TOKEN`
70
+ *
71
+ * The fallback variables provide compatibility with Vercel KV and other platforms
72
+ * that may use different naming conventions.
69
73
  */
70
74
  static fromEnv(config?: Omit<RedisConfigNodejs, "url" | "token">): Redis;
71
75
  }
package/nodejs.js CHANGED
@@ -2573,7 +2573,7 @@ var Subscriber = class extends EventTarget {
2573
2573
  const count = Number.parseInt(messageStr);
2574
2574
  this.dispatchToListeners(type, count);
2575
2575
  } else {
2576
- const message = this.opts?.automaticDeserialization === false ? messageStr : JSON.parse(messageStr);
2576
+ const message = this.opts?.automaticDeserialization === false ? messageStr : parseWithTryCatch(messageStr);
2577
2577
  this.dispatchToListeners(type, { channel, message });
2578
2578
  this.dispatchToListeners(`${type}:${channel}`, { channel, message });
2579
2579
  }
@@ -2646,6 +2646,13 @@ var SubscribeCommand = class extends Command {
2646
2646
  });
2647
2647
  }
2648
2648
  };
2649
+ var parseWithTryCatch = (str) => {
2650
+ try {
2651
+ return JSON.parse(str);
2652
+ } catch {
2653
+ return str;
2654
+ }
2655
+ };
2649
2656
 
2650
2657
  // pkg/commands/zdiffstore.ts
2651
2658
  var ZDiffStoreCommand = class extends Command {
@@ -4504,7 +4511,7 @@ var Redis = class {
4504
4511
  };
4505
4512
 
4506
4513
  // version.ts
4507
- var VERSION = "v1.35.4";
4514
+ var VERSION = "v1.35.5";
4508
4515
 
4509
4516
  // platforms/nodejs.ts
4510
4517
  if (typeof atob === "undefined") {
@@ -4586,8 +4593,12 @@ var Redis2 = class _Redis extends Redis {
4586
4593
  * Use this to automatically load connection secrets from your environment
4587
4594
  * variables. For instance when using the Vercel integration.
4588
4595
  *
4589
- * This tries to load `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN` from
4590
- * your environment using `process.env`.
4596
+ * This tries to load connection details from your environment using `process.env`:
4597
+ * - URL: `UPSTASH_REDIS_REST_URL` or fallback to `KV_REST_API_URL`
4598
+ * - Token: `UPSTASH_REDIS_REST_TOKEN` or fallback to `KV_REST_API_TOKEN`
4599
+ *
4600
+ * The fallback variables provide compatibility with Vercel KV and other platforms
4601
+ * that may use different naming conventions.
4591
4602
  */
4592
4603
  static fromEnv(config) {
4593
4604
  if (process.env === void 0) {
package/nodejs.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Redis,
4
4
  VERSION,
5
5
  error_exports
6
- } from "./chunk-XJQAWEWD.mjs";
6
+ } from "./chunk-CXQK4IKU.mjs";
7
7
 
8
8
  // platforms/nodejs.ts
9
9
  if (typeof atob === "undefined") {
@@ -85,8 +85,12 @@ var Redis2 = class _Redis extends Redis {
85
85
  * Use this to automatically load connection secrets from your environment
86
86
  * variables. For instance when using the Vercel integration.
87
87
  *
88
- * This tries to load `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN` from
89
- * your environment using `process.env`.
88
+ * This tries to load connection details from your environment using `process.env`:
89
+ * - URL: `UPSTASH_REDIS_REST_URL` or fallback to `KV_REST_API_URL`
90
+ * - Token: `UPSTASH_REDIS_REST_TOKEN` or fallback to `KV_REST_API_TOKEN`
91
+ *
92
+ * The fallback variables provide compatibility with Vercel KV and other platforms
93
+ * that may use different naming conventions.
90
94
  */
91
95
  static fromEnv(config) {
92
96
  if (process.env === void 0) {
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@upstash/redis","version":"v1.35.4","main":"./nodejs.js","module":"./nodejs.mjs","types":"./nodejs.d.ts","exports":{".":{"import":"./nodejs.mjs","require":"./nodejs.js"},"./node":{"import":"./nodejs.mjs","require":"./nodejs.js"},"./cloudflare":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./cloudflare.js":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./cloudflare.mjs":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./fastly":{"import":"./fastly.mjs","require":"./fastly.js"},"./fastly.js":{"import":"./fastly.mjs","require":"./fastly.js"},"./fastly.mjs":{"import":"./fastly.mjs","require":"./fastly.js"}},"description":"An HTTP/REST based Redis client built on top of Upstash REST API.","repository":{"type":"git","url":"git+https://github.com/upstash/upstash-redis.git"},"keywords":["redis","database","serverless","edge","upstash"],"files":["./*"],"scripts":{"build":"tsup && cp package.json README.md LICENSE dist/","test":"bun test pkg","fmt":"prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"","lint":"eslint \"**/*.{js,ts,tsx}\" --quiet --fix","format":"prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"","format:check":"prettier --check \"**/*.{ts,tsx,js,jsx,json,md}\"","lint:fix":"eslint . -c .ts,.tsx,.js,.jsx --fix","commit":"cz","lint:format":"bun run lint:fix && bun run format","check-exports":"bun run build && cd dist && attw -P"},"author":"Andreas Thomas <dev@chronark.com>","license":"MIT","bugs":{"url":"https://github.com/upstash/upstash-redis/issues"},"homepage":"https://github.com/upstash/upstash-redis#readme","devDependencies":{"@biomejs/biome":"latest","@commitlint/cli":"^19.3.0","@commitlint/config-conventional":"^19.2.2","@typescript-eslint/eslint-plugin":"8.4.0","@typescript-eslint/parser":"8.4.0","bun-types":"1.0.33","eslint":"9.10.0","eslint-plugin-unicorn":"55.0.0","husky":"^9.1.1","prettier":"^3.3.3","tsup":"^8.2.3","typescript":"latest"},"dependencies":{"uncrypto":"^0.1.3"}}
1
+ {"name":"@upstash/redis","version":"v1.35.5","main":"./nodejs.js","module":"./nodejs.mjs","types":"./nodejs.d.ts","exports":{".":{"import":"./nodejs.mjs","require":"./nodejs.js"},"./node":{"import":"./nodejs.mjs","require":"./nodejs.js"},"./cloudflare":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./cloudflare.js":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./cloudflare.mjs":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./fastly":{"import":"./fastly.mjs","require":"./fastly.js"},"./fastly.js":{"import":"./fastly.mjs","require":"./fastly.js"},"./fastly.mjs":{"import":"./fastly.mjs","require":"./fastly.js"}},"description":"An HTTP/REST based Redis client built on top of Upstash REST API.","repository":{"type":"git","url":"git+https://github.com/upstash/upstash-redis.git"},"keywords":["redis","database","serverless","edge","upstash"],"files":["./*"],"scripts":{"build":"tsup && cp package.json README.md LICENSE dist/","test":"bun test pkg","fmt":"prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"","lint":"eslint \"**/*.{js,ts,tsx}\" --quiet --fix","format":"prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"","format:check":"prettier --check \"**/*.{ts,tsx,js,jsx,json,md}\"","lint:fix":"eslint . -c .ts,.tsx,.js,.jsx --fix","commit":"cz","lint:format":"bun run lint:fix && bun run format","check-exports":"bun run build && cd dist && attw -P"},"author":"Andreas Thomas <dev@chronark.com>","license":"MIT","bugs":{"url":"https://github.com/upstash/upstash-redis/issues"},"homepage":"https://github.com/upstash/upstash-redis#readme","devDependencies":{"@biomejs/biome":"latest","@commitlint/cli":"^19.3.0","@commitlint/config-conventional":"^19.2.2","@typescript-eslint/eslint-plugin":"8.4.0","@typescript-eslint/parser":"8.4.0","bun-types":"1.0.33","eslint":"9.10.0","eslint-plugin-unicorn":"55.0.0","husky":"^9.1.1","prettier":"^3.3.3","tsup":"^8.2.3","typescript":"latest"},"dependencies":{"uncrypto":"^0.1.3"}}