@upstash/qstash
Advanced tools
Comparing version 2.1.8 to 2.1.9-canary-1
@@ -567,3 +567,6 @@ /** | ||
} | ||
declare class QstashRatelimitError extends QstashError { | ||
constructor(args: unknown); | ||
} | ||
export { AddEndpointsRequest, Client, CreateScheduleRequest, Endpoint, Event, EventsRequest, GetEventsResponse, Message, Messages, PublishJsonRequest, PublishRequest, QstashError, Receiver, ReceiverConfig, RemoveEndpointsRequest, Schedule, Schedules, SignatureError, State, Topic, Topics, VerifyRequest, WithCursor }; | ||
export { AddEndpointsRequest, Client, CreateScheduleRequest, Endpoint, Event, EventsRequest, GetEventsResponse, Message, Messages, PublishJsonRequest, PublishRequest, QstashError, QstashRatelimitError, Receiver, ReceiverConfig, RemoveEndpointsRequest, Schedule, Schedules, SignatureError, State, Topic, Topics, VerifyRequest, WithCursor }; |
@@ -16,2 +16,7 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
}; | ||
var QstashRatelimitError = class extends QstashError { | ||
constructor(args) { | ||
super(`You have been ratelimited. ${JSON.stringify(args)} `); | ||
} | ||
}; | ||
@@ -69,2 +74,9 @@ // src/client/http.ts | ||
} | ||
if (res.status === 429) { | ||
throw new QstashRatelimitError({ | ||
limit: res.headers.get("Burst-RateLimit-Limit"), | ||
remaining: res.headers.get("Burst-RateLimit-Remaining"), | ||
reset: res.headers.get("Burst-RateLimit-Reset") | ||
}); | ||
} | ||
if (res.status < 200 || res.status >= 300) { | ||
@@ -415,3 +427,4 @@ const body = yield res.text(); | ||
exports.Client = Client; exports.Messages = Messages; exports.QstashError = QstashError; exports.Receiver = _chunkEQTYEU4Ujs.Receiver; exports.Schedules = Schedules; exports.SignatureError = _chunkEQTYEU4Ujs.SignatureError; exports.Topics = Topics; | ||
exports.Client = Client; exports.Messages = Messages; exports.QstashError = QstashError; exports.QstashRatelimitError = QstashRatelimitError; exports.Receiver = _chunkEQTYEU4Ujs.Receiver; exports.Schedules = Schedules; exports.SignatureError = _chunkEQTYEU4Ujs.SignatureError; exports.Topics = Topics; | ||
//# sourceMappingURL=index.js.map |
import { NextApiHandler } from 'next'; | ||
import { NextRequest, NextFetchEvent, NextResponse } from 'next/server'; | ||
type VerifySignaturConfig = { | ||
type VerifySignatureConfig = { | ||
currentSigningKey?: string; | ||
@@ -20,5 +20,5 @@ nextSigningKey?: string; | ||
}; | ||
declare function verifySignature(handler: NextApiHandler, config?: VerifySignaturConfig): NextApiHandler; | ||
declare function verifySignatureEdge(handler: (req: NextRequest, nfe: NextFetchEvent) => NextResponse | Promise<NextResponse>, config?: VerifySignaturConfig): (req: NextRequest, nfe: NextFetchEvent) => Promise<NextResponse<unknown>>; | ||
declare function verifySignature(handler: NextApiHandler, config?: VerifySignatureConfig): NextApiHandler; | ||
declare function verifySignatureEdge(handler: (req: NextRequest, nfe?: NextFetchEvent) => NextResponse | Promise<NextResponse>, config?: VerifySignatureConfig): (req: NextRequest, nfe: NextFetchEvent) => Promise<NextResponse<unknown>>; | ||
export { VerifySignaturConfig, verifySignature, verifySignatureEdge }; | ||
export { VerifySignatureConfig, verifySignature, verifySignatureEdge }; |
{ | ||
"name": "@upstash/qstash", | ||
"version": "2.1.8", | ||
"version": "2.1.9-canary-1", | ||
"description": "Official Typescript client for QStash", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2
157735
19
1879
1