@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/package.json CHANGED
@@ -1 +1 @@
1
- {"version":"v2.9.0","name":"@upstash/qstash","description":"Official Typescript client for QStash","author":"Andreas Thomas <dev@chronark.com>","license":"MIT","homepage":"https://github.com/upstash/sdk-qstash-ts#readme","repository":{"type":"git","url":"git+https://github.com/upstash/sdk-qstash-ts.git"},"bugs":{"url":"https://github.com/upstash/sdk-qstash-ts/issues"},"main":"./index.js","module":"./index.mjs","types":"./index.d.ts","files":["./*"],"exports":{".":{"import":"./index.mjs","require":"./index.js"},"./dist/nextjs":{"import":"./nextjs.mjs","require":"./nextjs.js"},"./nextjs":{"import":"./nextjs.mjs","require":"./nextjs.js"},"./h3":{"import":"./h3.mjs","require":"./h3.js"},"./nuxt":{"import":"./nuxt.mjs","require":"./nuxt.js"},"./svelte":{"import":"./svelte.mjs","require":"./svelte.js"},"./solidjs":{"import":"./solidjs.mjs","require":"./solidjs.js"},"./workflow":{"import":"./workflow.mjs","require":"./workflow.js"},"./hono":{"import":"./hono.mjs","require":"./hono.js"},"./cloudflare":{"import":"./cloudflare.mjs","require":"./cloudflare.js"}},"keywords":["qstash","queue","events","serverless","upstash"],"scripts":{"build":"tsup && cp README.md ./dist/ && cp package.json ./dist/ && cp LICENSE ./dist/","test":"bun test src","fmt":"prettier --write .","lint":"tsc && eslint \"{src,platforms}/**/*.{js,ts,tsx}\" --quiet --fix","check-exports":"bun run build && cd dist && attw -P"},"devDependencies":{"@commitlint/cli":"^19.2.2","@commitlint/config-conventional":"^19.2.2","@eslint/eslintrc":"^3.1.0","@eslint/js":"^9.10.0","@solidjs/start":"^1.0.6","@sveltejs/kit":"^2.5.18","@types/bun":"^1.1.1","@types/crypto-js":"^4.2.0","@typescript-eslint/eslint-plugin":"^8.4.0","@typescript-eslint/parser":"^8.4.0","bun-types":"^1.1.7","eslint":"^9.10.0","eslint-plugin-unicorn":"^51.0.1","h3":"^1.12.0","hono":"^4.5.8","husky":"^9.0.10","next":"^14.0.2","prettier":"^3.2.5","tsup":"latest","typescript":"^5.4.5","undici-types":"^6.16.0","vitest":"latest"},"dependencies":{"crypto-js":">=4.2.0","jose":"^5.2.3","neverthrow":"^7.0.1"}}
1
+ {"version":"v2.9.1","name":"@upstash/qstash","description":"Official Typescript client for QStash","author":"Andreas Thomas <dev@chronark.com>","license":"MIT","homepage":"https://github.com/upstash/qstash-js#readme","repository":{"type":"git","url":"git+https://github.com/upstash/qstash-js.git"},"bugs":{"url":"https://github.com/upstash/qstash-js/issues"},"main":"./index.js","module":"./index.mjs","types":"./index.d.ts","files":["./*"],"exports":{".":{"import":"./index.mjs","require":"./index.js"},"./dist/nextjs":{"import":"./nextjs.mjs","require":"./nextjs.js"},"./nextjs":{"import":"./nextjs.mjs","require":"./nextjs.js"},"./h3":{"import":"./h3.mjs","require":"./h3.js"},"./nuxt":{"import":"./nuxt.mjs","require":"./nuxt.js"},"./svelte":{"import":"./svelte.mjs","require":"./svelte.js"},"./solidjs":{"import":"./solidjs.mjs","require":"./solidjs.js"},"./workflow":{"import":"./workflow.mjs","require":"./workflow.js"},"./hono":{"import":"./hono.mjs","require":"./hono.js"},"./cloudflare":{"import":"./cloudflare.mjs","require":"./cloudflare.js"}},"keywords":["qstash","queue","events","serverless","upstash"],"scripts":{"build":"tsup && cp README.md ./dist/ && cp package.json ./dist/ && cp LICENSE ./dist/","test":"bun test src","fmt":"prettier --write .","lint":"tsc && eslint \"{src,platforms}/**/*.{js,ts,tsx}\" --quiet --fix","check-exports":"bun run build && cd dist && attw -P"},"devDependencies":{"@commitlint/cli":"^19.2.2","@commitlint/config-conventional":"^19.2.2","@eslint/eslintrc":"^3.1.0","@eslint/js":"^9.10.0","@solidjs/start":"^1.0.6","@sveltejs/kit":"^2.5.18","@types/bun":"^1.1.1","@types/crypto-js":"^4.2.0","@typescript-eslint/eslint-plugin":"^8.4.0","@typescript-eslint/parser":"^8.4.0","bun-types":"^1.1.7","eslint":"^9.10.0","eslint-plugin-unicorn":"^51.0.1","h3":"^1.12.0","hono":"^4.5.8","husky":"^9.0.10","next":"^14.0.2","prettier":"^3.2.5","tsup":"latest","typescript":"^5.4.5","undici-types":"^6.16.0","vitest":"latest"},"dependencies":{"crypto-js":">=4.2.0","jose":"^5.2.3","neverthrow":"^7.0.1"}}
package/solidjs.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { APIHandler, APIEvent } from '@solidjs/start/server';
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 VerifySignatureConfig = {
package/solidjs.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { APIHandler, APIEvent } from '@solidjs/start/server';
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 VerifySignatureConfig = {
package/solidjs.js CHANGED
@@ -671,6 +671,107 @@ var DLQ = class {
671
671
  }
672
672
  };
673
673
 
674
+ // src/client/flow-control.ts
675
+ var FlowControlApi = class {
676
+ http;
677
+ constructor(http) {
678
+ this.http = http;
679
+ }
680
+ /**
681
+ * Get a single flow control by key.
682
+ */
683
+ async get(flowControlKey) {
684
+ return await this.http.request({
685
+ method: "GET",
686
+ path: ["v2", "flowControl", flowControlKey]
687
+ });
688
+ }
689
+ /**
690
+ * Get the global parallelism info.
691
+ */
692
+ async getGlobalParallelism() {
693
+ const response = await this.http.request({
694
+ method: "GET",
695
+ path: ["v2", "globalParallelism"]
696
+ });
697
+ return {
698
+ parallelismMax: response.parallelismMax ?? 0,
699
+ parallelismCount: response.parallelismCount ?? 0
700
+ };
701
+ }
702
+ /**
703
+ * Pause message delivery for a flow-control key.
704
+ *
705
+ * Messages already in the waitlist will remain there.
706
+ * New incoming messages will be added directly to the waitlist.
707
+ */
708
+ async pause(flowControlKey) {
709
+ await this.http.request({
710
+ method: "POST",
711
+ path: ["v2", "flowControl", flowControlKey, "pause"],
712
+ parseResponseAsJson: false
713
+ });
714
+ }
715
+ /**
716
+ * Resume message delivery for a flow-control key.
717
+ */
718
+ async resume(flowControlKey) {
719
+ await this.http.request({
720
+ method: "POST",
721
+ path: ["v2", "flowControl", flowControlKey, "resume"],
722
+ parseResponseAsJson: false
723
+ });
724
+ }
725
+ /**
726
+ * Pin a processing configuration for a flow-control key.
727
+ *
728
+ * While pinned, the system ignores configurations provided by incoming
729
+ * messages and uses the pinned configuration instead.
730
+ */
731
+ async pin(flowControlKey, options) {
732
+ await this.http.request({
733
+ method: "POST",
734
+ path: ["v2", "flowControl", flowControlKey, "pin"],
735
+ query: {
736
+ parallelism: options.parallelism,
737
+ rate: options.rate,
738
+ period: options.period
739
+ },
740
+ parseResponseAsJson: false
741
+ });
742
+ }
743
+ /**
744
+ * Remove the pinned configuration for a flow-control key.
745
+ *
746
+ * After unpinning, the system resumes updating the configuration
747
+ * based on incoming messages.
748
+ */
749
+ async unpin(flowControlKey, options) {
750
+ await this.http.request({
751
+ method: "POST",
752
+ path: ["v2", "flowControl", flowControlKey, "unpin"],
753
+ query: {
754
+ parallelism: options.parallelism,
755
+ rate: options.rate
756
+ },
757
+ parseResponseAsJson: false
758
+ });
759
+ }
760
+ /**
761
+ * Reset the rate configuration state for a flow-control key.
762
+ *
763
+ * Clears the current rate count and immediately ends the current period.
764
+ * The current timestamp becomes the start of the new rate period.
765
+ */
766
+ async resetRate(flowControlKey) {
767
+ await this.http.request({
768
+ method: "POST",
769
+ path: ["v2", "flowControl", flowControlKey, "resetRate"],
770
+ parseResponseAsJson: false
771
+ });
772
+ }
773
+ };
774
+
674
775
  // src/client/http.ts
675
776
  var HttpClient = class {
676
777
  baseUrl;
@@ -2741,7 +2842,7 @@ var Workflow = class {
2741
2842
  };
2742
2843
 
2743
2844
  // version.ts
2744
- var VERSION = "v2.9.0";
2845
+ var VERSION = "v2.9.1";
2745
2846
 
2746
2847
  // src/client/client.ts
2747
2848
  var Client = class {
@@ -2812,6 +2913,14 @@ var Client = class {
2812
2913
  get schedules() {
2813
2914
  return new Schedules(this.http);
2814
2915
  }
2916
+ /**
2917
+ * Access the flow control API.
2918
+ *
2919
+ * List, get, or reset flow controls.
2920
+ */
2921
+ get flowControl() {
2922
+ return new FlowControlApi(this.http);
2923
+ }
2815
2924
  /**
2816
2925
  * Access the workflow API.
2817
2926
  *
package/solidjs.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import "./chunk-M7SEEFAC.mjs";
1
+ import "./chunk-KDHOB7B5.mjs";
2
2
  import {
3
3
  Receiver,
4
4
  serve
5
- } from "./chunk-QYBCXZKB.mjs";
5
+ } from "./chunk-DT2X63FB.mjs";
6
6
 
7
7
  // platforms/solidjs.ts
8
8
  var verifySignatureSolidjs = (handler, config) => {
package/svelte.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { RequestHandler } from '@sveltejs/kit';
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 VerifySignatureConfig = {
package/svelte.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { RequestHandler } from '@sveltejs/kit';
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 VerifySignatureConfig = {
package/svelte.js CHANGED
@@ -671,6 +671,107 @@ var DLQ = class {
671
671
  }
672
672
  };
673
673
 
674
+ // src/client/flow-control.ts
675
+ var FlowControlApi = class {
676
+ http;
677
+ constructor(http) {
678
+ this.http = http;
679
+ }
680
+ /**
681
+ * Get a single flow control by key.
682
+ */
683
+ async get(flowControlKey) {
684
+ return await this.http.request({
685
+ method: "GET",
686
+ path: ["v2", "flowControl", flowControlKey]
687
+ });
688
+ }
689
+ /**
690
+ * Get the global parallelism info.
691
+ */
692
+ async getGlobalParallelism() {
693
+ const response = await this.http.request({
694
+ method: "GET",
695
+ path: ["v2", "globalParallelism"]
696
+ });
697
+ return {
698
+ parallelismMax: response.parallelismMax ?? 0,
699
+ parallelismCount: response.parallelismCount ?? 0
700
+ };
701
+ }
702
+ /**
703
+ * Pause message delivery for a flow-control key.
704
+ *
705
+ * Messages already in the waitlist will remain there.
706
+ * New incoming messages will be added directly to the waitlist.
707
+ */
708
+ async pause(flowControlKey) {
709
+ await this.http.request({
710
+ method: "POST",
711
+ path: ["v2", "flowControl", flowControlKey, "pause"],
712
+ parseResponseAsJson: false
713
+ });
714
+ }
715
+ /**
716
+ * Resume message delivery for a flow-control key.
717
+ */
718
+ async resume(flowControlKey) {
719
+ await this.http.request({
720
+ method: "POST",
721
+ path: ["v2", "flowControl", flowControlKey, "resume"],
722
+ parseResponseAsJson: false
723
+ });
724
+ }
725
+ /**
726
+ * Pin a processing configuration for a flow-control key.
727
+ *
728
+ * While pinned, the system ignores configurations provided by incoming
729
+ * messages and uses the pinned configuration instead.
730
+ */
731
+ async pin(flowControlKey, options) {
732
+ await this.http.request({
733
+ method: "POST",
734
+ path: ["v2", "flowControl", flowControlKey, "pin"],
735
+ query: {
736
+ parallelism: options.parallelism,
737
+ rate: options.rate,
738
+ period: options.period
739
+ },
740
+ parseResponseAsJson: false
741
+ });
742
+ }
743
+ /**
744
+ * Remove the pinned configuration for a flow-control key.
745
+ *
746
+ * After unpinning, the system resumes updating the configuration
747
+ * based on incoming messages.
748
+ */
749
+ async unpin(flowControlKey, options) {
750
+ await this.http.request({
751
+ method: "POST",
752
+ path: ["v2", "flowControl", flowControlKey, "unpin"],
753
+ query: {
754
+ parallelism: options.parallelism,
755
+ rate: options.rate
756
+ },
757
+ parseResponseAsJson: false
758
+ });
759
+ }
760
+ /**
761
+ * Reset the rate configuration state for a flow-control key.
762
+ *
763
+ * Clears the current rate count and immediately ends the current period.
764
+ * The current timestamp becomes the start of the new rate period.
765
+ */
766
+ async resetRate(flowControlKey) {
767
+ await this.http.request({
768
+ method: "POST",
769
+ path: ["v2", "flowControl", flowControlKey, "resetRate"],
770
+ parseResponseAsJson: false
771
+ });
772
+ }
773
+ };
774
+
674
775
  // src/client/http.ts
675
776
  var HttpClient = class {
676
777
  baseUrl;
@@ -2741,7 +2842,7 @@ var Workflow = class {
2741
2842
  };
2742
2843
 
2743
2844
  // version.ts
2744
- var VERSION = "v2.9.0";
2845
+ var VERSION = "v2.9.1";
2745
2846
 
2746
2847
  // src/client/client.ts
2747
2848
  var Client = class {
@@ -2812,6 +2913,14 @@ var Client = class {
2812
2913
  get schedules() {
2813
2914
  return new Schedules(this.http);
2814
2915
  }
2916
+ /**
2917
+ * Access the flow control API.
2918
+ *
2919
+ * List, get, or reset flow controls.
2920
+ */
2921
+ get flowControl() {
2922
+ return new FlowControlApi(this.http);
2923
+ }
2815
2924
  /**
2816
2925
  * Access the workflow API.
2817
2926
  *
package/svelte.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import "./chunk-M7SEEFAC.mjs";
1
+ import "./chunk-KDHOB7B5.mjs";
2
2
  import {
3
3
  Receiver,
4
4
  serve
5
- } from "./chunk-QYBCXZKB.mjs";
5
+ } from "./chunk-DT2X63FB.mjs";
6
6
 
7
7
  // platforms/svelte.ts
8
8
  var verifySignatureSvelte = (handler, config) => {
package/workflow.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export { am as AsyncStepFunction, af as DisabledWorkflowContext, F as FailureFunctionPayload, ap as FinishCondition, ar as LogLevel, ao as ParallelCallState, ak as RawStep, aq as RequiredExceptFields, a9 as RouteFunction, S as Step, an as StepFunction, aj as StepType, ai as StepTypes, al as SyncStepFunction, ab as Workflow, ag as WorkflowClient, ae as WorkflowContext, at as WorkflowLogger, as as WorkflowLoggerOptions, ah as WorkflowReceiver, aa as WorkflowServeOptions, ac as processOptions, ad as serve } from './client-BVG9vt90.mjs';
1
+ export { ar as AsyncStepFunction, ak as DisabledWorkflowContext, F as FailureFunctionPayload, au as FinishCondition, aw as LogLevel, at as ParallelCallState, ap as RawStep, av as RequiredExceptFields, ae as RouteFunction, S as Step, as as StepFunction, ao as StepType, an as StepTypes, aq as SyncStepFunction, ag as Workflow, al as WorkflowClient, aj as WorkflowContext, ay as WorkflowLogger, ax as WorkflowLoggerOptions, am as WorkflowReceiver, af as WorkflowServeOptions, ah as processOptions, ai as serve } from './client-jh_SomWB.mjs';
2
2
  import 'neverthrow';
package/workflow.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { am as AsyncStepFunction, af as DisabledWorkflowContext, F as FailureFunctionPayload, ap as FinishCondition, ar as LogLevel, ao as ParallelCallState, ak as RawStep, aq as RequiredExceptFields, a9 as RouteFunction, S as Step, an as StepFunction, aj as StepType, ai as StepTypes, al as SyncStepFunction, ab as Workflow, ag as WorkflowClient, ae as WorkflowContext, at as WorkflowLogger, as as WorkflowLoggerOptions, ah as WorkflowReceiver, aa as WorkflowServeOptions, ac as processOptions, ad as serve } from './client-BVG9vt90.js';
1
+ export { ar as AsyncStepFunction, ak as DisabledWorkflowContext, F as FailureFunctionPayload, au as FinishCondition, aw as LogLevel, at as ParallelCallState, ap as RawStep, av as RequiredExceptFields, ae as RouteFunction, S as Step, as as StepFunction, ao as StepType, an as StepTypes, aq as SyncStepFunction, ag as Workflow, al as WorkflowClient, aj as WorkflowContext, ay as WorkflowLogger, ax as WorkflowLoggerOptions, am as WorkflowReceiver, af as WorkflowServeOptions, ah as processOptions, ai as serve } from './client-jh_SomWB.js';
2
2
  import 'neverthrow';
package/workflow.js CHANGED
@@ -676,6 +676,107 @@ var DLQ = class {
676
676
  }
677
677
  };
678
678
 
679
+ // src/client/flow-control.ts
680
+ var FlowControlApi = class {
681
+ http;
682
+ constructor(http) {
683
+ this.http = http;
684
+ }
685
+ /**
686
+ * Get a single flow control by key.
687
+ */
688
+ async get(flowControlKey) {
689
+ return await this.http.request({
690
+ method: "GET",
691
+ path: ["v2", "flowControl", flowControlKey]
692
+ });
693
+ }
694
+ /**
695
+ * Get the global parallelism info.
696
+ */
697
+ async getGlobalParallelism() {
698
+ const response = await this.http.request({
699
+ method: "GET",
700
+ path: ["v2", "globalParallelism"]
701
+ });
702
+ return {
703
+ parallelismMax: response.parallelismMax ?? 0,
704
+ parallelismCount: response.parallelismCount ?? 0
705
+ };
706
+ }
707
+ /**
708
+ * Pause message delivery for a flow-control key.
709
+ *
710
+ * Messages already in the waitlist will remain there.
711
+ * New incoming messages will be added directly to the waitlist.
712
+ */
713
+ async pause(flowControlKey) {
714
+ await this.http.request({
715
+ method: "POST",
716
+ path: ["v2", "flowControl", flowControlKey, "pause"],
717
+ parseResponseAsJson: false
718
+ });
719
+ }
720
+ /**
721
+ * Resume message delivery for a flow-control key.
722
+ */
723
+ async resume(flowControlKey) {
724
+ await this.http.request({
725
+ method: "POST",
726
+ path: ["v2", "flowControl", flowControlKey, "resume"],
727
+ parseResponseAsJson: false
728
+ });
729
+ }
730
+ /**
731
+ * Pin a processing configuration for a flow-control key.
732
+ *
733
+ * While pinned, the system ignores configurations provided by incoming
734
+ * messages and uses the pinned configuration instead.
735
+ */
736
+ async pin(flowControlKey, options) {
737
+ await this.http.request({
738
+ method: "POST",
739
+ path: ["v2", "flowControl", flowControlKey, "pin"],
740
+ query: {
741
+ parallelism: options.parallelism,
742
+ rate: options.rate,
743
+ period: options.period
744
+ },
745
+ parseResponseAsJson: false
746
+ });
747
+ }
748
+ /**
749
+ * Remove the pinned configuration for a flow-control key.
750
+ *
751
+ * After unpinning, the system resumes updating the configuration
752
+ * based on incoming messages.
753
+ */
754
+ async unpin(flowControlKey, options) {
755
+ await this.http.request({
756
+ method: "POST",
757
+ path: ["v2", "flowControl", flowControlKey, "unpin"],
758
+ query: {
759
+ parallelism: options.parallelism,
760
+ rate: options.rate
761
+ },
762
+ parseResponseAsJson: false
763
+ });
764
+ }
765
+ /**
766
+ * Reset the rate configuration state for a flow-control key.
767
+ *
768
+ * Clears the current rate count and immediately ends the current period.
769
+ * The current timestamp becomes the start of the new rate period.
770
+ */
771
+ async resetRate(flowControlKey) {
772
+ await this.http.request({
773
+ method: "POST",
774
+ path: ["v2", "flowControl", flowControlKey, "resetRate"],
775
+ parseResponseAsJson: false
776
+ });
777
+ }
778
+ };
779
+
679
780
  // src/client/http.ts
680
781
  var HttpClient = class {
681
782
  baseUrl;
@@ -1360,7 +1461,7 @@ var UrlGroups = class {
1360
1461
  };
1361
1462
 
1362
1463
  // version.ts
1363
- var VERSION = "v2.9.0";
1464
+ var VERSION = "v2.9.1";
1364
1465
 
1365
1466
  // src/client/client.ts
1366
1467
  var Client = class {
@@ -1431,6 +1532,14 @@ var Client = class {
1431
1532
  get schedules() {
1432
1533
  return new Schedules(this.http);
1433
1534
  }
1535
+ /**
1536
+ * Access the flow control API.
1537
+ *
1538
+ * List, get, or reset flow controls.
1539
+ */
1540
+ get flowControl() {
1541
+ return new FlowControlApi(this.http);
1542
+ }
1434
1543
  /**
1435
1544
  * Access the workflow API.
1436
1545
  *
package/workflow.mjs CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  WorkflowLogger,
7
7
  processOptions,
8
8
  serve
9
- } from "./chunk-QYBCXZKB.mjs";
9
+ } from "./chunk-DT2X63FB.mjs";
10
10
  export {
11
11
  DisabledWorkflowContext,
12
12
  StepTypes,