@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/h3.js CHANGED
@@ -994,6 +994,107 @@ var DLQ = class {
994
994
  }
995
995
  };
996
996
 
997
+ // src/client/flow-control.ts
998
+ var FlowControlApi = class {
999
+ http;
1000
+ constructor(http) {
1001
+ this.http = http;
1002
+ }
1003
+ /**
1004
+ * Get a single flow control by key.
1005
+ */
1006
+ async get(flowControlKey) {
1007
+ return await this.http.request({
1008
+ method: "GET",
1009
+ path: ["v2", "flowControl", flowControlKey]
1010
+ });
1011
+ }
1012
+ /**
1013
+ * Get the global parallelism info.
1014
+ */
1015
+ async getGlobalParallelism() {
1016
+ const response = await this.http.request({
1017
+ method: "GET",
1018
+ path: ["v2", "globalParallelism"]
1019
+ });
1020
+ return {
1021
+ parallelismMax: response.parallelismMax ?? 0,
1022
+ parallelismCount: response.parallelismCount ?? 0
1023
+ };
1024
+ }
1025
+ /**
1026
+ * Pause message delivery for a flow-control key.
1027
+ *
1028
+ * Messages already in the waitlist will remain there.
1029
+ * New incoming messages will be added directly to the waitlist.
1030
+ */
1031
+ async pause(flowControlKey) {
1032
+ await this.http.request({
1033
+ method: "POST",
1034
+ path: ["v2", "flowControl", flowControlKey, "pause"],
1035
+ parseResponseAsJson: false
1036
+ });
1037
+ }
1038
+ /**
1039
+ * Resume message delivery for a flow-control key.
1040
+ */
1041
+ async resume(flowControlKey) {
1042
+ await this.http.request({
1043
+ method: "POST",
1044
+ path: ["v2", "flowControl", flowControlKey, "resume"],
1045
+ parseResponseAsJson: false
1046
+ });
1047
+ }
1048
+ /**
1049
+ * Pin a processing configuration for a flow-control key.
1050
+ *
1051
+ * While pinned, the system ignores configurations provided by incoming
1052
+ * messages and uses the pinned configuration instead.
1053
+ */
1054
+ async pin(flowControlKey, options) {
1055
+ await this.http.request({
1056
+ method: "POST",
1057
+ path: ["v2", "flowControl", flowControlKey, "pin"],
1058
+ query: {
1059
+ parallelism: options.parallelism,
1060
+ rate: options.rate,
1061
+ period: options.period
1062
+ },
1063
+ parseResponseAsJson: false
1064
+ });
1065
+ }
1066
+ /**
1067
+ * Remove the pinned configuration for a flow-control key.
1068
+ *
1069
+ * After unpinning, the system resumes updating the configuration
1070
+ * based on incoming messages.
1071
+ */
1072
+ async unpin(flowControlKey, options) {
1073
+ await this.http.request({
1074
+ method: "POST",
1075
+ path: ["v2", "flowControl", flowControlKey, "unpin"],
1076
+ query: {
1077
+ parallelism: options.parallelism,
1078
+ rate: options.rate
1079
+ },
1080
+ parseResponseAsJson: false
1081
+ });
1082
+ }
1083
+ /**
1084
+ * Reset the rate configuration state for a flow-control key.
1085
+ *
1086
+ * Clears the current rate count and immediately ends the current period.
1087
+ * The current timestamp becomes the start of the new rate period.
1088
+ */
1089
+ async resetRate(flowControlKey) {
1090
+ await this.http.request({
1091
+ method: "POST",
1092
+ path: ["v2", "flowControl", flowControlKey, "resetRate"],
1093
+ parseResponseAsJson: false
1094
+ });
1095
+ }
1096
+ };
1097
+
997
1098
  // src/client/http.ts
998
1099
  var HttpClient = class {
999
1100
  baseUrl;
@@ -3064,7 +3165,7 @@ var Workflow = class {
3064
3165
  };
3065
3166
 
3066
3167
  // version.ts
3067
- var VERSION = "v2.9.0";
3168
+ var VERSION = "v2.9.1";
3068
3169
 
3069
3170
  // src/client/client.ts
3070
3171
  var Client = class {
@@ -3135,6 +3236,14 @@ var Client = class {
3135
3236
  get schedules() {
3136
3237
  return new Schedules(this.http);
3137
3238
  }
3239
+ /**
3240
+ * Access the flow control API.
3241
+ *
3242
+ * List, get, or reset flow controls.
3243
+ */
3244
+ get flowControl() {
3245
+ return new FlowControlApi(this.http);
3246
+ }
3138
3247
  /**
3139
3248
  * Access the workflow API.
3140
3249
  *
package/h3.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  serve,
3
3
  verifySignatureH3
4
- } from "./chunk-H5OAU75L.mjs";
5
- import "./chunk-M7SEEFAC.mjs";
6
- import "./chunk-QYBCXZKB.mjs";
4
+ } from "./chunk-JO26IBSH.mjs";
5
+ import "./chunk-KDHOB7B5.mjs";
6
+ import "./chunk-DT2X63FB.mjs";
7
7
  export {
8
8
  serve,
9
9
  verifySignatureH3
package/hono.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Context } from 'hono';
2
- import { a9 as RouteFunction, aa as WorkflowServeOptions } from './client-BVG9vt90.mjs';
2
+ import { ae as RouteFunction, af as WorkflowServeOptions } from './client-jh_SomWB.mjs';
3
3
  import 'neverthrow';
4
4
 
5
5
  type WorkflowBindings = {
package/hono.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Context } from 'hono';
2
- import { a9 as RouteFunction, aa as WorkflowServeOptions } from './client-BVG9vt90.js';
2
+ import { ae as RouteFunction, af as WorkflowServeOptions } from './client-jh_SomWB.js';
3
3
  import 'neverthrow';
4
4
 
5
5
  type WorkflowBindings = {
package/hono.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.0";
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/hono.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  serve
3
- } from "./chunk-QYBCXZKB.mjs";
3
+ } from "./chunk-DT2X63FB.mjs";
4
4
 
5
5
  // platforms/hono.ts
6
6
  var serve2 = (routeFunction, options) => {
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-BVG9vt90.mjs';
2
- export { A as AddEndpointsRequest, K as BodyInit, X as Chat, Z as ChatCompletion, _ as ChatCompletionChunk, Y as ChatCompletionMessage, a4 as ChatRequest, j as Client, r as CreateScheduleRequest, t as Endpoint, y as Event, D as EventPayload, h as EventsRequest, T as FlowControl, J as GetEventsPayload, i as GetEventsResponse, I as GetLogsPayload, G as GetLogsResponse, H as HTTPMethods, N as HeadersInit, x as Log, z as LogPayload, g as LogsRequest, M as Message, o as MessagePayload, p as Messages, a2 as OpenAIChatModel, a3 as PromptChatRequest, d as PublishBatchRequest, f as PublishJsonRequest, e as PublishRequest, n as PublishResponse, k as PublishToApiResponse, m as PublishToUrlGroupsResponse, l as PublishToUrlResponse, Q as QueueRequest, c as Receiver, a as ReceiverConfig, u as RemoveEndpointsRequest, O as RequestOptions, q as Schedule, s as Schedules, b as SignatureError, w as State, a0 as StreamDisabled, $ as StreamEnabled, a1 as StreamParameter, U as UrlGroup, v as UrlGroups, V as VerifyRequest, W as WithCursor, a7 as anthropic, a8 as custom, a6 as openai, a5 as upstash } from './client-BVG9vt90.mjs';
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-jh_SomWB.mjs';
2
+ export { A as AddEndpointsRequest, Y as BodyInit, a0 as Chat, a2 as ChatCompletion, a3 as ChatCompletionChunk, a1 as ChatCompletionMessage, a9 as ChatRequest, j as Client, v as CreateScheduleRequest, x as Endpoint, K as Event, O as EventPayload, h as EventsRequest, $ as FlowControl, r as FlowControlApi, o as FlowControlInfo, W as GetEventsPayload, i as GetEventsResponse, T as GetLogsPayload, G as GetLogsResponse, p as GlobalParallelismInfo, I as HTTPMethods, Z as HeadersInit, J as Log, N as LogPayload, g as LogsRequest, M as Message, s as MessagePayload, t as Messages, a7 as OpenAIChatModel, q as PinFlowControlOptions, a8 as PromptChatRequest, d as PublishBatchRequest, f as PublishJsonRequest, e as PublishRequest, n as PublishResponse, k as PublishToApiResponse, m as PublishToUrlGroupsResponse, l as PublishToUrlResponse, Q as QueueRequest, c as Receiver, a as ReceiverConfig, y as RemoveEndpointsRequest, _ as RequestOptions, u as Schedule, w as Schedules, b as SignatureError, H as State, a5 as StreamDisabled, a4 as StreamEnabled, a6 as StreamParameter, U as UnpinFlowControlOptions, z as UrlGroup, D as UrlGroups, V as VerifyRequest, X as WithCursor, ac as anthropic, ad as custom, ab as openai, aa as upstash } from './client-jh_SomWB.mjs';
3
3
  import 'neverthrow';
4
4
 
5
5
  /**
package/index.d.ts 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-BVG9vt90.js';
2
- export { A as AddEndpointsRequest, K as BodyInit, X as Chat, Z as ChatCompletion, _ as ChatCompletionChunk, Y as ChatCompletionMessage, a4 as ChatRequest, j as Client, r as CreateScheduleRequest, t as Endpoint, y as Event, D as EventPayload, h as EventsRequest, T as FlowControl, J as GetEventsPayload, i as GetEventsResponse, I as GetLogsPayload, G as GetLogsResponse, H as HTTPMethods, N as HeadersInit, x as Log, z as LogPayload, g as LogsRequest, M as Message, o as MessagePayload, p as Messages, a2 as OpenAIChatModel, a3 as PromptChatRequest, d as PublishBatchRequest, f as PublishJsonRequest, e as PublishRequest, n as PublishResponse, k as PublishToApiResponse, m as PublishToUrlGroupsResponse, l as PublishToUrlResponse, Q as QueueRequest, c as Receiver, a as ReceiverConfig, u as RemoveEndpointsRequest, O as RequestOptions, q as Schedule, s as Schedules, b as SignatureError, w as State, a0 as StreamDisabled, $ as StreamEnabled, a1 as StreamParameter, U as UrlGroup, v as UrlGroups, V as VerifyRequest, W as WithCursor, a7 as anthropic, a8 as custom, a6 as openai, a5 as upstash } from './client-BVG9vt90.js';
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-jh_SomWB.js';
2
+ export { A as AddEndpointsRequest, Y as BodyInit, a0 as Chat, a2 as ChatCompletion, a3 as ChatCompletionChunk, a1 as ChatCompletionMessage, a9 as ChatRequest, j as Client, v as CreateScheduleRequest, x as Endpoint, K as Event, O as EventPayload, h as EventsRequest, $ as FlowControl, r as FlowControlApi, o as FlowControlInfo, W as GetEventsPayload, i as GetEventsResponse, T as GetLogsPayload, G as GetLogsResponse, p as GlobalParallelismInfo, I as HTTPMethods, Z as HeadersInit, J as Log, N as LogPayload, g as LogsRequest, M as Message, s as MessagePayload, t as Messages, a7 as OpenAIChatModel, q as PinFlowControlOptions, a8 as PromptChatRequest, d as PublishBatchRequest, f as PublishJsonRequest, e as PublishRequest, n as PublishResponse, k as PublishToApiResponse, m as PublishToUrlGroupsResponse, l as PublishToUrlResponse, Q as QueueRequest, c as Receiver, a as ReceiverConfig, y as RemoveEndpointsRequest, _ as RequestOptions, u as Schedule, w as Schedules, b as SignatureError, H as State, a5 as StreamDisabled, a4 as StreamEnabled, a6 as StreamParameter, U as UnpinFlowControlOptions, z as UrlGroup, D as UrlGroups, V as VerifyRequest, X as WithCursor, ac as anthropic, ad as custom, ab as openai, aa as upstash } from './client-jh_SomWB.js';
3
3
  import 'neverthrow';
4
4
 
5
5
  /**
package/index.js CHANGED
@@ -32,6 +32,7 @@ var src_exports = {};
32
32
  __export(src_exports, {
33
33
  Chat: () => Chat,
34
34
  Client: () => Client,
35
+ FlowControlApi: () => FlowControlApi,
35
36
  Messages: () => Messages,
36
37
  QStashWorkflowAbort: () => QStashWorkflowAbort,
37
38
  QStashWorkflowError: () => QStashWorkflowError,
@@ -701,6 +702,107 @@ var DLQ = class {
701
702
  }
702
703
  };
703
704
 
705
+ // src/client/flow-control.ts
706
+ var FlowControlApi = class {
707
+ http;
708
+ constructor(http) {
709
+ this.http = http;
710
+ }
711
+ /**
712
+ * Get a single flow control by key.
713
+ */
714
+ async get(flowControlKey) {
715
+ return await this.http.request({
716
+ method: "GET",
717
+ path: ["v2", "flowControl", flowControlKey]
718
+ });
719
+ }
720
+ /**
721
+ * Get the global parallelism info.
722
+ */
723
+ async getGlobalParallelism() {
724
+ const response = await this.http.request({
725
+ method: "GET",
726
+ path: ["v2", "globalParallelism"]
727
+ });
728
+ return {
729
+ parallelismMax: response.parallelismMax ?? 0,
730
+ parallelismCount: response.parallelismCount ?? 0
731
+ };
732
+ }
733
+ /**
734
+ * Pause message delivery for a flow-control key.
735
+ *
736
+ * Messages already in the waitlist will remain there.
737
+ * New incoming messages will be added directly to the waitlist.
738
+ */
739
+ async pause(flowControlKey) {
740
+ await this.http.request({
741
+ method: "POST",
742
+ path: ["v2", "flowControl", flowControlKey, "pause"],
743
+ parseResponseAsJson: false
744
+ });
745
+ }
746
+ /**
747
+ * Resume message delivery for a flow-control key.
748
+ */
749
+ async resume(flowControlKey) {
750
+ await this.http.request({
751
+ method: "POST",
752
+ path: ["v2", "flowControl", flowControlKey, "resume"],
753
+ parseResponseAsJson: false
754
+ });
755
+ }
756
+ /**
757
+ * Pin a processing configuration for a flow-control key.
758
+ *
759
+ * While pinned, the system ignores configurations provided by incoming
760
+ * messages and uses the pinned configuration instead.
761
+ */
762
+ async pin(flowControlKey, options) {
763
+ await this.http.request({
764
+ method: "POST",
765
+ path: ["v2", "flowControl", flowControlKey, "pin"],
766
+ query: {
767
+ parallelism: options.parallelism,
768
+ rate: options.rate,
769
+ period: options.period
770
+ },
771
+ parseResponseAsJson: false
772
+ });
773
+ }
774
+ /**
775
+ * Remove the pinned configuration for a flow-control key.
776
+ *
777
+ * After unpinning, the system resumes updating the configuration
778
+ * based on incoming messages.
779
+ */
780
+ async unpin(flowControlKey, options) {
781
+ await this.http.request({
782
+ method: "POST",
783
+ path: ["v2", "flowControl", flowControlKey, "unpin"],
784
+ query: {
785
+ parallelism: options.parallelism,
786
+ rate: options.rate
787
+ },
788
+ parseResponseAsJson: false
789
+ });
790
+ }
791
+ /**
792
+ * Reset the rate configuration state for a flow-control key.
793
+ *
794
+ * Clears the current rate count and immediately ends the current period.
795
+ * The current timestamp becomes the start of the new rate period.
796
+ */
797
+ async resetRate(flowControlKey) {
798
+ await this.http.request({
799
+ method: "POST",
800
+ path: ["v2", "flowControl", flowControlKey, "resetRate"],
801
+ parseResponseAsJson: false
802
+ });
803
+ }
804
+ };
805
+
704
806
  // src/client/http.ts
705
807
  var HttpClient = class {
706
808
  baseUrl;
@@ -1416,7 +1518,7 @@ var Workflow = class {
1416
1518
  };
1417
1519
 
1418
1520
  // version.ts
1419
- var VERSION = "v2.9.0";
1521
+ var VERSION = "v2.9.1";
1420
1522
 
1421
1523
  // src/client/client.ts
1422
1524
  var Client = class {
@@ -1487,6 +1589,14 @@ var Client = class {
1487
1589
  get schedules() {
1488
1590
  return new Schedules(this.http);
1489
1591
  }
1592
+ /**
1593
+ * Access the flow control API.
1594
+ *
1595
+ * List, get, or reset flow controls.
1596
+ */
1597
+ get flowControl() {
1598
+ return new FlowControlApi(this.http);
1599
+ }
1490
1600
  /**
1491
1601
  * Access the workflow API.
1492
1602
  *
@@ -1702,6 +1812,7 @@ var resend = ({
1702
1812
  0 && (module.exports = {
1703
1813
  Chat,
1704
1814
  Client,
1815
+ FlowControlApi,
1705
1816
  Messages,
1706
1817
  QStashWorkflowAbort,
1707
1818
  QStashWorkflowError,
package/index.mjs CHANGED
@@ -1,9 +1,10 @@
1
1
  import {
2
2
  resend
3
- } from "./chunk-M7SEEFAC.mjs";
3
+ } from "./chunk-KDHOB7B5.mjs";
4
4
  import {
5
5
  Chat,
6
6
  Client,
7
+ FlowControlApi,
7
8
  Messages,
8
9
  QStashWorkflowAbort,
9
10
  QStashWorkflowError,
@@ -22,10 +23,11 @@ import {
22
23
  openai,
23
24
  setupAnalytics,
24
25
  upstash
25
- } from "./chunk-QYBCXZKB.mjs";
26
+ } from "./chunk-DT2X63FB.mjs";
26
27
  export {
27
28
  Chat,
28
29
  Client,
30
+ FlowControlApi,
29
31
  Messages,
30
32
  QStashWorkflowAbort,
31
33
  QStashWorkflowError,
package/nextjs.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { NextApiHandler } from 'next';
2
2
  import { NextRequest, NextFetchEvent } from 'next/server';
3
- import { a9 as RouteFunction, aa as WorkflowServeOptions } from './client-BVG9vt90.mjs';
3
+ import { ae as RouteFunction, af as WorkflowServeOptions } from './client-jh_SomWB.mjs';
4
4
  import 'neverthrow';
5
5
 
6
6
  type VerifySignatureConfig = {
package/nextjs.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { NextApiHandler } from 'next';
2
2
  import { NextRequest, NextFetchEvent } from 'next/server';
3
- import { a9 as RouteFunction, aa as WorkflowServeOptions } from './client-BVG9vt90.js';
3
+ import { ae as RouteFunction, af as WorkflowServeOptions } from './client-jh_SomWB.js';
4
4
  import 'neverthrow';
5
5
 
6
6
  type VerifySignatureConfig = {
package/nextjs.js CHANGED
@@ -674,6 +674,107 @@ var DLQ = class {
674
674
  }
675
675
  };
676
676
 
677
+ // src/client/flow-control.ts
678
+ var FlowControlApi = class {
679
+ http;
680
+ constructor(http) {
681
+ this.http = http;
682
+ }
683
+ /**
684
+ * Get a single flow control by key.
685
+ */
686
+ async get(flowControlKey) {
687
+ return await this.http.request({
688
+ method: "GET",
689
+ path: ["v2", "flowControl", flowControlKey]
690
+ });
691
+ }
692
+ /**
693
+ * Get the global parallelism info.
694
+ */
695
+ async getGlobalParallelism() {
696
+ const response = await this.http.request({
697
+ method: "GET",
698
+ path: ["v2", "globalParallelism"]
699
+ });
700
+ return {
701
+ parallelismMax: response.parallelismMax ?? 0,
702
+ parallelismCount: response.parallelismCount ?? 0
703
+ };
704
+ }
705
+ /**
706
+ * Pause message delivery for a flow-control key.
707
+ *
708
+ * Messages already in the waitlist will remain there.
709
+ * New incoming messages will be added directly to the waitlist.
710
+ */
711
+ async pause(flowControlKey) {
712
+ await this.http.request({
713
+ method: "POST",
714
+ path: ["v2", "flowControl", flowControlKey, "pause"],
715
+ parseResponseAsJson: false
716
+ });
717
+ }
718
+ /**
719
+ * Resume message delivery for a flow-control key.
720
+ */
721
+ async resume(flowControlKey) {
722
+ await this.http.request({
723
+ method: "POST",
724
+ path: ["v2", "flowControl", flowControlKey, "resume"],
725
+ parseResponseAsJson: false
726
+ });
727
+ }
728
+ /**
729
+ * Pin a processing configuration for a flow-control key.
730
+ *
731
+ * While pinned, the system ignores configurations provided by incoming
732
+ * messages and uses the pinned configuration instead.
733
+ */
734
+ async pin(flowControlKey, options) {
735
+ await this.http.request({
736
+ method: "POST",
737
+ path: ["v2", "flowControl", flowControlKey, "pin"],
738
+ query: {
739
+ parallelism: options.parallelism,
740
+ rate: options.rate,
741
+ period: options.period
742
+ },
743
+ parseResponseAsJson: false
744
+ });
745
+ }
746
+ /**
747
+ * Remove the pinned configuration for a flow-control key.
748
+ *
749
+ * After unpinning, the system resumes updating the configuration
750
+ * based on incoming messages.
751
+ */
752
+ async unpin(flowControlKey, options) {
753
+ await this.http.request({
754
+ method: "POST",
755
+ path: ["v2", "flowControl", flowControlKey, "unpin"],
756
+ query: {
757
+ parallelism: options.parallelism,
758
+ rate: options.rate
759
+ },
760
+ parseResponseAsJson: false
761
+ });
762
+ }
763
+ /**
764
+ * Reset the rate configuration state for a flow-control key.
765
+ *
766
+ * Clears the current rate count and immediately ends the current period.
767
+ * The current timestamp becomes the start of the new rate period.
768
+ */
769
+ async resetRate(flowControlKey) {
770
+ await this.http.request({
771
+ method: "POST",
772
+ path: ["v2", "flowControl", flowControlKey, "resetRate"],
773
+ parseResponseAsJson: false
774
+ });
775
+ }
776
+ };
777
+
677
778
  // src/client/http.ts
678
779
  var HttpClient = class {
679
780
  baseUrl;
@@ -1358,7 +1459,7 @@ var UrlGroups = class {
1358
1459
  };
1359
1460
 
1360
1461
  // version.ts
1361
- var VERSION = "v2.9.0";
1462
+ var VERSION = "v2.9.1";
1362
1463
 
1363
1464
  // src/client/client.ts
1364
1465
  var Client = class {
@@ -1429,6 +1530,14 @@ var Client = class {
1429
1530
  get schedules() {
1430
1531
  return new Schedules(this.http);
1431
1532
  }
1533
+ /**
1534
+ * Access the flow control API.
1535
+ *
1536
+ * List, get, or reset flow controls.
1537
+ */
1538
+ get flowControl() {
1539
+ return new FlowControlApi(this.http);
1540
+ }
1432
1541
  /**
1433
1542
  * Access the workflow API.
1434
1543
  *
package/nextjs.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Receiver,
3
3
  serve
4
- } from "./chunk-QYBCXZKB.mjs";
4
+ } from "./chunk-DT2X63FB.mjs";
5
5
 
6
6
  // platforms/nextjs.ts
7
7
  var BAD_REQUEST = 400;
package/nuxt.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  verifySignatureH3
3
- } from "./chunk-H5OAU75L.mjs";
4
- import "./chunk-M7SEEFAC.mjs";
5
- import "./chunk-QYBCXZKB.mjs";
3
+ } from "./chunk-JO26IBSH.mjs";
4
+ import "./chunk-KDHOB7B5.mjs";
5
+ import "./chunk-DT2X63FB.mjs";
6
6
 
7
7
  // platforms/nuxt.ts
8
8
  var verifySignatureNuxt = verifySignatureH3;