@upstash/redis 0.0.0-ci.9190cbfb-20230208 → 0.0.0-ci.9cbc6e25-20230504
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/commands/json_forget.js +1 -1
- package/esm/pkg/http.js +3 -1
- package/esm/platforms/nodejs.js +4 -1
- package/esm/version.js +1 -1
- package/package.json +1 -1
- package/script/pkg/commands/json_forget.js +1 -1
- package/script/pkg/http.js +3 -1
- package/script/platforms/nodejs.js +4 -1
- package/script/version.js +1 -1
- package/types/pkg/commands/hdel.d.ts +1 -1
- package/types/pkg/http.d.ts +4 -0
- package/types/pkg/pipeline.d.ts +1 -1
- package/types/pkg/redis.d.ts +3 -2
- package/types/version.d.ts +1 -1
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",
|
|
31
|
+
responseEncoding: config.responseEncoding ?? "base64",
|
|
32
|
+
cache: config.cache,
|
|
32
33
|
};
|
|
33
34
|
this.baseUrl = config.baseUrl.replace(/\/$/, "");
|
|
34
35
|
this.headers = {
|
|
@@ -71,6 +72,7 @@ export class HttpClient {
|
|
|
71
72
|
}
|
|
72
73
|
async request(req) {
|
|
73
74
|
const requestOptions = {
|
|
75
|
+
cache: this.options.cache,
|
|
74
76
|
method: "POST",
|
|
75
77
|
headers: this.headers,
|
|
76
78
|
body: JSON.stringify(req.body),
|
package/esm/platforms/nodejs.js
CHANGED
|
@@ -35,13 +35,16 @@ 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,
|
|
41
42
|
enableTelemetry: !process.env.UPSTASH_DISABLE_TELEMETRY,
|
|
42
43
|
});
|
|
43
44
|
this.addTelemetry({
|
|
44
|
-
runtime:
|
|
45
|
+
runtime: typeof EdgeRuntime === "string"
|
|
46
|
+
? "edge-light"
|
|
47
|
+
: `node@${process.version}`,
|
|
45
48
|
platform: process.env.VERCEL
|
|
46
49
|
? "vercel"
|
|
47
50
|
: process.env.AWS_REGION
|
package/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "v0.0.0-ci.
|
|
1
|
+
export const VERSION = "v0.0.0-ci.9cbc6e25-20230504";
|
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": "v0.0.0-ci.
|
|
6
|
+
"version": "v0.0.0-ci.9cbc6e25-20230504",
|
|
7
7
|
"description": "An HTTP/REST based Redis client built on top of Upstash REST API.",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -7,7 +7,7 @@ const command_js_1 = require("./command.js");
|
|
|
7
7
|
*/
|
|
8
8
|
class JsonForgetCommand extends command_js_1.Command {
|
|
9
9
|
constructor(cmd, opts) {
|
|
10
|
-
super(["JSON.
|
|
10
|
+
super(["JSON.FORGET", ...cmd], opts);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
exports.JsonForgetCommand = JsonForgetCommand;
|
package/script/pkg/http.js
CHANGED
|
@@ -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",
|
|
34
|
+
responseEncoding: config.responseEncoding ?? "base64",
|
|
35
|
+
cache: config.cache,
|
|
35
36
|
};
|
|
36
37
|
this.baseUrl = config.baseUrl.replace(/\/$/, "");
|
|
37
38
|
this.headers = {
|
|
@@ -74,6 +75,7 @@ class HttpClient {
|
|
|
74
75
|
}
|
|
75
76
|
async request(req) {
|
|
76
77
|
const requestOptions = {
|
|
78
|
+
cache: this.options.cache,
|
|
77
79
|
method: "POST",
|
|
78
80
|
headers: this.headers,
|
|
79
81
|
body: JSON.stringify(req.body),
|
|
@@ -61,13 +61,16 @@ 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,
|
|
67
68
|
enableTelemetry: !process.env.UPSTASH_DISABLE_TELEMETRY,
|
|
68
69
|
});
|
|
69
70
|
this.addTelemetry({
|
|
70
|
-
runtime:
|
|
71
|
+
runtime: typeof EdgeRuntime === "string"
|
|
72
|
+
? "edge-light"
|
|
73
|
+
: `node@${process.version}`,
|
|
71
74
|
platform: process.env.VERCEL
|
|
72
75
|
? "vercel"
|
|
73
76
|
: process.env.AWS_REGION
|
package/script/version.js
CHANGED
|
@@ -3,5 +3,5 @@ import { Command, CommandOptions } from "./command.js";
|
|
|
3
3
|
* @see https://redis.io/commands/hdel
|
|
4
4
|
*/
|
|
5
5
|
export declare class HDelCommand extends Command<"0" | "1", 0 | 1> {
|
|
6
|
-
constructor(cmd: [key: string,
|
|
6
|
+
constructor(cmd: [key: string, ...fields: string[]], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
7
7
|
}
|
package/types/pkg/http.d.ts
CHANGED
|
@@ -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 {};
|
package/types/pkg/pipeline.d.ts
CHANGED
package/types/pkg/redis.d.ts
CHANGED
|
@@ -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
|
*/
|
|
@@ -232,7 +233,7 @@ export declare class Redis {
|
|
|
232
233
|
/**
|
|
233
234
|
* @see https://redis.io/commands/hdel
|
|
234
235
|
*/
|
|
235
|
-
hdel: (key: string,
|
|
236
|
+
hdel: (key: string, ...fields: string[]) => Promise<0 | 1>;
|
|
236
237
|
/**
|
|
237
238
|
* @see https://redis.io/commands/hexists
|
|
238
239
|
*/
|
package/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "v0.0.0-ci.
|
|
1
|
+
export declare const VERSION = "v0.0.0-ci.9cbc6e25-20230504";
|