@upstash/qstash 2.7.21 → 2.7.22
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-FGKPOZOO.mjs → chunk-3N4XI2LB.mjs} +1 -1
- package/{chunk-QHCEWG63.mjs → chunk-MQSZDXFZ.mjs} +42 -4
- package/{chunk-3D34OUXY.mjs → chunk-RQQYKT2M.mjs} +1 -1
- package/{client-DuOcoFUv.d.ts → client-vTeVVeh7.d.mts} +50 -1
- package/{client-DuOcoFUv.d.mts → client-vTeVVeh7.d.ts} +50 -1
- package/cloudflare.d.mts +1 -1
- package/cloudflare.d.ts +1 -1
- package/cloudflare.js +42 -4
- package/cloudflare.mjs +1 -1
- package/h3.d.mts +1 -1
- package/h3.d.ts +1 -1
- package/h3.js +42 -4
- package/h3.mjs +3 -3
- package/hono.d.mts +1 -1
- package/hono.d.ts +1 -1
- package/hono.js +42 -4
- package/hono.mjs +1 -1
- package/index.d.mts +2 -2
- package/index.d.ts +2 -2
- package/index.js +42 -4
- package/index.mjs +2 -2
- package/nextjs.d.mts +1 -1
- package/nextjs.d.ts +1 -1
- package/nextjs.js +42 -4
- package/nextjs.mjs +1 -1
- package/nuxt.mjs +3 -3
- package/package.json +1 -1
- package/solidjs.d.mts +1 -1
- package/solidjs.d.ts +1 -1
- package/solidjs.js +42 -4
- package/solidjs.mjs +2 -2
- package/svelte.d.mts +1 -1
- package/svelte.d.ts +1 -1
- package/svelte.js +42 -4
- package/svelte.mjs +2 -2
- package/workflow.d.mts +1 -1
- package/workflow.d.ts +1 -1
- package/workflow.js +42 -4
- package/workflow.mjs +1 -1
|
@@ -85,7 +85,8 @@ var DLQ = class {
|
|
|
85
85
|
messages: messagesPayload.messages.map((message) => {
|
|
86
86
|
return {
|
|
87
87
|
...message,
|
|
88
|
-
urlGroup: message.topicName
|
|
88
|
+
urlGroup: message.topicName,
|
|
89
|
+
ratePerSecond: "rate" in message ? message.rate : void 0
|
|
89
90
|
};
|
|
90
91
|
}),
|
|
91
92
|
cursor: messagesPayload.cursor
|
|
@@ -515,7 +516,8 @@ var Messages = class {
|
|
|
515
516
|
});
|
|
516
517
|
const message = {
|
|
517
518
|
...messagePayload,
|
|
518
|
-
urlGroup: messagePayload.topicName
|
|
519
|
+
urlGroup: messagePayload.topicName,
|
|
520
|
+
ratePerSecond: "rate" in messagePayload ? messagePayload.rate : void 0
|
|
519
521
|
};
|
|
520
522
|
return message;
|
|
521
523
|
}
|
|
@@ -772,6 +774,19 @@ function processHeaders(request) {
|
|
|
772
774
|
headers.set("Upstash-Timeout", `${request.timeout}s`);
|
|
773
775
|
}
|
|
774
776
|
}
|
|
777
|
+
if (request.flowControl?.key) {
|
|
778
|
+
const parallelism = request.flowControl.parallelism?.toString();
|
|
779
|
+
const rate = request.flowControl.ratePerSecond?.toString();
|
|
780
|
+
const controlValue = [
|
|
781
|
+
parallelism ? `parallelism=${parallelism}` : void 0,
|
|
782
|
+
rate ? `rate=${rate}` : void 0
|
|
783
|
+
].filter(Boolean);
|
|
784
|
+
if (controlValue.length === 0) {
|
|
785
|
+
throw new QstashError("Provide at least one of parallelism or ratePerSecond for flowControl");
|
|
786
|
+
}
|
|
787
|
+
headers.set("Upstash-Flow-Control-Key", request.flowControl.key);
|
|
788
|
+
headers.set("Upstash-Flow-Control-Value", controlValue.join(", "));
|
|
789
|
+
}
|
|
775
790
|
return headers;
|
|
776
791
|
}
|
|
777
792
|
function getRequestPath(request) {
|
|
@@ -988,6 +1003,21 @@ var Schedules = class {
|
|
|
988
1003
|
if (request.queueName !== void 0) {
|
|
989
1004
|
headers.set("Upstash-Queue-Name", request.queueName);
|
|
990
1005
|
}
|
|
1006
|
+
if (request.flowControl?.key) {
|
|
1007
|
+
const parallelism = request.flowControl.parallelism?.toString();
|
|
1008
|
+
const rate = request.flowControl.ratePerSecond?.toString();
|
|
1009
|
+
const controlValue = [
|
|
1010
|
+
parallelism ? `parallelism=${parallelism}` : void 0,
|
|
1011
|
+
rate ? `rate=${rate}` : void 0
|
|
1012
|
+
].filter(Boolean);
|
|
1013
|
+
if (controlValue.length === 0) {
|
|
1014
|
+
throw new QstashError(
|
|
1015
|
+
"Provide at least one of parallelism or ratePerSecond for flowControl"
|
|
1016
|
+
);
|
|
1017
|
+
}
|
|
1018
|
+
headers.set("Upstash-Flow-Control-Key", request.flowControl.key);
|
|
1019
|
+
headers.set("Upstash-Flow-Control-Value", controlValue.join(", "));
|
|
1020
|
+
}
|
|
991
1021
|
return await this.http.request({
|
|
992
1022
|
method: "POST",
|
|
993
1023
|
headers: wrapWithGlobalHeaders(headers, this.http.headers),
|
|
@@ -999,19 +1029,27 @@ var Schedules = class {
|
|
|
999
1029
|
* Get a schedule
|
|
1000
1030
|
*/
|
|
1001
1031
|
async get(scheduleId) {
|
|
1002
|
-
|
|
1032
|
+
const schedule = await this.http.request({
|
|
1003
1033
|
method: "GET",
|
|
1004
1034
|
path: ["v2", "schedules", scheduleId]
|
|
1005
1035
|
});
|
|
1036
|
+
if ("rate" in schedule)
|
|
1037
|
+
schedule.ratePerSecond = schedule.rate;
|
|
1038
|
+
return schedule;
|
|
1006
1039
|
}
|
|
1007
1040
|
/**
|
|
1008
1041
|
* List your schedules
|
|
1009
1042
|
*/
|
|
1010
1043
|
async list() {
|
|
1011
|
-
|
|
1044
|
+
const schedules = await this.http.request({
|
|
1012
1045
|
method: "GET",
|
|
1013
1046
|
path: ["v2", "schedules"]
|
|
1014
1047
|
});
|
|
1048
|
+
for (const schedule of schedules) {
|
|
1049
|
+
if ("rate" in schedule)
|
|
1050
|
+
schedule.ratePerSecond = schedule.rate;
|
|
1051
|
+
}
|
|
1052
|
+
return schedules;
|
|
1015
1053
|
}
|
|
1016
1054
|
/**
|
|
1017
1055
|
* Delete a schedule
|
|
@@ -105,6 +105,30 @@ type RateLimit = {
|
|
|
105
105
|
remaining: string | null;
|
|
106
106
|
reset: string | null;
|
|
107
107
|
};
|
|
108
|
+
type FlowControl = {
|
|
109
|
+
/**
|
|
110
|
+
* flow control key
|
|
111
|
+
*/
|
|
112
|
+
key: string;
|
|
113
|
+
} & ({
|
|
114
|
+
/**
|
|
115
|
+
* number of requests which can be active with the same flow control key
|
|
116
|
+
*/
|
|
117
|
+
parallelism: number;
|
|
118
|
+
/**
|
|
119
|
+
* number of requests to activate per second with the same flow control key
|
|
120
|
+
*/
|
|
121
|
+
ratePerSecond?: number;
|
|
122
|
+
} | {
|
|
123
|
+
/**
|
|
124
|
+
* number of requests which can be active with the same flow control key
|
|
125
|
+
*/
|
|
126
|
+
parallelism?: number;
|
|
127
|
+
/**
|
|
128
|
+
* number of requests to activate per second with the same flow control key
|
|
129
|
+
*/
|
|
130
|
+
ratePerSecond: number;
|
|
131
|
+
});
|
|
108
132
|
|
|
109
133
|
type ProviderInfo = {
|
|
110
134
|
/**
|
|
@@ -457,6 +481,18 @@ type Message = {
|
|
|
457
481
|
* IP address of the publisher of this message
|
|
458
482
|
*/
|
|
459
483
|
callerIp?: string;
|
|
484
|
+
/**
|
|
485
|
+
* flow control key
|
|
486
|
+
*/
|
|
487
|
+
flowControlKey: string;
|
|
488
|
+
/**
|
|
489
|
+
* number of requests which can be active with the same flow control key
|
|
490
|
+
*/
|
|
491
|
+
parallelism?: number;
|
|
492
|
+
/**
|
|
493
|
+
* number of requests to activate per second with the same flow control key
|
|
494
|
+
*/
|
|
495
|
+
ratePerSecond?: number;
|
|
460
496
|
};
|
|
461
497
|
type MessagePayload = Omit<Message, "urlGroup"> & {
|
|
462
498
|
topicName: string;
|
|
@@ -693,6 +729,9 @@ type Schedule = {
|
|
|
693
729
|
callerIp?: string;
|
|
694
730
|
isPaused: boolean;
|
|
695
731
|
queueName?: string;
|
|
732
|
+
flowControlKey?: string;
|
|
733
|
+
parallelism?: number;
|
|
734
|
+
ratePerSecond?: number;
|
|
696
735
|
};
|
|
697
736
|
type CreateScheduleRequest = {
|
|
698
737
|
/**
|
|
@@ -781,6 +820,11 @@ type CreateScheduleRequest = {
|
|
|
781
820
|
* Queue name to schedule the message over.
|
|
782
821
|
*/
|
|
783
822
|
queueName?: string;
|
|
823
|
+
/**
|
|
824
|
+
* Settings for controlling the number of active requests
|
|
825
|
+
* and number of requests per second with the same key.
|
|
826
|
+
*/
|
|
827
|
+
flowControl?: FlowControl;
|
|
784
828
|
};
|
|
785
829
|
declare class Schedules {
|
|
786
830
|
private readonly http;
|
|
@@ -1689,6 +1733,11 @@ type PublishRequest<TBody = BodyInit> = {
|
|
|
1689
1733
|
* @default undefined
|
|
1690
1734
|
*/
|
|
1691
1735
|
timeout?: Duration | number;
|
|
1736
|
+
/**
|
|
1737
|
+
* Settings for controlling the number of active requests
|
|
1738
|
+
* and number of requests per second with the same key.
|
|
1739
|
+
*/
|
|
1740
|
+
flowControl?: FlowControl;
|
|
1692
1741
|
} & ({
|
|
1693
1742
|
/**
|
|
1694
1743
|
* The url where the message should be sent to.
|
|
@@ -1903,4 +1952,4 @@ type PublishResponse<TRequest> = TRequest extends {
|
|
|
1903
1952
|
urlGroup: string;
|
|
1904
1953
|
} ? PublishToUrlGroupsResponse : PublishToApiResponse;
|
|
1905
1954
|
|
|
1906
|
-
export {
|
|
1955
|
+
export { type ChatRequest as $, type AddEndpointsRequest as A, BaseProvider as B, type ChatRateLimit as C, type RequestOptions as D, type EmailOwner as E, type FailureFunctionPayload as F, type GetEventsResponse as G, type HTTPMethods as H, type FlowControl as I, Chat as J, type ChatCompletionMessage as K, type LLMOwner as L, type Message as M, type ChatCompletion as N, type ChatCompletionChunk as O, type ProviderInfo as P, type QueueRequest as Q, type RateLimit as R, type Step as S, type StreamEnabled as T, type UrlGroup as U, type VerifyRequest as V, type WithCursor as W, type StreamDisabled as X, type StreamParameter as Y, type OpenAIChatModel as Z, type PromptChatRequest as _, type ReceiverConfig as a, upstash as a0, openai as a1, anthropic as a2, custom as a3, type RouteFunction as a4, type WorkflowServeOptions as a5, Workflow as a6, processOptions as a7, serve as a8, WorkflowContext as a9, DisabledWorkflowContext as aa, type WorkflowClient as ab, type WorkflowReceiver as ac, StepTypes as ad, type StepType as ae, type RawStep as af, type SyncStepFunction as ag, type AsyncStepFunction as ah, type StepFunction as ai, type ParallelCallState as aj, type FinishCondition as ak, type RequiredExceptFields as al, type LogLevel as am, type WorkflowLoggerOptions as an, WorkflowLogger as ao, SignatureError as b, Receiver as c, type PublishBatchRequest as d, type PublishRequest as e, type PublishJsonRequest as f, type EventsRequest as g, Client as h, type PublishToApiResponse as i, type PublishToUrlResponse as j, type PublishToUrlGroupsResponse as k, type PublishResponse as l, type MessagePayload as m, Messages as n, type Schedule as o, type CreateScheduleRequest as p, Schedules as q, type Endpoint as r, type RemoveEndpointsRequest as s, UrlGroups as t, type State as u, type Event as v, type EventPayload as w, type GetEventsPayload as x, type BodyInit as y, type HeadersInit as z };
|
|
@@ -105,6 +105,30 @@ type RateLimit = {
|
|
|
105
105
|
remaining: string | null;
|
|
106
106
|
reset: string | null;
|
|
107
107
|
};
|
|
108
|
+
type FlowControl = {
|
|
109
|
+
/**
|
|
110
|
+
* flow control key
|
|
111
|
+
*/
|
|
112
|
+
key: string;
|
|
113
|
+
} & ({
|
|
114
|
+
/**
|
|
115
|
+
* number of requests which can be active with the same flow control key
|
|
116
|
+
*/
|
|
117
|
+
parallelism: number;
|
|
118
|
+
/**
|
|
119
|
+
* number of requests to activate per second with the same flow control key
|
|
120
|
+
*/
|
|
121
|
+
ratePerSecond?: number;
|
|
122
|
+
} | {
|
|
123
|
+
/**
|
|
124
|
+
* number of requests which can be active with the same flow control key
|
|
125
|
+
*/
|
|
126
|
+
parallelism?: number;
|
|
127
|
+
/**
|
|
128
|
+
* number of requests to activate per second with the same flow control key
|
|
129
|
+
*/
|
|
130
|
+
ratePerSecond: number;
|
|
131
|
+
});
|
|
108
132
|
|
|
109
133
|
type ProviderInfo = {
|
|
110
134
|
/**
|
|
@@ -457,6 +481,18 @@ type Message = {
|
|
|
457
481
|
* IP address of the publisher of this message
|
|
458
482
|
*/
|
|
459
483
|
callerIp?: string;
|
|
484
|
+
/**
|
|
485
|
+
* flow control key
|
|
486
|
+
*/
|
|
487
|
+
flowControlKey: string;
|
|
488
|
+
/**
|
|
489
|
+
* number of requests which can be active with the same flow control key
|
|
490
|
+
*/
|
|
491
|
+
parallelism?: number;
|
|
492
|
+
/**
|
|
493
|
+
* number of requests to activate per second with the same flow control key
|
|
494
|
+
*/
|
|
495
|
+
ratePerSecond?: number;
|
|
460
496
|
};
|
|
461
497
|
type MessagePayload = Omit<Message, "urlGroup"> & {
|
|
462
498
|
topicName: string;
|
|
@@ -693,6 +729,9 @@ type Schedule = {
|
|
|
693
729
|
callerIp?: string;
|
|
694
730
|
isPaused: boolean;
|
|
695
731
|
queueName?: string;
|
|
732
|
+
flowControlKey?: string;
|
|
733
|
+
parallelism?: number;
|
|
734
|
+
ratePerSecond?: number;
|
|
696
735
|
};
|
|
697
736
|
type CreateScheduleRequest = {
|
|
698
737
|
/**
|
|
@@ -781,6 +820,11 @@ type CreateScheduleRequest = {
|
|
|
781
820
|
* Queue name to schedule the message over.
|
|
782
821
|
*/
|
|
783
822
|
queueName?: string;
|
|
823
|
+
/**
|
|
824
|
+
* Settings for controlling the number of active requests
|
|
825
|
+
* and number of requests per second with the same key.
|
|
826
|
+
*/
|
|
827
|
+
flowControl?: FlowControl;
|
|
784
828
|
};
|
|
785
829
|
declare class Schedules {
|
|
786
830
|
private readonly http;
|
|
@@ -1689,6 +1733,11 @@ type PublishRequest<TBody = BodyInit> = {
|
|
|
1689
1733
|
* @default undefined
|
|
1690
1734
|
*/
|
|
1691
1735
|
timeout?: Duration | number;
|
|
1736
|
+
/**
|
|
1737
|
+
* Settings for controlling the number of active requests
|
|
1738
|
+
* and number of requests per second with the same key.
|
|
1739
|
+
*/
|
|
1740
|
+
flowControl?: FlowControl;
|
|
1692
1741
|
} & ({
|
|
1693
1742
|
/**
|
|
1694
1743
|
* The url where the message should be sent to.
|
|
@@ -1903,4 +1952,4 @@ type PublishResponse<TRequest> = TRequest extends {
|
|
|
1903
1952
|
urlGroup: string;
|
|
1904
1953
|
} ? PublishToUrlGroupsResponse : PublishToApiResponse;
|
|
1905
1954
|
|
|
1906
|
-
export {
|
|
1955
|
+
export { type ChatRequest as $, type AddEndpointsRequest as A, BaseProvider as B, type ChatRateLimit as C, type RequestOptions as D, type EmailOwner as E, type FailureFunctionPayload as F, type GetEventsResponse as G, type HTTPMethods as H, type FlowControl as I, Chat as J, type ChatCompletionMessage as K, type LLMOwner as L, type Message as M, type ChatCompletion as N, type ChatCompletionChunk as O, type ProviderInfo as P, type QueueRequest as Q, type RateLimit as R, type Step as S, type StreamEnabled as T, type UrlGroup as U, type VerifyRequest as V, type WithCursor as W, type StreamDisabled as X, type StreamParameter as Y, type OpenAIChatModel as Z, type PromptChatRequest as _, type ReceiverConfig as a, upstash as a0, openai as a1, anthropic as a2, custom as a3, type RouteFunction as a4, type WorkflowServeOptions as a5, Workflow as a6, processOptions as a7, serve as a8, WorkflowContext as a9, DisabledWorkflowContext as aa, type WorkflowClient as ab, type WorkflowReceiver as ac, StepTypes as ad, type StepType as ae, type RawStep as af, type SyncStepFunction as ag, type AsyncStepFunction as ah, type StepFunction as ai, type ParallelCallState as aj, type FinishCondition as ak, type RequiredExceptFields as al, type LogLevel as am, type WorkflowLoggerOptions as an, WorkflowLogger as ao, SignatureError as b, Receiver as c, type PublishBatchRequest as d, type PublishRequest as e, type PublishJsonRequest as f, type EventsRequest as g, Client as h, type PublishToApiResponse as i, type PublishToUrlResponse as j, type PublishToUrlGroupsResponse as k, type PublishResponse as l, type MessagePayload as m, Messages as n, type Schedule as o, type CreateScheduleRequest as p, Schedules as q, type Endpoint as r, type RemoveEndpointsRequest as s, UrlGroups as t, type State as u, type Event as v, type EventPayload as w, type GetEventsPayload as x, type BodyInit as y, type HeadersInit as z };
|
package/cloudflare.d.mts
CHANGED
package/cloudflare.d.ts
CHANGED
package/cloudflare.js
CHANGED
|
@@ -121,7 +121,8 @@ var DLQ = class {
|
|
|
121
121
|
messages: messagesPayload.messages.map((message) => {
|
|
122
122
|
return {
|
|
123
123
|
...message,
|
|
124
|
-
urlGroup: message.topicName
|
|
124
|
+
urlGroup: message.topicName,
|
|
125
|
+
ratePerSecond: "rate" in message ? message.rate : void 0
|
|
125
126
|
};
|
|
126
127
|
}),
|
|
127
128
|
cursor: messagesPayload.cursor
|
|
@@ -551,7 +552,8 @@ var Messages = class {
|
|
|
551
552
|
});
|
|
552
553
|
const message = {
|
|
553
554
|
...messagePayload,
|
|
554
|
-
urlGroup: messagePayload.topicName
|
|
555
|
+
urlGroup: messagePayload.topicName,
|
|
556
|
+
ratePerSecond: "rate" in messagePayload ? messagePayload.rate : void 0
|
|
555
557
|
};
|
|
556
558
|
return message;
|
|
557
559
|
}
|
|
@@ -792,6 +794,19 @@ function processHeaders(request) {
|
|
|
792
794
|
headers.set("Upstash-Timeout", `${request.timeout}s`);
|
|
793
795
|
}
|
|
794
796
|
}
|
|
797
|
+
if (request.flowControl?.key) {
|
|
798
|
+
const parallelism = request.flowControl.parallelism?.toString();
|
|
799
|
+
const rate = request.flowControl.ratePerSecond?.toString();
|
|
800
|
+
const controlValue = [
|
|
801
|
+
parallelism ? `parallelism=${parallelism}` : void 0,
|
|
802
|
+
rate ? `rate=${rate}` : void 0
|
|
803
|
+
].filter(Boolean);
|
|
804
|
+
if (controlValue.length === 0) {
|
|
805
|
+
throw new QstashError("Provide at least one of parallelism or ratePerSecond for flowControl");
|
|
806
|
+
}
|
|
807
|
+
headers.set("Upstash-Flow-Control-Key", request.flowControl.key);
|
|
808
|
+
headers.set("Upstash-Flow-Control-Value", controlValue.join(", "));
|
|
809
|
+
}
|
|
795
810
|
return headers;
|
|
796
811
|
}
|
|
797
812
|
function getRequestPath(request) {
|
|
@@ -1008,6 +1023,21 @@ var Schedules = class {
|
|
|
1008
1023
|
if (request.queueName !== void 0) {
|
|
1009
1024
|
headers.set("Upstash-Queue-Name", request.queueName);
|
|
1010
1025
|
}
|
|
1026
|
+
if (request.flowControl?.key) {
|
|
1027
|
+
const parallelism = request.flowControl.parallelism?.toString();
|
|
1028
|
+
const rate = request.flowControl.ratePerSecond?.toString();
|
|
1029
|
+
const controlValue = [
|
|
1030
|
+
parallelism ? `parallelism=${parallelism}` : void 0,
|
|
1031
|
+
rate ? `rate=${rate}` : void 0
|
|
1032
|
+
].filter(Boolean);
|
|
1033
|
+
if (controlValue.length === 0) {
|
|
1034
|
+
throw new QstashError(
|
|
1035
|
+
"Provide at least one of parallelism or ratePerSecond for flowControl"
|
|
1036
|
+
);
|
|
1037
|
+
}
|
|
1038
|
+
headers.set("Upstash-Flow-Control-Key", request.flowControl.key);
|
|
1039
|
+
headers.set("Upstash-Flow-Control-Value", controlValue.join(", "));
|
|
1040
|
+
}
|
|
1011
1041
|
return await this.http.request({
|
|
1012
1042
|
method: "POST",
|
|
1013
1043
|
headers: wrapWithGlobalHeaders(headers, this.http.headers),
|
|
@@ -1019,19 +1049,27 @@ var Schedules = class {
|
|
|
1019
1049
|
* Get a schedule
|
|
1020
1050
|
*/
|
|
1021
1051
|
async get(scheduleId) {
|
|
1022
|
-
|
|
1052
|
+
const schedule = await this.http.request({
|
|
1023
1053
|
method: "GET",
|
|
1024
1054
|
path: ["v2", "schedules", scheduleId]
|
|
1025
1055
|
});
|
|
1056
|
+
if ("rate" in schedule)
|
|
1057
|
+
schedule.ratePerSecond = schedule.rate;
|
|
1058
|
+
return schedule;
|
|
1026
1059
|
}
|
|
1027
1060
|
/**
|
|
1028
1061
|
* List your schedules
|
|
1029
1062
|
*/
|
|
1030
1063
|
async list() {
|
|
1031
|
-
|
|
1064
|
+
const schedules = await this.http.request({
|
|
1032
1065
|
method: "GET",
|
|
1033
1066
|
path: ["v2", "schedules"]
|
|
1034
1067
|
});
|
|
1068
|
+
for (const schedule of schedules) {
|
|
1069
|
+
if ("rate" in schedule)
|
|
1070
|
+
schedule.ratePerSecond = schedule.rate;
|
|
1071
|
+
}
|
|
1072
|
+
return schedules;
|
|
1035
1073
|
}
|
|
1036
1074
|
/**
|
|
1037
1075
|
* Delete a schedule
|
package/cloudflare.mjs
CHANGED
package/h3.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as h3 from 'h3';
|
|
2
2
|
import { H3Event } from 'h3';
|
|
3
|
-
import {
|
|
3
|
+
import { a4 as RouteFunction, a5 as WorkflowServeOptions } from './client-vTeVVeh7.mjs';
|
|
4
4
|
import 'neverthrow';
|
|
5
5
|
|
|
6
6
|
type VerifySignatureConfig = {
|
package/h3.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as h3 from 'h3';
|
|
2
2
|
import { H3Event } from 'h3';
|
|
3
|
-
import {
|
|
3
|
+
import { a4 as RouteFunction, a5 as WorkflowServeOptions } from './client-vTeVVeh7.js';
|
|
4
4
|
import 'neverthrow';
|
|
5
5
|
|
|
6
6
|
type VerifySignatureConfig = {
|
package/h3.js
CHANGED
|
@@ -445,7 +445,8 @@ var DLQ = class {
|
|
|
445
445
|
messages: messagesPayload.messages.map((message) => {
|
|
446
446
|
return {
|
|
447
447
|
...message,
|
|
448
|
-
urlGroup: message.topicName
|
|
448
|
+
urlGroup: message.topicName,
|
|
449
|
+
ratePerSecond: "rate" in message ? message.rate : void 0
|
|
449
450
|
};
|
|
450
451
|
}),
|
|
451
452
|
cursor: messagesPayload.cursor
|
|
@@ -875,7 +876,8 @@ var Messages = class {
|
|
|
875
876
|
});
|
|
876
877
|
const message = {
|
|
877
878
|
...messagePayload,
|
|
878
|
-
urlGroup: messagePayload.topicName
|
|
879
|
+
urlGroup: messagePayload.topicName,
|
|
880
|
+
ratePerSecond: "rate" in messagePayload ? messagePayload.rate : void 0
|
|
879
881
|
};
|
|
880
882
|
return message;
|
|
881
883
|
}
|
|
@@ -1116,6 +1118,19 @@ function processHeaders(request) {
|
|
|
1116
1118
|
headers.set("Upstash-Timeout", `${request.timeout}s`);
|
|
1117
1119
|
}
|
|
1118
1120
|
}
|
|
1121
|
+
if (request.flowControl?.key) {
|
|
1122
|
+
const parallelism = request.flowControl.parallelism?.toString();
|
|
1123
|
+
const rate = request.flowControl.ratePerSecond?.toString();
|
|
1124
|
+
const controlValue = [
|
|
1125
|
+
parallelism ? `parallelism=${parallelism}` : void 0,
|
|
1126
|
+
rate ? `rate=${rate}` : void 0
|
|
1127
|
+
].filter(Boolean);
|
|
1128
|
+
if (controlValue.length === 0) {
|
|
1129
|
+
throw new QstashError("Provide at least one of parallelism or ratePerSecond for flowControl");
|
|
1130
|
+
}
|
|
1131
|
+
headers.set("Upstash-Flow-Control-Key", request.flowControl.key);
|
|
1132
|
+
headers.set("Upstash-Flow-Control-Value", controlValue.join(", "));
|
|
1133
|
+
}
|
|
1119
1134
|
return headers;
|
|
1120
1135
|
}
|
|
1121
1136
|
function getRequestPath(request) {
|
|
@@ -1332,6 +1347,21 @@ var Schedules = class {
|
|
|
1332
1347
|
if (request.queueName !== void 0) {
|
|
1333
1348
|
headers.set("Upstash-Queue-Name", request.queueName);
|
|
1334
1349
|
}
|
|
1350
|
+
if (request.flowControl?.key) {
|
|
1351
|
+
const parallelism = request.flowControl.parallelism?.toString();
|
|
1352
|
+
const rate = request.flowControl.ratePerSecond?.toString();
|
|
1353
|
+
const controlValue = [
|
|
1354
|
+
parallelism ? `parallelism=${parallelism}` : void 0,
|
|
1355
|
+
rate ? `rate=${rate}` : void 0
|
|
1356
|
+
].filter(Boolean);
|
|
1357
|
+
if (controlValue.length === 0) {
|
|
1358
|
+
throw new QstashError(
|
|
1359
|
+
"Provide at least one of parallelism or ratePerSecond for flowControl"
|
|
1360
|
+
);
|
|
1361
|
+
}
|
|
1362
|
+
headers.set("Upstash-Flow-Control-Key", request.flowControl.key);
|
|
1363
|
+
headers.set("Upstash-Flow-Control-Value", controlValue.join(", "));
|
|
1364
|
+
}
|
|
1335
1365
|
return await this.http.request({
|
|
1336
1366
|
method: "POST",
|
|
1337
1367
|
headers: wrapWithGlobalHeaders(headers, this.http.headers),
|
|
@@ -1343,19 +1373,27 @@ var Schedules = class {
|
|
|
1343
1373
|
* Get a schedule
|
|
1344
1374
|
*/
|
|
1345
1375
|
async get(scheduleId) {
|
|
1346
|
-
|
|
1376
|
+
const schedule = await this.http.request({
|
|
1347
1377
|
method: "GET",
|
|
1348
1378
|
path: ["v2", "schedules", scheduleId]
|
|
1349
1379
|
});
|
|
1380
|
+
if ("rate" in schedule)
|
|
1381
|
+
schedule.ratePerSecond = schedule.rate;
|
|
1382
|
+
return schedule;
|
|
1350
1383
|
}
|
|
1351
1384
|
/**
|
|
1352
1385
|
* List your schedules
|
|
1353
1386
|
*/
|
|
1354
1387
|
async list() {
|
|
1355
|
-
|
|
1388
|
+
const schedules = await this.http.request({
|
|
1356
1389
|
method: "GET",
|
|
1357
1390
|
path: ["v2", "schedules"]
|
|
1358
1391
|
});
|
|
1392
|
+
for (const schedule of schedules) {
|
|
1393
|
+
if ("rate" in schedule)
|
|
1394
|
+
schedule.ratePerSecond = schedule.rate;
|
|
1395
|
+
}
|
|
1396
|
+
return schedules;
|
|
1359
1397
|
}
|
|
1360
1398
|
/**
|
|
1361
1399
|
* Delete a schedule
|
package/h3.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
serve,
|
|
3
3
|
verifySignatureH3
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-3N4XI2LB.mjs";
|
|
5
|
+
import "./chunk-RQQYKT2M.mjs";
|
|
6
|
+
import "./chunk-MQSZDXFZ.mjs";
|
|
7
7
|
export {
|
|
8
8
|
serve,
|
|
9
9
|
verifySignatureH3
|
package/hono.d.mts
CHANGED
package/hono.d.ts
CHANGED
package/hono.js
CHANGED
|
@@ -121,7 +121,8 @@ var DLQ = class {
|
|
|
121
121
|
messages: messagesPayload.messages.map((message) => {
|
|
122
122
|
return {
|
|
123
123
|
...message,
|
|
124
|
-
urlGroup: message.topicName
|
|
124
|
+
urlGroup: message.topicName,
|
|
125
|
+
ratePerSecond: "rate" in message ? message.rate : void 0
|
|
125
126
|
};
|
|
126
127
|
}),
|
|
127
128
|
cursor: messagesPayload.cursor
|
|
@@ -551,7 +552,8 @@ var Messages = class {
|
|
|
551
552
|
});
|
|
552
553
|
const message = {
|
|
553
554
|
...messagePayload,
|
|
554
|
-
urlGroup: messagePayload.topicName
|
|
555
|
+
urlGroup: messagePayload.topicName,
|
|
556
|
+
ratePerSecond: "rate" in messagePayload ? messagePayload.rate : void 0
|
|
555
557
|
};
|
|
556
558
|
return message;
|
|
557
559
|
}
|
|
@@ -792,6 +794,19 @@ function processHeaders(request) {
|
|
|
792
794
|
headers.set("Upstash-Timeout", `${request.timeout}s`);
|
|
793
795
|
}
|
|
794
796
|
}
|
|
797
|
+
if (request.flowControl?.key) {
|
|
798
|
+
const parallelism = request.flowControl.parallelism?.toString();
|
|
799
|
+
const rate = request.flowControl.ratePerSecond?.toString();
|
|
800
|
+
const controlValue = [
|
|
801
|
+
parallelism ? `parallelism=${parallelism}` : void 0,
|
|
802
|
+
rate ? `rate=${rate}` : void 0
|
|
803
|
+
].filter(Boolean);
|
|
804
|
+
if (controlValue.length === 0) {
|
|
805
|
+
throw new QstashError("Provide at least one of parallelism or ratePerSecond for flowControl");
|
|
806
|
+
}
|
|
807
|
+
headers.set("Upstash-Flow-Control-Key", request.flowControl.key);
|
|
808
|
+
headers.set("Upstash-Flow-Control-Value", controlValue.join(", "));
|
|
809
|
+
}
|
|
795
810
|
return headers;
|
|
796
811
|
}
|
|
797
812
|
function getRequestPath(request) {
|
|
@@ -1008,6 +1023,21 @@ var Schedules = class {
|
|
|
1008
1023
|
if (request.queueName !== void 0) {
|
|
1009
1024
|
headers.set("Upstash-Queue-Name", request.queueName);
|
|
1010
1025
|
}
|
|
1026
|
+
if (request.flowControl?.key) {
|
|
1027
|
+
const parallelism = request.flowControl.parallelism?.toString();
|
|
1028
|
+
const rate = request.flowControl.ratePerSecond?.toString();
|
|
1029
|
+
const controlValue = [
|
|
1030
|
+
parallelism ? `parallelism=${parallelism}` : void 0,
|
|
1031
|
+
rate ? `rate=${rate}` : void 0
|
|
1032
|
+
].filter(Boolean);
|
|
1033
|
+
if (controlValue.length === 0) {
|
|
1034
|
+
throw new QstashError(
|
|
1035
|
+
"Provide at least one of parallelism or ratePerSecond for flowControl"
|
|
1036
|
+
);
|
|
1037
|
+
}
|
|
1038
|
+
headers.set("Upstash-Flow-Control-Key", request.flowControl.key);
|
|
1039
|
+
headers.set("Upstash-Flow-Control-Value", controlValue.join(", "));
|
|
1040
|
+
}
|
|
1011
1041
|
return await this.http.request({
|
|
1012
1042
|
method: "POST",
|
|
1013
1043
|
headers: wrapWithGlobalHeaders(headers, this.http.headers),
|
|
@@ -1019,19 +1049,27 @@ var Schedules = class {
|
|
|
1019
1049
|
* Get a schedule
|
|
1020
1050
|
*/
|
|
1021
1051
|
async get(scheduleId) {
|
|
1022
|
-
|
|
1052
|
+
const schedule = await this.http.request({
|
|
1023
1053
|
method: "GET",
|
|
1024
1054
|
path: ["v2", "schedules", scheduleId]
|
|
1025
1055
|
});
|
|
1056
|
+
if ("rate" in schedule)
|
|
1057
|
+
schedule.ratePerSecond = schedule.rate;
|
|
1058
|
+
return schedule;
|
|
1026
1059
|
}
|
|
1027
1060
|
/**
|
|
1028
1061
|
* List your schedules
|
|
1029
1062
|
*/
|
|
1030
1063
|
async list() {
|
|
1031
|
-
|
|
1064
|
+
const schedules = await this.http.request({
|
|
1032
1065
|
method: "GET",
|
|
1033
1066
|
path: ["v2", "schedules"]
|
|
1034
1067
|
});
|
|
1068
|
+
for (const schedule of schedules) {
|
|
1069
|
+
if ("rate" in schedule)
|
|
1070
|
+
schedule.ratePerSecond = schedule.rate;
|
|
1071
|
+
}
|
|
1072
|
+
return schedules;
|
|
1035
1073
|
}
|
|
1036
1074
|
/**
|
|
1037
1075
|
* Delete a schedule
|
package/hono.mjs
CHANGED
package/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RateLimit, C as ChatRateLimit, S as Step, F as FailureFunctionPayload, L as LLMOwner, B as BaseProvider, E as EmailOwner, P as ProviderInfo } from './client-
|
|
2
|
-
export { A as AddEndpointsRequest, y as BodyInit,
|
|
1
|
+
import { R as RateLimit, C as ChatRateLimit, S as Step, F as FailureFunctionPayload, L as LLMOwner, B as BaseProvider, E as EmailOwner, P as ProviderInfo } from './client-vTeVVeh7.mjs';
|
|
2
|
+
export { A as AddEndpointsRequest, y as BodyInit, J as Chat, N as ChatCompletion, O as ChatCompletionChunk, K as ChatCompletionMessage, $ as ChatRequest, h as Client, p as CreateScheduleRequest, r as Endpoint, v as Event, w as EventPayload, g as EventsRequest, I as FlowControl, x as GetEventsPayload, G as GetEventsResponse, H as HTTPMethods, z as HeadersInit, M as Message, m as MessagePayload, n as Messages, Z as OpenAIChatModel, _ as PromptChatRequest, d as PublishBatchRequest, f as PublishJsonRequest, e as PublishRequest, l as PublishResponse, i as PublishToApiResponse, k as PublishToUrlGroupsResponse, j as PublishToUrlResponse, Q as QueueRequest, c as Receiver, a as ReceiverConfig, s as RemoveEndpointsRequest, D as RequestOptions, o as Schedule, q as Schedules, b as SignatureError, u as State, X as StreamDisabled, T as StreamEnabled, Y as StreamParameter, U as UrlGroup, t as UrlGroups, V as VerifyRequest, W as WithCursor, a2 as anthropic, a3 as custom, a1 as openai, a0 as upstash } from './client-vTeVVeh7.mjs';
|
|
3
3
|
import 'neverthrow';
|
|
4
4
|
|
|
5
5
|
/**
|