@vercel/queue 0.0.0-alpha.32 → 0.0.0-alpha.33
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/dist/index.d.mts +260 -73
- package/dist/index.d.ts +260 -73
- package/dist/index.js +308 -245
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +307 -245
- 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 +126 -118
- package/dist/nextjs-pages.js.map +1 -1
- package/dist/nextjs-pages.mjs +126 -118
- package/dist/nextjs-pages.mjs.map +1 -1
- package/dist/{types-JvOenjfT.d.mts → types-Dw29Fr9y.d.mts} +126 -2
- package/dist/{types-JvOenjfT.d.ts → types-Dw29Fr9y.d.ts} +126 -2
- package/package.json +1 -1
|
@@ -50,7 +50,7 @@ declare class BufferTransport implements Transport<Buffer> {
|
|
|
50
50
|
*
|
|
51
51
|
* IMPORTANT: When using StreamTransport, you must call finalize(payload) when done
|
|
52
52
|
* processing the message to prevent resource leaks, especially in error cases.
|
|
53
|
-
* ConsumerGroup handles this automatically, but direct
|
|
53
|
+
* ConsumerGroup handles this automatically, but direct Client usage requires manual cleanup.
|
|
54
54
|
*
|
|
55
55
|
* Example usage:
|
|
56
56
|
* ```typescript
|
|
@@ -77,6 +77,29 @@ declare class StreamTransport implements Transport<ReadableStream<Uint8Array>> {
|
|
|
77
77
|
* Vercel Queue Service client types
|
|
78
78
|
*/
|
|
79
79
|
|
|
80
|
+
interface QueueClientOptions {
|
|
81
|
+
/**
|
|
82
|
+
* Base URL for the Vercel Queue Service API
|
|
83
|
+
* Can also be set via VERCEL_QUEUE_BASE_URL environment variable
|
|
84
|
+
* @default "https://vercel-queue.com"
|
|
85
|
+
*/
|
|
86
|
+
baseUrl?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Base path for API endpoints
|
|
89
|
+
* Can also be set via VERCEL_QUEUE_BASE_PATH environment variable
|
|
90
|
+
* @default "/api/v2/messages"
|
|
91
|
+
*/
|
|
92
|
+
basePath?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Authentication token for the Vercel Queue Service API
|
|
95
|
+
* If not provided, the client will attempt to get a token via OIDC
|
|
96
|
+
*/
|
|
97
|
+
token?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Custom headers to include in all requests
|
|
100
|
+
*/
|
|
101
|
+
headers?: Record<string, string>;
|
|
102
|
+
}
|
|
80
103
|
/**
|
|
81
104
|
* Shared options for publishing messages
|
|
82
105
|
*/
|
|
@@ -143,6 +166,79 @@ interface Message<T = unknown> {
|
|
|
143
166
|
*/
|
|
144
167
|
ticket: string;
|
|
145
168
|
}
|
|
169
|
+
interface ReceiveMessagesOptions<T = unknown> {
|
|
170
|
+
/**
|
|
171
|
+
* The queue name to receive messages from
|
|
172
|
+
*/
|
|
173
|
+
queueName: string;
|
|
174
|
+
/**
|
|
175
|
+
* Consumer group name
|
|
176
|
+
*/
|
|
177
|
+
consumerGroup: string;
|
|
178
|
+
/**
|
|
179
|
+
* Time in seconds that messages will be invisible to other consumers
|
|
180
|
+
* @default 900 (15 minutes)
|
|
181
|
+
*/
|
|
182
|
+
visibilityTimeoutSeconds?: number;
|
|
183
|
+
/**
|
|
184
|
+
* Maximum number of messages to retrieve
|
|
185
|
+
* @default 10
|
|
186
|
+
* @max 10
|
|
187
|
+
*/
|
|
188
|
+
limit?: number;
|
|
189
|
+
}
|
|
190
|
+
interface DeleteMessageOptions {
|
|
191
|
+
/**
|
|
192
|
+
* The queue name the message belongs to
|
|
193
|
+
*/
|
|
194
|
+
queueName: string;
|
|
195
|
+
/**
|
|
196
|
+
* Consumer group name
|
|
197
|
+
*/
|
|
198
|
+
consumerGroup: string;
|
|
199
|
+
/**
|
|
200
|
+
* The message ID to delete
|
|
201
|
+
*/
|
|
202
|
+
messageId: string;
|
|
203
|
+
/**
|
|
204
|
+
* Ticket received from the message
|
|
205
|
+
*/
|
|
206
|
+
ticket: string;
|
|
207
|
+
}
|
|
208
|
+
interface DeleteMessageResponse {
|
|
209
|
+
/**
|
|
210
|
+
* Whether the message was successfully deleted
|
|
211
|
+
*/
|
|
212
|
+
deleted: boolean;
|
|
213
|
+
}
|
|
214
|
+
interface ChangeVisibilityOptions {
|
|
215
|
+
/**
|
|
216
|
+
* The queue name the message belongs to
|
|
217
|
+
*/
|
|
218
|
+
queueName: string;
|
|
219
|
+
/**
|
|
220
|
+
* Consumer group name
|
|
221
|
+
*/
|
|
222
|
+
consumerGroup: string;
|
|
223
|
+
/**
|
|
224
|
+
* The message ID to update
|
|
225
|
+
*/
|
|
226
|
+
messageId: string;
|
|
227
|
+
/**
|
|
228
|
+
* Ticket received from the message
|
|
229
|
+
*/
|
|
230
|
+
ticket: string;
|
|
231
|
+
/**
|
|
232
|
+
* New visibility timeout in seconds
|
|
233
|
+
*/
|
|
234
|
+
visibilityTimeoutSeconds: number;
|
|
235
|
+
}
|
|
236
|
+
interface ChangeVisibilityResponse {
|
|
237
|
+
/**
|
|
238
|
+
* Whether the visibility was successfully updated
|
|
239
|
+
*/
|
|
240
|
+
updated: boolean;
|
|
241
|
+
}
|
|
146
242
|
/**
|
|
147
243
|
* Result indicating the message should be timed out for retry later
|
|
148
244
|
*/
|
|
@@ -190,6 +286,34 @@ interface ConsumerGroupOptions<T = unknown> {
|
|
|
190
286
|
*/
|
|
191
287
|
refreshInterval?: number;
|
|
192
288
|
}
|
|
289
|
+
interface ReceiveMessageByIdOptions<T = unknown> {
|
|
290
|
+
/**
|
|
291
|
+
* The queue name to receive the message from
|
|
292
|
+
*/
|
|
293
|
+
queueName: string;
|
|
294
|
+
/**
|
|
295
|
+
* Consumer group name
|
|
296
|
+
*/
|
|
297
|
+
consumerGroup: string;
|
|
298
|
+
/**
|
|
299
|
+
* The message ID to retrieve
|
|
300
|
+
*/
|
|
301
|
+
messageId: string;
|
|
302
|
+
/**
|
|
303
|
+
* Time in seconds that the message will be invisible to other consumers
|
|
304
|
+
* @default 900 (15 minutes)
|
|
305
|
+
*/
|
|
306
|
+
visibilityTimeoutSeconds?: number;
|
|
307
|
+
/**
|
|
308
|
+
* Skip payload content and only return message metadata
|
|
309
|
+
* When true, the server returns a 204 status with headers containing message metadata
|
|
310
|
+
* @default false
|
|
311
|
+
*/
|
|
312
|
+
skipPayload?: boolean;
|
|
313
|
+
}
|
|
314
|
+
interface ReceiveMessageByIdResponse<T = unknown, TSkipPayload extends boolean = false> {
|
|
315
|
+
message: TSkipPayload extends true ? Message<void> : Message<T>;
|
|
316
|
+
}
|
|
193
317
|
/**
|
|
194
318
|
* Error thrown when a message is not found (404)
|
|
195
319
|
*/
|
|
@@ -253,4 +377,4 @@ declare class InvalidLimitError extends Error {
|
|
|
253
377
|
constructor(limit: number, min?: number, max?: number);
|
|
254
378
|
}
|
|
255
379
|
|
|
256
|
-
export { BufferTransport as B, type
|
|
380
|
+
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, InvalidLimitError as j, MessageCorruptedError as k, MessageLockedError as l, MessageNotAvailableError as m, MessageNotFoundError as n, QueueEmptyError as o, type MessageHandlerResult as p, type MessageMetadata as q, type MessageTimeoutResult as r };
|
|
@@ -50,7 +50,7 @@ declare class BufferTransport implements Transport<Buffer> {
|
|
|
50
50
|
*
|
|
51
51
|
* IMPORTANT: When using StreamTransport, you must call finalize(payload) when done
|
|
52
52
|
* processing the message to prevent resource leaks, especially in error cases.
|
|
53
|
-
* ConsumerGroup handles this automatically, but direct
|
|
53
|
+
* ConsumerGroup handles this automatically, but direct Client usage requires manual cleanup.
|
|
54
54
|
*
|
|
55
55
|
* Example usage:
|
|
56
56
|
* ```typescript
|
|
@@ -77,6 +77,29 @@ declare class StreamTransport implements Transport<ReadableStream<Uint8Array>> {
|
|
|
77
77
|
* Vercel Queue Service client types
|
|
78
78
|
*/
|
|
79
79
|
|
|
80
|
+
interface QueueClientOptions {
|
|
81
|
+
/**
|
|
82
|
+
* Base URL for the Vercel Queue Service API
|
|
83
|
+
* Can also be set via VERCEL_QUEUE_BASE_URL environment variable
|
|
84
|
+
* @default "https://vercel-queue.com"
|
|
85
|
+
*/
|
|
86
|
+
baseUrl?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Base path for API endpoints
|
|
89
|
+
* Can also be set via VERCEL_QUEUE_BASE_PATH environment variable
|
|
90
|
+
* @default "/api/v2/messages"
|
|
91
|
+
*/
|
|
92
|
+
basePath?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Authentication token for the Vercel Queue Service API
|
|
95
|
+
* If not provided, the client will attempt to get a token via OIDC
|
|
96
|
+
*/
|
|
97
|
+
token?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Custom headers to include in all requests
|
|
100
|
+
*/
|
|
101
|
+
headers?: Record<string, string>;
|
|
102
|
+
}
|
|
80
103
|
/**
|
|
81
104
|
* Shared options for publishing messages
|
|
82
105
|
*/
|
|
@@ -143,6 +166,79 @@ interface Message<T = unknown> {
|
|
|
143
166
|
*/
|
|
144
167
|
ticket: string;
|
|
145
168
|
}
|
|
169
|
+
interface ReceiveMessagesOptions<T = unknown> {
|
|
170
|
+
/**
|
|
171
|
+
* The queue name to receive messages from
|
|
172
|
+
*/
|
|
173
|
+
queueName: string;
|
|
174
|
+
/**
|
|
175
|
+
* Consumer group name
|
|
176
|
+
*/
|
|
177
|
+
consumerGroup: string;
|
|
178
|
+
/**
|
|
179
|
+
* Time in seconds that messages will be invisible to other consumers
|
|
180
|
+
* @default 900 (15 minutes)
|
|
181
|
+
*/
|
|
182
|
+
visibilityTimeoutSeconds?: number;
|
|
183
|
+
/**
|
|
184
|
+
* Maximum number of messages to retrieve
|
|
185
|
+
* @default 10
|
|
186
|
+
* @max 10
|
|
187
|
+
*/
|
|
188
|
+
limit?: number;
|
|
189
|
+
}
|
|
190
|
+
interface DeleteMessageOptions {
|
|
191
|
+
/**
|
|
192
|
+
* The queue name the message belongs to
|
|
193
|
+
*/
|
|
194
|
+
queueName: string;
|
|
195
|
+
/**
|
|
196
|
+
* Consumer group name
|
|
197
|
+
*/
|
|
198
|
+
consumerGroup: string;
|
|
199
|
+
/**
|
|
200
|
+
* The message ID to delete
|
|
201
|
+
*/
|
|
202
|
+
messageId: string;
|
|
203
|
+
/**
|
|
204
|
+
* Ticket received from the message
|
|
205
|
+
*/
|
|
206
|
+
ticket: string;
|
|
207
|
+
}
|
|
208
|
+
interface DeleteMessageResponse {
|
|
209
|
+
/**
|
|
210
|
+
* Whether the message was successfully deleted
|
|
211
|
+
*/
|
|
212
|
+
deleted: boolean;
|
|
213
|
+
}
|
|
214
|
+
interface ChangeVisibilityOptions {
|
|
215
|
+
/**
|
|
216
|
+
* The queue name the message belongs to
|
|
217
|
+
*/
|
|
218
|
+
queueName: string;
|
|
219
|
+
/**
|
|
220
|
+
* Consumer group name
|
|
221
|
+
*/
|
|
222
|
+
consumerGroup: string;
|
|
223
|
+
/**
|
|
224
|
+
* The message ID to update
|
|
225
|
+
*/
|
|
226
|
+
messageId: string;
|
|
227
|
+
/**
|
|
228
|
+
* Ticket received from the message
|
|
229
|
+
*/
|
|
230
|
+
ticket: string;
|
|
231
|
+
/**
|
|
232
|
+
* New visibility timeout in seconds
|
|
233
|
+
*/
|
|
234
|
+
visibilityTimeoutSeconds: number;
|
|
235
|
+
}
|
|
236
|
+
interface ChangeVisibilityResponse {
|
|
237
|
+
/**
|
|
238
|
+
* Whether the visibility was successfully updated
|
|
239
|
+
*/
|
|
240
|
+
updated: boolean;
|
|
241
|
+
}
|
|
146
242
|
/**
|
|
147
243
|
* Result indicating the message should be timed out for retry later
|
|
148
244
|
*/
|
|
@@ -190,6 +286,34 @@ interface ConsumerGroupOptions<T = unknown> {
|
|
|
190
286
|
*/
|
|
191
287
|
refreshInterval?: number;
|
|
192
288
|
}
|
|
289
|
+
interface ReceiveMessageByIdOptions<T = unknown> {
|
|
290
|
+
/**
|
|
291
|
+
* The queue name to receive the message from
|
|
292
|
+
*/
|
|
293
|
+
queueName: string;
|
|
294
|
+
/**
|
|
295
|
+
* Consumer group name
|
|
296
|
+
*/
|
|
297
|
+
consumerGroup: string;
|
|
298
|
+
/**
|
|
299
|
+
* The message ID to retrieve
|
|
300
|
+
*/
|
|
301
|
+
messageId: string;
|
|
302
|
+
/**
|
|
303
|
+
* Time in seconds that the message will be invisible to other consumers
|
|
304
|
+
* @default 900 (15 minutes)
|
|
305
|
+
*/
|
|
306
|
+
visibilityTimeoutSeconds?: number;
|
|
307
|
+
/**
|
|
308
|
+
* Skip payload content and only return message metadata
|
|
309
|
+
* When true, the server returns a 204 status with headers containing message metadata
|
|
310
|
+
* @default false
|
|
311
|
+
*/
|
|
312
|
+
skipPayload?: boolean;
|
|
313
|
+
}
|
|
314
|
+
interface ReceiveMessageByIdResponse<T = unknown, TSkipPayload extends boolean = false> {
|
|
315
|
+
message: TSkipPayload extends true ? Message<void> : Message<T>;
|
|
316
|
+
}
|
|
193
317
|
/**
|
|
194
318
|
* Error thrown when a message is not found (404)
|
|
195
319
|
*/
|
|
@@ -253,4 +377,4 @@ declare class InvalidLimitError extends Error {
|
|
|
253
377
|
constructor(limit: number, min?: number, max?: number);
|
|
254
378
|
}
|
|
255
379
|
|
|
256
|
-
export { BufferTransport as B, type
|
|
380
|
+
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, InvalidLimitError as j, MessageCorruptedError as k, MessageLockedError as l, MessageNotAvailableError as m, MessageNotFoundError as n, QueueEmptyError as o, type MessageHandlerResult as p, type MessageMetadata as q, type MessageTimeoutResult as r };
|