@upstash/redis 0.0.0-ci.f8d46c0e → 0.0.0-ci.fb6b986f-20221006
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/esm/deps/deno.land/x/base64@v0.2.1/base.js +100 -0
- package/esm/deps/deno.land/x/base64@v0.2.1/base64url.js +9 -0
- package/esm/deps/deno.land/x/sha1@v1.0.3/deps.js +1 -0
- package/esm/deps/deno.land/x/sha1@v1.0.3/mod.js +191 -0
- package/esm/deps/denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.js +50 -0
- package/esm/pkg/commands/lpos.js +19 -0
- package/esm/pkg/commands/mod.js +1 -0
- package/esm/pkg/commands/scan.js +3 -0
- package/esm/pkg/commands/sdiffstore.js +1 -1
- package/esm/pkg/commands/set.js +16 -4
- package/esm/pkg/commands/zmscore.js +10 -0
- package/esm/pkg/commands/zrange.js +6 -0
- package/esm/pkg/http.js +53 -2
- package/esm/pkg/pipeline.js +20 -1
- package/esm/pkg/redis.js +36 -1
- package/esm/pkg/script.js +77 -0
- package/package.json +1 -39
- package/script/deps/deno.land/x/base64@v0.2.1/base.js +104 -0
- package/script/deps/deno.land/x/base64@v0.2.1/base64url.js +13 -0
- package/script/deps/deno.land/x/sha1@v1.0.3/deps.js +6 -0
- package/script/deps/deno.land/x/sha1@v1.0.3/mod.js +196 -0
- package/script/deps/denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.js +55 -0
- package/script/pkg/commands/lpos.js +23 -0
- package/script/pkg/commands/mod.js +1 -0
- package/script/pkg/commands/scan.js +3 -0
- package/script/pkg/commands/sdiffstore.js +1 -1
- package/script/pkg/commands/set.js +16 -4
- package/script/pkg/commands/zmscore.js +14 -0
- package/script/pkg/commands/zrange.js +6 -0
- package/script/pkg/http.js +53 -2
- package/script/pkg/pipeline.js +19 -0
- package/script/pkg/redis.js +35 -0
- package/script/pkg/script.js +81 -0
- package/types/deps/deno.land/x/base64@v0.2.1/base.d.ts +5 -0
- package/types/deps/deno.land/x/base64@v0.2.1/base64url.d.ts +1 -0
- package/types/deps/deno.land/x/sha1@v1.0.3/deps.d.ts +1 -0
- package/types/deps/deno.land/x/sha1@v1.0.3/mod.d.ts +26 -0
- package/types/deps/denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.d.ts +3 -0
- package/types/pkg/commands/bitop.d.ts +0 -1
- package/types/pkg/commands/bitpos.d.ts +1 -1
- package/types/pkg/commands/lpop.d.ts +1 -1
- package/types/pkg/commands/lpos.d.ts +15 -0
- package/types/pkg/commands/mget.d.ts +1 -1
- package/types/pkg/commands/mod.d.ts +1 -0
- package/types/pkg/commands/rpop.d.ts +2 -2
- package/types/pkg/commands/scan.d.ts +1 -0
- package/types/pkg/commands/sdiffstore.d.ts +1 -1
- package/types/pkg/commands/set.d.ts +31 -2
- package/types/pkg/commands/spop.d.ts +2 -2
- package/types/pkg/commands/zadd.d.ts +1 -1
- package/types/pkg/commands/zmscore.d.ts +7 -0
- package/types/pkg/commands/zrange.d.ts +7 -0
- package/types/pkg/pipeline.d.ts +18 -6
- package/types/pkg/redis.d.ts +26 -8
- package/types/pkg/script.d.ts +42 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Redis } from "./redis.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a new script.
|
|
4
|
+
*
|
|
5
|
+
* Scripts offer the ability to optimistically try to execute a script without having to send the
|
|
6
|
+
* entire script to the server. If the script is loaded on the server, it tries again by sending
|
|
7
|
+
* the entire script. Afterwards, the script is cached on the server.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const redis = new Redis({...})
|
|
12
|
+
*
|
|
13
|
+
* const script = redis.createScript<string>("return ARGV[1];")
|
|
14
|
+
* const arg1 = await script.eval([], ["Hello World"])
|
|
15
|
+
* assertEquals(arg1, "Hello World")
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare class Script<TResult = unknown> {
|
|
19
|
+
readonly script: string;
|
|
20
|
+
readonly sha1: string;
|
|
21
|
+
private readonly redis;
|
|
22
|
+
constructor(redis: Redis, script: string);
|
|
23
|
+
/**
|
|
24
|
+
* Send an `EVAL` command to redis.
|
|
25
|
+
*/
|
|
26
|
+
eval(keys: string[], args: string[]): Promise<TResult>;
|
|
27
|
+
/**
|
|
28
|
+
* Calculates the sha1 hash of the script and then calls `EVALSHA`.
|
|
29
|
+
*/
|
|
30
|
+
evalsha(keys: string[], args: string[]): Promise<TResult>;
|
|
31
|
+
/**
|
|
32
|
+
* Optimistically try to run `EVALSHA` first.
|
|
33
|
+
* If the script is not loaded in redis, it will fall back and try again with `EVAL`.
|
|
34
|
+
*
|
|
35
|
+
* Following calls will be able to use the cached script
|
|
36
|
+
*/
|
|
37
|
+
exec(keys: string[], args: string[]): Promise<TResult>;
|
|
38
|
+
/**
|
|
39
|
+
* Compute the sha1 hash of the script and return its hex representation.
|
|
40
|
+
*/
|
|
41
|
+
private digest;
|
|
42
|
+
}
|