@upstash/redis 1.38.0 → 1.38.2

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.
@@ -315,7 +315,15 @@ function merge(obj, key, value) {
315
315
  if (!value) {
316
316
  return obj;
317
317
  }
318
- obj[key] = obj[key] ? [obj[key], value].join(",") : value;
318
+ if (!obj[key]) {
319
+ obj[key] = value;
320
+ return obj;
321
+ }
322
+ const values = obj[key].split(",");
323
+ if (!values.includes(value)) {
324
+ values.push(value);
325
+ obj[key] = values.join(",");
326
+ }
319
327
  return obj;
320
328
  }
321
329
 
@@ -5421,7 +5429,7 @@ var Redis = class {
5421
5429
  };
5422
5430
 
5423
5431
  // version.ts
5424
- var VERSION = "v1.38.0";
5432
+ var VERSION = "v1.38.2";
5425
5433
 
5426
5434
  export {
5427
5435
  error_exports,
package/cloudflare.js CHANGED
@@ -336,7 +336,15 @@ function merge(obj, key, value) {
336
336
  if (!value) {
337
337
  return obj;
338
338
  }
339
- obj[key] = obj[key] ? [obj[key], value].join(",") : value;
339
+ if (!obj[key]) {
340
+ obj[key] = value;
341
+ return obj;
342
+ }
343
+ const values = obj[key].split(",");
344
+ if (!values.includes(value)) {
345
+ values.push(value);
346
+ obj[key] = values.join(",");
347
+ }
340
348
  return obj;
341
349
  }
342
350
 
@@ -5442,7 +5450,7 @@ var Redis = class {
5442
5450
  };
5443
5451
 
5444
5452
  // version.ts
5445
- var VERSION = "v1.38.0";
5453
+ var VERSION = "v1.38.2";
5446
5454
 
5447
5455
  // platforms/cloudflare.ts
5448
5456
  var Redis2 = class _Redis extends Redis {
@@ -5460,7 +5468,7 @@ var Redis2 = class _Redis extends Redis {
5460
5468
  constructor(config, env) {
5461
5469
  if (!config.url) {
5462
5470
  console.warn(
5463
- `[Upstash Redis] The 'url' property is missing or undefined in your Redis config.`
5471
+ `[Upstash Redis] The 'url' property is missing or undefined in your Redis config. To create a database instantly (no signup needed), run: curl -X POST https://upstash.com/start-redis`
5464
5472
  );
5465
5473
  } else if (config.url.startsWith(" ") || config.url.endsWith(" ") || /\r|\n/.test(config.url)) {
5466
5474
  console.warn(
@@ -5469,7 +5477,7 @@ var Redis2 = class _Redis extends Redis {
5469
5477
  }
5470
5478
  if (!config.token) {
5471
5479
  console.warn(
5472
- `[Upstash Redis] The 'token' property is missing or undefined in your Redis config.`
5480
+ `[Upstash Redis] The 'token' property is missing or undefined in your Redis config. To create a database instantly (no signup needed), run: curl -X POST https://upstash.com/start-redis`
5473
5481
  );
5474
5482
  } else if (config.token.startsWith(" ") || config.token.endsWith(" ") || /\r|\n/.test(config.token)) {
5475
5483
  console.warn(
@@ -5521,10 +5529,15 @@ var Redis2 = class _Redis extends Redis {
5521
5529
  // @ts-expect-error These will be defined by cloudflare
5522
5530
  UPSTASH_REDIS_REST_TOKEN
5523
5531
  ) : void 0);
5524
- const messageInfo = !url && !token ? "Unable to find environment variables: `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN`" : url ? token ? void 0 : "Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`" : "Unable to find environment variable: `UPSTASH_REDIS_REST_URL`";
5525
- if (messageInfo) {
5532
+ const missing = [];
5533
+ if (!url) missing.push("UPSTASH_REDIS_REST_URL");
5534
+ if (!token) missing.push("UPSTASH_REDIS_REST_TOKEN");
5535
+ if (missing.length > 0) {
5536
+ const plural = missing.length > 1;
5537
+ const names = missing.map((name) => `\`${name}\``).join(" and ");
5538
+ const commands = missing.map((name) => `\`wrangler secret put ${name}\``).join(" and ");
5526
5539
  console.warn(
5527
- `[Upstash Redis] ${messageInfo}. Please add it via \`wrangler secret put ${url ? "UPSTASH_REDIS_REST_TOKEN" : "UPSTASH_REDIS_REST_URL"}\` and provide it as an argument to the \`Redis.fromEnv\` function`
5540
+ `[Upstash Redis] Unable to find environment variable${plural ? "s" : ""}: ${names}. Please add ${plural ? "them" : "it"} via ${commands} and provide ${plural ? "them as arguments" : "it as an argument"} to the \`Redis.fromEnv\` function. To create a database instantly (no signup needed), run: curl -X POST https://upstash.com/start-redis`
5528
5541
  );
5529
5542
  }
5530
5543
  return new _Redis({ ...opts, url, token }, env);
package/cloudflare.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Redis,
4
4
  VERSION,
5
5
  error_exports
6
- } from "./chunk-2X4SLXT7.mjs";
6
+ } from "./chunk-K7RP6Y36.mjs";
7
7
 
8
8
  // platforms/cloudflare.ts
9
9
  var Redis2 = class _Redis extends Redis {
@@ -21,7 +21,7 @@ var Redis2 = class _Redis extends Redis {
21
21
  constructor(config, env) {
22
22
  if (!config.url) {
23
23
  console.warn(
24
- `[Upstash Redis] The 'url' property is missing or undefined in your Redis config.`
24
+ `[Upstash Redis] The 'url' property is missing or undefined in your Redis config. To create a database instantly (no signup needed), run: curl -X POST https://upstash.com/start-redis`
25
25
  );
26
26
  } else if (config.url.startsWith(" ") || config.url.endsWith(" ") || /\r|\n/.test(config.url)) {
27
27
  console.warn(
@@ -30,7 +30,7 @@ var Redis2 = class _Redis extends Redis {
30
30
  }
31
31
  if (!config.token) {
32
32
  console.warn(
33
- `[Upstash Redis] The 'token' property is missing or undefined in your Redis config.`
33
+ `[Upstash Redis] The 'token' property is missing or undefined in your Redis config. To create a database instantly (no signup needed), run: curl -X POST https://upstash.com/start-redis`
34
34
  );
35
35
  } else if (config.token.startsWith(" ") || config.token.endsWith(" ") || /\r|\n/.test(config.token)) {
36
36
  console.warn(
@@ -82,10 +82,15 @@ var Redis2 = class _Redis extends Redis {
82
82
  // @ts-expect-error These will be defined by cloudflare
83
83
  UPSTASH_REDIS_REST_TOKEN
84
84
  ) : void 0);
85
- const messageInfo = !url && !token ? "Unable to find environment variables: `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN`" : url ? token ? void 0 : "Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`" : "Unable to find environment variable: `UPSTASH_REDIS_REST_URL`";
86
- if (messageInfo) {
85
+ const missing = [];
86
+ if (!url) missing.push("UPSTASH_REDIS_REST_URL");
87
+ if (!token) missing.push("UPSTASH_REDIS_REST_TOKEN");
88
+ if (missing.length > 0) {
89
+ const plural = missing.length > 1;
90
+ const names = missing.map((name) => `\`${name}\``).join(" and ");
91
+ const commands = missing.map((name) => `\`wrangler secret put ${name}\``).join(" and ");
87
92
  console.warn(
88
- `[Upstash Redis] ${messageInfo}. Please add it via \`wrangler secret put ${url ? "UPSTASH_REDIS_REST_TOKEN" : "UPSTASH_REDIS_REST_URL"}\` and provide it as an argument to the \`Redis.fromEnv\` function`
93
+ `[Upstash Redis] Unable to find environment variable${plural ? "s" : ""}: ${names}. Please add ${plural ? "them" : "it"} via ${commands} and provide ${plural ? "them as arguments" : "it as an argument"} to the \`Redis.fromEnv\` function. To create a database instantly (no signup needed), run: curl -X POST https://upstash.com/start-redis`
89
94
  );
90
95
  }
91
96
  return new _Redis({ ...opts, url, token }, env);
package/fastly.js CHANGED
@@ -336,7 +336,15 @@ function merge(obj, key, value) {
336
336
  if (!value) {
337
337
  return obj;
338
338
  }
339
- obj[key] = obj[key] ? [obj[key], value].join(",") : value;
339
+ if (!obj[key]) {
340
+ obj[key] = value;
341
+ return obj;
342
+ }
343
+ const values = obj[key].split(",");
344
+ if (!values.includes(value)) {
345
+ values.push(value);
346
+ obj[key] = values.join(",");
347
+ }
340
348
  return obj;
341
349
  }
342
350
 
@@ -5442,7 +5450,7 @@ var Redis = class {
5442
5450
  };
5443
5451
 
5444
5452
  // version.ts
5445
- var VERSION = "v1.38.0";
5453
+ var VERSION = "v1.38.2";
5446
5454
 
5447
5455
  // platforms/fastly.ts
5448
5456
  var Redis2 = class extends Redis {
@@ -5461,7 +5469,7 @@ var Redis2 = class extends Redis {
5461
5469
  constructor(config) {
5462
5470
  if (!config.url) {
5463
5471
  console.warn(
5464
- `[Upstash Redis] The 'url' property is missing or undefined in your Redis config.`
5472
+ `[Upstash Redis] The 'url' property is missing or undefined in your Redis config. To create a database instantly (no signup needed), run: curl -X POST https://upstash.com/start-redis`
5465
5473
  );
5466
5474
  } else if (config.url.startsWith(" ") || config.url.endsWith(" ") || /\r|\n/.test(config.url)) {
5467
5475
  console.warn(
@@ -5470,7 +5478,7 @@ var Redis2 = class extends Redis {
5470
5478
  }
5471
5479
  if (!config.token) {
5472
5480
  console.warn(
5473
- `[Upstash Redis] The 'token' property is missing or undefined in your Redis config.`
5481
+ `[Upstash Redis] The 'token' property is missing or undefined in your Redis config. To create a database instantly (no signup needed), run: curl -X POST https://upstash.com/start-redis`
5474
5482
  );
5475
5483
  } else if (config.token.startsWith(" ") || config.token.endsWith(" ") || /\r|\n/.test(config.token)) {
5476
5484
  console.warn(
package/fastly.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Redis,
4
4
  VERSION,
5
5
  error_exports
6
- } from "./chunk-2X4SLXT7.mjs";
6
+ } from "./chunk-K7RP6Y36.mjs";
7
7
 
8
8
  // platforms/fastly.ts
9
9
  var Redis2 = class extends Redis {
@@ -22,7 +22,7 @@ var Redis2 = class extends Redis {
22
22
  constructor(config) {
23
23
  if (!config.url) {
24
24
  console.warn(
25
- `[Upstash Redis] The 'url' property is missing or undefined in your Redis config.`
25
+ `[Upstash Redis] The 'url' property is missing or undefined in your Redis config. To create a database instantly (no signup needed), run: curl -X POST https://upstash.com/start-redis`
26
26
  );
27
27
  } else if (config.url.startsWith(" ") || config.url.endsWith(" ") || /\r|\n/.test(config.url)) {
28
28
  console.warn(
@@ -31,7 +31,7 @@ var Redis2 = class extends Redis {
31
31
  }
32
32
  if (!config.token) {
33
33
  console.warn(
34
- `[Upstash Redis] The 'token' property is missing or undefined in your Redis config.`
34
+ `[Upstash Redis] The 'token' property is missing or undefined in your Redis config. To create a database instantly (no signup needed), run: curl -X POST https://upstash.com/start-redis`
35
35
  );
36
36
  } else if (config.token.startsWith(" ") || config.token.endsWith(" ") || /\r|\n/.test(config.token)) {
37
37
  console.warn(
package/nodejs.js CHANGED
@@ -338,7 +338,15 @@ function merge(obj, key, value) {
338
338
  if (!value) {
339
339
  return obj;
340
340
  }
341
- obj[key] = obj[key] ? [obj[key], value].join(",") : value;
341
+ if (!obj[key]) {
342
+ obj[key] = value;
343
+ return obj;
344
+ }
345
+ const values = obj[key].split(",");
346
+ if (!values.includes(value)) {
347
+ values.push(value);
348
+ obj[key] = values.join(",");
349
+ }
342
350
  return obj;
343
351
  }
344
352
 
@@ -5444,7 +5452,7 @@ var Redis = class {
5444
5452
  };
5445
5453
 
5446
5454
  // version.ts
5447
- var VERSION = "v1.38.0";
5455
+ var VERSION = "v1.38.2";
5448
5456
 
5449
5457
  // pkg/commands/search/schema-builder.ts
5450
5458
  var BUILD = /* @__PURE__ */ Symbol("build");
@@ -5643,7 +5651,7 @@ var Redis2 = class _Redis extends Redis {
5643
5651
  }
5644
5652
  if (!configOrRequester.url) {
5645
5653
  console.warn(
5646
- `[Upstash Redis] The 'url' property is missing or undefined in your Redis config.`
5654
+ `[Upstash Redis] The 'url' property is missing or undefined in your Redis config. To create a database instantly (no signup needed), run: curl -X POST https://upstash.com/start-redis`
5647
5655
  );
5648
5656
  } else if (configOrRequester.url.startsWith(" ") || configOrRequester.url.endsWith(" ") || /\r|\n/.test(configOrRequester.url)) {
5649
5657
  console.warn(
@@ -5652,7 +5660,7 @@ var Redis2 = class _Redis extends Redis {
5652
5660
  }
5653
5661
  if (!configOrRequester.token) {
5654
5662
  console.warn(
5655
- `[Upstash Redis] The 'token' property is missing or undefined in your Redis config.`
5663
+ `[Upstash Redis] The 'token' property is missing or undefined in your Redis config. To create a database instantly (no signup needed), run: curl -X POST https://upstash.com/start-redis`
5656
5664
  );
5657
5665
  } else if (configOrRequester.token.startsWith(" ") || configOrRequester.token.endsWith(" ") || /\r|\n/.test(configOrRequester.token)) {
5658
5666
  console.warn(
@@ -5711,12 +5719,14 @@ var Redis2 = class _Redis extends Redis {
5711
5719
  }
5712
5720
  const url = process.env.UPSTASH_REDIS_REST_URL || process.env.KV_REST_API_URL;
5713
5721
  if (!url) {
5714
- console.warn("[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_URL`");
5722
+ console.warn(
5723
+ "[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_URL`. To create a database instantly (no signup needed), run: curl -X POST https://upstash.com/start-redis"
5724
+ );
5715
5725
  }
5716
5726
  const token = process.env.UPSTASH_REDIS_REST_TOKEN || process.env.KV_REST_API_TOKEN;
5717
5727
  if (!token) {
5718
5728
  console.warn(
5719
- "[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`"
5729
+ "[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`. To create a database instantly (no signup needed), run: curl -X POST https://upstash.com/start-redis"
5720
5730
  );
5721
5731
  }
5722
5732
  return new _Redis({ ...config, url, token });
package/nodejs.mjs CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  SearchIndex,
5
5
  VERSION,
6
6
  error_exports
7
- } from "./chunk-2X4SLXT7.mjs";
7
+ } from "./chunk-K7RP6Y36.mjs";
8
8
 
9
9
  // pkg/commands/search/schema-builder.ts
10
10
  var BUILD = /* @__PURE__ */ Symbol("build");
@@ -203,7 +203,7 @@ var Redis2 = class _Redis extends Redis {
203
203
  }
204
204
  if (!configOrRequester.url) {
205
205
  console.warn(
206
- `[Upstash Redis] The 'url' property is missing or undefined in your Redis config.`
206
+ `[Upstash Redis] The 'url' property is missing or undefined in your Redis config. To create a database instantly (no signup needed), run: curl -X POST https://upstash.com/start-redis`
207
207
  );
208
208
  } else if (configOrRequester.url.startsWith(" ") || configOrRequester.url.endsWith(" ") || /\r|\n/.test(configOrRequester.url)) {
209
209
  console.warn(
@@ -212,7 +212,7 @@ var Redis2 = class _Redis extends Redis {
212
212
  }
213
213
  if (!configOrRequester.token) {
214
214
  console.warn(
215
- `[Upstash Redis] The 'token' property is missing or undefined in your Redis config.`
215
+ `[Upstash Redis] The 'token' property is missing or undefined in your Redis config. To create a database instantly (no signup needed), run: curl -X POST https://upstash.com/start-redis`
216
216
  );
217
217
  } else if (configOrRequester.token.startsWith(" ") || configOrRequester.token.endsWith(" ") || /\r|\n/.test(configOrRequester.token)) {
218
218
  console.warn(
@@ -271,12 +271,14 @@ var Redis2 = class _Redis extends Redis {
271
271
  }
272
272
  const url = process.env.UPSTASH_REDIS_REST_URL || process.env.KV_REST_API_URL;
273
273
  if (!url) {
274
- console.warn("[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_URL`");
274
+ console.warn(
275
+ "[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_URL`. To create a database instantly (no signup needed), run: curl -X POST https://upstash.com/start-redis"
276
+ );
275
277
  }
276
278
  const token = process.env.UPSTASH_REDIS_REST_TOKEN || process.env.KV_REST_API_TOKEN;
277
279
  if (!token) {
278
280
  console.warn(
279
- "[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`"
281
+ "[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`. To create a database instantly (no signup needed), run: curl -X POST https://upstash.com/start-redis"
280
282
  );
281
283
  }
282
284
  return new _Redis({ ...config, url, token });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@upstash/redis",
3
- "version": "1.38.0",
3
+ "version": "1.38.2",
4
4
  "main": "./nodejs.js",
5
5
  "module": "./nodejs.mjs",
6
6
  "types": "./nodejs.d.ts",