@upstash/redis 1.3.0 → 1.3.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/{chunk-C2RGMNOQ.mjs → chunk-WRHUFPCZ.mjs} +2 -1
- package/index.js +2 -1
- package/index.mjs +1 -1
- package/nodejs.d.ts +38 -38
- package/nodejs.js +2 -1
- package/nodejs.mjs +1 -1
- package/package.json +1 -1
|
@@ -10,12 +10,13 @@ import https from "https";
|
|
|
10
10
|
import "isomorphic-fetch";
|
|
11
11
|
var Redis2 = class extends Redis {
|
|
12
12
|
constructor(configOrRequester) {
|
|
13
|
+
var _a;
|
|
13
14
|
if ("request" in configOrRequester) {
|
|
14
15
|
super(configOrRequester);
|
|
15
16
|
return;
|
|
16
17
|
}
|
|
17
18
|
let agent = void 0;
|
|
18
|
-
if (typeof window === "undefined") {
|
|
19
|
+
if (typeof window === "undefined" && typeof process !== "undefined" && ((_a = process.release) == null ? void 0 : _a.name) === "node") {
|
|
19
20
|
const protocol = new URL(configOrRequester.url).protocol;
|
|
20
21
|
switch (protocol) {
|
|
21
22
|
case "https:":
|
package/index.js
CHANGED
|
@@ -1377,12 +1377,13 @@ var import_https = __toESM(require("https"));
|
|
|
1377
1377
|
var import_isomorphic_fetch = require("isomorphic-fetch");
|
|
1378
1378
|
var Redis2 = class extends Redis {
|
|
1379
1379
|
constructor(configOrRequester) {
|
|
1380
|
+
var _a;
|
|
1380
1381
|
if ("request" in configOrRequester) {
|
|
1381
1382
|
super(configOrRequester);
|
|
1382
1383
|
return;
|
|
1383
1384
|
}
|
|
1384
1385
|
let agent = void 0;
|
|
1385
|
-
if (typeof window === "undefined") {
|
|
1386
|
+
if (typeof window === "undefined" && typeof process !== "undefined" && ((_a = process.release) == null ? void 0 : _a.name) === "node") {
|
|
1386
1387
|
const protocol = new URL(configOrRequester.url).protocol;
|
|
1387
1388
|
switch (protocol) {
|
|
1388
1389
|
case "https:":
|
package/index.mjs
CHANGED
package/nodejs.d.ts
CHANGED
|
@@ -11,12 +11,12 @@ import 'http';
|
|
|
11
11
|
*/
|
|
12
12
|
declare type RedisConfigNodejs = {
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
* UPSTASH_REDIS_REST_URL
|
|
15
|
+
*/
|
|
16
16
|
url: string;
|
|
17
17
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
* UPSTASH_REDIS_REST_TOKEN
|
|
19
|
+
*/
|
|
20
20
|
token: string;
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
@@ -24,44 +24,44 @@ declare type RedisConfigNodejs = {
|
|
|
24
24
|
*/
|
|
25
25
|
declare class Redis extends Redis$1 {
|
|
26
26
|
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
* Create a new redis client by providing the url and token
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const redis = new Redis({
|
|
32
|
+
* url: "<UPSTASH_REDIS_REST_URL>",
|
|
33
|
+
* token: "<UPSTASH_REDIS_REST_TOKEN>",
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
37
|
constructor(config: RedisConfigNodejs);
|
|
38
38
|
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
39
|
+
* Create a new redis client by providing a custom `Requester` implementation
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
*
|
|
44
|
+
* import { UpstashRequest, Requester, UpstashResponse, Redis } from "@upstash/redis"
|
|
45
|
+
*
|
|
46
|
+
* const requester: Requester = {
|
|
47
|
+
* request: <TResult>(req: UpstashRequest): Promise<UpstashResponse<TResult>> => {
|
|
48
|
+
* // ...
|
|
49
|
+
* }
|
|
50
|
+
* }
|
|
51
|
+
*
|
|
52
|
+
* const redis = new Redis(requester)
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
55
|
constructor(requesters: Requester);
|
|
56
56
|
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
* Create a new Upstash Redis instance from environment variables.
|
|
58
|
+
*
|
|
59
|
+
* Use this to automatically load connection secrets from your environment
|
|
60
|
+
* variables. For instance when using the Vercel integration.
|
|
61
|
+
*
|
|
62
|
+
* This tries to load `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN` from
|
|
63
|
+
* your environment using `process.env`.
|
|
64
|
+
*/
|
|
65
65
|
static fromEnv(): Redis;
|
|
66
66
|
}
|
|
67
67
|
|
package/nodejs.js
CHANGED
|
@@ -1376,12 +1376,13 @@ var import_https = __toESM(require("https"));
|
|
|
1376
1376
|
var import_isomorphic_fetch = require("isomorphic-fetch");
|
|
1377
1377
|
var Redis2 = class extends Redis {
|
|
1378
1378
|
constructor(configOrRequester) {
|
|
1379
|
+
var _a;
|
|
1379
1380
|
if ("request" in configOrRequester) {
|
|
1380
1381
|
super(configOrRequester);
|
|
1381
1382
|
return;
|
|
1382
1383
|
}
|
|
1383
1384
|
let agent = void 0;
|
|
1384
|
-
if (typeof window === "undefined") {
|
|
1385
|
+
if (typeof window === "undefined" && typeof process !== "undefined" && ((_a = process.release) == null ? void 0 : _a.name) === "node") {
|
|
1385
1386
|
const protocol = new URL(configOrRequester.url).protocol;
|
|
1386
1387
|
switch (protocol) {
|
|
1387
1388
|
case "https:":
|
package/nodejs.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "name": "@upstash/redis", "version": "v1.3.
|
|
1
|
+
{ "name": "@upstash/redis", "version": "v1.3.1", "description": "An HTTP/REST based Redis client built on top of Upstash REST API.", "main": "./index.js", "module": "./index.mjs", "types": "./index.d.ts", "scripts": { "test": "jest -i", "fmt": "rome format .", "build": "tsup && cp package.json ./dist/ && pnpm size-limit" }, "repository": { "type": "git", "url": "git+https://github.com/upstash/upstash-redis.git" }, "keywords": [ "redis", "database", "serverless", "edge", "upstash" ], "author": "Andreas Thomas <andreas.thomas@chronark.com>", "license": "MIT", "bugs": { "url": "https://github.com/upstash/upstash-redis/issues" }, "homepage": "https://github.com/upstash/upstash-redis#readme", "directories": { "examples": "examples" }, "devDependencies": { "@jest/globals": "^27.4.6", "@size-limit/preset-small-lib": "^7.0.8", "@types/jest": "^27.4.0", "@types/node": "^17.0.8", "dotenv": "^12.0.3", "jest": "^27.4.7", "rome": "^0.4.2-next", "size-limit": "^7.0.8", "ts-jest": "^27.1.3", "tsup": "^5.11.11", "typescript": "^4.5.5" }, "dependencies": { "isomorphic-fetch": "^3.0.0" }, "browser": { "isomorphic-fetch": false, "http": false, "https": false }, "size-limit": [ { "path": "dist/index.js", "limit": "6 KB" }, { "path": "dist/index.mjs", "limit": "6 KB" }, { "path": "dist/cloudflare.js", "limit": "6 KB" }, { "path": "dist/cloudflare.mjs", "limit": "6 KB" }, { "path": "dist/nodejs.js", "limit": "6 KB" }, { "path": "dist/nodejs.mjs", "limit": "6 KB" }, { "path": "dist/fastly.js", "limit": "6 KB" }, { "path": "dist/fastly.mjs", "limit": "6 KB" } ] }
|