@vercel/queue 0.0.0-alpha.34 → 0.0.0-alpha.35
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 +284 -34
- package/dist/index.d.mts +208 -54
- package/dist/index.d.ts +208 -54
- package/dist/index.js +146 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +146 -30
- 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 +120 -25
- package/dist/nextjs-pages.js.map +1 -1
- package/dist/nextjs-pages.mjs +120 -25
- package/dist/nextjs-pages.mjs.map +1 -1
- package/dist/types-BLG4ASI_.d.mts +504 -0
- package/dist/types-BLG4ASI_.d.ts +504 -0
- package/package.json +1 -1
- package/dist/types-BHtRP_i_.d.mts +0 -411
- package/dist/types-BHtRP_i_.d.ts +0 -411
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serializer/Deserializer interface for message payloads.
|
|
3
|
+
*
|
|
4
|
+
* Built-in implementations:
|
|
5
|
+
* - `JsonTransport` - JSON serialization (default, buffers entire payload)
|
|
6
|
+
* - `BufferTransport` - Binary data (buffers entire payload)
|
|
7
|
+
* - `StreamTransport` - Pass-through streaming (no buffering, ideal for large payloads)
|
|
8
|
+
*/
|
|
9
|
+
interface Transport<T = unknown> {
|
|
10
|
+
/**
|
|
11
|
+
* Serialize a value to a buffer or stream for transmission.
|
|
12
|
+
* The result is sent as the request body with the `contentType` header.
|
|
13
|
+
*/
|
|
14
|
+
serialize(value: T): Buffer | ReadableStream<Uint8Array>;
|
|
15
|
+
/**
|
|
16
|
+
* Deserialize a readable stream back to the original value.
|
|
17
|
+
* Called when receiving messages from the queue.
|
|
18
|
+
*/
|
|
19
|
+
deserialize(stream: ReadableStream<Uint8Array>): Promise<T>;
|
|
20
|
+
/**
|
|
21
|
+
* Optional cleanup method for deserialized payloads that may contain resources.
|
|
22
|
+
* Called automatically by ConsumerGroup on error; manual cleanup required for direct client usage.
|
|
23
|
+
* @param payload The deserialized payload to clean up
|
|
24
|
+
*/
|
|
25
|
+
finalize?(payload: T): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* MIME type for this serialization format.
|
|
28
|
+
* Sent as the Content-Type header when publishing messages.
|
|
29
|
+
*/
|
|
30
|
+
contentType: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* JSON serializer/deserializer (default transport).
|
|
34
|
+
*
|
|
35
|
+
* Ideal for structured data. Buffers the entire payload in memory for parsing.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* // Default usage
|
|
40
|
+
* await send("topic", { data: "example" });
|
|
41
|
+
*
|
|
42
|
+
* // With custom serialization
|
|
43
|
+
* const transport = new JsonTransport({
|
|
44
|
+
* replacer: (key, value) => key === "password" ? undefined : value,
|
|
45
|
+
* reviver: (key, value) => key === "date" ? new Date(value) : value,
|
|
46
|
+
* });
|
|
47
|
+
* await send("topic", { data: "example" }, { transport });
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
declare class JsonTransport<T = unknown> implements Transport<T> {
|
|
51
|
+
readonly contentType = "application/json";
|
|
52
|
+
readonly replacer?: Parameters<typeof JSON.stringify>[1];
|
|
53
|
+
readonly reviver?: Parameters<typeof JSON.parse>[1];
|
|
54
|
+
/**
|
|
55
|
+
* Create a new JsonTransport.
|
|
56
|
+
* @param options - Optional JSON serialization options
|
|
57
|
+
* @param options.replacer - Custom replacer for JSON.stringify
|
|
58
|
+
* @param options.reviver - Custom reviver for JSON.parse
|
|
59
|
+
*/
|
|
60
|
+
constructor(options?: {
|
|
61
|
+
replacer?: Parameters<typeof JSON.stringify>[1];
|
|
62
|
+
reviver?: Parameters<typeof JSON.parse>[1];
|
|
63
|
+
});
|
|
64
|
+
serialize(value: T): Buffer;
|
|
65
|
+
deserialize(stream: ReadableStream<Uint8Array>): Promise<T>;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Binary data serializer/deserializer.
|
|
69
|
+
*
|
|
70
|
+
* Ideal for binary data that fits in memory. Buffers the entire payload.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* const transport = new BufferTransport();
|
|
75
|
+
* await send("binary-topic", myBuffer, { transport });
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
declare class BufferTransport implements Transport<Buffer> {
|
|
79
|
+
readonly contentType = "application/octet-stream";
|
|
80
|
+
serialize(value: Buffer): Buffer;
|
|
81
|
+
deserialize(stream: ReadableStream<Uint8Array>): Promise<Buffer>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Pass-through stream serializer/deserializer.
|
|
85
|
+
*
|
|
86
|
+
* Ideal for large files and real-time streams. Does not buffer data in memory.
|
|
87
|
+
*
|
|
88
|
+
* **Important:** When using StreamTransport, you must call `finalize(payload)` when done
|
|
89
|
+
* processing to prevent resource leaks. ConsumerGroup handles this automatically;
|
|
90
|
+
* direct client usage requires manual cleanup.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* const transport = new StreamTransport();
|
|
95
|
+
*
|
|
96
|
+
* // Sending a stream
|
|
97
|
+
* await send("large-file", myReadableStream, { transport });
|
|
98
|
+
*
|
|
99
|
+
* // Receiving - cleanup handled by ConsumerGroup
|
|
100
|
+
* await receive("large-file", "processor", async (stream, meta) => {
|
|
101
|
+
* const reader = stream.getReader();
|
|
102
|
+
* // Process chunks...
|
|
103
|
+
* }, { transport });
|
|
104
|
+
*
|
|
105
|
+
* // Direct client usage - manual cleanup required
|
|
106
|
+
* try {
|
|
107
|
+
* for await (const msg of client.receiveMessages(options, transport)) {
|
|
108
|
+
* // Process stream...
|
|
109
|
+
* }
|
|
110
|
+
* } catch (error) {
|
|
111
|
+
* await transport.finalize(msg.payload); // Manual cleanup
|
|
112
|
+
* }
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
declare class StreamTransport implements Transport<ReadableStream<Uint8Array>> {
|
|
116
|
+
readonly contentType = "application/octet-stream";
|
|
117
|
+
serialize(value: ReadableStream<Uint8Array>): ReadableStream<Uint8Array>;
|
|
118
|
+
deserialize(stream: ReadableStream<Uint8Array>): Promise<ReadableStream<Uint8Array>>;
|
|
119
|
+
/**
|
|
120
|
+
* Consume any remaining stream data to prevent resource leaks.
|
|
121
|
+
* Called automatically by ConsumerGroup; manual call required for direct client usage.
|
|
122
|
+
*/
|
|
123
|
+
finalize(payload: ReadableStream<Uint8Array>): Promise<void>;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Vercel Queue Service client types
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
interface QueueClientOptions {
|
|
131
|
+
/**
|
|
132
|
+
* Base URL for the Vercel Queue Service API.
|
|
133
|
+
* Can also be set via VERCEL_QUEUE_BASE_URL environment variable.
|
|
134
|
+
* @default "https://vercel-queue.com"
|
|
135
|
+
*/
|
|
136
|
+
baseUrl?: string;
|
|
137
|
+
/**
|
|
138
|
+
* Base path for API endpoints.
|
|
139
|
+
* Can also be set via VERCEL_QUEUE_BASE_PATH environment variable.
|
|
140
|
+
* @default "/api/v3/topic"
|
|
141
|
+
*/
|
|
142
|
+
basePath?: string;
|
|
143
|
+
/**
|
|
144
|
+
* Authentication token for the Vercel Queue Service API.
|
|
145
|
+
* If not provided, the client will attempt to get a token via OIDC
|
|
146
|
+
* when running in a Vercel Function environment.
|
|
147
|
+
*/
|
|
148
|
+
token?: string;
|
|
149
|
+
/**
|
|
150
|
+
* Custom headers to include in all requests.
|
|
151
|
+
*/
|
|
152
|
+
headers?: Record<string, string>;
|
|
153
|
+
/**
|
|
154
|
+
* Deployment ID to include in requests.
|
|
155
|
+
* Used for message routing and lease validation.
|
|
156
|
+
* @default process.env.VERCEL_DEPLOYMENT_ID if pinToDeployment is true
|
|
157
|
+
*/
|
|
158
|
+
deploymentId?: string;
|
|
159
|
+
/**
|
|
160
|
+
* Whether to pin messages to the current deployment when publishing.
|
|
161
|
+
* When true, sends VERCEL_DEPLOYMENT_ID from environment, ensuring
|
|
162
|
+
* messages are routed to consumers on the same deployment.
|
|
163
|
+
*
|
|
164
|
+
* - Only affects send/publish operations
|
|
165
|
+
* - Consume operations always send deployment ID in production
|
|
166
|
+
* - Ignored in development mode (deployment ID is never sent locally)
|
|
167
|
+
* @default true
|
|
168
|
+
*/
|
|
169
|
+
pinToDeployment?: boolean;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Options for publishing messages to a topic.
|
|
173
|
+
*/
|
|
174
|
+
interface PublishOptions {
|
|
175
|
+
/**
|
|
176
|
+
* Unique key to prevent duplicate message submissions.
|
|
177
|
+
* Deduplication window: `min(message retention, 24 hours)`.
|
|
178
|
+
*/
|
|
179
|
+
idempotencyKey?: string;
|
|
180
|
+
/**
|
|
181
|
+
* Message retention time in seconds. After this period, the message expires.
|
|
182
|
+
* @default 86400 (24 hours)
|
|
183
|
+
* @minimum 60 (1 minute)
|
|
184
|
+
* @maximum 86400 (24 hours)
|
|
185
|
+
*/
|
|
186
|
+
retentionSeconds?: number;
|
|
187
|
+
/**
|
|
188
|
+
* Delay delivery of the message by this many seconds.
|
|
189
|
+
* The message will not be visible to consumers until the delay has passed.
|
|
190
|
+
* @default 0
|
|
191
|
+
* @minimum 0
|
|
192
|
+
* @maximum Value of retentionSeconds (delay cannot exceed retention)
|
|
193
|
+
*/
|
|
194
|
+
delaySeconds?: number;
|
|
195
|
+
}
|
|
196
|
+
interface SendMessageOptions<T = unknown> extends PublishOptions {
|
|
197
|
+
/**
|
|
198
|
+
* The topic/queue name to send the message to.
|
|
199
|
+
* Must match pattern: `[A-Za-z0-9_-]+`
|
|
200
|
+
*/
|
|
201
|
+
queueName: string;
|
|
202
|
+
/**
|
|
203
|
+
* The message payload. Will be serialized using the provided transport.
|
|
204
|
+
*/
|
|
205
|
+
payload: T;
|
|
206
|
+
}
|
|
207
|
+
interface SendMessageResponse {
|
|
208
|
+
/**
|
|
209
|
+
* The generated message ID
|
|
210
|
+
*/
|
|
211
|
+
messageId: string;
|
|
212
|
+
}
|
|
213
|
+
interface Message<T = unknown> {
|
|
214
|
+
/**
|
|
215
|
+
* Unique message identifier. Used for receive-by-ID operations.
|
|
216
|
+
*/
|
|
217
|
+
messageId: string;
|
|
218
|
+
/**
|
|
219
|
+
* The deserialized message payload.
|
|
220
|
+
* Note: If using StreamTransport, ensure proper cleanup by calling
|
|
221
|
+
* `transport.finalize(payload)` when done processing, especially in error cases.
|
|
222
|
+
*/
|
|
223
|
+
payload: T;
|
|
224
|
+
/**
|
|
225
|
+
* Number of times this message has been delivered.
|
|
226
|
+
* Starts at 1 for the first delivery, increments on each retry.
|
|
227
|
+
*/
|
|
228
|
+
deliveryCount: number;
|
|
229
|
+
/**
|
|
230
|
+
* Timestamp when the message was created/published.
|
|
231
|
+
*/
|
|
232
|
+
createdAt: Date;
|
|
233
|
+
/**
|
|
234
|
+
* MIME type of the message content.
|
|
235
|
+
* Set by the transport's `contentType` property during publish.
|
|
236
|
+
*/
|
|
237
|
+
contentType: string;
|
|
238
|
+
/**
|
|
239
|
+
* Receipt handle (lease token) for this message delivery.
|
|
240
|
+
* Required for delete and visibility extension operations.
|
|
241
|
+
* Valid only until the visibility timeout expires.
|
|
242
|
+
*/
|
|
243
|
+
receiptHandle: string;
|
|
244
|
+
}
|
|
245
|
+
interface ReceiveMessagesOptions<T = unknown> {
|
|
246
|
+
/**
|
|
247
|
+
* The topic/queue name to receive messages from.
|
|
248
|
+
* Must match pattern: `[A-Za-z0-9_-]+`
|
|
249
|
+
*/
|
|
250
|
+
queueName: string;
|
|
251
|
+
/**
|
|
252
|
+
* Consumer group name. Each consumer group maintains independent message state.
|
|
253
|
+
* Must match pattern: `[A-Za-z0-9_-]+`
|
|
254
|
+
*/
|
|
255
|
+
consumerGroup: string;
|
|
256
|
+
/**
|
|
257
|
+
* Time in seconds that messages will be invisible to other consumers after receipt.
|
|
258
|
+
* Set to 0 for immediate re-visibility (useful for peeking).
|
|
259
|
+
* @default 30
|
|
260
|
+
* @minimum 0
|
|
261
|
+
* @maximum 3600 (1 hour)
|
|
262
|
+
*/
|
|
263
|
+
visibilityTimeoutSeconds?: number;
|
|
264
|
+
/**
|
|
265
|
+
* Maximum number of messages to retrieve in a single request.
|
|
266
|
+
* @default 1
|
|
267
|
+
* @minimum 1
|
|
268
|
+
* @maximum 10
|
|
269
|
+
*/
|
|
270
|
+
limit?: number;
|
|
271
|
+
/**
|
|
272
|
+
* Maximum concurrent in-flight messages for this consumer group.
|
|
273
|
+
* When limit is reached, receive requests throw ConcurrencyLimitError.
|
|
274
|
+
* @default unlimited
|
|
275
|
+
* @minimum 1
|
|
276
|
+
*/
|
|
277
|
+
maxConcurrency?: number;
|
|
278
|
+
}
|
|
279
|
+
interface DeleteMessageOptions {
|
|
280
|
+
/**
|
|
281
|
+
* The topic/queue name the message belongs to.
|
|
282
|
+
*/
|
|
283
|
+
queueName: string;
|
|
284
|
+
/**
|
|
285
|
+
* Consumer group name.
|
|
286
|
+
*/
|
|
287
|
+
consumerGroup: string;
|
|
288
|
+
/**
|
|
289
|
+
* Receipt handle received when the message was consumed.
|
|
290
|
+
*/
|
|
291
|
+
receiptHandle: string;
|
|
292
|
+
}
|
|
293
|
+
interface DeleteMessageResponse {
|
|
294
|
+
/**
|
|
295
|
+
* Whether the message was successfully deleted
|
|
296
|
+
*/
|
|
297
|
+
deleted: boolean;
|
|
298
|
+
}
|
|
299
|
+
interface ChangeVisibilityOptions {
|
|
300
|
+
/**
|
|
301
|
+
* The topic/queue name the message belongs to.
|
|
302
|
+
*/
|
|
303
|
+
queueName: string;
|
|
304
|
+
/**
|
|
305
|
+
* Consumer group name.
|
|
306
|
+
*/
|
|
307
|
+
consumerGroup: string;
|
|
308
|
+
/**
|
|
309
|
+
* Receipt handle received when the message was consumed.
|
|
310
|
+
*/
|
|
311
|
+
receiptHandle: string;
|
|
312
|
+
/**
|
|
313
|
+
* New visibility timeout in seconds.
|
|
314
|
+
* Cannot extend beyond the message's original expiration time.
|
|
315
|
+
* @minimum 0
|
|
316
|
+
* @maximum 3600 (1 hour)
|
|
317
|
+
*/
|
|
318
|
+
visibilityTimeoutSeconds: number;
|
|
319
|
+
}
|
|
320
|
+
interface ChangeVisibilityResponse {
|
|
321
|
+
/**
|
|
322
|
+
* Whether the visibility was successfully updated
|
|
323
|
+
*/
|
|
324
|
+
success: boolean;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Message metadata provided to handlers
|
|
328
|
+
*/
|
|
329
|
+
interface MessageMetadata {
|
|
330
|
+
messageId: string;
|
|
331
|
+
deliveryCount: number;
|
|
332
|
+
createdAt: Date;
|
|
333
|
+
topicName: string;
|
|
334
|
+
consumerGroup: string;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Message handler function type
|
|
338
|
+
*/
|
|
339
|
+
type MessageHandler<T = unknown> = (message: T, metadata: MessageMetadata) => Promise<void> | void;
|
|
340
|
+
/**
|
|
341
|
+
* Options for creating a ConsumerGroup instance.
|
|
342
|
+
*/
|
|
343
|
+
interface ConsumerGroupOptions<T = unknown> {
|
|
344
|
+
/**
|
|
345
|
+
* Serializer/deserializer for the payload.
|
|
346
|
+
* Built-in options: JsonTransport, BufferTransport, StreamTransport.
|
|
347
|
+
* @default JsonTransport
|
|
348
|
+
*/
|
|
349
|
+
transport?: Transport<T>;
|
|
350
|
+
/**
|
|
351
|
+
* Time in seconds that messages will be invisible to other consumers after receipt.
|
|
352
|
+
* The ConsumerGroup will automatically extend this timeout during processing.
|
|
353
|
+
* @default 30
|
|
354
|
+
* @minimum 0
|
|
355
|
+
* @maximum 3600 (1 hour)
|
|
356
|
+
*/
|
|
357
|
+
visibilityTimeoutSeconds?: number;
|
|
358
|
+
/**
|
|
359
|
+
* How often (in seconds) to refresh the visibility timeout during message processing.
|
|
360
|
+
* Should be less than visibilityTimeoutSeconds to prevent message redelivery.
|
|
361
|
+
* @default Math.floor(visibilityTimeoutSeconds / 3)
|
|
362
|
+
*/
|
|
363
|
+
visibilityRefreshInterval?: number;
|
|
364
|
+
}
|
|
365
|
+
interface ReceiveMessageByIdOptions<T = unknown> {
|
|
366
|
+
/**
|
|
367
|
+
* The topic/queue name to receive the message from.
|
|
368
|
+
* Must match pattern: `[A-Za-z0-9_-]+`
|
|
369
|
+
*/
|
|
370
|
+
queueName: string;
|
|
371
|
+
/**
|
|
372
|
+
* Consumer group name.
|
|
373
|
+
* Must match pattern: `[A-Za-z0-9_-]+`
|
|
374
|
+
*/
|
|
375
|
+
consumerGroup: string;
|
|
376
|
+
/**
|
|
377
|
+
* The specific message ID to retrieve.
|
|
378
|
+
*/
|
|
379
|
+
messageId: string;
|
|
380
|
+
/**
|
|
381
|
+
* Time in seconds that the message will be invisible to other consumers after receipt.
|
|
382
|
+
* @default 30
|
|
383
|
+
* @minimum 0
|
|
384
|
+
* @maximum 3600 (1 hour)
|
|
385
|
+
*/
|
|
386
|
+
visibilityTimeoutSeconds?: number;
|
|
387
|
+
/**
|
|
388
|
+
* Maximum concurrent in-flight messages for this consumer group.
|
|
389
|
+
* @default unlimited
|
|
390
|
+
* @minimum 1
|
|
391
|
+
*/
|
|
392
|
+
maxConcurrency?: number;
|
|
393
|
+
}
|
|
394
|
+
interface ReceiveMessageByIdResponse<T = unknown> {
|
|
395
|
+
message: Message<T>;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Error thrown when a message does not exist or has expired.
|
|
399
|
+
*/
|
|
400
|
+
declare class MessageNotFoundError extends Error {
|
|
401
|
+
constructor(messageId: string);
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Error thrown when a message exists but cannot be processed.
|
|
405
|
+
* This can happen when the message is in the wrong state or already claimed by another consumer.
|
|
406
|
+
*/
|
|
407
|
+
declare class MessageNotAvailableError extends Error {
|
|
408
|
+
constructor(messageId: string, reason?: string);
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Error thrown when message data is corrupted or can't be parsed
|
|
412
|
+
*/
|
|
413
|
+
declare class MessageCorruptedError extends Error {
|
|
414
|
+
constructor(messageId: string, reason: string);
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Error thrown when there are no messages available in the queue.
|
|
418
|
+
*/
|
|
419
|
+
declare class QueueEmptyError extends Error {
|
|
420
|
+
constructor(queueName: string, consumerGroup: string);
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Error thrown when a message is temporarily locked by another consumer.
|
|
424
|
+
* The message is currently being processed and cannot be claimed.
|
|
425
|
+
*/
|
|
426
|
+
declare class MessageLockedError extends Error {
|
|
427
|
+
/** Suggested retry delay in seconds, if provided by the server. */
|
|
428
|
+
readonly retryAfter?: number;
|
|
429
|
+
constructor(messageId: string, retryAfter?: number);
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Error thrown when authentication fails.
|
|
433
|
+
* This typically means the token is missing, invalid, or expired.
|
|
434
|
+
*/
|
|
435
|
+
declare class UnauthorizedError extends Error {
|
|
436
|
+
constructor(message?: string);
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Error thrown when access is forbidden.
|
|
440
|
+
* This typically means the queue belongs to a different environment or project.
|
|
441
|
+
*/
|
|
442
|
+
declare class ForbiddenError extends Error {
|
|
443
|
+
constructor(message?: string);
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Error thrown when request parameters are invalid.
|
|
447
|
+
*/
|
|
448
|
+
declare class BadRequestError extends Error {
|
|
449
|
+
constructor(message: string);
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Error thrown when the server encounters an unexpected error.
|
|
453
|
+
*/
|
|
454
|
+
declare class InternalServerError extends Error {
|
|
455
|
+
constructor(message?: string);
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Error thrown when the batch limit parameter is outside the valid range.
|
|
459
|
+
* The limit must be between 1 and 10 (inclusive).
|
|
460
|
+
*/
|
|
461
|
+
declare class InvalidLimitError extends Error {
|
|
462
|
+
constructor(limit: number, min?: number, max?: number);
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Error thrown when attempting to process a message that has already been successfully processed.
|
|
466
|
+
*/
|
|
467
|
+
declare class MessageAlreadyProcessedError extends Error {
|
|
468
|
+
constructor(messageId: string);
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Error thrown when the concurrency limit is exceeded.
|
|
472
|
+
* This occurs when maxConcurrency is set and too many messages are already in-flight.
|
|
473
|
+
*/
|
|
474
|
+
declare class ConcurrencyLimitError extends Error {
|
|
475
|
+
/** Current number of in-flight messages for this consumer group. */
|
|
476
|
+
readonly currentInflight?: number;
|
|
477
|
+
/** Maximum allowed concurrent messages (as configured). */
|
|
478
|
+
readonly maxConcurrency?: number;
|
|
479
|
+
constructor(message?: string, currentInflight?: number, maxConcurrency?: number);
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Error thrown when a duplicate idempotency key is detected.
|
|
483
|
+
* The message was already sent within the deduplication window.
|
|
484
|
+
*/
|
|
485
|
+
declare class DuplicateMessageError extends Error {
|
|
486
|
+
readonly idempotencyKey?: string;
|
|
487
|
+
constructor(message: string, idempotencyKey?: string);
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Error thrown when consumer discovery fails.
|
|
491
|
+
* This typically means the deployment could not be reached or is not configured correctly.
|
|
492
|
+
*/
|
|
493
|
+
declare class ConsumerDiscoveryError extends Error {
|
|
494
|
+
readonly deploymentId?: string;
|
|
495
|
+
constructor(message: string, deploymentId?: string);
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Error thrown when the consumer registry is not configured for the project.
|
|
499
|
+
*/
|
|
500
|
+
declare class ConsumerRegistryNotConfiguredError extends Error {
|
|
501
|
+
constructor(message?: string);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
export { BufferTransport as B, type ChangeVisibilityOptions as C, type DeleteMessageOptions as D, ForbiddenError as F, InternalServerError as I, JsonTransport as J, type Message as M, type PublishOptions as P, type QueueClientOptions as Q, type ReceiveMessagesOptions as R, type SendMessageOptions as S, type Transport as T, UnauthorizedError as U, type SendMessageResponse as a, type ReceiveMessageByIdOptions as b, type ReceiveMessageByIdResponse as c, type DeleteMessageResponse as d, type ChangeVisibilityResponse as e, type MessageHandler as f, type ConsumerGroupOptions as g, StreamTransport as h, BadRequestError as i, ConcurrencyLimitError as j, ConsumerDiscoveryError as k, ConsumerRegistryNotConfiguredError as l, DuplicateMessageError as m, InvalidLimitError as n, MessageAlreadyProcessedError as o, MessageCorruptedError as p, MessageLockedError as q, MessageNotAvailableError as r, MessageNotFoundError as s, QueueEmptyError as t, type MessageMetadata as u };
|