@upstash/redis 1.34.1 → 1.34.3-canary
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/chunk-FC2CKVKB.mjs +3810 -0
- package/cloudflare.js +3924 -1
- package/cloudflare.mjs +95 -1
- package/fastly.js +3897 -1
- package/fastly.mjs +68 -1
- package/nodejs.js +3944 -1
- package/nodejs.mjs +115 -1
- package/package.json +1 -1
- package/chunk-6D54FT2F.mjs +0 -1
- package/chunk-JNBN5IB4.js +0 -1
package/fastly.mjs
CHANGED
|
@@ -1 +1,68 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
HttpClient,
|
|
3
|
+
Redis,
|
|
4
|
+
VERSION,
|
|
5
|
+
error_exports
|
|
6
|
+
} from "./chunk-FC2CKVKB.mjs";
|
|
7
|
+
|
|
8
|
+
// platforms/fastly.ts
|
|
9
|
+
var Redis2 = class extends Redis {
|
|
10
|
+
/**
|
|
11
|
+
* Create a new redis client
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const redis = new Redis({
|
|
16
|
+
* url: "<UPSTASH_REDIS_REST_URL>",
|
|
17
|
+
* token: "<UPSTASH_REDIS_REST_TOKEN>",
|
|
18
|
+
* backend: "upstash-db",
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
constructor(config) {
|
|
23
|
+
if (!config.url) {
|
|
24
|
+
console.warn(
|
|
25
|
+
`[Upstash Redis] The 'url' property is missing or undefined in your Redis config.`
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
if (!config.token) {
|
|
29
|
+
console.warn(
|
|
30
|
+
`[Upstash Redis] The 'token' property is missing or undefined in your Redis config.`
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
if (config.url.startsWith(" ") || config.url.endsWith(" ") || /\r|\n/.test(config.url)) {
|
|
34
|
+
console.warn(
|
|
35
|
+
"[Upstash Redis] The redis url contains whitespace or newline, which can cause errors!"
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
if (config.token.startsWith(" ") || config.token.endsWith(" ") || /\r|\n/.test(config.token)) {
|
|
39
|
+
console.warn(
|
|
40
|
+
"[Upstash Redis] The redis token contains whitespace or newline, which can cause errors!"
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
const client = new HttpClient({
|
|
44
|
+
baseUrl: config.url,
|
|
45
|
+
retry: config.retry,
|
|
46
|
+
headers: { authorization: `Bearer ${config.token}` },
|
|
47
|
+
options: { backend: config.backend },
|
|
48
|
+
responseEncoding: config.responseEncoding,
|
|
49
|
+
keepAlive: config.keepAlive,
|
|
50
|
+
readYourWrites: config.readYourWrites
|
|
51
|
+
});
|
|
52
|
+
super(client, {
|
|
53
|
+
automaticDeserialization: config.automaticDeserialization,
|
|
54
|
+
enableAutoPipelining: config.enableAutoPipelining
|
|
55
|
+
});
|
|
56
|
+
this.addTelemetry({
|
|
57
|
+
sdk: `@upstash/redis@${VERSION}`,
|
|
58
|
+
platform: "fastly"
|
|
59
|
+
});
|
|
60
|
+
if (this.enableAutoPipelining) {
|
|
61
|
+
return this.autoPipeline();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
export {
|
|
66
|
+
Redis2 as Redis,
|
|
67
|
+
error_exports as errors
|
|
68
|
+
};
|