@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/index.mjs
CHANGED
|
@@ -153,18 +153,6 @@ var MessageAlreadyProcessedError = class extends Error {
|
|
|
153
153
|
this.name = "MessageAlreadyProcessedError";
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
|
-
var ConcurrencyLimitError = class extends Error {
|
|
157
|
-
/** Current number of in-flight messages for this consumer group. */
|
|
158
|
-
currentInflight;
|
|
159
|
-
/** Maximum allowed concurrent messages (as configured). */
|
|
160
|
-
maxConcurrency;
|
|
161
|
-
constructor(message = "Concurrency limit exceeded", currentInflight, maxConcurrency) {
|
|
162
|
-
super(message);
|
|
163
|
-
this.name = "ConcurrencyLimitError";
|
|
164
|
-
this.currentInflight = currentInflight;
|
|
165
|
-
this.maxConcurrency = maxConcurrency;
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
156
|
var DuplicateMessageError = class extends Error {
|
|
169
157
|
idempotencyKey;
|
|
170
158
|
constructor(message, idempotencyKey) {
|
|
@@ -649,25 +637,17 @@ var QueueClient = class {
|
|
|
649
637
|
* @param options.consumerGroup - Consumer group name (pattern: `[A-Za-z0-9_-]+`)
|
|
650
638
|
* @param options.visibilityTimeoutSeconds - Lock duration (default: 30, min: 0, max: 3600)
|
|
651
639
|
* @param options.limit - Max messages to retrieve (default: 1, min: 1, max: 10)
|
|
652
|
-
* @param options.maxConcurrency - Max in-flight messages (default: unlimited, min: 1)
|
|
653
640
|
* @param transport - Deserializer for message payloads
|
|
654
641
|
* @yields Message objects with payload, messageId, receiptHandle, etc.
|
|
655
642
|
* @throws {QueueEmptyError} When no messages available
|
|
656
643
|
* @throws {InvalidLimitError} When limit is outside 1-10 range
|
|
657
|
-
* @throws {ConcurrencyLimitError} When maxConcurrency exceeded
|
|
658
644
|
* @throws {BadRequestError} When parameters are invalid
|
|
659
645
|
* @throws {UnauthorizedError} When authentication fails
|
|
660
646
|
* @throws {ForbiddenError} When access is denied
|
|
661
647
|
* @throws {InternalServerError} When server encounters an error
|
|
662
648
|
*/
|
|
663
649
|
async *receiveMessages(options, transport) {
|
|
664
|
-
const {
|
|
665
|
-
queueName,
|
|
666
|
-
consumerGroup,
|
|
667
|
-
visibilityTimeoutSeconds,
|
|
668
|
-
limit,
|
|
669
|
-
maxConcurrency
|
|
670
|
-
} = options;
|
|
650
|
+
const { queueName, consumerGroup, visibilityTimeoutSeconds, limit } = options;
|
|
671
651
|
if (limit !== void 0 && (limit < 1 || limit > 10)) {
|
|
672
652
|
throw new InvalidLimitError(limit);
|
|
673
653
|
}
|
|
@@ -685,9 +665,6 @@ var QueueClient = class {
|
|
|
685
665
|
if (limit !== void 0) {
|
|
686
666
|
headers.set("Vqs-Max-Messages", limit.toString());
|
|
687
667
|
}
|
|
688
|
-
if (maxConcurrency !== void 0) {
|
|
689
|
-
headers.set("Vqs-Max-Concurrency", maxConcurrency.toString());
|
|
690
|
-
}
|
|
691
668
|
const effectiveDeploymentId = this.getConsumeDeploymentId();
|
|
692
669
|
if (effectiveDeploymentId) {
|
|
693
670
|
headers.set("Vqs-Deployment-Id", effectiveDeploymentId);
|
|
@@ -704,18 +681,6 @@ var QueueClient = class {
|
|
|
704
681
|
}
|
|
705
682
|
if (!response.ok) {
|
|
706
683
|
const errorText = await response.text();
|
|
707
|
-
if (response.status === 429) {
|
|
708
|
-
let errorData = {};
|
|
709
|
-
try {
|
|
710
|
-
errorData = JSON.parse(errorText);
|
|
711
|
-
} catch {
|
|
712
|
-
}
|
|
713
|
-
throw new ConcurrencyLimitError(
|
|
714
|
-
errorData.error || "Concurrency limit exceeded or throttled",
|
|
715
|
-
errorData.currentInflight,
|
|
716
|
-
errorData.maxConcurrency
|
|
717
|
-
);
|
|
718
|
-
}
|
|
719
684
|
throwCommonHttpError(
|
|
720
685
|
response.status,
|
|
721
686
|
response.statusText,
|
|
@@ -753,26 +718,18 @@ var QueueClient = class {
|
|
|
753
718
|
* @param options.consumerGroup - Consumer group name (pattern: `[A-Za-z0-9_-]+`)
|
|
754
719
|
* @param options.messageId - Message ID to retrieve
|
|
755
720
|
* @param options.visibilityTimeoutSeconds - Lock duration (default: 30, min: 0, max: 3600)
|
|
756
|
-
* @param options.maxConcurrency - Max in-flight messages (default: unlimited, min: 1)
|
|
757
721
|
* @param transport - Deserializer for the message payload
|
|
758
722
|
* @returns Promise with the message
|
|
759
723
|
* @throws {MessageNotFoundError} When message doesn't exist
|
|
760
724
|
* @throws {MessageNotAvailableError} When message is in wrong state or was a duplicate
|
|
761
725
|
* @throws {MessageAlreadyProcessedError} When message was already processed
|
|
762
|
-
* @throws {ConcurrencyLimitError} When maxConcurrency exceeded
|
|
763
726
|
* @throws {BadRequestError} When parameters are invalid
|
|
764
727
|
* @throws {UnauthorizedError} When authentication fails
|
|
765
728
|
* @throws {ForbiddenError} When access is denied
|
|
766
729
|
* @throws {InternalServerError} When server encounters an error
|
|
767
730
|
*/
|
|
768
731
|
async receiveMessageById(options, transport) {
|
|
769
|
-
const {
|
|
770
|
-
queueName,
|
|
771
|
-
consumerGroup,
|
|
772
|
-
messageId,
|
|
773
|
-
visibilityTimeoutSeconds,
|
|
774
|
-
maxConcurrency
|
|
775
|
-
} = options;
|
|
732
|
+
const { queueName, consumerGroup, messageId, visibilityTimeoutSeconds } = options;
|
|
776
733
|
const headers = new Headers({
|
|
777
734
|
Authorization: `Bearer ${await this.getToken()}`,
|
|
778
735
|
Accept: "multipart/mixed",
|
|
@@ -784,9 +741,6 @@ var QueueClient = class {
|
|
|
784
741
|
visibilityTimeoutSeconds.toString()
|
|
785
742
|
);
|
|
786
743
|
}
|
|
787
|
-
if (maxConcurrency !== void 0) {
|
|
788
|
-
headers.set("Vqs-Max-Concurrency", maxConcurrency.toString());
|
|
789
|
-
}
|
|
790
744
|
const effectiveDeploymentId = this.getConsumeDeploymentId();
|
|
791
745
|
if (effectiveDeploymentId) {
|
|
792
746
|
headers.set("Vqs-Deployment-Id", effectiveDeploymentId);
|
|
@@ -820,18 +774,6 @@ var QueueClient = class {
|
|
|
820
774
|
if (response.status === 410) {
|
|
821
775
|
throw new MessageAlreadyProcessedError(messageId);
|
|
822
776
|
}
|
|
823
|
-
if (response.status === 429) {
|
|
824
|
-
let errorData = {};
|
|
825
|
-
try {
|
|
826
|
-
errorData = JSON.parse(errorText);
|
|
827
|
-
} catch {
|
|
828
|
-
}
|
|
829
|
-
throw new ConcurrencyLimitError(
|
|
830
|
-
errorData.error || "Concurrency limit exceeded or throttled",
|
|
831
|
-
errorData.currentInflight,
|
|
832
|
-
errorData.maxConcurrency
|
|
833
|
-
);
|
|
834
|
-
}
|
|
835
777
|
throwCommonHttpError(
|
|
836
778
|
response.status,
|
|
837
779
|
response.statusText,
|
|
@@ -1512,7 +1454,6 @@ export {
|
|
|
1512
1454
|
BadRequestError,
|
|
1513
1455
|
BufferTransport,
|
|
1514
1456
|
Client,
|
|
1515
|
-
ConcurrencyLimitError,
|
|
1516
1457
|
ConsumerDiscoveryError,
|
|
1517
1458
|
ConsumerRegistryNotConfiguredError,
|
|
1518
1459
|
DuplicateMessageError,
|