@upstash/redis 1.35.0-canary → 1.35.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/{dist/chunk-Q4ZBDYYE.mjs → chunk-AIBLSL5D.mjs} +782 -89
- package/cloudflare.d.mts +55 -0
- package/cloudflare.d.ts +55 -0
- package/{dist/cloudflare.js → cloudflare.js} +796 -111
- package/{dist/cloudflare.mjs → cloudflare.mjs} +15 -13
- package/fastly.d.mts +48 -0
- package/fastly.d.ts +48 -0
- package/{dist/fastly.js → fastly.js} +792 -107
- package/{dist/fastly.mjs → fastly.mjs} +11 -9
- package/nodejs.d.mts +73 -0
- package/nodejs.d.ts +73 -0
- package/{dist/nodejs.js → nodejs.js} +799 -113
- package/{dist/nodejs.mjs → nodejs.mjs} +18 -15
- package/package.json +1 -1
- package/{dist/zmscore-BhX8yEQc.d.mts → zmscore-BshEAkn7.d.mts} +591 -46
- package/{dist/zmscore-BhX8yEQc.d.ts → zmscore-BshEAkn7.d.ts} +591 -46
- package/dist/cloudflare.d.mts +0 -55
- package/dist/cloudflare.d.ts +0 -55
- package/dist/fastly.d.mts +0 -48
- package/dist/fastly.d.ts +0 -48
- package/dist/nodejs.d.mts +0 -73
- package/dist/nodejs.d.ts +0 -73
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
Redis,
|
|
4
4
|
VERSION,
|
|
5
5
|
error_exports
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AIBLSL5D.mjs";
|
|
7
7
|
|
|
8
8
|
// platforms/nodejs.ts
|
|
9
9
|
if (typeof atob === "undefined") {
|
|
@@ -33,26 +33,27 @@ var Redis2 = class _Redis extends Redis {
|
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
if (!configOrRequester.url) {
|
|
36
|
-
|
|
36
|
+
console.warn(
|
|
37
37
|
`[Upstash Redis] The 'url' property is missing or undefined in your Redis config.`
|
|
38
38
|
);
|
|
39
|
+
} else if (configOrRequester.url.startsWith(" ") || configOrRequester.url.endsWith(" ") || /\r|\n/.test(configOrRequester.url)) {
|
|
40
|
+
console.warn(
|
|
41
|
+
"[Upstash Redis] The redis url contains whitespace or newline, which can cause errors!"
|
|
42
|
+
);
|
|
39
43
|
}
|
|
40
44
|
if (!configOrRequester.token) {
|
|
41
|
-
|
|
45
|
+
console.warn(
|
|
42
46
|
`[Upstash Redis] The 'token' property is missing or undefined in your Redis config.`
|
|
43
47
|
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (configOrRequester.token.startsWith(" ") || configOrRequester.token.endsWith(" ") || /\r|\n/.test(configOrRequester.token)) {
|
|
49
|
-
console.warn("The redis token contains whitespace or newline, which can cause errors!");
|
|
48
|
+
} else if (configOrRequester.token.startsWith(" ") || configOrRequester.token.endsWith(" ") || /\r|\n/.test(configOrRequester.token)) {
|
|
49
|
+
console.warn(
|
|
50
|
+
"[Upstash Redis] The redis token contains whitespace or newline, which can cause errors!"
|
|
51
|
+
);
|
|
50
52
|
}
|
|
51
53
|
const client = new HttpClient({
|
|
52
54
|
baseUrl: configOrRequester.url,
|
|
53
55
|
retry: configOrRequester.retry,
|
|
54
56
|
headers: { authorization: `Bearer ${configOrRequester.token}` },
|
|
55
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
56
57
|
agent: configOrRequester.agent,
|
|
57
58
|
responseEncoding: configOrRequester.responseEncoding,
|
|
58
59
|
cache: configOrRequester.cache ?? "no-store",
|
|
@@ -90,16 +91,18 @@ var Redis2 = class _Redis extends Redis {
|
|
|
90
91
|
static fromEnv(config) {
|
|
91
92
|
if (process.env === void 0) {
|
|
92
93
|
throw new TypeError(
|
|
93
|
-
'Unable to get environment variables, `process.env` is undefined. If you are deploying to cloudflare, please import from "@upstash/redis/cloudflare" instead'
|
|
94
|
+
'[Upstash Redis] Unable to get environment variables, `process.env` is undefined. If you are deploying to cloudflare, please import from "@upstash/redis/cloudflare" instead'
|
|
94
95
|
);
|
|
95
96
|
}
|
|
96
|
-
const url = process.env.UPSTASH_REDIS_REST_URL;
|
|
97
|
+
const url = process.env.UPSTASH_REDIS_REST_URL || process.env.KV_REST_API_URL;
|
|
97
98
|
if (!url) {
|
|
98
|
-
|
|
99
|
+
console.warn("[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_URL`");
|
|
99
100
|
}
|
|
100
|
-
const token = process.env.UPSTASH_REDIS_REST_TOKEN;
|
|
101
|
+
const token = process.env.UPSTASH_REDIS_REST_TOKEN || process.env.KV_REST_API_TOKEN;
|
|
101
102
|
if (!token) {
|
|
102
|
-
|
|
103
|
+
console.warn(
|
|
104
|
+
"[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`"
|
|
105
|
+
);
|
|
103
106
|
}
|
|
104
107
|
return new _Redis({ ...config, url, token });
|
|
105
108
|
}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{
|
|
1
|
+
{"name":"@upstash/redis","version":"v1.35.1","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"}}
|