@upstash/redis 1.0.0-alpha.0 → 1.0.0-alpha.3

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/cloudflare.mjs ADDED
@@ -0,0 +1,35 @@
1
+ import {
2
+ Redis
3
+ } from "./chunk-Y5TC4HX2.mjs";
4
+ import "./chunk-ZIB6XPPC.mjs";
5
+ import {
6
+ HttpClient
7
+ } from "./chunk-U7OXAQMQ.mjs";
8
+ import "./chunk-7YUZYRJS.mjs";
9
+
10
+ // pkg/cloudflare.ts
11
+ var Redis2 = class extends Redis {
12
+ constructor(config) {
13
+ const client = new HttpClient({
14
+ baseUrl: config.url,
15
+ headers: {
16
+ authorization: `Bearer ${config.token}`
17
+ }
18
+ });
19
+ super(client);
20
+ }
21
+ static fromEnv() {
22
+ const url = UPSTASH_REDIS_REST_URL;
23
+ const token = UPSTASH_REDIS_REST_TOKEN;
24
+ if (!url) {
25
+ throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_URL`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_URL`");
26
+ }
27
+ if (!token) {
28
+ throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_TOKEN`");
29
+ }
30
+ return new Redis2({ url, token });
31
+ }
32
+ };
33
+ export {
34
+ Redis2 as Redis
35
+ };
@@ -1,5 +1,6 @@
1
- import { au as Command, N as NonEmptyArray } from './zunionstore-f1aa0b4a';
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-f1aa0b4a';
1
+ import { at as Command, N as NonEmptyArray } from './zunionstore-dffa797d';
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-dffa797d';
3
+ import './http';
3
4
 
4
5
  /**
5
6
  * @see https://redis.io/commands/bitop
@@ -167,7 +167,7 @@ var Command = class {
167
167
  this.deserialize = (_a = opts == null ? void 0 : opts.deserialize) != null ? _a : parseResponse;
168
168
  }
169
169
  async exec(client) {
170
- const { result, error } = await client.post({
170
+ const { result, error } = await client.request({
171
171
  body: this.command
172
172
  });
173
173
  if (error) {
@@ -106,7 +106,8 @@ import {
106
106
  ZScanCommand,
107
107
  ZScoreCommand,
108
108
  ZUnionStoreCommand
109
- } from "./chunk-RYSRH3HC.mjs";
109
+ } from "./chunk-ZIB6XPPC.mjs";
110
+ import "./chunk-7YUZYRJS.mjs";
110
111
  export {
111
112
  AppendCommand,
112
113
  BitCountCommand,
package/fastly.d.ts ADDED
@@ -0,0 +1,44 @@
1
+ import { R as Redis$1 } from './redis-dd052782';
2
+ import './zunionstore-dffa797d';
3
+ import './http';
4
+
5
+ /**
6
+ * Connection credentials for upstash redis.
7
+ * Get them from https://console.upstash.com/redis/<uuid>
8
+ */
9
+ declare type RedisConfigFastly = {
10
+ /**
11
+ * UPSTASH_REDIS_REST_URL
12
+ */
13
+ url: string;
14
+ /**
15
+ * UPSTASH_REDIS_REST_TOKEN
16
+ */
17
+ token: string;
18
+ /**
19
+ * A Request can be forwarded to any backend defined on your service. Backends
20
+ * can be created via the Fastly CLI, API, or web interface, and are
21
+ * referenced by name.
22
+ */
23
+ backend: string;
24
+ };
25
+ /**
26
+ * Serverless redis client for upstash.
27
+ */
28
+ declare class Redis extends Redis$1 {
29
+ /**
30
+ * Create a new redis client
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * const redis = new Redis({
35
+ * url: "<UPSTASH_REDIS_REST_URL>",
36
+ * token: "<UPSTASH_REDIS_REST_TOKEN>",
37
+ * backend: "upstash-db",
38
+ * });
39
+ * ```
40
+ */
41
+ constructor(config: RedisConfigFastly);
42
+ }
43
+
44
+ export { Redis, RedisConfigFastly };