@vercel/queue 0.0.0-alpha.36 → 0.0.0-alpha.37
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/README.md +4 -14
- package/dist/index.d.mts +2 -7
- package/dist/index.d.ts +2 -7
- package/dist/index.js +2 -62
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -61
- package/dist/index.mjs.map +1 -1
- package/dist/nextjs-pages.d.mts +1 -1
- package/dist/nextjs-pages.d.ts +1 -1
- package/dist/nextjs-pages.js +2 -60
- package/dist/nextjs-pages.js.map +1 -1
- package/dist/nextjs-pages.mjs +2 -60
- package/dist/nextjs-pages.mjs.map +1 -1
- package/dist/{types-C7IKe67P.d.mts → types-CAA8nT8x.d.mts} +1 -25
- package/dist/{types-C7IKe67P.d.ts → types-CAA8nT8x.d.ts} +1 -25
- package/package.json +1 -1
package/dist/nextjs-pages.mjs
CHANGED
|
@@ -110,18 +110,6 @@ var MessageAlreadyProcessedError = class extends Error {
|
|
|
110
110
|
this.name = "MessageAlreadyProcessedError";
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
|
-
var ConcurrencyLimitError = class extends Error {
|
|
114
|
-
/** Current number of in-flight messages for this consumer group. */
|
|
115
|
-
currentInflight;
|
|
116
|
-
/** Maximum allowed concurrent messages (as configured). */
|
|
117
|
-
maxConcurrency;
|
|
118
|
-
constructor(message = "Concurrency limit exceeded", currentInflight, maxConcurrency) {
|
|
119
|
-
super(message);
|
|
120
|
-
this.name = "ConcurrencyLimitError";
|
|
121
|
-
this.currentInflight = currentInflight;
|
|
122
|
-
this.maxConcurrency = maxConcurrency;
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
113
|
var DuplicateMessageError = class extends Error {
|
|
126
114
|
idempotencyKey;
|
|
127
115
|
constructor(message, idempotencyKey) {
|
|
@@ -606,25 +594,17 @@ var QueueClient = class {
|
|
|
606
594
|
* @param options.consumerGroup - Consumer group name (pattern: `[A-Za-z0-9_-]+`)
|
|
607
595
|
* @param options.visibilityTimeoutSeconds - Lock duration (default: 30, min: 0, max: 3600)
|
|
608
596
|
* @param options.limit - Max messages to retrieve (default: 1, min: 1, max: 10)
|
|
609
|
-
* @param options.maxConcurrency - Max in-flight messages (default: unlimited, min: 1)
|
|
610
597
|
* @param transport - Deserializer for message payloads
|
|
611
598
|
* @yields Message objects with payload, messageId, receiptHandle, etc.
|
|
612
599
|
* @throws {QueueEmptyError} When no messages available
|
|
613
600
|
* @throws {InvalidLimitError} When limit is outside 1-10 range
|
|
614
|
-
* @throws {ConcurrencyLimitError} When maxConcurrency exceeded
|
|
615
601
|
* @throws {BadRequestError} When parameters are invalid
|
|
616
602
|
* @throws {UnauthorizedError} When authentication fails
|
|
617
603
|
* @throws {ForbiddenError} When access is denied
|
|
618
604
|
* @throws {InternalServerError} When server encounters an error
|
|
619
605
|
*/
|
|
620
606
|
async *receiveMessages(options, transport) {
|
|
621
|
-
const {
|
|
622
|
-
queueName,
|
|
623
|
-
consumerGroup,
|
|
624
|
-
visibilityTimeoutSeconds,
|
|
625
|
-
limit,
|
|
626
|
-
maxConcurrency
|
|
627
|
-
} = options;
|
|
607
|
+
const { queueName, consumerGroup, visibilityTimeoutSeconds, limit } = options;
|
|
628
608
|
if (limit !== void 0 && (limit < 1 || limit > 10)) {
|
|
629
609
|
throw new InvalidLimitError(limit);
|
|
630
610
|
}
|
|
@@ -642,9 +622,6 @@ var QueueClient = class {
|
|
|
642
622
|
if (limit !== void 0) {
|
|
643
623
|
headers.set("Vqs-Max-Messages", limit.toString());
|
|
644
624
|
}
|
|
645
|
-
if (maxConcurrency !== void 0) {
|
|
646
|
-
headers.set("Vqs-Max-Concurrency", maxConcurrency.toString());
|
|
647
|
-
}
|
|
648
625
|
const effectiveDeploymentId = this.getConsumeDeploymentId();
|
|
649
626
|
if (effectiveDeploymentId) {
|
|
650
627
|
headers.set("Vqs-Deployment-Id", effectiveDeploymentId);
|
|
@@ -661,18 +638,6 @@ var QueueClient = class {
|
|
|
661
638
|
}
|
|
662
639
|
if (!response.ok) {
|
|
663
640
|
const errorText = await response.text();
|
|
664
|
-
if (response.status === 429) {
|
|
665
|
-
let errorData = {};
|
|
666
|
-
try {
|
|
667
|
-
errorData = JSON.parse(errorText);
|
|
668
|
-
} catch {
|
|
669
|
-
}
|
|
670
|
-
throw new ConcurrencyLimitError(
|
|
671
|
-
errorData.error || "Concurrency limit exceeded or throttled",
|
|
672
|
-
errorData.currentInflight,
|
|
673
|
-
errorData.maxConcurrency
|
|
674
|
-
);
|
|
675
|
-
}
|
|
676
641
|
throwCommonHttpError(
|
|
677
642
|
response.status,
|
|
678
643
|
response.statusText,
|
|
@@ -710,26 +675,18 @@ var QueueClient = class {
|
|
|
710
675
|
* @param options.consumerGroup - Consumer group name (pattern: `[A-Za-z0-9_-]+`)
|
|
711
676
|
* @param options.messageId - Message ID to retrieve
|
|
712
677
|
* @param options.visibilityTimeoutSeconds - Lock duration (default: 30, min: 0, max: 3600)
|
|
713
|
-
* @param options.maxConcurrency - Max in-flight messages (default: unlimited, min: 1)
|
|
714
678
|
* @param transport - Deserializer for the message payload
|
|
715
679
|
* @returns Promise with the message
|
|
716
680
|
* @throws {MessageNotFoundError} When message doesn't exist
|
|
717
681
|
* @throws {MessageNotAvailableError} When message is in wrong state or was a duplicate
|
|
718
682
|
* @throws {MessageAlreadyProcessedError} When message was already processed
|
|
719
|
-
* @throws {ConcurrencyLimitError} When maxConcurrency exceeded
|
|
720
683
|
* @throws {BadRequestError} When parameters are invalid
|
|
721
684
|
* @throws {UnauthorizedError} When authentication fails
|
|
722
685
|
* @throws {ForbiddenError} When access is denied
|
|
723
686
|
* @throws {InternalServerError} When server encounters an error
|
|
724
687
|
*/
|
|
725
688
|
async receiveMessageById(options, transport) {
|
|
726
|
-
const {
|
|
727
|
-
queueName,
|
|
728
|
-
consumerGroup,
|
|
729
|
-
messageId,
|
|
730
|
-
visibilityTimeoutSeconds,
|
|
731
|
-
maxConcurrency
|
|
732
|
-
} = options;
|
|
689
|
+
const { queueName, consumerGroup, messageId, visibilityTimeoutSeconds } = options;
|
|
733
690
|
const headers = new Headers({
|
|
734
691
|
Authorization: `Bearer ${await this.getToken()}`,
|
|
735
692
|
Accept: "multipart/mixed",
|
|
@@ -741,9 +698,6 @@ var QueueClient = class {
|
|
|
741
698
|
visibilityTimeoutSeconds.toString()
|
|
742
699
|
);
|
|
743
700
|
}
|
|
744
|
-
if (maxConcurrency !== void 0) {
|
|
745
|
-
headers.set("Vqs-Max-Concurrency", maxConcurrency.toString());
|
|
746
|
-
}
|
|
747
701
|
const effectiveDeploymentId = this.getConsumeDeploymentId();
|
|
748
702
|
if (effectiveDeploymentId) {
|
|
749
703
|
headers.set("Vqs-Deployment-Id", effectiveDeploymentId);
|
|
@@ -777,18 +731,6 @@ var QueueClient = class {
|
|
|
777
731
|
if (response.status === 410) {
|
|
778
732
|
throw new MessageAlreadyProcessedError(messageId);
|
|
779
733
|
}
|
|
780
|
-
if (response.status === 429) {
|
|
781
|
-
let errorData = {};
|
|
782
|
-
try {
|
|
783
|
-
errorData = JSON.parse(errorText);
|
|
784
|
-
} catch {
|
|
785
|
-
}
|
|
786
|
-
throw new ConcurrencyLimitError(
|
|
787
|
-
errorData.error || "Concurrency limit exceeded or throttled",
|
|
788
|
-
errorData.currentInflight,
|
|
789
|
-
errorData.maxConcurrency
|
|
790
|
-
);
|
|
791
|
-
}
|
|
792
734
|
throwCommonHttpError(
|
|
793
735
|
response.status,
|
|
794
736
|
response.statusText,
|