@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
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-
|
|
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.js';
|
|
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.js';
|
|
3
3
|
import 'neverthrow';
|
|
4
4
|
|
|
5
5
|
/**
|
package/index.js
CHANGED
|
@@ -141,7 +141,8 @@ var DLQ = class {
|
|
|
141
141
|
messages: messagesPayload.messages.map((message) => {
|
|
142
142
|
return {
|
|
143
143
|
...message,
|
|
144
|
-
urlGroup: message.topicName
|
|
144
|
+
urlGroup: message.topicName,
|
|
145
|
+
ratePerSecond: "rate" in message ? message.rate : void 0
|
|
145
146
|
};
|
|
146
147
|
}),
|
|
147
148
|
cursor: messagesPayload.cursor
|
|
@@ -571,7 +572,8 @@ var Messages = class {
|
|
|
571
572
|
});
|
|
572
573
|
const message = {
|
|
573
574
|
...messagePayload,
|
|
574
|
-
urlGroup: messagePayload.topicName
|
|
575
|
+
urlGroup: messagePayload.topicName,
|
|
576
|
+
ratePerSecond: "rate" in messagePayload ? messagePayload.rate : void 0
|
|
575
577
|
};
|
|
576
578
|
return message;
|
|
577
579
|
}
|
|
@@ -828,6 +830,19 @@ function processHeaders(request) {
|
|
|
828
830
|
headers.set("Upstash-Timeout", `${request.timeout}s`);
|
|
829
831
|
}
|
|
830
832
|
}
|
|
833
|
+
if (request.flowControl?.key) {
|
|
834
|
+
const parallelism = request.flowControl.parallelism?.toString();
|
|
835
|
+
const rate = request.flowControl.ratePerSecond?.toString();
|
|
836
|
+
const controlValue = [
|
|
837
|
+
parallelism ? `parallelism=${parallelism}` : void 0,
|
|
838
|
+
rate ? `rate=${rate}` : void 0
|
|
839
|
+
].filter(Boolean);
|
|
840
|
+
if (controlValue.length === 0) {
|
|
841
|
+
throw new QstashError("Provide at least one of parallelism or ratePerSecond for flowControl");
|
|
842
|
+
}
|
|
843
|
+
headers.set("Upstash-Flow-Control-Key", request.flowControl.key);
|
|
844
|
+
headers.set("Upstash-Flow-Control-Value", controlValue.join(", "));
|
|
845
|
+
}
|
|
831
846
|
return headers;
|
|
832
847
|
}
|
|
833
848
|
function getRequestPath(request) {
|
|
@@ -1039,6 +1054,21 @@ var Schedules = class {
|
|
|
1039
1054
|
if (request.queueName !== void 0) {
|
|
1040
1055
|
headers.set("Upstash-Queue-Name", request.queueName);
|
|
1041
1056
|
}
|
|
1057
|
+
if (request.flowControl?.key) {
|
|
1058
|
+
const parallelism = request.flowControl.parallelism?.toString();
|
|
1059
|
+
const rate = request.flowControl.ratePerSecond?.toString();
|
|
1060
|
+
const controlValue = [
|
|
1061
|
+
parallelism ? `parallelism=${parallelism}` : void 0,
|
|
1062
|
+
rate ? `rate=${rate}` : void 0
|
|
1063
|
+
].filter(Boolean);
|
|
1064
|
+
if (controlValue.length === 0) {
|
|
1065
|
+
throw new QstashError(
|
|
1066
|
+
"Provide at least one of parallelism or ratePerSecond for flowControl"
|
|
1067
|
+
);
|
|
1068
|
+
}
|
|
1069
|
+
headers.set("Upstash-Flow-Control-Key", request.flowControl.key);
|
|
1070
|
+
headers.set("Upstash-Flow-Control-Value", controlValue.join(", "));
|
|
1071
|
+
}
|
|
1042
1072
|
return await this.http.request({
|
|
1043
1073
|
method: "POST",
|
|
1044
1074
|
headers: wrapWithGlobalHeaders(headers, this.http.headers),
|
|
@@ -1050,19 +1080,27 @@ var Schedules = class {
|
|
|
1050
1080
|
* Get a schedule
|
|
1051
1081
|
*/
|
|
1052
1082
|
async get(scheduleId) {
|
|
1053
|
-
|
|
1083
|
+
const schedule = await this.http.request({
|
|
1054
1084
|
method: "GET",
|
|
1055
1085
|
path: ["v2", "schedules", scheduleId]
|
|
1056
1086
|
});
|
|
1087
|
+
if ("rate" in schedule)
|
|
1088
|
+
schedule.ratePerSecond = schedule.rate;
|
|
1089
|
+
return schedule;
|
|
1057
1090
|
}
|
|
1058
1091
|
/**
|
|
1059
1092
|
* List your schedules
|
|
1060
1093
|
*/
|
|
1061
1094
|
async list() {
|
|
1062
|
-
|
|
1095
|
+
const schedules = await this.http.request({
|
|
1063
1096
|
method: "GET",
|
|
1064
1097
|
path: ["v2", "schedules"]
|
|
1065
1098
|
});
|
|
1099
|
+
for (const schedule of schedules) {
|
|
1100
|
+
if ("rate" in schedule)
|
|
1101
|
+
schedule.ratePerSecond = schedule.rate;
|
|
1102
|
+
}
|
|
1103
|
+
return schedules;
|
|
1066
1104
|
}
|
|
1067
1105
|
/**
|
|
1068
1106
|
* Delete a schedule
|
package/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resend
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RQQYKT2M.mjs";
|
|
4
4
|
import {
|
|
5
5
|
Chat,
|
|
6
6
|
Client,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
openai,
|
|
23
23
|
setupAnalytics,
|
|
24
24
|
upstash
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-MQSZDXFZ.mjs";
|
|
26
26
|
export {
|
|
27
27
|
Chat,
|
|
28
28
|
Client,
|
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 {
|
|
3
|
+
import { a4 as RouteFunction, a5 as WorkflowServeOptions } from './client-vTeVVeh7.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 {
|
|
3
|
+
import { a4 as RouteFunction, a5 as WorkflowServeOptions } from './client-vTeVVeh7.js';
|
|
4
4
|
import 'neverthrow';
|
|
5
5
|
|
|
6
6
|
type VerifySignatureConfig = {
|
package/nextjs.js
CHANGED
|
@@ -125,7 +125,8 @@ var DLQ = class {
|
|
|
125
125
|
messages: messagesPayload.messages.map((message) => {
|
|
126
126
|
return {
|
|
127
127
|
...message,
|
|
128
|
-
urlGroup: message.topicName
|
|
128
|
+
urlGroup: message.topicName,
|
|
129
|
+
ratePerSecond: "rate" in message ? message.rate : void 0
|
|
129
130
|
};
|
|
130
131
|
}),
|
|
131
132
|
cursor: messagesPayload.cursor
|
|
@@ -555,7 +556,8 @@ var Messages = class {
|
|
|
555
556
|
});
|
|
556
557
|
const message = {
|
|
557
558
|
...messagePayload,
|
|
558
|
-
urlGroup: messagePayload.topicName
|
|
559
|
+
urlGroup: messagePayload.topicName,
|
|
560
|
+
ratePerSecond: "rate" in messagePayload ? messagePayload.rate : void 0
|
|
559
561
|
};
|
|
560
562
|
return message;
|
|
561
563
|
}
|
|
@@ -796,6 +798,19 @@ function processHeaders(request) {
|
|
|
796
798
|
headers.set("Upstash-Timeout", `${request.timeout}s`);
|
|
797
799
|
}
|
|
798
800
|
}
|
|
801
|
+
if (request.flowControl?.key) {
|
|
802
|
+
const parallelism = request.flowControl.parallelism?.toString();
|
|
803
|
+
const rate = request.flowControl.ratePerSecond?.toString();
|
|
804
|
+
const controlValue = [
|
|
805
|
+
parallelism ? `parallelism=${parallelism}` : void 0,
|
|
806
|
+
rate ? `rate=${rate}` : void 0
|
|
807
|
+
].filter(Boolean);
|
|
808
|
+
if (controlValue.length === 0) {
|
|
809
|
+
throw new QstashError("Provide at least one of parallelism or ratePerSecond for flowControl");
|
|
810
|
+
}
|
|
811
|
+
headers.set("Upstash-Flow-Control-Key", request.flowControl.key);
|
|
812
|
+
headers.set("Upstash-Flow-Control-Value", controlValue.join(", "));
|
|
813
|
+
}
|
|
799
814
|
return headers;
|
|
800
815
|
}
|
|
801
816
|
function getRequestPath(request) {
|
|
@@ -1012,6 +1027,21 @@ var Schedules = class {
|
|
|
1012
1027
|
if (request.queueName !== void 0) {
|
|
1013
1028
|
headers.set("Upstash-Queue-Name", request.queueName);
|
|
1014
1029
|
}
|
|
1030
|
+
if (request.flowControl?.key) {
|
|
1031
|
+
const parallelism = request.flowControl.parallelism?.toString();
|
|
1032
|
+
const rate = request.flowControl.ratePerSecond?.toString();
|
|
1033
|
+
const controlValue = [
|
|
1034
|
+
parallelism ? `parallelism=${parallelism}` : void 0,
|
|
1035
|
+
rate ? `rate=${rate}` : void 0
|
|
1036
|
+
].filter(Boolean);
|
|
1037
|
+
if (controlValue.length === 0) {
|
|
1038
|
+
throw new QstashError(
|
|
1039
|
+
"Provide at least one of parallelism or ratePerSecond for flowControl"
|
|
1040
|
+
);
|
|
1041
|
+
}
|
|
1042
|
+
headers.set("Upstash-Flow-Control-Key", request.flowControl.key);
|
|
1043
|
+
headers.set("Upstash-Flow-Control-Value", controlValue.join(", "));
|
|
1044
|
+
}
|
|
1015
1045
|
return await this.http.request({
|
|
1016
1046
|
method: "POST",
|
|
1017
1047
|
headers: wrapWithGlobalHeaders(headers, this.http.headers),
|
|
@@ -1023,19 +1053,27 @@ var Schedules = class {
|
|
|
1023
1053
|
* Get a schedule
|
|
1024
1054
|
*/
|
|
1025
1055
|
async get(scheduleId) {
|
|
1026
|
-
|
|
1056
|
+
const schedule = await this.http.request({
|
|
1027
1057
|
method: "GET",
|
|
1028
1058
|
path: ["v2", "schedules", scheduleId]
|
|
1029
1059
|
});
|
|
1060
|
+
if ("rate" in schedule)
|
|
1061
|
+
schedule.ratePerSecond = schedule.rate;
|
|
1062
|
+
return schedule;
|
|
1030
1063
|
}
|
|
1031
1064
|
/**
|
|
1032
1065
|
* List your schedules
|
|
1033
1066
|
*/
|
|
1034
1067
|
async list() {
|
|
1035
|
-
|
|
1068
|
+
const schedules = await this.http.request({
|
|
1036
1069
|
method: "GET",
|
|
1037
1070
|
path: ["v2", "schedules"]
|
|
1038
1071
|
});
|
|
1072
|
+
for (const schedule of schedules) {
|
|
1073
|
+
if ("rate" in schedule)
|
|
1074
|
+
schedule.ratePerSecond = schedule.rate;
|
|
1075
|
+
}
|
|
1076
|
+
return schedules;
|
|
1039
1077
|
}
|
|
1040
1078
|
/**
|
|
1041
1079
|
* Delete a schedule
|
package/nextjs.mjs
CHANGED
package/nuxt.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
verifySignatureH3
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-3N4XI2LB.mjs";
|
|
4
|
+
import "./chunk-RQQYKT2M.mjs";
|
|
5
|
+
import "./chunk-MQSZDXFZ.mjs";
|
|
6
6
|
|
|
7
7
|
// platforms/nuxt.ts
|
|
8
8
|
var verifySignatureNuxt = verifySignatureH3;
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"v2.7.
|
|
1
|
+
{"version":"v2.7.22","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","ai":"^3.1.28","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 {
|
|
2
|
+
import { a4 as RouteFunction, a5 as WorkflowServeOptions } from './client-vTeVVeh7.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 {
|
|
2
|
+
import { a4 as RouteFunction, a5 as WorkflowServeOptions } from './client-vTeVVeh7.js';
|
|
3
3
|
import 'neverthrow';
|
|
4
4
|
|
|
5
5
|
type VerifySignatureConfig = {
|
package/solidjs.js
CHANGED
|
@@ -122,7 +122,8 @@ var DLQ = class {
|
|
|
122
122
|
messages: messagesPayload.messages.map((message) => {
|
|
123
123
|
return {
|
|
124
124
|
...message,
|
|
125
|
-
urlGroup: message.topicName
|
|
125
|
+
urlGroup: message.topicName,
|
|
126
|
+
ratePerSecond: "rate" in message ? message.rate : void 0
|
|
126
127
|
};
|
|
127
128
|
}),
|
|
128
129
|
cursor: messagesPayload.cursor
|
|
@@ -552,7 +553,8 @@ var Messages = class {
|
|
|
552
553
|
});
|
|
553
554
|
const message = {
|
|
554
555
|
...messagePayload,
|
|
555
|
-
urlGroup: messagePayload.topicName
|
|
556
|
+
urlGroup: messagePayload.topicName,
|
|
557
|
+
ratePerSecond: "rate" in messagePayload ? messagePayload.rate : void 0
|
|
556
558
|
};
|
|
557
559
|
return message;
|
|
558
560
|
}
|
|
@@ -793,6 +795,19 @@ function processHeaders(request) {
|
|
|
793
795
|
headers.set("Upstash-Timeout", `${request.timeout}s`);
|
|
794
796
|
}
|
|
795
797
|
}
|
|
798
|
+
if (request.flowControl?.key) {
|
|
799
|
+
const parallelism = request.flowControl.parallelism?.toString();
|
|
800
|
+
const rate = request.flowControl.ratePerSecond?.toString();
|
|
801
|
+
const controlValue = [
|
|
802
|
+
parallelism ? `parallelism=${parallelism}` : void 0,
|
|
803
|
+
rate ? `rate=${rate}` : void 0
|
|
804
|
+
].filter(Boolean);
|
|
805
|
+
if (controlValue.length === 0) {
|
|
806
|
+
throw new QstashError("Provide at least one of parallelism or ratePerSecond for flowControl");
|
|
807
|
+
}
|
|
808
|
+
headers.set("Upstash-Flow-Control-Key", request.flowControl.key);
|
|
809
|
+
headers.set("Upstash-Flow-Control-Value", controlValue.join(", "));
|
|
810
|
+
}
|
|
796
811
|
return headers;
|
|
797
812
|
}
|
|
798
813
|
function getRequestPath(request) {
|
|
@@ -1009,6 +1024,21 @@ var Schedules = class {
|
|
|
1009
1024
|
if (request.queueName !== void 0) {
|
|
1010
1025
|
headers.set("Upstash-Queue-Name", request.queueName);
|
|
1011
1026
|
}
|
|
1027
|
+
if (request.flowControl?.key) {
|
|
1028
|
+
const parallelism = request.flowControl.parallelism?.toString();
|
|
1029
|
+
const rate = request.flowControl.ratePerSecond?.toString();
|
|
1030
|
+
const controlValue = [
|
|
1031
|
+
parallelism ? `parallelism=${parallelism}` : void 0,
|
|
1032
|
+
rate ? `rate=${rate}` : void 0
|
|
1033
|
+
].filter(Boolean);
|
|
1034
|
+
if (controlValue.length === 0) {
|
|
1035
|
+
throw new QstashError(
|
|
1036
|
+
"Provide at least one of parallelism or ratePerSecond for flowControl"
|
|
1037
|
+
);
|
|
1038
|
+
}
|
|
1039
|
+
headers.set("Upstash-Flow-Control-Key", request.flowControl.key);
|
|
1040
|
+
headers.set("Upstash-Flow-Control-Value", controlValue.join(", "));
|
|
1041
|
+
}
|
|
1012
1042
|
return await this.http.request({
|
|
1013
1043
|
method: "POST",
|
|
1014
1044
|
headers: wrapWithGlobalHeaders(headers, this.http.headers),
|
|
@@ -1020,19 +1050,27 @@ var Schedules = class {
|
|
|
1020
1050
|
* Get a schedule
|
|
1021
1051
|
*/
|
|
1022
1052
|
async get(scheduleId) {
|
|
1023
|
-
|
|
1053
|
+
const schedule = await this.http.request({
|
|
1024
1054
|
method: "GET",
|
|
1025
1055
|
path: ["v2", "schedules", scheduleId]
|
|
1026
1056
|
});
|
|
1057
|
+
if ("rate" in schedule)
|
|
1058
|
+
schedule.ratePerSecond = schedule.rate;
|
|
1059
|
+
return schedule;
|
|
1027
1060
|
}
|
|
1028
1061
|
/**
|
|
1029
1062
|
* List your schedules
|
|
1030
1063
|
*/
|
|
1031
1064
|
async list() {
|
|
1032
|
-
|
|
1065
|
+
const schedules = await this.http.request({
|
|
1033
1066
|
method: "GET",
|
|
1034
1067
|
path: ["v2", "schedules"]
|
|
1035
1068
|
});
|
|
1069
|
+
for (const schedule of schedules) {
|
|
1070
|
+
if ("rate" in schedule)
|
|
1071
|
+
schedule.ratePerSecond = schedule.rate;
|
|
1072
|
+
}
|
|
1073
|
+
return schedules;
|
|
1036
1074
|
}
|
|
1037
1075
|
/**
|
|
1038
1076
|
* Delete a schedule
|
package/solidjs.mjs
CHANGED
package/svelte.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestHandler } from '@sveltejs/kit';
|
|
2
|
-
import {
|
|
2
|
+
import { a4 as RouteFunction, a5 as WorkflowServeOptions } from './client-vTeVVeh7.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 {
|
|
2
|
+
import { a4 as RouteFunction, a5 as WorkflowServeOptions } from './client-vTeVVeh7.js';
|
|
3
3
|
import 'neverthrow';
|
|
4
4
|
|
|
5
5
|
type VerifySignatureConfig = {
|
package/svelte.js
CHANGED
|
@@ -122,7 +122,8 @@ var DLQ = class {
|
|
|
122
122
|
messages: messagesPayload.messages.map((message) => {
|
|
123
123
|
return {
|
|
124
124
|
...message,
|
|
125
|
-
urlGroup: message.topicName
|
|
125
|
+
urlGroup: message.topicName,
|
|
126
|
+
ratePerSecond: "rate" in message ? message.rate : void 0
|
|
126
127
|
};
|
|
127
128
|
}),
|
|
128
129
|
cursor: messagesPayload.cursor
|
|
@@ -552,7 +553,8 @@ var Messages = class {
|
|
|
552
553
|
});
|
|
553
554
|
const message = {
|
|
554
555
|
...messagePayload,
|
|
555
|
-
urlGroup: messagePayload.topicName
|
|
556
|
+
urlGroup: messagePayload.topicName,
|
|
557
|
+
ratePerSecond: "rate" in messagePayload ? messagePayload.rate : void 0
|
|
556
558
|
};
|
|
557
559
|
return message;
|
|
558
560
|
}
|
|
@@ -793,6 +795,19 @@ function processHeaders(request) {
|
|
|
793
795
|
headers.set("Upstash-Timeout", `${request.timeout}s`);
|
|
794
796
|
}
|
|
795
797
|
}
|
|
798
|
+
if (request.flowControl?.key) {
|
|
799
|
+
const parallelism = request.flowControl.parallelism?.toString();
|
|
800
|
+
const rate = request.flowControl.ratePerSecond?.toString();
|
|
801
|
+
const controlValue = [
|
|
802
|
+
parallelism ? `parallelism=${parallelism}` : void 0,
|
|
803
|
+
rate ? `rate=${rate}` : void 0
|
|
804
|
+
].filter(Boolean);
|
|
805
|
+
if (controlValue.length === 0) {
|
|
806
|
+
throw new QstashError("Provide at least one of parallelism or ratePerSecond for flowControl");
|
|
807
|
+
}
|
|
808
|
+
headers.set("Upstash-Flow-Control-Key", request.flowControl.key);
|
|
809
|
+
headers.set("Upstash-Flow-Control-Value", controlValue.join(", "));
|
|
810
|
+
}
|
|
796
811
|
return headers;
|
|
797
812
|
}
|
|
798
813
|
function getRequestPath(request) {
|
|
@@ -1009,6 +1024,21 @@ var Schedules = class {
|
|
|
1009
1024
|
if (request.queueName !== void 0) {
|
|
1010
1025
|
headers.set("Upstash-Queue-Name", request.queueName);
|
|
1011
1026
|
}
|
|
1027
|
+
if (request.flowControl?.key) {
|
|
1028
|
+
const parallelism = request.flowControl.parallelism?.toString();
|
|
1029
|
+
const rate = request.flowControl.ratePerSecond?.toString();
|
|
1030
|
+
const controlValue = [
|
|
1031
|
+
parallelism ? `parallelism=${parallelism}` : void 0,
|
|
1032
|
+
rate ? `rate=${rate}` : void 0
|
|
1033
|
+
].filter(Boolean);
|
|
1034
|
+
if (controlValue.length === 0) {
|
|
1035
|
+
throw new QstashError(
|
|
1036
|
+
"Provide at least one of parallelism or ratePerSecond for flowControl"
|
|
1037
|
+
);
|
|
1038
|
+
}
|
|
1039
|
+
headers.set("Upstash-Flow-Control-Key", request.flowControl.key);
|
|
1040
|
+
headers.set("Upstash-Flow-Control-Value", controlValue.join(", "));
|
|
1041
|
+
}
|
|
1012
1042
|
return await this.http.request({
|
|
1013
1043
|
method: "POST",
|
|
1014
1044
|
headers: wrapWithGlobalHeaders(headers, this.http.headers),
|
|
@@ -1020,19 +1050,27 @@ var Schedules = class {
|
|
|
1020
1050
|
* Get a schedule
|
|
1021
1051
|
*/
|
|
1022
1052
|
async get(scheduleId) {
|
|
1023
|
-
|
|
1053
|
+
const schedule = await this.http.request({
|
|
1024
1054
|
method: "GET",
|
|
1025
1055
|
path: ["v2", "schedules", scheduleId]
|
|
1026
1056
|
});
|
|
1057
|
+
if ("rate" in schedule)
|
|
1058
|
+
schedule.ratePerSecond = schedule.rate;
|
|
1059
|
+
return schedule;
|
|
1027
1060
|
}
|
|
1028
1061
|
/**
|
|
1029
1062
|
* List your schedules
|
|
1030
1063
|
*/
|
|
1031
1064
|
async list() {
|
|
1032
|
-
|
|
1065
|
+
const schedules = await this.http.request({
|
|
1033
1066
|
method: "GET",
|
|
1034
1067
|
path: ["v2", "schedules"]
|
|
1035
1068
|
});
|
|
1069
|
+
for (const schedule of schedules) {
|
|
1070
|
+
if ("rate" in schedule)
|
|
1071
|
+
schedule.ratePerSecond = schedule.rate;
|
|
1072
|
+
}
|
|
1073
|
+
return schedules;
|
|
1036
1074
|
}
|
|
1037
1075
|
/**
|
|
1038
1076
|
* Delete a schedule
|
package/svelte.mjs
CHANGED
package/workflow.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ah as AsyncStepFunction, aa as DisabledWorkflowContext, F as FailureFunctionPayload, ak as FinishCondition, am as LogLevel, aj as ParallelCallState, af as RawStep, al as RequiredExceptFields, a4 as RouteFunction, S as Step, ai as StepFunction, ae as StepType, ad as StepTypes, ag as SyncStepFunction, a6 as Workflow, ab as WorkflowClient, a9 as WorkflowContext, ao as WorkflowLogger, an as WorkflowLoggerOptions, ac as WorkflowReceiver, a5 as WorkflowServeOptions, a7 as processOptions, a8 as serve } from './client-vTeVVeh7.mjs';
|
|
2
2
|
import 'neverthrow';
|
package/workflow.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ah as AsyncStepFunction, aa as DisabledWorkflowContext, F as FailureFunctionPayload, ak as FinishCondition, am as LogLevel, aj as ParallelCallState, af as RawStep, al as RequiredExceptFields, a4 as RouteFunction, S as Step, ai as StepFunction, ae as StepType, ad as StepTypes, ag as SyncStepFunction, a6 as Workflow, ab as WorkflowClient, a9 as WorkflowContext, ao as WorkflowLogger, an as WorkflowLoggerOptions, ac as WorkflowReceiver, a5 as WorkflowServeOptions, a7 as processOptions, a8 as serve } from './client-vTeVVeh7.js';
|
|
2
2
|
import 'neverthrow';
|
package/workflow.js
CHANGED
|
@@ -127,7 +127,8 @@ var DLQ = class {
|
|
|
127
127
|
messages: messagesPayload.messages.map((message) => {
|
|
128
128
|
return {
|
|
129
129
|
...message,
|
|
130
|
-
urlGroup: message.topicName
|
|
130
|
+
urlGroup: message.topicName,
|
|
131
|
+
ratePerSecond: "rate" in message ? message.rate : void 0
|
|
131
132
|
};
|
|
132
133
|
}),
|
|
133
134
|
cursor: messagesPayload.cursor
|
|
@@ -557,7 +558,8 @@ var Messages = class {
|
|
|
557
558
|
});
|
|
558
559
|
const message = {
|
|
559
560
|
...messagePayload,
|
|
560
|
-
urlGroup: messagePayload.topicName
|
|
561
|
+
urlGroup: messagePayload.topicName,
|
|
562
|
+
ratePerSecond: "rate" in messagePayload ? messagePayload.rate : void 0
|
|
561
563
|
};
|
|
562
564
|
return message;
|
|
563
565
|
}
|
|
@@ -798,6 +800,19 @@ function processHeaders(request) {
|
|
|
798
800
|
headers.set("Upstash-Timeout", `${request.timeout}s`);
|
|
799
801
|
}
|
|
800
802
|
}
|
|
803
|
+
if (request.flowControl?.key) {
|
|
804
|
+
const parallelism = request.flowControl.parallelism?.toString();
|
|
805
|
+
const rate = request.flowControl.ratePerSecond?.toString();
|
|
806
|
+
const controlValue = [
|
|
807
|
+
parallelism ? `parallelism=${parallelism}` : void 0,
|
|
808
|
+
rate ? `rate=${rate}` : void 0
|
|
809
|
+
].filter(Boolean);
|
|
810
|
+
if (controlValue.length === 0) {
|
|
811
|
+
throw new QstashError("Provide at least one of parallelism or ratePerSecond for flowControl");
|
|
812
|
+
}
|
|
813
|
+
headers.set("Upstash-Flow-Control-Key", request.flowControl.key);
|
|
814
|
+
headers.set("Upstash-Flow-Control-Value", controlValue.join(", "));
|
|
815
|
+
}
|
|
801
816
|
return headers;
|
|
802
817
|
}
|
|
803
818
|
function getRequestPath(request) {
|
|
@@ -1014,6 +1029,21 @@ var Schedules = class {
|
|
|
1014
1029
|
if (request.queueName !== void 0) {
|
|
1015
1030
|
headers.set("Upstash-Queue-Name", request.queueName);
|
|
1016
1031
|
}
|
|
1032
|
+
if (request.flowControl?.key) {
|
|
1033
|
+
const parallelism = request.flowControl.parallelism?.toString();
|
|
1034
|
+
const rate = request.flowControl.ratePerSecond?.toString();
|
|
1035
|
+
const controlValue = [
|
|
1036
|
+
parallelism ? `parallelism=${parallelism}` : void 0,
|
|
1037
|
+
rate ? `rate=${rate}` : void 0
|
|
1038
|
+
].filter(Boolean);
|
|
1039
|
+
if (controlValue.length === 0) {
|
|
1040
|
+
throw new QstashError(
|
|
1041
|
+
"Provide at least one of parallelism or ratePerSecond for flowControl"
|
|
1042
|
+
);
|
|
1043
|
+
}
|
|
1044
|
+
headers.set("Upstash-Flow-Control-Key", request.flowControl.key);
|
|
1045
|
+
headers.set("Upstash-Flow-Control-Value", controlValue.join(", "));
|
|
1046
|
+
}
|
|
1017
1047
|
return await this.http.request({
|
|
1018
1048
|
method: "POST",
|
|
1019
1049
|
headers: wrapWithGlobalHeaders(headers, this.http.headers),
|
|
@@ -1025,19 +1055,27 @@ var Schedules = class {
|
|
|
1025
1055
|
* Get a schedule
|
|
1026
1056
|
*/
|
|
1027
1057
|
async get(scheduleId) {
|
|
1028
|
-
|
|
1058
|
+
const schedule = await this.http.request({
|
|
1029
1059
|
method: "GET",
|
|
1030
1060
|
path: ["v2", "schedules", scheduleId]
|
|
1031
1061
|
});
|
|
1062
|
+
if ("rate" in schedule)
|
|
1063
|
+
schedule.ratePerSecond = schedule.rate;
|
|
1064
|
+
return schedule;
|
|
1032
1065
|
}
|
|
1033
1066
|
/**
|
|
1034
1067
|
* List your schedules
|
|
1035
1068
|
*/
|
|
1036
1069
|
async list() {
|
|
1037
|
-
|
|
1070
|
+
const schedules = await this.http.request({
|
|
1038
1071
|
method: "GET",
|
|
1039
1072
|
path: ["v2", "schedules"]
|
|
1040
1073
|
});
|
|
1074
|
+
for (const schedule of schedules) {
|
|
1075
|
+
if ("rate" in schedule)
|
|
1076
|
+
schedule.ratePerSecond = schedule.rate;
|
|
1077
|
+
}
|
|
1078
|
+
return schedules;
|
|
1041
1079
|
}
|
|
1042
1080
|
/**
|
|
1043
1081
|
* Delete a schedule
|