@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.js
CHANGED
|
@@ -146,18 +146,6 @@ var MessageAlreadyProcessedError = class extends Error {
|
|
|
146
146
|
this.name = "MessageAlreadyProcessedError";
|
|
147
147
|
}
|
|
148
148
|
};
|
|
149
|
-
var ConcurrencyLimitError = class extends Error {
|
|
150
|
-
/** Current number of in-flight messages for this consumer group. */
|
|
151
|
-
currentInflight;
|
|
152
|
-
/** Maximum allowed concurrent messages (as configured). */
|
|
153
|
-
maxConcurrency;
|
|
154
|
-
constructor(message = "Concurrency limit exceeded", currentInflight, maxConcurrency) {
|
|
155
|
-
super(message);
|
|
156
|
-
this.name = "ConcurrencyLimitError";
|
|
157
|
-
this.currentInflight = currentInflight;
|
|
158
|
-
this.maxConcurrency = maxConcurrency;
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
149
|
var DuplicateMessageError = class extends Error {
|
|
162
150
|
idempotencyKey;
|
|
163
151
|
constructor(message, idempotencyKey) {
|
|
@@ -642,25 +630,17 @@ var QueueClient = class {
|
|
|
642
630
|
* @param options.consumerGroup - Consumer group name (pattern: `[A-Za-z0-9_-]+`)
|
|
643
631
|
* @param options.visibilityTimeoutSeconds - Lock duration (default: 30, min: 0, max: 3600)
|
|
644
632
|
* @param options.limit - Max messages to retrieve (default: 1, min: 1, max: 10)
|
|
645
|
-
* @param options.maxConcurrency - Max in-flight messages (default: unlimited, min: 1)
|
|
646
633
|
* @param transport - Deserializer for message payloads
|
|
647
634
|
* @yields Message objects with payload, messageId, receiptHandle, etc.
|
|
648
635
|
* @throws {QueueEmptyError} When no messages available
|
|
649
636
|
* @throws {InvalidLimitError} When limit is outside 1-10 range
|
|
650
|
-
* @throws {ConcurrencyLimitError} When maxConcurrency exceeded
|
|
651
637
|
* @throws {BadRequestError} When parameters are invalid
|
|
652
638
|
* @throws {UnauthorizedError} When authentication fails
|
|
653
639
|
* @throws {ForbiddenError} When access is denied
|
|
654
640
|
* @throws {InternalServerError} When server encounters an error
|
|
655
641
|
*/
|
|
656
642
|
async *receiveMessages(options, transport) {
|
|
657
|
-
const {
|
|
658
|
-
queueName,
|
|
659
|
-
consumerGroup,
|
|
660
|
-
visibilityTimeoutSeconds,
|
|
661
|
-
limit,
|
|
662
|
-
maxConcurrency
|
|
663
|
-
} = options;
|
|
643
|
+
const { queueName, consumerGroup, visibilityTimeoutSeconds, limit } = options;
|
|
664
644
|
if (limit !== void 0 && (limit < 1 || limit > 10)) {
|
|
665
645
|
throw new InvalidLimitError(limit);
|
|
666
646
|
}
|
|
@@ -678,9 +658,6 @@ var QueueClient = class {
|
|
|
678
658
|
if (limit !== void 0) {
|
|
679
659
|
headers.set("Vqs-Max-Messages", limit.toString());
|
|
680
660
|
}
|
|
681
|
-
if (maxConcurrency !== void 0) {
|
|
682
|
-
headers.set("Vqs-Max-Concurrency", maxConcurrency.toString());
|
|
683
|
-
}
|
|
684
661
|
const effectiveDeploymentId = this.getConsumeDeploymentId();
|
|
685
662
|
if (effectiveDeploymentId) {
|
|
686
663
|
headers.set("Vqs-Deployment-Id", effectiveDeploymentId);
|
|
@@ -697,18 +674,6 @@ var QueueClient = class {
|
|
|
697
674
|
}
|
|
698
675
|
if (!response.ok) {
|
|
699
676
|
const errorText = await response.text();
|
|
700
|
-
if (response.status === 429) {
|
|
701
|
-
let errorData = {};
|
|
702
|
-
try {
|
|
703
|
-
errorData = JSON.parse(errorText);
|
|
704
|
-
} catch {
|
|
705
|
-
}
|
|
706
|
-
throw new ConcurrencyLimitError(
|
|
707
|
-
errorData.error || "Concurrency limit exceeded or throttled",
|
|
708
|
-
errorData.currentInflight,
|
|
709
|
-
errorData.maxConcurrency
|
|
710
|
-
);
|
|
711
|
-
}
|
|
712
677
|
throwCommonHttpError(
|
|
713
678
|
response.status,
|
|
714
679
|
response.statusText,
|
|
@@ -746,26 +711,18 @@ var QueueClient = class {
|
|
|
746
711
|
* @param options.consumerGroup - Consumer group name (pattern: `[A-Za-z0-9_-]+`)
|
|
747
712
|
* @param options.messageId - Message ID to retrieve
|
|
748
713
|
* @param options.visibilityTimeoutSeconds - Lock duration (default: 30, min: 0, max: 3600)
|
|
749
|
-
* @param options.maxConcurrency - Max in-flight messages (default: unlimited, min: 1)
|
|
750
714
|
* @param transport - Deserializer for the message payload
|
|
751
715
|
* @returns Promise with the message
|
|
752
716
|
* @throws {MessageNotFoundError} When message doesn't exist
|
|
753
717
|
* @throws {MessageNotAvailableError} When message is in wrong state or was a duplicate
|
|
754
718
|
* @throws {MessageAlreadyProcessedError} When message was already processed
|
|
755
|
-
* @throws {ConcurrencyLimitError} When maxConcurrency exceeded
|
|
756
719
|
* @throws {BadRequestError} When parameters are invalid
|
|
757
720
|
* @throws {UnauthorizedError} When authentication fails
|
|
758
721
|
* @throws {ForbiddenError} When access is denied
|
|
759
722
|
* @throws {InternalServerError} When server encounters an error
|
|
760
723
|
*/
|
|
761
724
|
async receiveMessageById(options, transport) {
|
|
762
|
-
const {
|
|
763
|
-
queueName,
|
|
764
|
-
consumerGroup,
|
|
765
|
-
messageId,
|
|
766
|
-
visibilityTimeoutSeconds,
|
|
767
|
-
maxConcurrency
|
|
768
|
-
} = options;
|
|
725
|
+
const { queueName, consumerGroup, messageId, visibilityTimeoutSeconds } = options;
|
|
769
726
|
const headers = new Headers({
|
|
770
727
|
Authorization: `Bearer ${await this.getToken()}`,
|
|
771
728
|
Accept: "multipart/mixed",
|
|
@@ -777,9 +734,6 @@ var QueueClient = class {
|
|
|
777
734
|
visibilityTimeoutSeconds.toString()
|
|
778
735
|
);
|
|
779
736
|
}
|
|
780
|
-
if (maxConcurrency !== void 0) {
|
|
781
|
-
headers.set("Vqs-Max-Concurrency", maxConcurrency.toString());
|
|
782
|
-
}
|
|
783
737
|
const effectiveDeploymentId = this.getConsumeDeploymentId();
|
|
784
738
|
if (effectiveDeploymentId) {
|
|
785
739
|
headers.set("Vqs-Deployment-Id", effectiveDeploymentId);
|
|
@@ -813,18 +767,6 @@ var QueueClient = class {
|
|
|
813
767
|
if (response.status === 410) {
|
|
814
768
|
throw new MessageAlreadyProcessedError(messageId);
|
|
815
769
|
}
|
|
816
|
-
if (response.status === 429) {
|
|
817
|
-
let errorData = {};
|
|
818
|
-
try {
|
|
819
|
-
errorData = JSON.parse(errorText);
|
|
820
|
-
} catch {
|
|
821
|
-
}
|
|
822
|
-
throw new ConcurrencyLimitError(
|
|
823
|
-
errorData.error || "Concurrency limit exceeded or throttled",
|
|
824
|
-
errorData.currentInflight,
|
|
825
|
-
errorData.maxConcurrency
|
|
826
|
-
);
|
|
827
|
-
}
|
|
828
770
|
throwCommonHttpError(
|
|
829
771
|
response.status,
|
|
830
772
|
response.statusText,
|