@upstash/redis 1.20.2 → 1.20.4

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/pkg/http.js CHANGED
@@ -28,7 +28,8 @@ export class HttpClient {
28
28
  this.options = {
29
29
  backend: config.options?.backend,
30
30
  agent: config.agent,
31
- responseEncoding: config.responseEncoding ?? "base64", // default to base64
31
+ responseEncoding: config.responseEncoding ?? "base64",
32
+ cache: config.cache,
32
33
  };
33
34
  this.baseUrl = config.baseUrl.replace(/\/$/, "");
34
35
  this.headers = {
@@ -71,7 +72,7 @@ export class HttpClient {
71
72
  }
72
73
  async request(req) {
73
74
  const requestOptions = {
74
- cache: "no-store",
75
+ cache: this.options.cache,
75
76
  method: "POST",
76
77
  headers: this.headers,
77
78
  body: JSON.stringify(req.body),
@@ -35,6 +35,7 @@ export class Redis extends core.Redis {
35
35
  headers: { authorization: `Bearer ${configOrRequester.token}` },
36
36
  agent: configOrRequester.agent,
37
37
  responseEncoding: configOrRequester.responseEncoding,
38
+ cache: "no-store",
38
39
  });
39
40
  super(client, {
40
41
  automaticDeserialization: configOrRequester.automaticDeserialization,
package/esm/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "v1.20.2";
1
+ export const VERSION = "v1.20.4";
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "main": "./script/platforms/nodejs.js",
4
4
  "types": "./types/platforms/nodejs.d.ts",
5
5
  "name": "@upstash/redis",
6
- "version": "v1.20.2",
6
+ "version": "v1.20.4",
7
7
  "description": "An HTTP/REST based Redis client built on top of Upstash REST API.",
8
8
  "repository": {
9
9
  "type": "git",
@@ -31,7 +31,8 @@ class HttpClient {
31
31
  this.options = {
32
32
  backend: config.options?.backend,
33
33
  agent: config.agent,
34
- responseEncoding: config.responseEncoding ?? "base64", // default to base64
34
+ responseEncoding: config.responseEncoding ?? "base64",
35
+ cache: config.cache,
35
36
  };
36
37
  this.baseUrl = config.baseUrl.replace(/\/$/, "");
37
38
  this.headers = {
@@ -74,7 +75,7 @@ class HttpClient {
74
75
  }
75
76
  async request(req) {
76
77
  const requestOptions = {
77
- cache: "no-store",
78
+ cache: this.options.cache,
78
79
  method: "POST",
79
80
  headers: this.headers,
80
81
  body: JSON.stringify(req.body),
@@ -61,6 +61,7 @@ class Redis extends core.Redis {
61
61
  headers: { authorization: `Bearer ${configOrRequester.token}` },
62
62
  agent: configOrRequester.agent,
63
63
  responseEncoding: configOrRequester.responseEncoding,
64
+ cache: "no-store",
64
65
  });
65
66
  super(client, {
66
67
  automaticDeserialization: configOrRequester.automaticDeserialization,
package/script/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = "v1.20.2";
4
+ exports.VERSION = "v1.20.4";
@@ -1,4 +1,5 @@
1
1
  import { Telemetry } from "./types.js";
2
+ type CacheSetting = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload";
2
3
  export type UpstashRequest = {
3
4
  path?: string[];
4
5
  /**
@@ -68,6 +69,7 @@ export type HttpClientConfig = {
68
69
  options?: Options;
69
70
  retry?: RetryConfig;
70
71
  agent?: any;
72
+ cache?: CacheSetting;
71
73
  } & RequesterConfig;
72
74
  export declare class HttpClient implements Requester {
73
75
  baseUrl: string;
@@ -76,6 +78,7 @@ export declare class HttpClient implements Requester {
76
78
  backend?: string;
77
79
  agent: any;
78
80
  responseEncoding?: false | "base64";
81
+ cache?: CacheSetting;
79
82
  };
80
83
  readonly retry: {
81
84
  attempts: number;
@@ -85,3 +88,4 @@ export declare class HttpClient implements Requester {
85
88
  mergeTelemetry(telemetry: Telemetry): void;
86
89
  request<TResult>(req: UpstashRequest): Promise<UpstashResponse<TResult>>;
87
90
  }
91
+ export {};
@@ -3,7 +3,8 @@ import { Requester, UpstashRequest, UpstashResponse } from "./http.js";
3
3
  import { Pipeline } from "./pipeline.js";
4
4
  import type { CommandArgs } from "./types.js";
5
5
  import { Script } from "./script.js";
6
- import { RedisOptions, Telemetry } from "./types.js";
6
+ import type { RedisOptions, Telemetry } from "./types.js";
7
+ export type { RedisOptions } from "./types.js";
7
8
  /**
8
9
  * Serverless redis client for upstash.
9
10
  */
@@ -1 +1 @@
1
- export declare const VERSION = "v1.20.2";
1
+ export declare const VERSION = "v1.20.4";