@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.
Files changed (55) hide show
  1. package/esm/deps/deno.land/x/base64@v0.2.1/base.js +100 -0
  2. package/esm/deps/deno.land/x/base64@v0.2.1/base64url.js +9 -0
  3. package/esm/deps/deno.land/x/sha1@v1.0.3/deps.js +1 -0
  4. package/esm/deps/deno.land/x/sha1@v1.0.3/mod.js +191 -0
  5. package/esm/deps/denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.js +50 -0
  6. package/esm/pkg/commands/lpos.js +19 -0
  7. package/esm/pkg/commands/mod.js +1 -0
  8. package/esm/pkg/commands/scan.js +3 -0
  9. package/esm/pkg/commands/sdiffstore.js +1 -1
  10. package/esm/pkg/commands/set.js +16 -4
  11. package/esm/pkg/commands/zmscore.js +10 -0
  12. package/esm/pkg/commands/zrange.js +6 -0
  13. package/esm/pkg/http.js +53 -2
  14. package/esm/pkg/pipeline.js +20 -1
  15. package/esm/pkg/redis.js +36 -1
  16. package/esm/pkg/script.js +77 -0
  17. package/package.json +1 -39
  18. package/script/deps/deno.land/x/base64@v0.2.1/base.js +104 -0
  19. package/script/deps/deno.land/x/base64@v0.2.1/base64url.js +13 -0
  20. package/script/deps/deno.land/x/sha1@v1.0.3/deps.js +6 -0
  21. package/script/deps/deno.land/x/sha1@v1.0.3/mod.js +196 -0
  22. package/script/deps/denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.js +55 -0
  23. package/script/pkg/commands/lpos.js +23 -0
  24. package/script/pkg/commands/mod.js +1 -0
  25. package/script/pkg/commands/scan.js +3 -0
  26. package/script/pkg/commands/sdiffstore.js +1 -1
  27. package/script/pkg/commands/set.js +16 -4
  28. package/script/pkg/commands/zmscore.js +14 -0
  29. package/script/pkg/commands/zrange.js +6 -0
  30. package/script/pkg/http.js +53 -2
  31. package/script/pkg/pipeline.js +19 -0
  32. package/script/pkg/redis.js +35 -0
  33. package/script/pkg/script.js +81 -0
  34. package/types/deps/deno.land/x/base64@v0.2.1/base.d.ts +5 -0
  35. package/types/deps/deno.land/x/base64@v0.2.1/base64url.d.ts +1 -0
  36. package/types/deps/deno.land/x/sha1@v1.0.3/deps.d.ts +1 -0
  37. package/types/deps/deno.land/x/sha1@v1.0.3/mod.d.ts +26 -0
  38. package/types/deps/denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.d.ts +3 -0
  39. package/types/pkg/commands/bitop.d.ts +0 -1
  40. package/types/pkg/commands/bitpos.d.ts +1 -1
  41. package/types/pkg/commands/lpop.d.ts +1 -1
  42. package/types/pkg/commands/lpos.d.ts +15 -0
  43. package/types/pkg/commands/mget.d.ts +1 -1
  44. package/types/pkg/commands/mod.d.ts +1 -0
  45. package/types/pkg/commands/rpop.d.ts +2 -2
  46. package/types/pkg/commands/scan.d.ts +1 -0
  47. package/types/pkg/commands/sdiffstore.d.ts +1 -1
  48. package/types/pkg/commands/set.d.ts +31 -2
  49. package/types/pkg/commands/spop.d.ts +2 -2
  50. package/types/pkg/commands/zadd.d.ts +1 -1
  51. package/types/pkg/commands/zmscore.d.ts +7 -0
  52. package/types/pkg/commands/zrange.d.ts +7 -0
  53. package/types/pkg/pipeline.d.ts +18 -6
  54. package/types/pkg/redis.d.ts +26 -8
  55. 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
+ }