@upstash/redis 0.0.0-ci.e3757170 → 0.0.0-ci.e5c2b594-20231017

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 (168) hide show
  1. package/README.md +42 -278
  2. package/esm/deps/deno.land/x/base64@v0.2.1/base.js +100 -0
  3. package/esm/deps/deno.land/x/base64@v0.2.1/base64url.js +9 -0
  4. package/esm/deps/deno.land/x/sha1@v1.0.3/deps.js +1 -0
  5. package/esm/deps/deno.land/x/sha1@v1.0.3/mod.js +191 -0
  6. package/esm/deps/denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.js +50 -0
  7. package/esm/pkg/commands/command.js +12 -3
  8. package/esm/pkg/commands/getdel.js +9 -0
  9. package/esm/pkg/commands/hgetall.js +0 -4
  10. package/esm/pkg/commands/hrandfield.js +39 -0
  11. package/esm/pkg/commands/json_arrappend.js +9 -0
  12. package/esm/pkg/commands/json_arrindex.js +9 -0
  13. package/esm/pkg/commands/json_arrinsert.js +9 -0
  14. package/esm/pkg/commands/json_arrlen.js +9 -0
  15. package/esm/pkg/commands/json_arrpop.js +9 -0
  16. package/esm/pkg/commands/json_arrtrim.js +12 -0
  17. package/esm/pkg/commands/json_clear.js +9 -0
  18. package/esm/pkg/commands/json_del.js +9 -0
  19. package/esm/pkg/commands/json_forget.js +9 -0
  20. package/esm/pkg/commands/json_get.js +30 -0
  21. package/esm/pkg/commands/json_mget.js +9 -0
  22. package/esm/pkg/commands/json_numincrby.js +9 -0
  23. package/esm/pkg/commands/json_nummultby.js +9 -0
  24. package/esm/pkg/commands/json_objkeys.js +9 -0
  25. package/esm/pkg/commands/json_objlen.js +9 -0
  26. package/esm/pkg/commands/json_resp.js +9 -0
  27. package/esm/pkg/commands/json_set.js +18 -0
  28. package/esm/pkg/commands/json_strappend.js +9 -0
  29. package/esm/pkg/commands/json_strlen.js +9 -0
  30. package/esm/pkg/commands/json_toggle.js +9 -0
  31. package/esm/pkg/commands/json_type.js +9 -0
  32. package/esm/pkg/commands/lmove.js +9 -0
  33. package/esm/pkg/commands/lpos.js +19 -0
  34. package/esm/pkg/commands/mod.js +28 -0
  35. package/esm/pkg/commands/scan.js +3 -0
  36. package/esm/pkg/commands/sdiffstore.js +1 -1
  37. package/esm/pkg/commands/set.js +16 -4
  38. package/esm/pkg/commands/smismember.js +9 -0
  39. package/esm/pkg/commands/xadd.js +26 -0
  40. package/esm/pkg/commands/xrange.js +36 -0
  41. package/esm/pkg/commands/zdiffstore.js +9 -0
  42. package/esm/pkg/commands/zmscore.js +10 -0
  43. package/esm/pkg/commands/zrange.js +6 -0
  44. package/esm/pkg/http.js +100 -3
  45. package/esm/pkg/pipeline.js +179 -12
  46. package/esm/pkg/redis.js +241 -2
  47. package/esm/pkg/script.js +77 -0
  48. package/esm/platforms/cloudflare.js +10 -2
  49. package/esm/platforms/fastly.js +6 -0
  50. package/esm/platforms/node_with_fetch.js +26 -1
  51. package/esm/platforms/nodejs.js +24 -1
  52. package/esm/version.js +1 -0
  53. package/package.json +53 -58
  54. package/script/deps/deno.land/x/base64@v0.2.1/base.js +104 -0
  55. package/script/deps/deno.land/x/base64@v0.2.1/base64url.js +13 -0
  56. package/script/deps/deno.land/x/sha1@v1.0.3/deps.js +6 -0
  57. package/script/deps/deno.land/x/sha1@v1.0.3/mod.js +196 -0
  58. package/script/deps/denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.js +55 -0
  59. package/script/pkg/commands/command.js +12 -3
  60. package/script/pkg/commands/getdel.js +13 -0
  61. package/script/pkg/commands/hgetall.js +0 -4
  62. package/script/pkg/commands/hrandfield.js +43 -0
  63. package/script/pkg/commands/json_arrappend.js +13 -0
  64. package/script/pkg/commands/json_arrindex.js +13 -0
  65. package/script/pkg/commands/json_arrinsert.js +13 -0
  66. package/script/pkg/commands/json_arrlen.js +13 -0
  67. package/script/pkg/commands/json_arrpop.js +13 -0
  68. package/script/pkg/commands/json_arrtrim.js +16 -0
  69. package/script/pkg/commands/json_clear.js +13 -0
  70. package/script/pkg/commands/json_del.js +13 -0
  71. package/script/pkg/commands/json_forget.js +13 -0
  72. package/script/pkg/commands/json_get.js +34 -0
  73. package/script/pkg/commands/json_mget.js +13 -0
  74. package/script/pkg/commands/json_numincrby.js +13 -0
  75. package/script/pkg/commands/json_nummultby.js +13 -0
  76. package/script/pkg/commands/json_objkeys.js +13 -0
  77. package/script/pkg/commands/json_objlen.js +13 -0
  78. package/script/pkg/commands/json_resp.js +13 -0
  79. package/script/pkg/commands/json_set.js +22 -0
  80. package/script/pkg/commands/json_strappend.js +13 -0
  81. package/script/pkg/commands/json_strlen.js +13 -0
  82. package/script/pkg/commands/json_toggle.js +13 -0
  83. package/script/pkg/commands/json_type.js +13 -0
  84. package/script/pkg/commands/lmove.js +13 -0
  85. package/script/pkg/commands/lpos.js +23 -0
  86. package/script/pkg/commands/mod.js +28 -0
  87. package/script/pkg/commands/scan.js +3 -0
  88. package/script/pkg/commands/sdiffstore.js +1 -1
  89. package/script/pkg/commands/set.js +16 -4
  90. package/script/pkg/commands/smismember.js +13 -0
  91. package/script/pkg/commands/xadd.js +30 -0
  92. package/script/pkg/commands/xrange.js +40 -0
  93. package/script/pkg/commands/zdiffstore.js +13 -0
  94. package/script/pkg/commands/zmscore.js +14 -0
  95. package/script/pkg/commands/zrange.js +6 -0
  96. package/script/pkg/http.js +100 -3
  97. package/script/pkg/pipeline.js +178 -11
  98. package/script/pkg/redis.js +240 -1
  99. package/script/pkg/script.js +81 -0
  100. package/script/platforms/cloudflare.js +10 -2
  101. package/script/platforms/fastly.js +6 -0
  102. package/script/platforms/node_with_fetch.js +26 -1
  103. package/script/platforms/nodejs.js +24 -1
  104. package/script/version.js +4 -0
  105. package/types/deps/deno.land/x/base64@v0.2.1/base.d.ts +5 -0
  106. package/types/deps/deno.land/x/base64@v0.2.1/base64url.d.ts +1 -0
  107. package/types/deps/deno.land/x/sha1@v1.0.3/deps.d.ts +1 -0
  108. package/types/deps/deno.land/x/sha1@v1.0.3/mod.d.ts +26 -0
  109. package/types/deps/denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.d.ts +3 -0
  110. package/types/pkg/commands/bitop.d.ts +0 -1
  111. package/types/pkg/commands/bitpos.d.ts +1 -1
  112. package/types/pkg/commands/command.d.ts +5 -5
  113. package/types/pkg/commands/getdel.d.ts +7 -0
  114. package/types/pkg/commands/hdel.d.ts +1 -1
  115. package/types/pkg/commands/hrandfield.d.ts +9 -0
  116. package/types/pkg/commands/json_arrappend.d.ts +7 -0
  117. package/types/pkg/commands/json_arrindex.d.ts +13 -0
  118. package/types/pkg/commands/json_arrinsert.d.ts +7 -0
  119. package/types/pkg/commands/json_arrlen.d.ts +7 -0
  120. package/types/pkg/commands/json_arrpop.d.ts +7 -0
  121. package/types/pkg/commands/json_arrtrim.d.ts +7 -0
  122. package/types/pkg/commands/json_clear.d.ts +7 -0
  123. package/types/pkg/commands/json_del.d.ts +7 -0
  124. package/types/pkg/commands/json_forget.d.ts +7 -0
  125. package/types/pkg/commands/json_get.d.ts +15 -0
  126. package/types/pkg/commands/json_mget.d.ts +7 -0
  127. package/types/pkg/commands/json_numincrby.d.ts +7 -0
  128. package/types/pkg/commands/json_nummultby.d.ts +7 -0
  129. package/types/pkg/commands/json_objkeys.d.ts +7 -0
  130. package/types/pkg/commands/json_objlen.d.ts +7 -0
  131. package/types/pkg/commands/json_resp.d.ts +7 -0
  132. package/types/pkg/commands/json_set.d.ts +18 -0
  133. package/types/pkg/commands/json_strappend.d.ts +7 -0
  134. package/types/pkg/commands/json_strlen.d.ts +7 -0
  135. package/types/pkg/commands/json_toggle.d.ts +7 -0
  136. package/types/pkg/commands/json_type.d.ts +7 -0
  137. package/types/pkg/commands/lmove.d.ts +12 -0
  138. package/types/pkg/commands/lpop.d.ts +1 -1
  139. package/types/pkg/commands/lpos.d.ts +15 -0
  140. package/types/pkg/commands/mget.d.ts +1 -1
  141. package/types/pkg/commands/mod.d.ts +28 -0
  142. package/types/pkg/commands/rpop.d.ts +2 -2
  143. package/types/pkg/commands/scan.d.ts +2 -1
  144. package/types/pkg/commands/script_flush.d.ts +1 -1
  145. package/types/pkg/commands/sdiffstore.d.ts +1 -1
  146. package/types/pkg/commands/set.d.ts +31 -2
  147. package/types/pkg/commands/smembers.d.ts +2 -2
  148. package/types/pkg/commands/smismember.d.ts +7 -0
  149. package/types/pkg/commands/spop.d.ts +2 -2
  150. package/types/pkg/commands/type.d.ts +1 -1
  151. package/types/pkg/commands/xadd.d.ts +31 -0
  152. package/types/pkg/commands/xrange.d.ts +9 -0
  153. package/types/pkg/commands/zadd.d.ts +4 -4
  154. package/types/pkg/commands/zdiffstore.d.ts +7 -0
  155. package/types/pkg/commands/zinterstore.d.ts +1 -1
  156. package/types/pkg/commands/zmscore.d.ts +7 -0
  157. package/types/pkg/commands/zrange.d.ts +8 -1
  158. package/types/pkg/commands/zunionstore.d.ts +1 -1
  159. package/types/pkg/http.d.ts +48 -7
  160. package/types/pkg/pipeline.d.ts +262 -124
  161. package/types/pkg/redis.d.ts +187 -19
  162. package/types/pkg/script.d.ts +42 -0
  163. package/types/pkg/types.d.ts +27 -1
  164. package/types/platforms/cloudflare.d.ts +9 -8
  165. package/types/platforms/fastly.d.ts +3 -7
  166. package/types/platforms/node_with_fetch.d.ts +3 -22
  167. package/types/platforms/nodejs.d.ts +4 -7
  168. package/types/version.d.ts +1 -0
@@ -1,18 +1,20 @@
1
- export declare type UpstashRequest = {
1
+ import { Telemetry } from "./types.js";
2
+ type CacheSetting = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload";
3
+ export type UpstashRequest = {
2
4
  path?: string[];
3
5
  /**
4
6
  * Request body will be serialized to json
5
7
  */
6
8
  body?: unknown;
7
9
  };
8
- export declare type UpstashResponse<TResult> = {
10
+ export type UpstashResponse<TResult> = {
9
11
  result?: TResult;
10
12
  error?: string;
11
13
  };
12
14
  export interface Requester {
13
15
  request: <TResult = unknown>(req: UpstashRequest) => Promise<UpstashResponse<TResult>>;
14
16
  }
15
- export declare type RetryConfig = false | {
17
+ export type RetryConfig = false | {
16
18
  /**
17
19
  * The number of retries to attempt before giving up.
18
20
  *
@@ -29,26 +31,65 @@ export declare type RetryConfig = false | {
29
31
  */
30
32
  backoff?: (retryCount: number) => number;
31
33
  };
32
- declare type Options = {
34
+ export type Options = {
33
35
  backend?: string;
34
36
  };
35
- export declare type HttpClientConfig = {
37
+ export type RequesterConfig = {
38
+ /**
39
+ * Configure the retry behaviour in case of network errors
40
+ */
41
+ retry?: RetryConfig;
42
+ /**
43
+ * Due to the nature of dynamic and custom data, it is possible to write data to redis that is not
44
+ * valid json and will therefore cause errors when deserializing. This used to happen very
45
+ * frequently with non-utf8 data, such as emojis.
46
+ *
47
+ * By default we will therefore encode the data as base64 on the server, before sending it to the
48
+ * client. The client will then decode the base64 data and parse it as utf8.
49
+ *
50
+ * For very large entries, this can add a few milliseconds, so if you are sure that your data is
51
+ * valid utf8, you can disable this behaviour by setting this option to false.
52
+ *
53
+ * Here's what the response body looks like:
54
+ *
55
+ * ```json
56
+ * {
57
+ * result?: "base64-encoded",
58
+ * error?: string
59
+ * }
60
+ * ```
61
+ *
62
+ * @default "base64"
63
+ */
64
+ responseEncoding?: false | "base64";
65
+ /**
66
+ * Configure the cache behaviour
67
+ * @default "no-store"
68
+ */
69
+ cache?: CacheSetting;
70
+ };
71
+ export type HttpClientConfig = {
36
72
  headers?: Record<string, string>;
37
73
  baseUrl: string;
38
74
  options?: Options;
39
75
  retry?: RetryConfig;
40
- };
76
+ agent?: any;
77
+ } & RequesterConfig;
41
78
  export declare class HttpClient implements Requester {
42
79
  baseUrl: string;
43
80
  headers: Record<string, string>;
44
- readonly options?: {
81
+ readonly options: {
45
82
  backend?: string;
83
+ agent: any;
84
+ responseEncoding?: false | "base64";
85
+ cache?: CacheSetting;
46
86
  };
47
87
  readonly retry: {
48
88
  attempts: number;
49
89
  backoff: (retryCount: number) => number;
50
90
  };
51
91
  constructor(config: HttpClientConfig);
92
+ mergeTelemetry(telemetry: Telemetry): void;
52
93
  request<TResult>(req: UpstashRequest): Promise<UpstashResponse<TResult>>;
53
94
  }
54
95
  export {};