@upstash/redis 1.34.4 → 1.34.6
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/{chunk-T6D4KAGH.mjs → chunk-56TVFNIH.mjs} +303 -50
- package/cloudflare.d.mts +2 -2
- package/cloudflare.d.ts +2 -2
- package/cloudflare.js +303 -50
- package/cloudflare.mjs +1 -1
- package/fastly.d.mts +2 -2
- package/fastly.d.ts +2 -2
- package/fastly.js +303 -50
- package/fastly.mjs +1 -1
- package/nodejs.d.mts +2 -2
- package/nodejs.d.ts +2 -2
- package/nodejs.js +303 -50
- package/nodejs.mjs +1 -1
- package/package.json +1 -1
- package/{zmscore-C3G81zLz.d.mts → zmscore-BdNsMd17.d.mts} +90 -0
- package/{zmscore-C3G81zLz.d.ts → zmscore-BdNsMd17.d.ts} +90 -0
|
@@ -36,7 +36,23 @@ type UpstashRequest = {
|
|
|
36
36
|
* Request body will be serialized to json
|
|
37
37
|
*/
|
|
38
38
|
body?: unknown;
|
|
39
|
+
/**
|
|
40
|
+
* Additional headers for the request
|
|
41
|
+
*/
|
|
42
|
+
headers?: Record<string, string>;
|
|
39
43
|
upstashSyncToken?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Callback for handling streaming messages
|
|
46
|
+
*/
|
|
47
|
+
onMessage?: (data: string) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Whether this request expects a streaming response
|
|
50
|
+
*/
|
|
51
|
+
isStreaming?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Abort signal for the request
|
|
54
|
+
*/
|
|
55
|
+
signal?: AbortSignal;
|
|
40
56
|
};
|
|
41
57
|
type UpstashResponse<TResult> = {
|
|
42
58
|
result?: TResult;
|
|
@@ -119,6 +135,31 @@ type CommandOptions<TResult, TData> = {
|
|
|
119
135
|
*/
|
|
120
136
|
automaticDeserialization?: boolean;
|
|
121
137
|
latencyLogging?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Additional headers to be sent with the request
|
|
140
|
+
*/
|
|
141
|
+
headers?: Record<string, string>;
|
|
142
|
+
/**
|
|
143
|
+
* Path to append to the URL
|
|
144
|
+
*/
|
|
145
|
+
path?: string[];
|
|
146
|
+
/**
|
|
147
|
+
* Options for streaming requests, mainly used for subscribe, monitor commands
|
|
148
|
+
**/
|
|
149
|
+
streamOptions?: {
|
|
150
|
+
/**
|
|
151
|
+
* Callback to be called when a message is received
|
|
152
|
+
*/
|
|
153
|
+
onMessage?: (data: string) => void;
|
|
154
|
+
/**
|
|
155
|
+
* Whether the request is streaming
|
|
156
|
+
*/
|
|
157
|
+
isStreaming?: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Signal to abort the request
|
|
160
|
+
*/
|
|
161
|
+
signal?: AbortSignal;
|
|
162
|
+
};
|
|
122
163
|
};
|
|
123
164
|
/**
|
|
124
165
|
* Command offers default (de)serialization and the exec method to all commands.
|
|
@@ -130,6 +171,11 @@ declare class Command<TResult, TData> {
|
|
|
130
171
|
readonly command: (string | number | boolean)[];
|
|
131
172
|
readonly serialize: Serialize;
|
|
132
173
|
readonly deserialize: Deserialize<TResult, TData>;
|
|
174
|
+
protected readonly headers?: Record<string, string>;
|
|
175
|
+
protected readonly path?: string[];
|
|
176
|
+
protected readonly onMessage?: (data: string) => void;
|
|
177
|
+
protected readonly isStreaming: boolean;
|
|
178
|
+
protected readonly signal?: AbortSignal;
|
|
133
179
|
/**
|
|
134
180
|
* Create a new command instance.
|
|
135
181
|
*
|
|
@@ -1643,6 +1689,42 @@ declare class ZScoreCommand<TData> extends Command<string | null, number | null>
|
|
|
1643
1689
|
constructor(cmd: [key: string, member: TData], opts?: CommandOptions<string | null, number | null>);
|
|
1644
1690
|
}
|
|
1645
1691
|
|
|
1692
|
+
type BaseMessageData<TMessage> = {
|
|
1693
|
+
channel: string;
|
|
1694
|
+
message: TMessage;
|
|
1695
|
+
};
|
|
1696
|
+
type PatternMessageData<TMessage> = BaseMessageData<TMessage> & {
|
|
1697
|
+
pattern: string;
|
|
1698
|
+
};
|
|
1699
|
+
type SubscriptionCountEvent = number;
|
|
1700
|
+
type MessageEventMap<TMessage> = {
|
|
1701
|
+
message: BaseMessageData<TMessage>;
|
|
1702
|
+
subscribe: SubscriptionCountEvent;
|
|
1703
|
+
unsubscribe: SubscriptionCountEvent;
|
|
1704
|
+
pmessage: PatternMessageData<TMessage>;
|
|
1705
|
+
psubscribe: SubscriptionCountEvent;
|
|
1706
|
+
punsubscribe: SubscriptionCountEvent;
|
|
1707
|
+
error: Error;
|
|
1708
|
+
[key: `message:${string}`]: BaseMessageData<TMessage>;
|
|
1709
|
+
[key: `pmessage:${string}`]: PatternMessageData<TMessage>;
|
|
1710
|
+
};
|
|
1711
|
+
type EventType = keyof MessageEventMap<any>;
|
|
1712
|
+
type Listener<TMessage, T extends EventType> = (event: MessageEventMap<TMessage>[T]) => void;
|
|
1713
|
+
declare class Subscriber<TMessage = any> extends EventTarget {
|
|
1714
|
+
private subscriptions;
|
|
1715
|
+
private client;
|
|
1716
|
+
private listeners;
|
|
1717
|
+
constructor(client: Requester, channels: string[], isPattern?: boolean);
|
|
1718
|
+
private subscribeToChannel;
|
|
1719
|
+
private subscribeToPattern;
|
|
1720
|
+
private handleMessage;
|
|
1721
|
+
private dispatchToListeners;
|
|
1722
|
+
on<T extends keyof MessageEventMap<TMessage>>(type: T, listener: Listener<TMessage, T>): void;
|
|
1723
|
+
removeAllListeners(): void;
|
|
1724
|
+
unsubscribe(channels?: string[]): Promise<void>;
|
|
1725
|
+
getSubscribedChannels(): string[];
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1646
1728
|
type InferResponseData<T extends unknown[]> = {
|
|
1647
1729
|
[K in keyof T]: T[K] extends Command<any, infer TData> ? TData : unknown;
|
|
1648
1730
|
};
|
|
@@ -3236,6 +3318,10 @@ declare class Redis {
|
|
|
3236
3318
|
* @see https://redis.io/commands/psetex
|
|
3237
3319
|
*/
|
|
3238
3320
|
psetex: <TData>(key: string, ttl: number, value: TData) => Promise<string>;
|
|
3321
|
+
/**
|
|
3322
|
+
* @see https://redis.io/commands/psubscribe
|
|
3323
|
+
*/
|
|
3324
|
+
psubscribe: <TMessage>(patterns: string | string[]) => Subscriber<TMessage>;
|
|
3239
3325
|
/**
|
|
3240
3326
|
* @see https://redis.io/commands/pttl
|
|
3241
3327
|
*/
|
|
@@ -3364,6 +3450,10 @@ declare class Redis {
|
|
|
3364
3450
|
* @see https://redis.io/commands/strlen
|
|
3365
3451
|
*/
|
|
3366
3452
|
strlen: (key: string) => Promise<number>;
|
|
3453
|
+
/**
|
|
3454
|
+
* @see https://redis.io/commands/subscribe
|
|
3455
|
+
*/
|
|
3456
|
+
subscribe: <TMessage>(channels: string | string[]) => Subscriber<TMessage>;
|
|
3367
3457
|
/**
|
|
3368
3458
|
* @see https://redis.io/commands/sunion
|
|
3369
3459
|
*/
|