@upstash/qstash 2.6.1 → 2.6.2
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/index.d.mts +16 -1
- package/index.d.ts +16 -1
- package/index.js +39 -3
- package/index.mjs +38 -2
- package/package.json +1 -1
package/index.d.mts
CHANGED
|
@@ -1077,10 +1077,25 @@ declare class QstashError extends Error {
|
|
|
1077
1077
|
constructor(message: string);
|
|
1078
1078
|
}
|
|
1079
1079
|
declare class QstashRatelimitError extends QstashError {
|
|
1080
|
+
limit: string | null;
|
|
1081
|
+
remaining: string | null;
|
|
1082
|
+
reset: string | null;
|
|
1080
1083
|
constructor(args: RateLimit);
|
|
1081
1084
|
}
|
|
1082
1085
|
declare class QstashChatRatelimitError extends QstashError {
|
|
1086
|
+
limitRequests: string | null;
|
|
1087
|
+
limitTokens: string | null;
|
|
1088
|
+
remainingRequests: string | null;
|
|
1089
|
+
remainingTokens: string | null;
|
|
1090
|
+
resetRequests: string | null;
|
|
1091
|
+
resetTokens: string | null;
|
|
1083
1092
|
constructor(args: ChatRateLimit);
|
|
1084
1093
|
}
|
|
1094
|
+
declare class QstashDailyRatelimitError extends QstashError {
|
|
1095
|
+
limit: string | null;
|
|
1096
|
+
remaining: string | null;
|
|
1097
|
+
reset: string | null;
|
|
1098
|
+
constructor(args: RateLimit);
|
|
1099
|
+
}
|
|
1085
1100
|
|
|
1086
|
-
export { type AddEndpointsRequest, type BodyInit, Chat, type ChatCompletion, type ChatCompletionChunk, type ChatCompletionMessage, type ChatRateLimit, type ChatRequest, Client, type CreateScheduleRequest, type Endpoint, type Event, type EventPayload, type EventsRequest, type GetEventsPayload, type GetEventsResponse, type HeadersInit, type Message, type MessagePayload, Messages, type OpenAIChatModel, type PromptChatRequest, type ProviderReturnType, type PublishBatchRequest, type PublishJsonRequest, type PublishRequest, type PublishResponse, type PublishToApiResponse, type PublishToUrlGroupsResponse, type PublishToUrlResponse, QstashChatRatelimitError, QstashError, QstashRatelimitError, type QueueRequest, type RateLimit, Receiver, type ReceiverConfig, type RemoveEndpointsRequest, type RequestOptions, type Schedule, Schedules, SignatureError, type State, type StreamDisabled, type StreamEnabled, type StreamParameter, type UrlGroup, UrlGroups, type VerifyRequest, type WithCursor, custom, openai, upstash };
|
|
1101
|
+
export { type AddEndpointsRequest, type BodyInit, Chat, type ChatCompletion, type ChatCompletionChunk, type ChatCompletionMessage, type ChatRateLimit, type ChatRequest, Client, type CreateScheduleRequest, type Endpoint, type Event, type EventPayload, type EventsRequest, type GetEventsPayload, type GetEventsResponse, type HeadersInit, type Message, type MessagePayload, Messages, type OpenAIChatModel, type PromptChatRequest, type ProviderReturnType, type PublishBatchRequest, type PublishJsonRequest, type PublishRequest, type PublishResponse, type PublishToApiResponse, type PublishToUrlGroupsResponse, type PublishToUrlResponse, QstashChatRatelimitError, QstashDailyRatelimitError, QstashError, QstashRatelimitError, type QueueRequest, type RateLimit, Receiver, type ReceiverConfig, type RemoveEndpointsRequest, type RequestOptions, type Schedule, Schedules, SignatureError, type State, type StreamDisabled, type StreamEnabled, type StreamParameter, type UrlGroup, UrlGroups, type VerifyRequest, type WithCursor, custom, openai, upstash };
|
package/index.d.ts
CHANGED
|
@@ -1077,10 +1077,25 @@ declare class QstashError extends Error {
|
|
|
1077
1077
|
constructor(message: string);
|
|
1078
1078
|
}
|
|
1079
1079
|
declare class QstashRatelimitError extends QstashError {
|
|
1080
|
+
limit: string | null;
|
|
1081
|
+
remaining: string | null;
|
|
1082
|
+
reset: string | null;
|
|
1080
1083
|
constructor(args: RateLimit);
|
|
1081
1084
|
}
|
|
1082
1085
|
declare class QstashChatRatelimitError extends QstashError {
|
|
1086
|
+
limitRequests: string | null;
|
|
1087
|
+
limitTokens: string | null;
|
|
1088
|
+
remainingRequests: string | null;
|
|
1089
|
+
remainingTokens: string | null;
|
|
1090
|
+
resetRequests: string | null;
|
|
1091
|
+
resetTokens: string | null;
|
|
1083
1092
|
constructor(args: ChatRateLimit);
|
|
1084
1093
|
}
|
|
1094
|
+
declare class QstashDailyRatelimitError extends QstashError {
|
|
1095
|
+
limit: string | null;
|
|
1096
|
+
remaining: string | null;
|
|
1097
|
+
reset: string | null;
|
|
1098
|
+
constructor(args: RateLimit);
|
|
1099
|
+
}
|
|
1085
1100
|
|
|
1086
|
-
export { type AddEndpointsRequest, type BodyInit, Chat, type ChatCompletion, type ChatCompletionChunk, type ChatCompletionMessage, type ChatRateLimit, type ChatRequest, Client, type CreateScheduleRequest, type Endpoint, type Event, type EventPayload, type EventsRequest, type GetEventsPayload, type GetEventsResponse, type HeadersInit, type Message, type MessagePayload, Messages, type OpenAIChatModel, type PromptChatRequest, type ProviderReturnType, type PublishBatchRequest, type PublishJsonRequest, type PublishRequest, type PublishResponse, type PublishToApiResponse, type PublishToUrlGroupsResponse, type PublishToUrlResponse, QstashChatRatelimitError, QstashError, QstashRatelimitError, type QueueRequest, type RateLimit, Receiver, type ReceiverConfig, type RemoveEndpointsRequest, type RequestOptions, type Schedule, Schedules, SignatureError, type State, type StreamDisabled, type StreamEnabled, type StreamParameter, type UrlGroup, UrlGroups, type VerifyRequest, type WithCursor, custom, openai, upstash };
|
|
1101
|
+
export { type AddEndpointsRequest, type BodyInit, Chat, type ChatCompletion, type ChatCompletionChunk, type ChatCompletionMessage, type ChatRateLimit, type ChatRequest, Client, type CreateScheduleRequest, type Endpoint, type Event, type EventPayload, type EventsRequest, type GetEventsPayload, type GetEventsResponse, type HeadersInit, type Message, type MessagePayload, Messages, type OpenAIChatModel, type PromptChatRequest, type ProviderReturnType, type PublishBatchRequest, type PublishJsonRequest, type PublishRequest, type PublishResponse, type PublishToApiResponse, type PublishToUrlGroupsResponse, type PublishToUrlResponse, QstashChatRatelimitError, QstashDailyRatelimitError, QstashError, QstashRatelimitError, type QueueRequest, type RateLimit, Receiver, type ReceiverConfig, type RemoveEndpointsRequest, type RequestOptions, type Schedule, Schedules, SignatureError, type State, type StreamDisabled, type StreamEnabled, type StreamParameter, type UrlGroup, UrlGroups, type VerifyRequest, type WithCursor, custom, openai, upstash };
|
package/index.js
CHANGED
|
@@ -68,13 +68,42 @@ var QstashError = class extends Error {
|
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
var QstashRatelimitError = class extends QstashError {
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
71
74
|
constructor(args) {
|
|
72
|
-
super(`
|
|
75
|
+
super(`Exceeded burst rate limit. ${JSON.stringify(args)} `);
|
|
76
|
+
this.limit = args.limit;
|
|
77
|
+
this.remaining = args.remaining;
|
|
78
|
+
this.reset = args.reset;
|
|
73
79
|
}
|
|
74
80
|
};
|
|
75
81
|
var QstashChatRatelimitError = class extends QstashError {
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
76
88
|
constructor(args) {
|
|
77
|
-
super(`
|
|
89
|
+
super(`Exceeded chat rate limit. ${JSON.stringify(args)} `);
|
|
90
|
+
this.limitRequests = args["limit-requests"];
|
|
91
|
+
this.limitTokens = args["limit-tokens"];
|
|
92
|
+
this.remainingRequests = args["remaining-requests"];
|
|
93
|
+
this.remainingTokens = args["remaining-tokens"];
|
|
94
|
+
this.resetRequests = args["reset-requests"];
|
|
95
|
+
this.resetTokens = args["reset-tokens"];
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
var QstashDailyRatelimitError = class extends QstashError {
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
constructor(args) {
|
|
103
|
+
super(`Exceeded daily rate limit. ${JSON.stringify(args)} `);
|
|
104
|
+
this.limit = args.limit;
|
|
105
|
+
this.remaining = args.remaining;
|
|
106
|
+
this.reset = args.reset;
|
|
78
107
|
}
|
|
79
108
|
};
|
|
80
109
|
|
|
@@ -187,6 +216,12 @@ var HttpClient = (_class = class {
|
|
|
187
216
|
"reset-requests": response.headers.get("x-ratelimit-reset-requests"),
|
|
188
217
|
"reset-tokens": response.headers.get("x-ratelimit-reset-tokens")
|
|
189
218
|
});
|
|
219
|
+
} else if (response.headers.get("RateLimit-Limit")) {
|
|
220
|
+
throw new QstashDailyRatelimitError({
|
|
221
|
+
limit: response.headers.get("RateLimit-Limit"),
|
|
222
|
+
remaining: response.headers.get("RateLimit-Remaining"),
|
|
223
|
+
reset: response.headers.get("RateLimit-Reset")
|
|
224
|
+
});
|
|
190
225
|
}
|
|
191
226
|
throw new QstashRatelimitError({
|
|
192
227
|
limit: response.headers.get("Burst-RateLimit-Limit"),
|
|
@@ -928,4 +963,5 @@ var custom = ({
|
|
|
928
963
|
|
|
929
964
|
|
|
930
965
|
|
|
931
|
-
|
|
966
|
+
|
|
967
|
+
exports.Chat = Chat; exports.Client = Client; exports.Messages = Messages; exports.QstashChatRatelimitError = QstashChatRatelimitError; exports.QstashDailyRatelimitError = QstashDailyRatelimitError; exports.QstashError = QstashError; exports.QstashRatelimitError = QstashRatelimitError; exports.Receiver = _chunkUUR7N6E6js.Receiver; exports.Schedules = Schedules; exports.SignatureError = _chunkUUR7N6E6js.SignatureError; exports.UrlGroups = UrlGroups; exports.custom = custom; exports.openai = openai; exports.upstash = upstash;
|
package/index.mjs
CHANGED
|
@@ -68,13 +68,42 @@ var QstashError = class extends Error {
|
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
var QstashRatelimitError = class extends QstashError {
|
|
71
|
+
limit;
|
|
72
|
+
remaining;
|
|
73
|
+
reset;
|
|
71
74
|
constructor(args) {
|
|
72
|
-
super(`
|
|
75
|
+
super(`Exceeded burst rate limit. ${JSON.stringify(args)} `);
|
|
76
|
+
this.limit = args.limit;
|
|
77
|
+
this.remaining = args.remaining;
|
|
78
|
+
this.reset = args.reset;
|
|
73
79
|
}
|
|
74
80
|
};
|
|
75
81
|
var QstashChatRatelimitError = class extends QstashError {
|
|
82
|
+
limitRequests;
|
|
83
|
+
limitTokens;
|
|
84
|
+
remainingRequests;
|
|
85
|
+
remainingTokens;
|
|
86
|
+
resetRequests;
|
|
87
|
+
resetTokens;
|
|
76
88
|
constructor(args) {
|
|
77
|
-
super(`
|
|
89
|
+
super(`Exceeded chat rate limit. ${JSON.stringify(args)} `);
|
|
90
|
+
this.limitRequests = args["limit-requests"];
|
|
91
|
+
this.limitTokens = args["limit-tokens"];
|
|
92
|
+
this.remainingRequests = args["remaining-requests"];
|
|
93
|
+
this.remainingTokens = args["remaining-tokens"];
|
|
94
|
+
this.resetRequests = args["reset-requests"];
|
|
95
|
+
this.resetTokens = args["reset-tokens"];
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
var QstashDailyRatelimitError = class extends QstashError {
|
|
99
|
+
limit;
|
|
100
|
+
remaining;
|
|
101
|
+
reset;
|
|
102
|
+
constructor(args) {
|
|
103
|
+
super(`Exceeded daily rate limit. ${JSON.stringify(args)} `);
|
|
104
|
+
this.limit = args.limit;
|
|
105
|
+
this.remaining = args.remaining;
|
|
106
|
+
this.reset = args.reset;
|
|
78
107
|
}
|
|
79
108
|
};
|
|
80
109
|
|
|
@@ -187,6 +216,12 @@ var HttpClient = class {
|
|
|
187
216
|
"reset-requests": response.headers.get("x-ratelimit-reset-requests"),
|
|
188
217
|
"reset-tokens": response.headers.get("x-ratelimit-reset-tokens")
|
|
189
218
|
});
|
|
219
|
+
} else if (response.headers.get("RateLimit-Limit")) {
|
|
220
|
+
throw new QstashDailyRatelimitError({
|
|
221
|
+
limit: response.headers.get("RateLimit-Limit"),
|
|
222
|
+
remaining: response.headers.get("RateLimit-Remaining"),
|
|
223
|
+
reset: response.headers.get("RateLimit-Reset")
|
|
224
|
+
});
|
|
190
225
|
}
|
|
191
226
|
throw new QstashRatelimitError({
|
|
192
227
|
limit: response.headers.get("Burst-RateLimit-Limit"),
|
|
@@ -919,6 +954,7 @@ export {
|
|
|
919
954
|
Client,
|
|
920
955
|
Messages,
|
|
921
956
|
QstashChatRatelimitError,
|
|
957
|
+
QstashDailyRatelimitError,
|
|
922
958
|
QstashError,
|
|
923
959
|
QstashRatelimitError,
|
|
924
960
|
Receiver,
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"v2.6.
|
|
1
|
+
{"version":"v2.6.2","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"},"./nextjs":{"import":"./nextjs.js","require":"./nextjs.js"},"./dist/nextjs":{"import":"./nextjs.js","require":"./nextjs.js"}},"typesVersions":{"*":{"nextjs":["./nextjs.d.ts"]}},"keywords":["qstash","queue","events","serverless","upstash"],"scripts":{"build":"tsup && cp README.md ./dist/ && cp package.json ./dist/ && cp LICENSE ./dist/","test":"bun test","fmt":"prettier --write .","lint":"tsc && eslint \"src/**/*.{js,ts,tsx}\" --quiet --fix"},"devDependencies":{"@commitlint/cli":"^19.2.2","@commitlint/config-conventional":"^19.2.2","@types/bun":"^1.1.1","@types/crypto-js":"^4.2.0","@typescript-eslint/eslint-plugin":"^7.0.1","@typescript-eslint/parser":"^7.0.1","ai":"^3.1.28","bun-types":"^1.1.7","eslint":"^8","eslint-plugin-unicorn":"^51.0.1","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"}}
|