@upstash/redis 1.0.0-alpha.2 → 1.0.0-alpha.7
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/README.md +256 -0
- package/{dist/chunk-7YUZYRJS.mjs → chunk-7YUZYRJS.mjs} +0 -0
- package/{dist/chunk-FJSI5EBJ.mjs → chunk-AHCVU33N.mjs} +2 -2
- package/{dist/chunk-ZIB6XPPC.mjs → chunk-HGM7M7CJ.mjs} +9 -4
- package/{dist/chunk-U7OXAQMQ.mjs → chunk-HIDCSH5S.mjs} +0 -1
- package/{dist/chunk-Y5TC4HX2.mjs → chunk-T66TTHSV.mjs} +5 -5
- package/{dist/cloudflare.d.ts → cloudflare.d.ts} +2 -2
- package/{dist/cloudflare.js → cloudflare.js} +12 -9
- package/{dist/cloudflare.mjs → cloudflare.mjs} +3 -3
- package/{dist/commands.d.ts → commands.d.ts} +5 -3
- package/{dist/commands.js → commands.js} +10 -4
- package/{dist/commands.mjs → commands.mjs} +3 -1
- package/{dist/fastly.d.ts → fastly.d.ts} +2 -2
- package/{dist/fastly.js → fastly.js} +12 -9
- package/{dist/fastly.mjs → fastly.mjs} +3 -3
- package/{dist/http.d.ts → http.d.ts} +0 -0
- package/{dist/http.js → http.js} +0 -1
- package/{dist/http.mjs → http.mjs} +1 -1
- package/{dist/index.d.ts → index.d.ts} +2 -2
- package/{dist/index.js → index.js} +13 -10
- package/index.mjs +13 -0
- package/{dist/nodejs.d.ts → nodejs.d.ts} +2 -2
- package/{dist/nodejs.js → nodejs.js} +13 -10
- package/nodejs.mjs +10 -0
- package/package.json +1 -1
- package/{dist/redis-dd052782.d.ts → redis-71fa1ee6.d.ts} +7 -3
- package/{dist/zunionstore-dffa797d.d.ts → zunionstore-b38007ba.d.ts} +1 -1
- package/.eslintrc.js +0 -49
- package/.prettierrc.js +0 -7
- package/LICENSE +0 -21
- package/dist/index.mjs +0 -13
- package/dist/nodejs.mjs +0 -10
- package/dist/package.json +0 -1
- package/jest.config.js +0 -195
- package/pkg/cloudflare.ts +0 -77
- package/pkg/command.ts +0 -40
- package/pkg/commands/append.test.ts +0 -28
- package/pkg/commands/append.ts +0 -10
- package/pkg/commands/bitcount.test.ts +0 -36
- package/pkg/commands/bitcount.ts +0 -19
- package/pkg/commands/bitop.test.ts +0 -44
- package/pkg/commands/bitop.ts +0 -22
- package/pkg/commands/bitpos.test.ts +0 -26
- package/pkg/commands/bitpos.ts +0 -10
- package/pkg/commands/dbsize.test.ts +0 -17
- package/pkg/commands/dbsize.ts +0 -10
- package/pkg/commands/decr.test.ts +0 -22
- package/pkg/commands/decr.ts +0 -10
- package/pkg/commands/decrby.test.ts +0 -23
- package/pkg/commands/decrby.ts +0 -10
- package/pkg/commands/del.test.ts +0 -38
- package/pkg/commands/del.ts +0 -11
- package/pkg/commands/echo.test.ts +0 -11
- package/pkg/commands/echo.ts +0 -10
- package/pkg/commands/exists.test.ts +0 -37
- package/pkg/commands/exists.ts +0 -11
- package/pkg/commands/expire.test.ts +0 -22
- package/pkg/commands/expire.ts +0 -10
- package/pkg/commands/expireat.test.ts +0 -24
- package/pkg/commands/expireat.ts +0 -10
- package/pkg/commands/flushall.test.ts +0 -17
- package/pkg/commands/flushall.ts +0 -13
- package/pkg/commands/flushdb.test.ts +0 -17
- package/pkg/commands/flushdb.ts +0 -13
- package/pkg/commands/get.test.ts +0 -34
- package/pkg/commands/get.ts +0 -10
- package/pkg/commands/getbit.test.ts +0 -16
- package/pkg/commands/getbit.ts +0 -10
- package/pkg/commands/getrange.test.ts +0 -25
- package/pkg/commands/getrange.ts +0 -10
- package/pkg/commands/getset.test.ts +0 -33
- package/pkg/commands/getset.ts +0 -10
- package/pkg/commands/hdel.test.ts +0 -30
- package/pkg/commands/hdel.ts +0 -10
- package/pkg/commands/hexists.test.ts +0 -31
- package/pkg/commands/hexists.ts +0 -10
- package/pkg/commands/hget.test.ts +0 -47
- package/pkg/commands/hget.ts +0 -10
- package/pkg/commands/hgetall.test.ts +0 -32
- package/pkg/commands/hgetall.ts +0 -35
- package/pkg/commands/hincrby.test.ts +0 -27
- package/pkg/commands/hincrby.ts +0 -10
- package/pkg/commands/hincrbyfloat.test.ts +0 -25
- package/pkg/commands/hincrbyfloat.ts +0 -10
- package/pkg/commands/hkeys.test.ts +0 -22
- package/pkg/commands/hkeys.ts +0 -10
- package/pkg/commands/hlen.test.ts +0 -24
- package/pkg/commands/hlen.ts +0 -10
- package/pkg/commands/hmget.test.ts +0 -48
- package/pkg/commands/hmget.ts +0 -41
- package/pkg/commands/hmset.test.ts +0 -24
- package/pkg/commands/hmset.ts +0 -10
- package/pkg/commands/hscan.test.ts +0 -46
- package/pkg/commands/hscan.ts +0 -22
- package/pkg/commands/hset.test.ts +0 -21
- package/pkg/commands/hset.ts +0 -10
- package/pkg/commands/hsetnx.test.ts +0 -37
- package/pkg/commands/hsetnx.ts +0 -10
- package/pkg/commands/hstrlen.test.ts +0 -24
- package/pkg/commands/hstrlen.ts +0 -10
- package/pkg/commands/hvals.test.ts +0 -23
- package/pkg/commands/hvals.ts +0 -10
- package/pkg/commands/incr.test.ts +0 -23
- package/pkg/commands/incr.ts +0 -10
- package/pkg/commands/incrby.test.ts +0 -23
- package/pkg/commands/incrby.ts +0 -10
- package/pkg/commands/incrbyfloat.test.ts +0 -24
- package/pkg/commands/incrbyfloat.ts +0 -10
- package/pkg/commands/index.ts +0 -107
- package/pkg/commands/keys.test.ts +0 -17
- package/pkg/commands/keys.ts +0 -10
- package/pkg/commands/lindex.test.ts +0 -33
- package/pkg/commands/lindex.ts +0 -7
- package/pkg/commands/linsert.test.ts +0 -19
- package/pkg/commands/linsert.ts +0 -6
- package/pkg/commands/llen.test.ts +0 -26
- package/pkg/commands/llen.ts +0 -10
- package/pkg/commands/lpop.test.ts +0 -27
- package/pkg/commands/lpop.ts +0 -10
- package/pkg/commands/lpush.test.ts +0 -17
- package/pkg/commands/lpush.ts +0 -11
- package/pkg/commands/lpushx.test.ts +0 -29
- package/pkg/commands/lpushx.ts +0 -11
- package/pkg/commands/lrange.test.ts +0 -22
- package/pkg/commands/lrange.ts +0 -7
- package/pkg/commands/lrem.test.ts +0 -19
- package/pkg/commands/lrem.ts +0 -6
- package/pkg/commands/lset.test.ts +0 -40
- package/pkg/commands/lset.ts +0 -7
- package/pkg/commands/ltrim.test.ts +0 -29
- package/pkg/commands/ltrim.ts +0 -7
- package/pkg/commands/mget.test.ts +0 -44
- package/pkg/commands/mget.ts +0 -9
- package/pkg/commands/mset.test.ts +0 -24
- package/pkg/commands/mset.ts +0 -10
- package/pkg/commands/msetnx.test.ts +0 -46
- package/pkg/commands/msetnx.ts +0 -10
- package/pkg/commands/persist.test.ts +0 -22
- package/pkg/commands/persist.ts +0 -10
- package/pkg/commands/pexpire.test.ts +0 -24
- package/pkg/commands/pexpire.ts +0 -10
- package/pkg/commands/pexpireat.test.ts +0 -24
- package/pkg/commands/pexpireat.ts +0 -10
- package/pkg/commands/ping.test.ts +0 -19
- package/pkg/commands/ping.ts +0 -13
- package/pkg/commands/psetex.test.ts +0 -23
- package/pkg/commands/psetex.ts +0 -10
- package/pkg/commands/pttl.test.ts +0 -17
- package/pkg/commands/pttl.ts +0 -10
- package/pkg/commands/randomkey.test.ts +0 -17
- package/pkg/commands/randomkey.ts +0 -10
- package/pkg/commands/rename.test.ts +0 -18
- package/pkg/commands/rename.ts +0 -10
- package/pkg/commands/renamenx.test.ts +0 -32
- package/pkg/commands/renamenx.ts +0 -10
- package/pkg/commands/rpop.test.ts +0 -27
- package/pkg/commands/rpop.ts +0 -10
- package/pkg/commands/rpush.test.ts +0 -17
- package/pkg/commands/rpush.ts +0 -11
- package/pkg/commands/rpushx.test.ts +0 -29
- package/pkg/commands/rpushx.ts +0 -11
- package/pkg/commands/sadd.test.ts +0 -16
- package/pkg/commands/sadd.ts +0 -11
- package/pkg/commands/scan.test.ts +0 -50
- package/pkg/commands/scan.ts +0 -21
- package/pkg/commands/scard.test.ts +0 -15
- package/pkg/commands/scard.ts +0 -9
- package/pkg/commands/sdiff.test.ts +0 -20
- package/pkg/commands/sdiff.ts +0 -9
- package/pkg/commands/sdiffstore.test.ts +0 -21
- package/pkg/commands/sdiffstore.ts +0 -10
- package/pkg/commands/set.test.ts +0 -112
- package/pkg/commands/set.ts +0 -53
- package/pkg/commands/setbit.test.ts +0 -16
- package/pkg/commands/setbit.ts +0 -10
- package/pkg/commands/setex.test.ts +0 -22
- package/pkg/commands/setex.ts +0 -10
- package/pkg/commands/setnx.test.ts +0 -27
- package/pkg/commands/setnx.ts +0 -10
- package/pkg/commands/setrange.test.ts +0 -25
- package/pkg/commands/setrange.ts +0 -10
- package/pkg/commands/sinter.test.ts +0 -36
- package/pkg/commands/sinter.ts +0 -9
- package/pkg/commands/sinterstore.test.ts +0 -21
- package/pkg/commands/sinterstore.ts +0 -9
- package/pkg/commands/sismember.test.ts +0 -30
- package/pkg/commands/sismember.ts +0 -9
- package/pkg/commands/smembers.test.ts +0 -22
- package/pkg/commands/smembers.ts +0 -10
- package/pkg/commands/smove.test.ts +0 -18
- package/pkg/commands/smove.ts +0 -9
- package/pkg/commands/spop.test.ts +0 -35
- package/pkg/commands/spop.ts +0 -13
- package/pkg/commands/srandmember.test.ts +0 -32
- package/pkg/commands/srandmember.ts +0 -13
- package/pkg/commands/srem.test.ts +0 -18
- package/pkg/commands/srem.ts +0 -10
- package/pkg/commands/sscan.test.ts +0 -50
- package/pkg/commands/sscan.ts +0 -22
- package/pkg/commands/strlen.test.ts +0 -16
- package/pkg/commands/strlen.ts +0 -10
- package/pkg/commands/sunion.test.ts +0 -22
- package/pkg/commands/sunion.ts +0 -10
- package/pkg/commands/sunionstore.test.ts +0 -29
- package/pkg/commands/sunionstore.ts +0 -10
- package/pkg/commands/time.test.ts +0 -11
- package/pkg/commands/time.ts +0 -9
- package/pkg/commands/touch.test.ts +0 -20
- package/pkg/commands/touch.ts +0 -10
- package/pkg/commands/ttl.test.ts +0 -17
- package/pkg/commands/ttl.ts +0 -10
- package/pkg/commands/type.test.ts +0 -72
- package/pkg/commands/type.ts +0 -11
- package/pkg/commands/unlink.test.ts +0 -21
- package/pkg/commands/unlink.ts +0 -10
- package/pkg/commands/zadd.test.ts +0 -177
- package/pkg/commands/zadd.ts +0 -64
- package/pkg/commands/zcard.test.ts +0 -15
- package/pkg/commands/zcard.ts +0 -10
- package/pkg/commands/zcount.test.ts +0 -15
- package/pkg/commands/zcount.ts +0 -9
- package/pkg/commands/zincrby.test.ts +0 -20
- package/pkg/commands/zincrby.ts +0 -9
- package/pkg/commands/zinterstore.test.ts +0 -239
- package/pkg/commands/zinterstore.ts +0 -55
- package/pkg/commands/zlexcount.test.ts +0 -22
- package/pkg/commands/zlexcount.ts +0 -9
- package/pkg/commands/zpopmax.test.ts +0 -45
- package/pkg/commands/zpopmax.ts +0 -13
- package/pkg/commands/zpopmin.test.ts +0 -49
- package/pkg/commands/zpopmin.ts +0 -13
- package/pkg/commands/zrange.test.ts +0 -52
- package/pkg/commands/zrange.ts +0 -22
- package/pkg/commands/zrank.test.ts +0 -22
- package/pkg/commands/zrank.ts +0 -10
- package/pkg/commands/zrem.test.ts +0 -20
- package/pkg/commands/zrem.ts +0 -10
- package/pkg/commands/zremrangebylex.test.ts +0 -26
- package/pkg/commands/zremrangebylex.ts +0 -9
- package/pkg/commands/zremrangebyrank.test.ts +0 -27
- package/pkg/commands/zremrangebyrank.ts +0 -9
- package/pkg/commands/zremrangebyscore.test.ts +0 -24
- package/pkg/commands/zremrangebyscore.ts +0 -9
- package/pkg/commands/zrevrank.test.ts +0 -22
- package/pkg/commands/zrevrank.ts +0 -10
- package/pkg/commands/zscan.test.ts +0 -50
- package/pkg/commands/zscan.ts +0 -22
- package/pkg/commands/zscore.test.ts +0 -18
- package/pkg/commands/zscore.ts +0 -10
- package/pkg/commands/zunionstore.test.ts +0 -215
- package/pkg/commands/zunionstore.ts +0 -55
- package/pkg/commands/zz.ts +0 -1
- package/pkg/error.ts +0 -9
- package/pkg/fastly.ts +0 -54
- package/pkg/http.test.ts +0 -34
- package/pkg/http.ts +0 -62
- package/pkg/index.ts +0 -2
- package/pkg/nodejs.ts +0 -83
- package/pkg/pipeline.test.ts +0 -177
- package/pkg/pipeline.ts +0 -999
- package/pkg/redis.ts +0 -930
- package/pkg/test-utils.ts +0 -41
- package/pkg/types.ts +0 -4
- package/pkg/util.ts +0 -22
- package/pnpm-lock.yaml +0 -3940
- package/tsconfig.json +0 -100
- package/tsconfig.module.json +0 -8
- package/tsup.config.ts +0 -16
package/README.md
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
# Upstash Redis
|
|
2
|
+
|
|
3
|
+
An HTTP/REST based Redis client built on top of
|
|
4
|
+
[Upstash REST API](https://docs.upstash.com/features/restapi).
|
|
5
|
+
|
|
6
|
+
[](https://github.com/upstash/upstash-redis/actions/workflows/tests.yaml)
|
|
7
|
+

|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
It is the only connectionless (HTTP based) Redis client and designed for:
|
|
11
|
+
|
|
12
|
+
- Serverless functions (AWS Lambda ...)
|
|
13
|
+
- Cloudflare Workers (see
|
|
14
|
+
[the example](https://github.com/upstash/upstash-redis/tree/master/examples/cloudflare-workers))
|
|
15
|
+
- Fastly Compute@Edge (see
|
|
16
|
+
[the example](https://github.com/upstash/upstash-redis/tree/master/examples/fastly))
|
|
17
|
+
- Next.js, Jamstack ...
|
|
18
|
+
- Client side web/mobile applications
|
|
19
|
+
- WebAssembly
|
|
20
|
+
- and other environments where HTTP is preferred over TCP.
|
|
21
|
+
|
|
22
|
+
See [the list of APIs](https://docs.upstash.com/features/restapi#rest---redis-api-compatibility) supported.
|
|
23
|
+
|
|
24
|
+
## Upgrading from v0.2.0?
|
|
25
|
+
|
|
26
|
+
Please read the [migration guide](https://github.com/upstash/upstash-redis#migrating-to-v1).
|
|
27
|
+
For further explanation we wrote a [blog post](https://blog.upstash.com/upstash-redis-sdk-v1).
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
### Install
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install @upstash/redis
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Create database
|
|
38
|
+
|
|
39
|
+
Create a new redis database on [upstash](https://console.upstash.com/)
|
|
40
|
+
|
|
41
|
+
### Environments
|
|
42
|
+
|
|
43
|
+
We support various platforms, such as nodejs, cloudflare and fastly.
|
|
44
|
+
Platforms differ slightly when it comes to environment variables and their `fetch` api. Please use the correct import when deploying to special platforms.
|
|
45
|
+
|
|
46
|
+
#### Node.js
|
|
47
|
+
|
|
48
|
+
Examples: Vercel, Netlify, AWS Lambda
|
|
49
|
+
|
|
50
|
+
If you are running on nodejs you can set `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN` as environment variable and create a redis instance like this:
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import { Redis } from "@upstash/redis"
|
|
54
|
+
|
|
55
|
+
const redis = new Redis({
|
|
56
|
+
url: <UPSTASH_REDIS_REST_URL>,
|
|
57
|
+
token: <UPSTASH_REDIS_REST_TOKEN>,
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
// or load directly from env
|
|
61
|
+
const redis = Redis.fromEnv()
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
- [Code example](https://github.com/upstash/upstash-redis/tree/main/examples/node)
|
|
65
|
+
|
|
66
|
+
#### Cloudflare Workers
|
|
67
|
+
|
|
68
|
+
Cloudflare handles environment variables differently than nodejs.
|
|
69
|
+
Please add `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN` using `wrangler secret put ...` or in the cloudflare dashboard.
|
|
70
|
+
|
|
71
|
+
Afterwards you can create a redis instance:
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import { Redis } from "@upstash/redis/cloudflare"
|
|
75
|
+
|
|
76
|
+
const redis = new Redis({
|
|
77
|
+
url: <UPSTASH_REDIS_REST_URL>,
|
|
78
|
+
token: <UPSTASH_REDIS_REST_TOKEN>,
|
|
79
|
+
})
|
|
80
|
+
// or load directly from env
|
|
81
|
+
const redis = Redis.fromEnv()
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
- [Code example](https://github.com/upstash/upstash-redis/tree/main/examples/cloudflare-workers)
|
|
85
|
+
- [Documentation](https://docs.upstash.com/redis/tutorials/cloudflare_workers_with_redis)
|
|
86
|
+
|
|
87
|
+
#### Fastly
|
|
88
|
+
|
|
89
|
+
Fastly introduces a concept called [backend](https://developer.fastly.com/reference/api/services/backend/). You need to configure a backend in your `fastly.toml`. An example can be found [here](https://github.com/upstash/upstash-redis/blob/main/examples/fastly/fastly.toml).
|
|
90
|
+
Until the fastly api stabilizes we recommend creating an instance manually:
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
import { Redis } from "@upstash/redis/fastly"
|
|
94
|
+
|
|
95
|
+
const redis = new Redis({
|
|
96
|
+
url: <UPSTASH_REDIS_REST_URL>,
|
|
97
|
+
token: <UPSTASH_REDIS_REST_TOKEN>,
|
|
98
|
+
backend: <BACKEND_NAME>,
|
|
99
|
+
})
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
- [Code example](https://github.com/upstash/upstash-redis/tree/main/examples/fastly)
|
|
103
|
+
- [Documentation](https://blog.upstash.com/fastly-compute-edge-with-redi)
|
|
104
|
+
|
|
105
|
+
### Working with types
|
|
106
|
+
|
|
107
|
+
Most commands allow you to provide a type to make working with typescript easier.
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
const data = await redis.get<MyCustomType>("key")
|
|
111
|
+
// data is typed as `MyCustomType`
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Migrating to v1
|
|
115
|
+
|
|
116
|
+
### Explicit authentication
|
|
117
|
+
|
|
118
|
+
The library is no longer automatically trying to load connection secrets from environment variables.
|
|
119
|
+
You must either supply them yourself:
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
import { Redis } from "@upstash/redis"
|
|
123
|
+
|
|
124
|
+
const redis = new Redis({
|
|
125
|
+
url: <UPSTASH_REDIS_REST_URL>,
|
|
126
|
+
token: <UPSTASH_REDIS_REST_TOKEN>,
|
|
127
|
+
})
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Or use one of the static constructors to load from environment variables:
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
// Nodejs
|
|
134
|
+
import { Redis } from "@upstash/redis"
|
|
135
|
+
const redis = Redis.fromEnv()
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
// or when deploying to cloudflare workers
|
|
140
|
+
import { Redis } from "@upstash/redis/cloudflare"
|
|
141
|
+
const redis = Redis.fromEnv()
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Error handling
|
|
145
|
+
|
|
146
|
+
Errors are now thrown automatically instead of being returned to you.
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
// old
|
|
150
|
+
const { data, error } = await set("key", "value")
|
|
151
|
+
if (error) {
|
|
152
|
+
throw new Error(error)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// new
|
|
156
|
+
const data = await redis.set("key", "value") // error is thrown automatically
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Pipeline
|
|
160
|
+
|
|
161
|
+
`v1.0.0` introduces redis pipelines.
|
|
162
|
+
Pipelining commands allows you to send a single http request with multiple commands.
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
import { Redis } from "@upstash/redis"
|
|
166
|
+
|
|
167
|
+
const redis = new Redis({
|
|
168
|
+
/* auth */
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
const p = redis.pipeline()
|
|
172
|
+
|
|
173
|
+
// Now you can chain multiple commands to create your pipeline:
|
|
174
|
+
|
|
175
|
+
p.set("key", 2)
|
|
176
|
+
p.incr("key")
|
|
177
|
+
|
|
178
|
+
// or inline:
|
|
179
|
+
p.hset("key2", "field", { hello: "world" }).hvals("key2")
|
|
180
|
+
|
|
181
|
+
// Execute the pipeline once you are done building it:
|
|
182
|
+
// `exec` returns an array where each element represents the response of a command in the pipeline.
|
|
183
|
+
// You can optionally provide a type like this to get a typed response.
|
|
184
|
+
const res = await p.exec<[Type1, Type2, Type3]>()
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
For more information about pipelines using REST see [here](https://blog.upstash.com/pipeline).
|
|
188
|
+
|
|
189
|
+
### Advanced
|
|
190
|
+
|
|
191
|
+
A low level `Command` class can be imported from `@upstash/redis` in case you need more control about types and or (de)serialization.
|
|
192
|
+
|
|
193
|
+
By default all objects you are storing in redis are serialized using `JSON.stringify` and recursively deserialized as well. Here's an example how you could customize that behaviour. Keep in mind that you need to provide a `fetch` polyfill if you are running on nodejs. We recommend [isomorphic-fetch](https://www.npmjs.com/package/isomorphic-fetch).
|
|
194
|
+
|
|
195
|
+
```ts
|
|
196
|
+
import { Command } from "@upstash/redis/commands"
|
|
197
|
+
import { HttpClient } from "@upstash/redis/http"
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* TData represents what the user will enter or receive,
|
|
201
|
+
* TResult is the raw data returned from upstash, which may need to be
|
|
202
|
+
* transformed or parsed.
|
|
203
|
+
*/
|
|
204
|
+
const deserialize: (raw: TResult) => TData = ...
|
|
205
|
+
|
|
206
|
+
class CustomGetCommand<TData, TResult> extends Command<TData | null, TResult | null> {
|
|
207
|
+
constructor(key: string, ) {
|
|
208
|
+
super(["get", key], { deserialize })
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const client = new HttpClient({
|
|
213
|
+
baseUrl: <UPSTASH_REDIS_REST_URL>,
|
|
214
|
+
headers: {
|
|
215
|
+
authorization: `Bearer ${<UPSTASH_REDIS_REST_TOKEN>}`,
|
|
216
|
+
},
|
|
217
|
+
})
|
|
218
|
+
|
|
219
|
+
const res = new CustomGetCommand("key").exec(client)
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
#### Javascript MAX_SAFE_INTEGER
|
|
224
|
+
|
|
225
|
+
Javascript can not handle numbers larger than `2^53 -1` safely and would return wrong results when trying to deserialize them.
|
|
226
|
+
In these cases the default deserializer will return them as string instead. This might cause a mismatch with your custom types.
|
|
227
|
+
|
|
228
|
+
```ts
|
|
229
|
+
await redis.set("key", "101600000000150081467")
|
|
230
|
+
const res = await redis<number>("get")
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
In this example `res` will still be a string despite the type annotation.
|
|
234
|
+
Please keep that in mind and adjust accordingly.
|
|
235
|
+
|
|
236
|
+
## Docs
|
|
237
|
+
|
|
238
|
+
See [the documentation](https://docs.upstash.com/features/javascriptsdk) for details.
|
|
239
|
+
|
|
240
|
+
## Contributing
|
|
241
|
+
|
|
242
|
+
### Installing dependencies
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
pnpm install
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Database
|
|
249
|
+
|
|
250
|
+
Create a new redis database on [upstash](https://console.upstash.com/) and copy the url and token to `.env` (See `.env.example` for reference)
|
|
251
|
+
|
|
252
|
+
### Running tests
|
|
253
|
+
|
|
254
|
+
```sh
|
|
255
|
+
pnpm test
|
|
256
|
+
```
|
|
File without changes
|
|
@@ -4,13 +4,17 @@ import {
|
|
|
4
4
|
|
|
5
5
|
// pkg/util.ts
|
|
6
6
|
function parseRecursive(obj) {
|
|
7
|
-
|
|
7
|
+
const parsed = Array.isArray(obj) ? obj.map((o) => {
|
|
8
8
|
try {
|
|
9
9
|
return parseRecursive(o);
|
|
10
10
|
} catch {
|
|
11
11
|
return o;
|
|
12
12
|
}
|
|
13
13
|
}) : JSON.parse(obj);
|
|
14
|
+
if (typeof parsed === "number" && parsed.toString() != obj) {
|
|
15
|
+
return obj;
|
|
16
|
+
}
|
|
17
|
+
return parsed;
|
|
14
18
|
}
|
|
15
19
|
function parseResponse(result) {
|
|
16
20
|
try {
|
|
@@ -20,7 +24,7 @@ function parseResponse(result) {
|
|
|
20
24
|
}
|
|
21
25
|
}
|
|
22
26
|
|
|
23
|
-
// pkg/command.ts
|
|
27
|
+
// pkg/commands/command.ts
|
|
24
28
|
var Command = class {
|
|
25
29
|
constructor(command, opts) {
|
|
26
30
|
var _a;
|
|
@@ -300,8 +304,8 @@ var HScanCommand = class extends Command {
|
|
|
300
304
|
|
|
301
305
|
// pkg/commands/hset.ts
|
|
302
306
|
var HSetCommand = class extends Command {
|
|
303
|
-
constructor(key,
|
|
304
|
-
super(["hset", key, field, value]);
|
|
307
|
+
constructor(key, kv) {
|
|
308
|
+
super(["hset", key, ...Object.entries(kv).flatMap(([field, value]) => [field, value])]);
|
|
305
309
|
}
|
|
306
310
|
};
|
|
307
311
|
|
|
@@ -951,6 +955,7 @@ var ZUnionStoreCommand = class extends Command {
|
|
|
951
955
|
};
|
|
952
956
|
|
|
953
957
|
export {
|
|
958
|
+
Command,
|
|
954
959
|
AppendCommand,
|
|
955
960
|
BitCountCommand,
|
|
956
961
|
BitOpCommand,
|
|
@@ -106,7 +106,7 @@ import {
|
|
|
106
106
|
ZScanCommand,
|
|
107
107
|
ZScoreCommand,
|
|
108
108
|
ZUnionStoreCommand
|
|
109
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-HGM7M7CJ.mjs";
|
|
110
110
|
import {
|
|
111
111
|
UpstashError
|
|
112
112
|
} from "./chunk-7YUZYRJS.mjs";
|
|
@@ -223,8 +223,8 @@ var Pipeline = class {
|
|
|
223
223
|
hscan(...args) {
|
|
224
224
|
return this.chain(new HScanCommand(...args));
|
|
225
225
|
}
|
|
226
|
-
hset(key,
|
|
227
|
-
return this.chain(new HSetCommand(key,
|
|
226
|
+
hset(key, kv) {
|
|
227
|
+
return this.chain(new HSetCommand(key, kv));
|
|
228
228
|
}
|
|
229
229
|
hsetnx(key, field, value) {
|
|
230
230
|
return this.chain(new HSetNXCommand(key, field, value));
|
|
@@ -554,8 +554,8 @@ var Redis = class {
|
|
|
554
554
|
hscan(...args) {
|
|
555
555
|
return new HScanCommand(...args).exec(this.client);
|
|
556
556
|
}
|
|
557
|
-
hset(key,
|
|
558
|
-
return new HSetCommand(key,
|
|
557
|
+
hset(key, kv) {
|
|
558
|
+
return new HSetCommand(key, kv).exec(this.client);
|
|
559
559
|
}
|
|
560
560
|
hsetnx(key, field, value) {
|
|
561
561
|
return new HSetNXCommand(key, field, value).exec(this.client);
|
|
@@ -51,13 +51,17 @@ var UpstashError = class extends Error {
|
|
|
51
51
|
|
|
52
52
|
// pkg/util.ts
|
|
53
53
|
function parseRecursive(obj) {
|
|
54
|
-
|
|
54
|
+
const parsed = Array.isArray(obj) ? obj.map((o) => {
|
|
55
55
|
try {
|
|
56
56
|
return parseRecursive(o);
|
|
57
57
|
} catch {
|
|
58
58
|
return o;
|
|
59
59
|
}
|
|
60
60
|
}) : JSON.parse(obj);
|
|
61
|
+
if (typeof parsed === "number" && parsed.toString() != obj) {
|
|
62
|
+
return obj;
|
|
63
|
+
}
|
|
64
|
+
return parsed;
|
|
61
65
|
}
|
|
62
66
|
function parseResponse(result) {
|
|
63
67
|
try {
|
|
@@ -67,7 +71,7 @@ function parseResponse(result) {
|
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
|
|
70
|
-
// pkg/command.ts
|
|
74
|
+
// pkg/commands/command.ts
|
|
71
75
|
var Command = class {
|
|
72
76
|
constructor(command, opts) {
|
|
73
77
|
var _a;
|
|
@@ -347,8 +351,8 @@ var HScanCommand = class extends Command {
|
|
|
347
351
|
|
|
348
352
|
// pkg/commands/hset.ts
|
|
349
353
|
var HSetCommand = class extends Command {
|
|
350
|
-
constructor(key,
|
|
351
|
-
super(["hset", key, field, value]);
|
|
354
|
+
constructor(key, kv) {
|
|
355
|
+
super(["hset", key, ...Object.entries(kv).flatMap(([field, value]) => [field, value])]);
|
|
352
356
|
}
|
|
353
357
|
};
|
|
354
358
|
|
|
@@ -1109,8 +1113,8 @@ var Pipeline = class {
|
|
|
1109
1113
|
hscan(...args) {
|
|
1110
1114
|
return this.chain(new HScanCommand(...args));
|
|
1111
1115
|
}
|
|
1112
|
-
hset(key,
|
|
1113
|
-
return this.chain(new HSetCommand(key,
|
|
1116
|
+
hset(key, kv) {
|
|
1117
|
+
return this.chain(new HSetCommand(key, kv));
|
|
1114
1118
|
}
|
|
1115
1119
|
hsetnx(key, field, value) {
|
|
1116
1120
|
return this.chain(new HSetNXCommand(key, field, value));
|
|
@@ -1440,8 +1444,8 @@ var Redis = class {
|
|
|
1440
1444
|
hscan(...args) {
|
|
1441
1445
|
return new HScanCommand(...args).exec(this.client);
|
|
1442
1446
|
}
|
|
1443
|
-
hset(key,
|
|
1444
|
-
return new HSetCommand(key,
|
|
1447
|
+
hset(key, kv) {
|
|
1448
|
+
return new HSetCommand(key, kv).exec(this.client);
|
|
1445
1449
|
}
|
|
1446
1450
|
hsetnx(key, field, value) {
|
|
1447
1451
|
return new HSetNXCommand(key, field, value).exec(this.client);
|
|
@@ -1680,7 +1684,6 @@ var Redis = class {
|
|
|
1680
1684
|
};
|
|
1681
1685
|
|
|
1682
1686
|
// pkg/http.ts
|
|
1683
|
-
var import_isomorphic_fetch = require("isomorphic-fetch");
|
|
1684
1687
|
var HttpClient = class {
|
|
1685
1688
|
constructor(config) {
|
|
1686
1689
|
this.baseUrl = config.baseUrl.replace(/\/$/, "");
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Redis
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-T66TTHSV.mjs";
|
|
4
|
+
import "./chunk-HGM7M7CJ.mjs";
|
|
5
5
|
import {
|
|
6
6
|
HttpClient
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HIDCSH5S.mjs";
|
|
8
8
|
import "./chunk-7YUZYRJS.mjs";
|
|
9
9
|
|
|
10
10
|
// pkg/cloudflare.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { at 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, H as HDelCommand, j as HExistsCommand, l as HGetAllCommand, k as HGetCommand, m as HIncrByCommand, n as HIncrByFloatCommand, o as HKeysCommand, p as HLenCommand, q as HMGetCommand, r as HScanCommand, s as HStrLenCommand, t as HValsCommand, u as IncrByCommand, v as IncrByFloatCommand, I as IncrCommand, K as KeysCommand, L as LIndexCommand, w as LLenCommand, x as LPopCommand, y as LRangeCommand, z as LTrimCommand, M as MGetCommand, O as PExpireAtCommand, J as PExpireCommand, R as PTtlCommand, P as PersistCommand, Q as PingCommand, U as RPopCommand, S as RenameCommand, T as RenameNXCommand, W as SCardCommand, X as SDiffCommand, Y as SDiffStoreCommand, a0 as SInterCommand, a1 as SInterStoreCommand, a2 as SMembersCommand, a3 as SPopCommand, a4 as SRandMemberCommand, a5 as SScanCommand, a7 as SUnionCommand, a8 as SUnionStoreCommand, V as ScanCommand, au as ScanCommandOptions, ad as ScoreMember, _ as SetBitCommand, av as SetCommand, Z as SetCommandOptions, $ as SetRangeCommand, a6 as StrLenCommand, a9 as TouchCommand, aa as TtlCommand, as as Type, ab as TypeCommand, ac as UnlinkCommand, aw as ZAddCommand, ae as ZAddCommandOptions, af as ZAddCommandOptionsWithIncr, ag as ZCardCommand, ah as ZCountCommand, ai as ZInterStoreCommand, ax as ZInterStoreCommandOptions, aj as ZLexCountCommand, ak as ZPopMaxCommand, al as ZPopMinCommand, am as ZRangeCommand, ay as ZRangeCommandOptions, an as ZRemRangeByLexCommand, ao as ZRemRangeByRankCommand, ap as ZRemRangeByScoreCommand, aq as ZScanCommand, ar as ZUnionStoreCommand, az as ZUnionStoreCommandOptions } from './zunionstore-
|
|
1
|
+
import { at as Command, N as NonEmptyArray } from './zunionstore-b38007ba';
|
|
2
|
+
export { A as AppendCommand, B as BitCountCommand, a as BitPosCommand, at as Command, 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, H as HDelCommand, j as HExistsCommand, l as HGetAllCommand, k as HGetCommand, m as HIncrByCommand, n as HIncrByFloatCommand, o as HKeysCommand, p as HLenCommand, q as HMGetCommand, r as HScanCommand, s as HStrLenCommand, t as HValsCommand, u as IncrByCommand, v as IncrByFloatCommand, I as IncrCommand, K as KeysCommand, L as LIndexCommand, w as LLenCommand, x as LPopCommand, y as LRangeCommand, z as LTrimCommand, M as MGetCommand, O as PExpireAtCommand, J as PExpireCommand, R as PTtlCommand, P as PersistCommand, Q as PingCommand, U as RPopCommand, S as RenameCommand, T as RenameNXCommand, W as SCardCommand, X as SDiffCommand, Y as SDiffStoreCommand, a0 as SInterCommand, a1 as SInterStoreCommand, a2 as SMembersCommand, a3 as SPopCommand, a4 as SRandMemberCommand, a5 as SScanCommand, a7 as SUnionCommand, a8 as SUnionStoreCommand, V as ScanCommand, au as ScanCommandOptions, ad as ScoreMember, _ as SetBitCommand, av as SetCommand, Z as SetCommandOptions, $ as SetRangeCommand, a6 as StrLenCommand, a9 as TouchCommand, aa as TtlCommand, as as Type, ab as TypeCommand, ac as UnlinkCommand, aw as ZAddCommand, ae as ZAddCommandOptions, af as ZAddCommandOptionsWithIncr, ag as ZCardCommand, ah as ZCountCommand, ai as ZInterStoreCommand, ax as ZInterStoreCommandOptions, aj as ZLexCountCommand, ak as ZPopMaxCommand, al as ZPopMinCommand, am as ZRangeCommand, ay as ZRangeCommandOptions, an as ZRemRangeByLexCommand, ao as ZRemRangeByRankCommand, ap as ZRemRangeByScoreCommand, aq as ZScanCommand, ar as ZUnionStoreCommand, az as ZUnionStoreCommandOptions } from './zunionstore-b38007ba';
|
|
3
3
|
import './http';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -37,7 +37,9 @@ declare class HMSetCommand<TData> extends Command<number, number> {
|
|
|
37
37
|
* @see https://redis.io/commands/hset
|
|
38
38
|
*/
|
|
39
39
|
declare class HSetCommand<TData> extends Command<number, number> {
|
|
40
|
-
constructor(key: string,
|
|
40
|
+
constructor(key: string, kv: {
|
|
41
|
+
[field: string]: TData;
|
|
42
|
+
});
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
/**
|
|
@@ -28,6 +28,7 @@ __export(commands_exports, {
|
|
|
28
28
|
BitCountCommand: () => BitCountCommand,
|
|
29
29
|
BitOpCommand: () => BitOpCommand,
|
|
30
30
|
BitPosCommand: () => BitPosCommand,
|
|
31
|
+
Command: () => Command,
|
|
31
32
|
DBSizeCommand: () => DBSizeCommand,
|
|
32
33
|
DecrByCommand: () => DecrByCommand,
|
|
33
34
|
DecrCommand: () => DecrCommand,
|
|
@@ -143,13 +144,17 @@ var UpstashError = class extends Error {
|
|
|
143
144
|
|
|
144
145
|
// pkg/util.ts
|
|
145
146
|
function parseRecursive(obj) {
|
|
146
|
-
|
|
147
|
+
const parsed = Array.isArray(obj) ? obj.map((o) => {
|
|
147
148
|
try {
|
|
148
149
|
return parseRecursive(o);
|
|
149
150
|
} catch {
|
|
150
151
|
return o;
|
|
151
152
|
}
|
|
152
153
|
}) : JSON.parse(obj);
|
|
154
|
+
if (typeof parsed === "number" && parsed.toString() != obj) {
|
|
155
|
+
return obj;
|
|
156
|
+
}
|
|
157
|
+
return parsed;
|
|
153
158
|
}
|
|
154
159
|
function parseResponse(result) {
|
|
155
160
|
try {
|
|
@@ -159,7 +164,7 @@ function parseResponse(result) {
|
|
|
159
164
|
}
|
|
160
165
|
}
|
|
161
166
|
|
|
162
|
-
// pkg/command.ts
|
|
167
|
+
// pkg/commands/command.ts
|
|
163
168
|
var Command = class {
|
|
164
169
|
constructor(command, opts) {
|
|
165
170
|
var _a;
|
|
@@ -439,8 +444,8 @@ var HScanCommand = class extends Command {
|
|
|
439
444
|
|
|
440
445
|
// pkg/commands/hset.ts
|
|
441
446
|
var HSetCommand = class extends Command {
|
|
442
|
-
constructor(key,
|
|
443
|
-
super(["hset", key, field, value]);
|
|
447
|
+
constructor(key, kv) {
|
|
448
|
+
super(["hset", key, ...Object.entries(kv).flatMap(([field, value]) => [field, value])]);
|
|
444
449
|
}
|
|
445
450
|
};
|
|
446
451
|
|
|
@@ -1095,6 +1100,7 @@ module.exports = __toCommonJS(commands_exports);
|
|
|
1095
1100
|
BitCountCommand,
|
|
1096
1101
|
BitOpCommand,
|
|
1097
1102
|
BitPosCommand,
|
|
1103
|
+
Command,
|
|
1098
1104
|
DBSizeCommand,
|
|
1099
1105
|
DecrByCommand,
|
|
1100
1106
|
DecrCommand,
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
BitCountCommand,
|
|
4
4
|
BitOpCommand,
|
|
5
5
|
BitPosCommand,
|
|
6
|
+
Command,
|
|
6
7
|
DBSizeCommand,
|
|
7
8
|
DecrByCommand,
|
|
8
9
|
DecrCommand,
|
|
@@ -106,13 +107,14 @@ import {
|
|
|
106
107
|
ZScanCommand,
|
|
107
108
|
ZScoreCommand,
|
|
108
109
|
ZUnionStoreCommand
|
|
109
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-HGM7M7CJ.mjs";
|
|
110
111
|
import "./chunk-7YUZYRJS.mjs";
|
|
111
112
|
export {
|
|
112
113
|
AppendCommand,
|
|
113
114
|
BitCountCommand,
|
|
114
115
|
BitOpCommand,
|
|
115
116
|
BitPosCommand,
|
|
117
|
+
Command,
|
|
116
118
|
DBSizeCommand,
|
|
117
119
|
DecrByCommand,
|
|
118
120
|
DecrCommand,
|
|
@@ -51,13 +51,17 @@ var UpstashError = class extends Error {
|
|
|
51
51
|
|
|
52
52
|
// pkg/util.ts
|
|
53
53
|
function parseRecursive(obj) {
|
|
54
|
-
|
|
54
|
+
const parsed = Array.isArray(obj) ? obj.map((o) => {
|
|
55
55
|
try {
|
|
56
56
|
return parseRecursive(o);
|
|
57
57
|
} catch {
|
|
58
58
|
return o;
|
|
59
59
|
}
|
|
60
60
|
}) : JSON.parse(obj);
|
|
61
|
+
if (typeof parsed === "number" && parsed.toString() != obj) {
|
|
62
|
+
return obj;
|
|
63
|
+
}
|
|
64
|
+
return parsed;
|
|
61
65
|
}
|
|
62
66
|
function parseResponse(result) {
|
|
63
67
|
try {
|
|
@@ -67,7 +71,7 @@ function parseResponse(result) {
|
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
|
|
70
|
-
// pkg/command.ts
|
|
74
|
+
// pkg/commands/command.ts
|
|
71
75
|
var Command = class {
|
|
72
76
|
constructor(command, opts) {
|
|
73
77
|
var _a;
|
|
@@ -347,8 +351,8 @@ var HScanCommand = class extends Command {
|
|
|
347
351
|
|
|
348
352
|
// pkg/commands/hset.ts
|
|
349
353
|
var HSetCommand = class extends Command {
|
|
350
|
-
constructor(key,
|
|
351
|
-
super(["hset", key, field, value]);
|
|
354
|
+
constructor(key, kv) {
|
|
355
|
+
super(["hset", key, ...Object.entries(kv).flatMap(([field, value]) => [field, value])]);
|
|
352
356
|
}
|
|
353
357
|
};
|
|
354
358
|
|
|
@@ -1109,8 +1113,8 @@ var Pipeline = class {
|
|
|
1109
1113
|
hscan(...args) {
|
|
1110
1114
|
return this.chain(new HScanCommand(...args));
|
|
1111
1115
|
}
|
|
1112
|
-
hset(key,
|
|
1113
|
-
return this.chain(new HSetCommand(key,
|
|
1116
|
+
hset(key, kv) {
|
|
1117
|
+
return this.chain(new HSetCommand(key, kv));
|
|
1114
1118
|
}
|
|
1115
1119
|
hsetnx(key, field, value) {
|
|
1116
1120
|
return this.chain(new HSetNXCommand(key, field, value));
|
|
@@ -1440,8 +1444,8 @@ var Redis = class {
|
|
|
1440
1444
|
hscan(...args) {
|
|
1441
1445
|
return new HScanCommand(...args).exec(this.client);
|
|
1442
1446
|
}
|
|
1443
|
-
hset(key,
|
|
1444
|
-
return new HSetCommand(key,
|
|
1447
|
+
hset(key, kv) {
|
|
1448
|
+
return new HSetCommand(key, kv).exec(this.client);
|
|
1445
1449
|
}
|
|
1446
1450
|
hsetnx(key, field, value) {
|
|
1447
1451
|
return new HSetNXCommand(key, field, value).exec(this.client);
|
|
@@ -1680,7 +1684,6 @@ var Redis = class {
|
|
|
1680
1684
|
};
|
|
1681
1685
|
|
|
1682
1686
|
// pkg/http.ts
|
|
1683
|
-
var import_isomorphic_fetch = require("isomorphic-fetch");
|
|
1684
1687
|
var HttpClient = class {
|
|
1685
1688
|
constructor(config) {
|
|
1686
1689
|
this.baseUrl = config.baseUrl.replace(/\/$/, "");
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Redis
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-T66TTHSV.mjs";
|
|
4
|
+
import "./chunk-HGM7M7CJ.mjs";
|
|
5
5
|
import {
|
|
6
6
|
HttpClient
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HIDCSH5S.mjs";
|
|
8
8
|
import "./chunk-7YUZYRJS.mjs";
|
|
9
9
|
|
|
10
10
|
// pkg/fastly.ts
|
|
File without changes
|
package/{dist/http.js → http.js}
RENAMED