@upstash/qstash 2.9.0 → 2.9.1
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-QYBCXZKB.mjs → chunk-DT2X63FB.mjs} +111 -1
- package/{chunk-H5OAU75L.mjs → chunk-JO26IBSH.mjs} +1 -1
- package/{chunk-M7SEEFAC.mjs → chunk-KDHOB7B5.mjs} +1 -1
- package/{client-BVG9vt90.d.ts → client-jh_SomWB.d.mts} +132 -1
- package/{client-BVG9vt90.d.mts → client-jh_SomWB.d.ts} +132 -1
- package/cloudflare.d.mts +1 -1
- package/cloudflare.d.ts +1 -1
- package/cloudflare.js +110 -1
- package/cloudflare.mjs +1 -1
- package/h3.d.mts +1 -1
- package/h3.d.ts +1 -1
- package/h3.js +110 -1
- package/h3.mjs +3 -3
- package/hono.d.mts +1 -1
- package/hono.d.ts +1 -1
- package/hono.js +110 -1
- package/hono.mjs +1 -1
- package/index.d.mts +2 -2
- package/index.d.ts +2 -2
- package/index.js +112 -1
- package/index.mjs +4 -2
- package/nextjs.d.mts +1 -1
- package/nextjs.d.ts +1 -1
- package/nextjs.js +110 -1
- 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 +110 -1
- package/solidjs.mjs +2 -2
- package/svelte.d.mts +1 -1
- package/svelte.d.ts +1 -1
- package/svelte.js +110 -1
- package/svelte.mjs +2 -2
- package/workflow.d.mts +1 -1
- package/workflow.d.ts +1 -1
- package/workflow.js +110 -1
- package/workflow.mjs +1 -1
|
@@ -650,6 +650,107 @@ var DLQ = class {
|
|
|
650
650
|
}
|
|
651
651
|
};
|
|
652
652
|
|
|
653
|
+
// src/client/flow-control.ts
|
|
654
|
+
var FlowControlApi = class {
|
|
655
|
+
http;
|
|
656
|
+
constructor(http) {
|
|
657
|
+
this.http = http;
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Get a single flow control by key.
|
|
661
|
+
*/
|
|
662
|
+
async get(flowControlKey) {
|
|
663
|
+
return await this.http.request({
|
|
664
|
+
method: "GET",
|
|
665
|
+
path: ["v2", "flowControl", flowControlKey]
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Get the global parallelism info.
|
|
670
|
+
*/
|
|
671
|
+
async getGlobalParallelism() {
|
|
672
|
+
const response = await this.http.request({
|
|
673
|
+
method: "GET",
|
|
674
|
+
path: ["v2", "globalParallelism"]
|
|
675
|
+
});
|
|
676
|
+
return {
|
|
677
|
+
parallelismMax: response.parallelismMax ?? 0,
|
|
678
|
+
parallelismCount: response.parallelismCount ?? 0
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Pause message delivery for a flow-control key.
|
|
683
|
+
*
|
|
684
|
+
* Messages already in the waitlist will remain there.
|
|
685
|
+
* New incoming messages will be added directly to the waitlist.
|
|
686
|
+
*/
|
|
687
|
+
async pause(flowControlKey) {
|
|
688
|
+
await this.http.request({
|
|
689
|
+
method: "POST",
|
|
690
|
+
path: ["v2", "flowControl", flowControlKey, "pause"],
|
|
691
|
+
parseResponseAsJson: false
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* Resume message delivery for a flow-control key.
|
|
696
|
+
*/
|
|
697
|
+
async resume(flowControlKey) {
|
|
698
|
+
await this.http.request({
|
|
699
|
+
method: "POST",
|
|
700
|
+
path: ["v2", "flowControl", flowControlKey, "resume"],
|
|
701
|
+
parseResponseAsJson: false
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* Pin a processing configuration for a flow-control key.
|
|
706
|
+
*
|
|
707
|
+
* While pinned, the system ignores configurations provided by incoming
|
|
708
|
+
* messages and uses the pinned configuration instead.
|
|
709
|
+
*/
|
|
710
|
+
async pin(flowControlKey, options) {
|
|
711
|
+
await this.http.request({
|
|
712
|
+
method: "POST",
|
|
713
|
+
path: ["v2", "flowControl", flowControlKey, "pin"],
|
|
714
|
+
query: {
|
|
715
|
+
parallelism: options.parallelism,
|
|
716
|
+
rate: options.rate,
|
|
717
|
+
period: options.period
|
|
718
|
+
},
|
|
719
|
+
parseResponseAsJson: false
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Remove the pinned configuration for a flow-control key.
|
|
724
|
+
*
|
|
725
|
+
* After unpinning, the system resumes updating the configuration
|
|
726
|
+
* based on incoming messages.
|
|
727
|
+
*/
|
|
728
|
+
async unpin(flowControlKey, options) {
|
|
729
|
+
await this.http.request({
|
|
730
|
+
method: "POST",
|
|
731
|
+
path: ["v2", "flowControl", flowControlKey, "unpin"],
|
|
732
|
+
query: {
|
|
733
|
+
parallelism: options.parallelism,
|
|
734
|
+
rate: options.rate
|
|
735
|
+
},
|
|
736
|
+
parseResponseAsJson: false
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Reset the rate configuration state for a flow-control key.
|
|
741
|
+
*
|
|
742
|
+
* Clears the current rate count and immediately ends the current period.
|
|
743
|
+
* The current timestamp becomes the start of the new rate period.
|
|
744
|
+
*/
|
|
745
|
+
async resetRate(flowControlKey) {
|
|
746
|
+
await this.http.request({
|
|
747
|
+
method: "POST",
|
|
748
|
+
path: ["v2", "flowControl", flowControlKey, "resetRate"],
|
|
749
|
+
parseResponseAsJson: false
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
};
|
|
753
|
+
|
|
653
754
|
// src/client/http.ts
|
|
654
755
|
var HttpClient = class {
|
|
655
756
|
baseUrl;
|
|
@@ -1334,7 +1435,7 @@ var UrlGroups = class {
|
|
|
1334
1435
|
};
|
|
1335
1436
|
|
|
1336
1437
|
// version.ts
|
|
1337
|
-
var VERSION = "v2.9.
|
|
1438
|
+
var VERSION = "v2.9.1";
|
|
1338
1439
|
|
|
1339
1440
|
// src/client/client.ts
|
|
1340
1441
|
var Client = class {
|
|
@@ -1405,6 +1506,14 @@ var Client = class {
|
|
|
1405
1506
|
get schedules() {
|
|
1406
1507
|
return new Schedules(this.http);
|
|
1407
1508
|
}
|
|
1509
|
+
/**
|
|
1510
|
+
* Access the flow control API.
|
|
1511
|
+
*
|
|
1512
|
+
* List, get, or reset flow controls.
|
|
1513
|
+
*/
|
|
1514
|
+
get flowControl() {
|
|
1515
|
+
return new FlowControlApi(this.http);
|
|
1516
|
+
}
|
|
1408
1517
|
/**
|
|
1409
1518
|
* Access the workflow API.
|
|
1410
1519
|
*
|
|
@@ -2991,6 +3100,7 @@ export {
|
|
|
2991
3100
|
decodeBase64,
|
|
2992
3101
|
SignatureError,
|
|
2993
3102
|
Receiver,
|
|
3103
|
+
FlowControlApi,
|
|
2994
3104
|
setupAnalytics,
|
|
2995
3105
|
Chat,
|
|
2996
3106
|
Messages,
|
|
@@ -732,6 +732,131 @@ declare class DLQ {
|
|
|
732
732
|
}>;
|
|
733
733
|
}
|
|
734
734
|
|
|
735
|
+
type FlowControlInfo = {
|
|
736
|
+
/**
|
|
737
|
+
* The flow control key.
|
|
738
|
+
*/
|
|
739
|
+
flowControlKey: string;
|
|
740
|
+
/**
|
|
741
|
+
* The number of messages waiting in the wait list.
|
|
742
|
+
*/
|
|
743
|
+
waitListSize: number;
|
|
744
|
+
/**
|
|
745
|
+
* The maximum parallelism configured for this flow control key.
|
|
746
|
+
*/
|
|
747
|
+
parallelismMax: number;
|
|
748
|
+
/**
|
|
749
|
+
* The current number of active requests for this flow control key.
|
|
750
|
+
*/
|
|
751
|
+
parallelismCount: number;
|
|
752
|
+
/**
|
|
753
|
+
* The maximum rate configured for this flow control key.
|
|
754
|
+
*/
|
|
755
|
+
rateMax: number;
|
|
756
|
+
/**
|
|
757
|
+
* The current number of requests consumed in the current period.
|
|
758
|
+
*/
|
|
759
|
+
rateCount: number;
|
|
760
|
+
/**
|
|
761
|
+
* The rate period in seconds.
|
|
762
|
+
*/
|
|
763
|
+
ratePeriod: number;
|
|
764
|
+
/**
|
|
765
|
+
* The start time of the current rate period as a unix timestamp.
|
|
766
|
+
*/
|
|
767
|
+
ratePeriodStart: number;
|
|
768
|
+
/**
|
|
769
|
+
* Whether message delivery is paused for this flow control key.
|
|
770
|
+
*/
|
|
771
|
+
isPaused: boolean;
|
|
772
|
+
/**
|
|
773
|
+
* Whether the parallelism configuration is pinned.
|
|
774
|
+
*/
|
|
775
|
+
isPinnedParallelism: boolean;
|
|
776
|
+
/**
|
|
777
|
+
* Whether the rate configuration is pinned.
|
|
778
|
+
*/
|
|
779
|
+
isPinnedRate: boolean;
|
|
780
|
+
};
|
|
781
|
+
type GlobalParallelismInfo = {
|
|
782
|
+
/**
|
|
783
|
+
* The maximum global parallelism.
|
|
784
|
+
*/
|
|
785
|
+
parallelismMax: number;
|
|
786
|
+
/**
|
|
787
|
+
* The current number of active requests globally.
|
|
788
|
+
*/
|
|
789
|
+
parallelismCount: number;
|
|
790
|
+
};
|
|
791
|
+
type PinFlowControlOptions = {
|
|
792
|
+
/**
|
|
793
|
+
* The parallelism value to apply to the flow-control key.
|
|
794
|
+
*/
|
|
795
|
+
parallelism?: number;
|
|
796
|
+
/**
|
|
797
|
+
* The rate value to apply to the flow-control key.
|
|
798
|
+
*/
|
|
799
|
+
rate?: number;
|
|
800
|
+
/**
|
|
801
|
+
* The period value to apply to the flow-control key, in seconds.
|
|
802
|
+
*/
|
|
803
|
+
period?: number;
|
|
804
|
+
};
|
|
805
|
+
type UnpinFlowControlOptions = {
|
|
806
|
+
/**
|
|
807
|
+
* Whether to unpin the parallelism configuration.
|
|
808
|
+
*/
|
|
809
|
+
parallelism?: boolean;
|
|
810
|
+
/**
|
|
811
|
+
* Whether to unpin the rate configuration.
|
|
812
|
+
*/
|
|
813
|
+
rate?: boolean;
|
|
814
|
+
};
|
|
815
|
+
declare class FlowControlApi {
|
|
816
|
+
private readonly http;
|
|
817
|
+
constructor(http: Requester);
|
|
818
|
+
/**
|
|
819
|
+
* Get a single flow control by key.
|
|
820
|
+
*/
|
|
821
|
+
get(flowControlKey: string): Promise<FlowControlInfo>;
|
|
822
|
+
/**
|
|
823
|
+
* Get the global parallelism info.
|
|
824
|
+
*/
|
|
825
|
+
getGlobalParallelism(): Promise<GlobalParallelismInfo>;
|
|
826
|
+
/**
|
|
827
|
+
* Pause message delivery for a flow-control key.
|
|
828
|
+
*
|
|
829
|
+
* Messages already in the waitlist will remain there.
|
|
830
|
+
* New incoming messages will be added directly to the waitlist.
|
|
831
|
+
*/
|
|
832
|
+
pause(flowControlKey: string): Promise<void>;
|
|
833
|
+
/**
|
|
834
|
+
* Resume message delivery for a flow-control key.
|
|
835
|
+
*/
|
|
836
|
+
resume(flowControlKey: string): Promise<void>;
|
|
837
|
+
/**
|
|
838
|
+
* Pin a processing configuration for a flow-control key.
|
|
839
|
+
*
|
|
840
|
+
* While pinned, the system ignores configurations provided by incoming
|
|
841
|
+
* messages and uses the pinned configuration instead.
|
|
842
|
+
*/
|
|
843
|
+
pin(flowControlKey: string, options: PinFlowControlOptions): Promise<void>;
|
|
844
|
+
/**
|
|
845
|
+
* Remove the pinned configuration for a flow-control key.
|
|
846
|
+
*
|
|
847
|
+
* After unpinning, the system resumes updating the configuration
|
|
848
|
+
* based on incoming messages.
|
|
849
|
+
*/
|
|
850
|
+
unpin(flowControlKey: string, options: UnpinFlowControlOptions): Promise<void>;
|
|
851
|
+
/**
|
|
852
|
+
* Reset the rate configuration state for a flow-control key.
|
|
853
|
+
*
|
|
854
|
+
* Clears the current rate count and immediately ends the current period.
|
|
855
|
+
* The current timestamp becomes the start of the new rate period.
|
|
856
|
+
*/
|
|
857
|
+
resetRate(flowControlKey: string): Promise<void>;
|
|
858
|
+
}
|
|
859
|
+
|
|
735
860
|
declare class Chat {
|
|
736
861
|
private http;
|
|
737
862
|
private token;
|
|
@@ -2111,6 +2236,12 @@ declare class Client {
|
|
|
2111
2236
|
* Create, read or delete schedules.
|
|
2112
2237
|
*/
|
|
2113
2238
|
get schedules(): Schedules;
|
|
2239
|
+
/**
|
|
2240
|
+
* Access the flow control API.
|
|
2241
|
+
*
|
|
2242
|
+
* List, get, or reset flow controls.
|
|
2243
|
+
*/
|
|
2244
|
+
get flowControl(): FlowControlApi;
|
|
2114
2245
|
/**
|
|
2115
2246
|
* Access the workflow API.
|
|
2116
2247
|
*
|
|
@@ -2206,4 +2337,4 @@ type PublishResponse<TRequest> = TRequest extends {
|
|
|
2206
2337
|
urlGroup: string;
|
|
2207
2338
|
} ? PublishToUrlGroupsResponse : PublishToApiResponse;
|
|
2208
2339
|
|
|
2209
|
-
export { type
|
|
2340
|
+
export { type FlowControl as $, type AddEndpointsRequest as A, BaseProvider as B, type ChatRateLimit as C, UrlGroups as D, type EmailOwner as E, type FailureFunctionPayload as F, type GetLogsResponse as G, type State as H, type HTTPMethods as I, type Log as J, type Event as K, type LLMOwner as L, type Message as M, type LogPayload as N, type EventPayload as O, type ProviderInfo as P, type QueueRequest as Q, type RateLimit as R, type Step as S, type GetLogsPayload as T, type UnpinFlowControlOptions as U, type VerifyRequest as V, type GetEventsPayload as W, type WithCursor as X, type BodyInit as Y, type HeadersInit as Z, type RequestOptions as _, type ReceiverConfig as a, Chat as a0, type ChatCompletionMessage as a1, type ChatCompletion as a2, type ChatCompletionChunk as a3, type StreamEnabled as a4, type StreamDisabled as a5, type StreamParameter as a6, type OpenAIChatModel as a7, type PromptChatRequest as a8, type ChatRequest as a9, upstash as aa, openai as ab, anthropic as ac, custom as ad, type RouteFunction as ae, type WorkflowServeOptions as af, Workflow as ag, processOptions as ah, serve as ai, WorkflowContext as aj, DisabledWorkflowContext as ak, type WorkflowClient as al, type WorkflowReceiver as am, StepTypes as an, type StepType as ao, type RawStep as ap, type SyncStepFunction as aq, type AsyncStepFunction as ar, type StepFunction as as, type ParallelCallState as at, type FinishCondition as au, type RequiredExceptFields as av, type LogLevel as aw, type WorkflowLoggerOptions as ax, WorkflowLogger as ay, SignatureError as b, Receiver as c, type PublishBatchRequest as d, type PublishRequest as e, type PublishJsonRequest as f, type LogsRequest as g, type EventsRequest as h, type GetEventsResponse as i, Client as j, type PublishToApiResponse as k, type PublishToUrlResponse as l, type PublishToUrlGroupsResponse as m, type PublishResponse as n, type FlowControlInfo as o, type GlobalParallelismInfo as p, type PinFlowControlOptions as q, FlowControlApi as r, type MessagePayload as s, Messages as t, type Schedule as u, type CreateScheduleRequest as v, Schedules as w, type Endpoint as x, type RemoveEndpointsRequest as y, type UrlGroup as z };
|
|
@@ -732,6 +732,131 @@ declare class DLQ {
|
|
|
732
732
|
}>;
|
|
733
733
|
}
|
|
734
734
|
|
|
735
|
+
type FlowControlInfo = {
|
|
736
|
+
/**
|
|
737
|
+
* The flow control key.
|
|
738
|
+
*/
|
|
739
|
+
flowControlKey: string;
|
|
740
|
+
/**
|
|
741
|
+
* The number of messages waiting in the wait list.
|
|
742
|
+
*/
|
|
743
|
+
waitListSize: number;
|
|
744
|
+
/**
|
|
745
|
+
* The maximum parallelism configured for this flow control key.
|
|
746
|
+
*/
|
|
747
|
+
parallelismMax: number;
|
|
748
|
+
/**
|
|
749
|
+
* The current number of active requests for this flow control key.
|
|
750
|
+
*/
|
|
751
|
+
parallelismCount: number;
|
|
752
|
+
/**
|
|
753
|
+
* The maximum rate configured for this flow control key.
|
|
754
|
+
*/
|
|
755
|
+
rateMax: number;
|
|
756
|
+
/**
|
|
757
|
+
* The current number of requests consumed in the current period.
|
|
758
|
+
*/
|
|
759
|
+
rateCount: number;
|
|
760
|
+
/**
|
|
761
|
+
* The rate period in seconds.
|
|
762
|
+
*/
|
|
763
|
+
ratePeriod: number;
|
|
764
|
+
/**
|
|
765
|
+
* The start time of the current rate period as a unix timestamp.
|
|
766
|
+
*/
|
|
767
|
+
ratePeriodStart: number;
|
|
768
|
+
/**
|
|
769
|
+
* Whether message delivery is paused for this flow control key.
|
|
770
|
+
*/
|
|
771
|
+
isPaused: boolean;
|
|
772
|
+
/**
|
|
773
|
+
* Whether the parallelism configuration is pinned.
|
|
774
|
+
*/
|
|
775
|
+
isPinnedParallelism: boolean;
|
|
776
|
+
/**
|
|
777
|
+
* Whether the rate configuration is pinned.
|
|
778
|
+
*/
|
|
779
|
+
isPinnedRate: boolean;
|
|
780
|
+
};
|
|
781
|
+
type GlobalParallelismInfo = {
|
|
782
|
+
/**
|
|
783
|
+
* The maximum global parallelism.
|
|
784
|
+
*/
|
|
785
|
+
parallelismMax: number;
|
|
786
|
+
/**
|
|
787
|
+
* The current number of active requests globally.
|
|
788
|
+
*/
|
|
789
|
+
parallelismCount: number;
|
|
790
|
+
};
|
|
791
|
+
type PinFlowControlOptions = {
|
|
792
|
+
/**
|
|
793
|
+
* The parallelism value to apply to the flow-control key.
|
|
794
|
+
*/
|
|
795
|
+
parallelism?: number;
|
|
796
|
+
/**
|
|
797
|
+
* The rate value to apply to the flow-control key.
|
|
798
|
+
*/
|
|
799
|
+
rate?: number;
|
|
800
|
+
/**
|
|
801
|
+
* The period value to apply to the flow-control key, in seconds.
|
|
802
|
+
*/
|
|
803
|
+
period?: number;
|
|
804
|
+
};
|
|
805
|
+
type UnpinFlowControlOptions = {
|
|
806
|
+
/**
|
|
807
|
+
* Whether to unpin the parallelism configuration.
|
|
808
|
+
*/
|
|
809
|
+
parallelism?: boolean;
|
|
810
|
+
/**
|
|
811
|
+
* Whether to unpin the rate configuration.
|
|
812
|
+
*/
|
|
813
|
+
rate?: boolean;
|
|
814
|
+
};
|
|
815
|
+
declare class FlowControlApi {
|
|
816
|
+
private readonly http;
|
|
817
|
+
constructor(http: Requester);
|
|
818
|
+
/**
|
|
819
|
+
* Get a single flow control by key.
|
|
820
|
+
*/
|
|
821
|
+
get(flowControlKey: string): Promise<FlowControlInfo>;
|
|
822
|
+
/**
|
|
823
|
+
* Get the global parallelism info.
|
|
824
|
+
*/
|
|
825
|
+
getGlobalParallelism(): Promise<GlobalParallelismInfo>;
|
|
826
|
+
/**
|
|
827
|
+
* Pause message delivery for a flow-control key.
|
|
828
|
+
*
|
|
829
|
+
* Messages already in the waitlist will remain there.
|
|
830
|
+
* New incoming messages will be added directly to the waitlist.
|
|
831
|
+
*/
|
|
832
|
+
pause(flowControlKey: string): Promise<void>;
|
|
833
|
+
/**
|
|
834
|
+
* Resume message delivery for a flow-control key.
|
|
835
|
+
*/
|
|
836
|
+
resume(flowControlKey: string): Promise<void>;
|
|
837
|
+
/**
|
|
838
|
+
* Pin a processing configuration for a flow-control key.
|
|
839
|
+
*
|
|
840
|
+
* While pinned, the system ignores configurations provided by incoming
|
|
841
|
+
* messages and uses the pinned configuration instead.
|
|
842
|
+
*/
|
|
843
|
+
pin(flowControlKey: string, options: PinFlowControlOptions): Promise<void>;
|
|
844
|
+
/**
|
|
845
|
+
* Remove the pinned configuration for a flow-control key.
|
|
846
|
+
*
|
|
847
|
+
* After unpinning, the system resumes updating the configuration
|
|
848
|
+
* based on incoming messages.
|
|
849
|
+
*/
|
|
850
|
+
unpin(flowControlKey: string, options: UnpinFlowControlOptions): Promise<void>;
|
|
851
|
+
/**
|
|
852
|
+
* Reset the rate configuration state for a flow-control key.
|
|
853
|
+
*
|
|
854
|
+
* Clears the current rate count and immediately ends the current period.
|
|
855
|
+
* The current timestamp becomes the start of the new rate period.
|
|
856
|
+
*/
|
|
857
|
+
resetRate(flowControlKey: string): Promise<void>;
|
|
858
|
+
}
|
|
859
|
+
|
|
735
860
|
declare class Chat {
|
|
736
861
|
private http;
|
|
737
862
|
private token;
|
|
@@ -2111,6 +2236,12 @@ declare class Client {
|
|
|
2111
2236
|
* Create, read or delete schedules.
|
|
2112
2237
|
*/
|
|
2113
2238
|
get schedules(): Schedules;
|
|
2239
|
+
/**
|
|
2240
|
+
* Access the flow control API.
|
|
2241
|
+
*
|
|
2242
|
+
* List, get, or reset flow controls.
|
|
2243
|
+
*/
|
|
2244
|
+
get flowControl(): FlowControlApi;
|
|
2114
2245
|
/**
|
|
2115
2246
|
* Access the workflow API.
|
|
2116
2247
|
*
|
|
@@ -2206,4 +2337,4 @@ type PublishResponse<TRequest> = TRequest extends {
|
|
|
2206
2337
|
urlGroup: string;
|
|
2207
2338
|
} ? PublishToUrlGroupsResponse : PublishToApiResponse;
|
|
2208
2339
|
|
|
2209
|
-
export { type
|
|
2340
|
+
export { type FlowControl as $, type AddEndpointsRequest as A, BaseProvider as B, type ChatRateLimit as C, UrlGroups as D, type EmailOwner as E, type FailureFunctionPayload as F, type GetLogsResponse as G, type State as H, type HTTPMethods as I, type Log as J, type Event as K, type LLMOwner as L, type Message as M, type LogPayload as N, type EventPayload as O, type ProviderInfo as P, type QueueRequest as Q, type RateLimit as R, type Step as S, type GetLogsPayload as T, type UnpinFlowControlOptions as U, type VerifyRequest as V, type GetEventsPayload as W, type WithCursor as X, type BodyInit as Y, type HeadersInit as Z, type RequestOptions as _, type ReceiverConfig as a, Chat as a0, type ChatCompletionMessage as a1, type ChatCompletion as a2, type ChatCompletionChunk as a3, type StreamEnabled as a4, type StreamDisabled as a5, type StreamParameter as a6, type OpenAIChatModel as a7, type PromptChatRequest as a8, type ChatRequest as a9, upstash as aa, openai as ab, anthropic as ac, custom as ad, type RouteFunction as ae, type WorkflowServeOptions as af, Workflow as ag, processOptions as ah, serve as ai, WorkflowContext as aj, DisabledWorkflowContext as ak, type WorkflowClient as al, type WorkflowReceiver as am, StepTypes as an, type StepType as ao, type RawStep as ap, type SyncStepFunction as aq, type AsyncStepFunction as ar, type StepFunction as as, type ParallelCallState as at, type FinishCondition as au, type RequiredExceptFields as av, type LogLevel as aw, type WorkflowLoggerOptions as ax, WorkflowLogger as ay, SignatureError as b, Receiver as c, type PublishBatchRequest as d, type PublishRequest as e, type PublishJsonRequest as f, type LogsRequest as g, type EventsRequest as h, type GetEventsResponse as i, Client as j, type PublishToApiResponse as k, type PublishToUrlResponse as l, type PublishToUrlGroupsResponse as m, type PublishResponse as n, type FlowControlInfo as o, type GlobalParallelismInfo as p, type PinFlowControlOptions as q, FlowControlApi as r, type MessagePayload as s, Messages as t, type Schedule as u, type CreateScheduleRequest as v, Schedules as w, type Endpoint as x, type RemoveEndpointsRequest as y, type UrlGroup as z };
|
package/cloudflare.d.mts
CHANGED
package/cloudflare.d.ts
CHANGED
package/cloudflare.js
CHANGED
|
@@ -670,6 +670,107 @@ var DLQ = class {
|
|
|
670
670
|
}
|
|
671
671
|
};
|
|
672
672
|
|
|
673
|
+
// src/client/flow-control.ts
|
|
674
|
+
var FlowControlApi = class {
|
|
675
|
+
http;
|
|
676
|
+
constructor(http) {
|
|
677
|
+
this.http = http;
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Get a single flow control by key.
|
|
681
|
+
*/
|
|
682
|
+
async get(flowControlKey) {
|
|
683
|
+
return await this.http.request({
|
|
684
|
+
method: "GET",
|
|
685
|
+
path: ["v2", "flowControl", flowControlKey]
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Get the global parallelism info.
|
|
690
|
+
*/
|
|
691
|
+
async getGlobalParallelism() {
|
|
692
|
+
const response = await this.http.request({
|
|
693
|
+
method: "GET",
|
|
694
|
+
path: ["v2", "globalParallelism"]
|
|
695
|
+
});
|
|
696
|
+
return {
|
|
697
|
+
parallelismMax: response.parallelismMax ?? 0,
|
|
698
|
+
parallelismCount: response.parallelismCount ?? 0
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* Pause message delivery for a flow-control key.
|
|
703
|
+
*
|
|
704
|
+
* Messages already in the waitlist will remain there.
|
|
705
|
+
* New incoming messages will be added directly to the waitlist.
|
|
706
|
+
*/
|
|
707
|
+
async pause(flowControlKey) {
|
|
708
|
+
await this.http.request({
|
|
709
|
+
method: "POST",
|
|
710
|
+
path: ["v2", "flowControl", flowControlKey, "pause"],
|
|
711
|
+
parseResponseAsJson: false
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* Resume message delivery for a flow-control key.
|
|
716
|
+
*/
|
|
717
|
+
async resume(flowControlKey) {
|
|
718
|
+
await this.http.request({
|
|
719
|
+
method: "POST",
|
|
720
|
+
path: ["v2", "flowControl", flowControlKey, "resume"],
|
|
721
|
+
parseResponseAsJson: false
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* Pin a processing configuration for a flow-control key.
|
|
726
|
+
*
|
|
727
|
+
* While pinned, the system ignores configurations provided by incoming
|
|
728
|
+
* messages and uses the pinned configuration instead.
|
|
729
|
+
*/
|
|
730
|
+
async pin(flowControlKey, options) {
|
|
731
|
+
await this.http.request({
|
|
732
|
+
method: "POST",
|
|
733
|
+
path: ["v2", "flowControl", flowControlKey, "pin"],
|
|
734
|
+
query: {
|
|
735
|
+
parallelism: options.parallelism,
|
|
736
|
+
rate: options.rate,
|
|
737
|
+
period: options.period
|
|
738
|
+
},
|
|
739
|
+
parseResponseAsJson: false
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Remove the pinned configuration for a flow-control key.
|
|
744
|
+
*
|
|
745
|
+
* After unpinning, the system resumes updating the configuration
|
|
746
|
+
* based on incoming messages.
|
|
747
|
+
*/
|
|
748
|
+
async unpin(flowControlKey, options) {
|
|
749
|
+
await this.http.request({
|
|
750
|
+
method: "POST",
|
|
751
|
+
path: ["v2", "flowControl", flowControlKey, "unpin"],
|
|
752
|
+
query: {
|
|
753
|
+
parallelism: options.parallelism,
|
|
754
|
+
rate: options.rate
|
|
755
|
+
},
|
|
756
|
+
parseResponseAsJson: false
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* Reset the rate configuration state for a flow-control key.
|
|
761
|
+
*
|
|
762
|
+
* Clears the current rate count and immediately ends the current period.
|
|
763
|
+
* The current timestamp becomes the start of the new rate period.
|
|
764
|
+
*/
|
|
765
|
+
async resetRate(flowControlKey) {
|
|
766
|
+
await this.http.request({
|
|
767
|
+
method: "POST",
|
|
768
|
+
path: ["v2", "flowControl", flowControlKey, "resetRate"],
|
|
769
|
+
parseResponseAsJson: false
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
};
|
|
773
|
+
|
|
673
774
|
// src/client/http.ts
|
|
674
775
|
var HttpClient = class {
|
|
675
776
|
baseUrl;
|
|
@@ -1354,7 +1455,7 @@ var UrlGroups = class {
|
|
|
1354
1455
|
};
|
|
1355
1456
|
|
|
1356
1457
|
// version.ts
|
|
1357
|
-
var VERSION = "v2.9.
|
|
1458
|
+
var VERSION = "v2.9.1";
|
|
1358
1459
|
|
|
1359
1460
|
// src/client/client.ts
|
|
1360
1461
|
var Client = class {
|
|
@@ -1425,6 +1526,14 @@ var Client = class {
|
|
|
1425
1526
|
get schedules() {
|
|
1426
1527
|
return new Schedules(this.http);
|
|
1427
1528
|
}
|
|
1529
|
+
/**
|
|
1530
|
+
* Access the flow control API.
|
|
1531
|
+
*
|
|
1532
|
+
* List, get, or reset flow controls.
|
|
1533
|
+
*/
|
|
1534
|
+
get flowControl() {
|
|
1535
|
+
return new FlowControlApi(this.http);
|
|
1536
|
+
}
|
|
1428
1537
|
/**
|
|
1429
1538
|
* Access the workflow API.
|
|
1430
1539
|
*
|
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 { ae as RouteFunction, af as WorkflowServeOptions } from './client-jh_SomWB.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 { ae as RouteFunction, af as WorkflowServeOptions } from './client-jh_SomWB.js';
|
|
4
4
|
import 'neverthrow';
|
|
5
5
|
|
|
6
6
|
type VerifySignatureConfig = {
|