@upstash/redis 0.0.0-ci.fa1d496e56b9c6b274a4edb64a8fbcbcb5d5080b-20251205201758 → 0.0.0-ci.fb72aeebe6c90b1afa447253d09fe5ee3a67ed16-20251205205954

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/cloudflare.js CHANGED
@@ -4600,8 +4600,16 @@ var Redis2 = class _Redis extends Redis {
4600
4600
  * ```
4601
4601
  */
4602
4602
  static fromEnv(env, opts) {
4603
- const url = env?.UPSTASH_REDIS_REST_URL ?? UPSTASH_REDIS_REST_URL;
4604
- const token = env?.UPSTASH_REDIS_REST_TOKEN ?? UPSTASH_REDIS_REST_TOKEN;
4603
+ const url = env?.UPSTASH_REDIS_REST_URL ?? // @ts-expect-error These will be defined by cloudflare
4604
+ (typeof UPSTASH_REDIS_REST_URL === "string" ? (
4605
+ // @ts-expect-error These will be defined by cloudflare
4606
+ UPSTASH_REDIS_REST_URL
4607
+ ) : void 0);
4608
+ const token = env?.UPSTASH_REDIS_REST_TOKEN ?? // @ts-expect-error These will be defined by cloudflare
4609
+ (typeof UPSTASH_REDIS_REST_TOKEN === "string" ? (
4610
+ // @ts-expect-error These will be defined by cloudflare
4611
+ UPSTASH_REDIS_REST_TOKEN
4612
+ ) : void 0);
4605
4613
  if (!url) {
4606
4614
  console.warn(
4607
4615
  "[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_URL`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_URL`"
package/cloudflare.mjs CHANGED
@@ -72,8 +72,16 @@ var Redis2 = class _Redis extends Redis {
72
72
  * ```
73
73
  */
74
74
  static fromEnv(env, opts) {
75
- const url = env?.UPSTASH_REDIS_REST_URL ?? UPSTASH_REDIS_REST_URL;
76
- const token = env?.UPSTASH_REDIS_REST_TOKEN ?? UPSTASH_REDIS_REST_TOKEN;
75
+ const url = env?.UPSTASH_REDIS_REST_URL ?? // @ts-expect-error These will be defined by cloudflare
76
+ (typeof UPSTASH_REDIS_REST_URL === "string" ? (
77
+ // @ts-expect-error These will be defined by cloudflare
78
+ UPSTASH_REDIS_REST_URL
79
+ ) : void 0);
80
+ const token = env?.UPSTASH_REDIS_REST_TOKEN ?? // @ts-expect-error These will be defined by cloudflare
81
+ (typeof UPSTASH_REDIS_REST_TOKEN === "string" ? (
82
+ // @ts-expect-error These will be defined by cloudflare
83
+ UPSTASH_REDIS_REST_TOKEN
84
+ ) : void 0);
77
85
  if (!url) {
78
86
  console.warn(
79
87
  "[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_URL`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_URL`"
package/nodejs.js CHANGED
@@ -4589,18 +4589,20 @@ var Redis2 = class _Redis extends Redis {
4589
4589
  keepAlive: configOrRequester.keepAlive,
4590
4590
  readYourWrites: configOrRequester.readYourWrites
4591
4591
  });
4592
+ const safeEnv = typeof process === "object" && process && typeof process.env === "object" && process.env ? process.env : {};
4592
4593
  super(client, {
4593
4594
  automaticDeserialization: configOrRequester.automaticDeserialization,
4594
- enableTelemetry: configOrRequester.enableTelemetry ?? !process.env.UPSTASH_DISABLE_TELEMETRY,
4595
+ enableTelemetry: configOrRequester.enableTelemetry ?? !safeEnv.UPSTASH_DISABLE_TELEMETRY,
4595
4596
  latencyLogging: configOrRequester.latencyLogging,
4596
4597
  enableAutoPipelining: configOrRequester.enableAutoPipelining
4597
4598
  });
4599
+ const nodeVersion = typeof process === "object" && process ? process.version : void 0;
4598
4600
  this.addTelemetry({
4599
4601
  runtime: (
4600
4602
  // @ts-expect-error to silence compiler
4601
- typeof EdgeRuntime === "string" ? "edge-light" : `node@${process.version}`
4603
+ typeof EdgeRuntime === "string" ? "edge-light" : nodeVersion ? `node@${nodeVersion}` : "unknown"
4602
4604
  ),
4603
- platform: process.env.UPSTASH_CONSOLE ? "console" : process.env.VERCEL ? "vercel" : process.env.AWS_REGION ? "aws" : "unknown",
4605
+ platform: safeEnv.UPSTASH_CONSOLE ? "console" : safeEnv.VERCEL ? "vercel" : safeEnv.AWS_REGION ? "aws" : "unknown",
4604
4606
  sdk: `@upstash/redis@${VERSION}`
4605
4607
  });
4606
4608
  if (this.enableAutoPipelining) {
@@ -4621,7 +4623,7 @@ var Redis2 = class _Redis extends Redis {
4621
4623
  * that may use different naming conventions.
4622
4624
  */
4623
4625
  static fromEnv(config) {
4624
- if (process.env === void 0) {
4626
+ if (typeof process !== "object" || !process || typeof process.env !== "object" || !process.env) {
4625
4627
  throw new TypeError(
4626
4628
  '[Upstash Redis] Unable to get environment variables, `process.env` is undefined. If you are deploying to cloudflare, please import from "@upstash/redis/cloudflare" instead'
4627
4629
  );
package/nodejs.mjs CHANGED
@@ -61,18 +61,20 @@ var Redis2 = class _Redis extends Redis {
61
61
  keepAlive: configOrRequester.keepAlive,
62
62
  readYourWrites: configOrRequester.readYourWrites
63
63
  });
64
+ const safeEnv = typeof process === "object" && process && typeof process.env === "object" && process.env ? process.env : {};
64
65
  super(client, {
65
66
  automaticDeserialization: configOrRequester.automaticDeserialization,
66
- enableTelemetry: configOrRequester.enableTelemetry ?? !process.env.UPSTASH_DISABLE_TELEMETRY,
67
+ enableTelemetry: configOrRequester.enableTelemetry ?? !safeEnv.UPSTASH_DISABLE_TELEMETRY,
67
68
  latencyLogging: configOrRequester.latencyLogging,
68
69
  enableAutoPipelining: configOrRequester.enableAutoPipelining
69
70
  });
71
+ const nodeVersion = typeof process === "object" && process ? process.version : void 0;
70
72
  this.addTelemetry({
71
73
  runtime: (
72
74
  // @ts-expect-error to silence compiler
73
- typeof EdgeRuntime === "string" ? "edge-light" : `node@${process.version}`
75
+ typeof EdgeRuntime === "string" ? "edge-light" : nodeVersion ? `node@${nodeVersion}` : "unknown"
74
76
  ),
75
- platform: process.env.UPSTASH_CONSOLE ? "console" : process.env.VERCEL ? "vercel" : process.env.AWS_REGION ? "aws" : "unknown",
77
+ platform: safeEnv.UPSTASH_CONSOLE ? "console" : safeEnv.VERCEL ? "vercel" : safeEnv.AWS_REGION ? "aws" : "unknown",
76
78
  sdk: `@upstash/redis@${VERSION}`
77
79
  });
78
80
  if (this.enableAutoPipelining) {
@@ -93,7 +95,7 @@ var Redis2 = class _Redis extends Redis {
93
95
  * that may use different naming conventions.
94
96
  */
95
97
  static fromEnv(config) {
96
- if (process.env === void 0) {
98
+ if (typeof process !== "object" || !process || typeof process.env !== "object" || !process.env) {
97
99
  throw new TypeError(
98
100
  '[Upstash Redis] Unable to get environment variables, `process.env` is undefined. If you are deploying to cloudflare, please import from "@upstash/redis/cloudflare" instead'
99
101
  );
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@upstash/redis","version":"v0.0.0-ci.fa1d496e56b9c6b274a4edb64a8fbcbcb5d5080b-20251205201758","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":"v0.0.0-ci.fb72aeebe6c90b1afa447253d09fe5ee3a67ed16-20251205205954","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"}}