@upstash/redis 1.0.0-alpha.0 → 1.0.0-alpha.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/commands.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { au as Command, N as NonEmptyArray } from './zunionstore-
|
|
2
|
-
export { A as AppendCommand, B as BitCountCommand, a as BitPosCommand, b as DecrByCommand, D as DecrCommand, c as DelCommand, E as EchoCommand, d as ExistsCommand, f as ExpireAtCommand, e as ExpireCommand, F as FlushAllCommand, g as FlushDBCommand, h as GetBitCommand, G as GetCommand, i as GetRangeCommand, j as HDelCommand, k as HExistsCommand, m as HGetAllCommand, l as HGetCommand, n as HIncrByCommand, o as HIncrByFloatCommand, p as HKeysCommand, q as HLenCommand, r as HMGetCommand, s as HScanCommand, t as HStrLenCommand, u as HValsCommand, v as IncrByCommand, w as IncrByFloatCommand, I as IncrCommand, K as KeysCommand, L as LIndexCommand, x as LLenCommand, y as LPopCommand, z as LRangeCommand, J as LTrimCommand, M as MGetCommand, Q as PExpireAtCommand, O as PExpireCommand, S as PTtlCommand, P as PersistCommand, R as PingCommand, V as RPopCommand, T as RenameCommand, U as RenameNXCommand, X as SCardCommand, Y as SDiffCommand, Z as SDiffStoreCommand, a1 as SInterCommand, a2 as SInterStoreCommand, a3 as SMembersCommand, a4 as SPopCommand, a5 as SRandMemberCommand, a6 as SScanCommand, a8 as SUnionCommand, a9 as SUnionStoreCommand, W as ScanCommand, av as ScanCommandOptions, ae as ScoreMember, $ as SetBitCommand, aw as SetCommand, _ as SetCommandOptions, a0 as SetRangeCommand, a7 as StrLenCommand, aa as TouchCommand, ab as TtlCommand, at as Type, ac as TypeCommand, ad as UnlinkCommand, ax as ZAddCommand, af as ZAddCommandOptions, ag as ZAddCommandOptionsWithIncr, ah as ZCardCommand, ai as ZCountCommand, aj as ZInterStoreCommand, ay as ZInterStoreCommandOptions, ak as ZLexCountCommand, al as ZPopMaxCommand, am as ZPopMinCommand, an as ZRangeCommand, az as ZRangeCommandOptions, ao as ZRemRangeByLexCommand, ap as ZRemRangeByRankCommand, aq as ZRemRangeByScoreCommand, ar as ZScanCommand, as as ZUnionStoreCommand, aA as ZUnionStoreCommandOptions } from './zunionstore-
|
|
1
|
+
import { au as Command, N as NonEmptyArray } from './zunionstore-462de5d3';
|
|
2
|
+
export { A as AppendCommand, B as BitCountCommand, a as BitPosCommand, b as DecrByCommand, D as DecrCommand, c as DelCommand, E as EchoCommand, d as ExistsCommand, f as ExpireAtCommand, e as ExpireCommand, F as FlushAllCommand, g as FlushDBCommand, h as GetBitCommand, G as GetCommand, i as GetRangeCommand, j as HDelCommand, k as HExistsCommand, m as HGetAllCommand, l as HGetCommand, n as HIncrByCommand, o as HIncrByFloatCommand, p as HKeysCommand, q as HLenCommand, r as HMGetCommand, s as HScanCommand, t as HStrLenCommand, u as HValsCommand, v as IncrByCommand, w as IncrByFloatCommand, I as IncrCommand, K as KeysCommand, L as LIndexCommand, x as LLenCommand, y as LPopCommand, z as LRangeCommand, J as LTrimCommand, M as MGetCommand, Q as PExpireAtCommand, O as PExpireCommand, S as PTtlCommand, P as PersistCommand, R as PingCommand, V as RPopCommand, T as RenameCommand, U as RenameNXCommand, X as SCardCommand, Y as SDiffCommand, Z as SDiffStoreCommand, a1 as SInterCommand, a2 as SInterStoreCommand, a3 as SMembersCommand, a4 as SPopCommand, a5 as SRandMemberCommand, a6 as SScanCommand, a8 as SUnionCommand, a9 as SUnionStoreCommand, W as ScanCommand, av as ScanCommandOptions, ae as ScoreMember, $ as SetBitCommand, aw as SetCommand, _ as SetCommandOptions, a0 as SetRangeCommand, a7 as StrLenCommand, aa as TouchCommand, ab as TtlCommand, at as Type, ac as TypeCommand, ad as UnlinkCommand, ax as ZAddCommand, af as ZAddCommandOptions, ag as ZAddCommandOptionsWithIncr, ah as ZCardCommand, ai as ZCountCommand, aj as ZInterStoreCommand, ay as ZInterStoreCommandOptions, ak as ZLexCountCommand, al as ZPopMaxCommand, am as ZPopMinCommand, an as ZRangeCommand, az as ZRangeCommandOptions, ao as ZRemRangeByLexCommand, ap as ZRemRangeByRankCommand, aq as ZRemRangeByScoreCommand, ar as ZScanCommand, as as ZUnionStoreCommand, aA as ZUnionStoreCommandOptions } from './zunionstore-462de5d3';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @see https://redis.io/commands/bitop
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as HttpClient, C as CommandArgs, A as AppendCommand, B as BitCountCommand, a as BitPosCommand, D as DecrCommand, b as DecrByCommand, c as DelCommand, E as EchoCommand, d as ExistsCommand, e as ExpireCommand, f as ExpireAtCommand, F as FlushAllCommand, g as FlushDBCommand, G as GetCommand, h as GetBitCommand, i as GetRangeCommand, j as HDelCommand, k as HExistsCommand, l as HGetCommand, m as HGetAllCommand, n as HIncrByCommand, o as HIncrByFloatCommand, p as HKeysCommand, q as HLenCommand, r as HMGetCommand, s as HScanCommand, t as HStrLenCommand, u as HValsCommand, I as IncrCommand, v as IncrByCommand, w as IncrByFloatCommand, K as KeysCommand, L as LIndexCommand, x as LLenCommand, y as LPopCommand, N as NonEmptyArray, z as LRangeCommand, J as LTrimCommand, M as MGetCommand, P as PersistCommand, O as PExpireCommand, Q as PExpireAtCommand, R as PingCommand, S as PTtlCommand, T as RenameCommand, U as RenameNXCommand, V as RPopCommand, W as ScanCommand, X as SCardCommand, Y as SDiffCommand, Z as SDiffStoreCommand, _ as SetCommandOptions, $ as SetBitCommand, a0 as SetRangeCommand, a1 as SInterCommand, a2 as SInterStoreCommand, a3 as SMembersCommand, a4 as SPopCommand, a5 as SRandMemberCommand, a6 as SScanCommand, a7 as StrLenCommand, a8 as SUnionCommand, a9 as SUnionStoreCommand, aa as TouchCommand, ab as TtlCommand, ac as TypeCommand, ad as UnlinkCommand, ae as ScoreMember, af as ZAddCommandOptions, ag as ZAddCommandOptionsWithIncr, ah as ZCardCommand, ai as ZCountCommand, aj as ZInterStoreCommand, ak as ZLexCountCommand, al as ZPopMaxCommand, am as ZPopMinCommand, an as ZRangeCommand, ao as ZRemRangeByLexCommand, ap as ZRemRangeByRankCommand, aq as ZRemRangeByScoreCommand, ar as ZScanCommand, as as ZUnionStoreCommand, at as Type } from './zunionstore-
|
|
1
|
+
import { H as HttpClient, C as CommandArgs, A as AppendCommand, B as BitCountCommand, a as BitPosCommand, D as DecrCommand, b as DecrByCommand, c as DelCommand, E as EchoCommand, d as ExistsCommand, e as ExpireCommand, f as ExpireAtCommand, F as FlushAllCommand, g as FlushDBCommand, G as GetCommand, h as GetBitCommand, i as GetRangeCommand, j as HDelCommand, k as HExistsCommand, l as HGetCommand, m as HGetAllCommand, n as HIncrByCommand, o as HIncrByFloatCommand, p as HKeysCommand, q as HLenCommand, r as HMGetCommand, s as HScanCommand, t as HStrLenCommand, u as HValsCommand, I as IncrCommand, v as IncrByCommand, w as IncrByFloatCommand, K as KeysCommand, L as LIndexCommand, x as LLenCommand, y as LPopCommand, N as NonEmptyArray, z as LRangeCommand, J as LTrimCommand, M as MGetCommand, P as PersistCommand, O as PExpireCommand, Q as PExpireAtCommand, R as PingCommand, S as PTtlCommand, T as RenameCommand, U as RenameNXCommand, V as RPopCommand, W as ScanCommand, X as SCardCommand, Y as SDiffCommand, Z as SDiffStoreCommand, _ as SetCommandOptions, $ as SetBitCommand, a0 as SetRangeCommand, a1 as SInterCommand, a2 as SInterStoreCommand, a3 as SMembersCommand, a4 as SPopCommand, a5 as SRandMemberCommand, a6 as SScanCommand, a7 as StrLenCommand, a8 as SUnionCommand, a9 as SUnionStoreCommand, aa as TouchCommand, ab as TtlCommand, ac as TypeCommand, ad as UnlinkCommand, ae as ScoreMember, af as ZAddCommandOptions, ag as ZAddCommandOptionsWithIncr, ah as ZCardCommand, ai as ZCountCommand, aj as ZInterStoreCommand, ak as ZLexCountCommand, al as ZPopMaxCommand, am as ZPopMinCommand, an as ZRangeCommand, ao as ZRemRangeByLexCommand, ap as ZRemRangeByRankCommand, aq as ZRemRangeByScoreCommand, ar as ZScanCommand, as as ZUnionStoreCommand, at as Type } from './zunionstore-462de5d3';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Upstash REST API supports command pipelining to send multiple commands in
|
|
@@ -510,6 +510,16 @@ declare type RedisConfig = {
|
|
|
510
510
|
* UPSTASH_REDIS_REST_TOKEN
|
|
511
511
|
*/
|
|
512
512
|
token: string;
|
|
513
|
+
requestOptions?: {
|
|
514
|
+
/**
|
|
515
|
+
* **fastly only**
|
|
516
|
+
*
|
|
517
|
+
* A Request can be forwarded to any backend defined on your service. Backends
|
|
518
|
+
* can be created via the Fastly CLI, API, or web interface, and are
|
|
519
|
+
* referenced by name.
|
|
520
|
+
*/
|
|
521
|
+
backend?: string;
|
|
522
|
+
};
|
|
513
523
|
};
|
|
514
524
|
/**
|
|
515
525
|
* Serverless redis client for upstash.
|
package/dist/index.js
CHANGED
|
@@ -59,8 +59,10 @@ var HttpClient = class {
|
|
|
59
59
|
var _a;
|
|
60
60
|
this.baseUrl = config.baseUrl.replace(/\/$/, "");
|
|
61
61
|
this.headers = (_a = config.headers) != null ? _a : {};
|
|
62
|
+
this.options = config.options;
|
|
62
63
|
}
|
|
63
64
|
async request(method, req) {
|
|
65
|
+
var _a;
|
|
64
66
|
if (!req.path) {
|
|
65
67
|
req.path = [];
|
|
66
68
|
}
|
|
@@ -70,7 +72,8 @@ var HttpClient = class {
|
|
|
70
72
|
const res = await fetch([this.baseUrl, ...req.path].join("/"), {
|
|
71
73
|
method,
|
|
72
74
|
headers,
|
|
73
|
-
body: JSON.stringify(req.body)
|
|
75
|
+
body: JSON.stringify(req.body),
|
|
76
|
+
backend: (_a = this.options) == null ? void 0 : _a.backend
|
|
74
77
|
});
|
|
75
78
|
const body = await res.json();
|
|
76
79
|
if (!res.ok) {
|
|
@@ -1386,7 +1389,8 @@ var Redis = class {
|
|
|
1386
1389
|
baseUrl: config.url,
|
|
1387
1390
|
headers: {
|
|
1388
1391
|
authorization: `Bearer ${config.token}`
|
|
1389
|
-
}
|
|
1392
|
+
},
|
|
1393
|
+
options: config.requestOptions
|
|
1390
1394
|
});
|
|
1391
1395
|
}
|
|
1392
1396
|
static fromEnv() {
|
package/dist/index.mjs
CHANGED
|
@@ -117,8 +117,10 @@ var HttpClient = class {
|
|
|
117
117
|
var _a;
|
|
118
118
|
this.baseUrl = config.baseUrl.replace(/\/$/, "");
|
|
119
119
|
this.headers = (_a = config.headers) != null ? _a : {};
|
|
120
|
+
this.options = config.options;
|
|
120
121
|
}
|
|
121
122
|
async request(method, req) {
|
|
123
|
+
var _a;
|
|
122
124
|
if (!req.path) {
|
|
123
125
|
req.path = [];
|
|
124
126
|
}
|
|
@@ -128,7 +130,8 @@ var HttpClient = class {
|
|
|
128
130
|
const res = await fetch([this.baseUrl, ...req.path].join("/"), {
|
|
129
131
|
method,
|
|
130
132
|
headers,
|
|
131
|
-
body: JSON.stringify(req.body)
|
|
133
|
+
body: JSON.stringify(req.body),
|
|
134
|
+
backend: (_a = this.options) == null ? void 0 : _a.backend
|
|
132
135
|
});
|
|
133
136
|
const body = await res.json();
|
|
134
137
|
if (!res.ok) {
|
|
@@ -496,7 +499,8 @@ var Redis = class {
|
|
|
496
499
|
baseUrl: config.url,
|
|
497
500
|
headers: {
|
|
498
501
|
authorization: `Bearer ${config.token}`
|
|
499
|
-
}
|
|
502
|
+
},
|
|
503
|
+
options: config.requestOptions
|
|
500
504
|
});
|
|
501
505
|
}
|
|
502
506
|
static fromEnv() {
|
|
@@ -10,10 +10,16 @@ declare type HttpRequest = {
|
|
|
10
10
|
declare type HttpClientConfig = {
|
|
11
11
|
headers?: Record<string, string>;
|
|
12
12
|
baseUrl: string;
|
|
13
|
+
options?: {
|
|
14
|
+
backend?: string;
|
|
15
|
+
};
|
|
13
16
|
};
|
|
14
17
|
declare class HttpClient {
|
|
15
18
|
baseUrl: string;
|
|
16
19
|
headers: Record<string, string>;
|
|
20
|
+
readonly options?: {
|
|
21
|
+
backend?: string;
|
|
22
|
+
};
|
|
17
23
|
constructor(config: HttpClientConfig);
|
|
18
24
|
private request;
|
|
19
25
|
post<TResponse>(req: HttpRequest): Promise<TResponse>;
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "name": "@upstash/redis", "version": "v1.0.0-alpha.
|
|
1
|
+
{ "name": "@upstash/redis", "version": "v1.0.0-alpha.1", "engines": { "node": ">=10" }, "description": "An HTTP/REST based Redis client built on top of Upstash REST API.", "main": "./dist/index.js", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", "exports": { ".": { "require": "./dist/index.js", "import": "./dist/index.mjs", "types": "./dist/index.d.ts" } }, "files": [ "package.json", "dist" ], "scripts": { "test": "jest -i", "fmt": "pnpm lint && pnpm prettier --write .", "lint": "eslint --ext .ts --fix --ignore-path .gitignore .", "build": "tsup && 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", "@trivago/prettier-plugin-sort-imports": "^3.2.0", "@types/jest": "^27.4.0", "@types/node": "^17.0.8", "@typescript-eslint/eslint-plugin": "^5.9.1", "@typescript-eslint/parser": "^5.9.1", "dotenv": "^12.0.3", "eslint": "^8.6.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^4.0.0", "jest": "^27.4.7", "prettier": "^2.5.1", "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 }, "size-limit": [ { "path": "dist/index.js", "limit": "5 KB" }, { "path": "dist/index.mjs", "limit": "5 KB" } ] }
|