@agentuity/server 0.1.16 → 0.1.18
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/api/api.d.ts +11 -6
- package/dist/api/api.d.ts.map +1 -1
- package/dist/api/api.js +19 -12
- package/dist/api/api.js.map +1 -1
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +1 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/org/env-delete.d.ts.map +1 -1
- package/dist/api/org/env-delete.js.map +1 -1
- package/dist/api/org/env-get.d.ts.map +1 -1
- package/dist/api/org/env-get.js.map +1 -1
- package/dist/api/org/env-update.d.ts.map +1 -1
- package/dist/api/org/env-update.js.map +1 -1
- package/dist/api/queue/analytics.d.ts +108 -0
- package/dist/api/queue/analytics.d.ts.map +1 -0
- package/dist/api/queue/analytics.js +245 -0
- package/dist/api/queue/analytics.js.map +1 -0
- package/dist/api/queue/destinations.d.ts +108 -0
- package/dist/api/queue/destinations.d.ts.map +1 -0
- package/dist/api/queue/destinations.js +238 -0
- package/dist/api/queue/destinations.js.map +1 -0
- package/dist/api/queue/dlq.d.ts +100 -0
- package/dist/api/queue/dlq.d.ts.map +1 -0
- package/dist/api/queue/dlq.js +204 -0
- package/dist/api/queue/dlq.js.map +1 -0
- package/dist/api/queue/index.d.ts +55 -0
- package/dist/api/queue/index.d.ts.map +1 -0
- package/dist/api/queue/index.js +86 -0
- package/dist/api/queue/index.js.map +1 -0
- package/dist/api/queue/messages.d.ts +332 -0
- package/dist/api/queue/messages.d.ts.map +1 -0
- package/dist/api/queue/messages.js +637 -0
- package/dist/api/queue/messages.js.map +1 -0
- package/dist/api/queue/queues.d.ts +153 -0
- package/dist/api/queue/queues.d.ts.map +1 -0
- package/dist/api/queue/queues.js +319 -0
- package/dist/api/queue/queues.js.map +1 -0
- package/dist/api/queue/sources.d.ts +132 -0
- package/dist/api/queue/sources.d.ts.map +1 -0
- package/dist/api/queue/sources.js +285 -0
- package/dist/api/queue/sources.js.map +1 -0
- package/dist/api/queue/types.d.ts +1129 -0
- package/dist/api/queue/types.d.ts.map +1 -0
- package/dist/api/queue/types.js +949 -0
- package/dist/api/queue/types.js.map +1 -0
- package/dist/api/queue/util.d.ts +262 -0
- package/dist/api/queue/util.d.ts.map +1 -0
- package/dist/api/queue/util.js +171 -0
- package/dist/api/queue/util.js.map +1 -0
- package/dist/api/queue/validation.d.ts +247 -0
- package/dist/api/queue/validation.d.ts.map +1 -0
- package/dist/api/queue/validation.js +513 -0
- package/dist/api/queue/validation.js.map +1 -0
- package/dist/api/sandbox/get.d.ts.map +1 -1
- package/dist/api/sandbox/get.js +5 -0
- package/dist/api/sandbox/get.js.map +1 -1
- package/dist/api/sandbox/index.d.ts +3 -3
- package/dist/api/sandbox/index.d.ts.map +1 -1
- package/dist/api/sandbox/index.js +1 -1
- package/dist/api/sandbox/index.js.map +1 -1
- package/dist/api/sandbox/run.d.ts.map +1 -1
- package/dist/api/sandbox/run.js +5 -2
- package/dist/api/sandbox/run.js.map +1 -1
- package/dist/api/sandbox/snapshot-build.d.ts +2 -0
- package/dist/api/sandbox/snapshot-build.d.ts.map +1 -1
- package/dist/api/sandbox/snapshot-build.js +4 -0
- package/dist/api/sandbox/snapshot-build.js.map +1 -1
- package/dist/api/sandbox/snapshot.d.ts +143 -1
- package/dist/api/sandbox/snapshot.d.ts.map +1 -1
- package/dist/api/sandbox/snapshot.js +183 -4
- package/dist/api/sandbox/snapshot.js.map +1 -1
- package/package.json +4 -4
- package/src/api/api.ts +62 -13
- package/src/api/index.ts +1 -0
- package/src/api/org/env-delete.ts +1 -4
- package/src/api/org/env-get.ts +1 -4
- package/src/api/org/env-update.ts +1 -4
- package/src/api/queue/analytics.ts +313 -0
- package/src/api/queue/destinations.ts +321 -0
- package/src/api/queue/dlq.ts +283 -0
- package/src/api/queue/index.ts +261 -0
- package/src/api/queue/messages.ts +875 -0
- package/src/api/queue/queues.ts +448 -0
- package/src/api/queue/sources.ts +384 -0
- package/src/api/queue/types.ts +1253 -0
- package/src/api/queue/util.ts +204 -0
- package/src/api/queue/validation.ts +560 -0
- package/src/api/sandbox/get.ts +5 -0
- package/src/api/sandbox/index.ts +13 -1
- package/src/api/sandbox/run.ts +5 -2
- package/src/api/sandbox/snapshot-build.ts +4 -0
- package/src/api/sandbox/snapshot.ts +223 -5
|
@@ -0,0 +1,637 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { APIResponseSchema, APIResponseSchemaNoData } from '../api';
|
|
3
|
+
import { MessageSchema, PublishMessageRequestSchema, BatchPublishMessagesRequestSchema, } from './types';
|
|
4
|
+
import { QueueError, QueueNotFoundError, MessageNotFoundError, queueApiPath, queueApiPathWithQuery, buildQueueHeaders, } from './util';
|
|
5
|
+
import { validateQueueName, validatePayload, validateMessageId, validatePartitionKey, validateIdempotencyKey, validateTTL, validateOffset, validateLimit, validateBatchSize, } from './validation';
|
|
6
|
+
const MessageResponseSchema = APIResponseSchema(z.object({ message: MessageSchema }));
|
|
7
|
+
const MessagesListResponseSchema = APIResponseSchema(z.object({
|
|
8
|
+
messages: z.array(MessageSchema),
|
|
9
|
+
total: z.number().optional(),
|
|
10
|
+
}));
|
|
11
|
+
const BatchPublishResponseSchema = APIResponseSchema(z.object({
|
|
12
|
+
messages: z.array(MessageSchema),
|
|
13
|
+
failed: z.array(z.number()).optional(),
|
|
14
|
+
}));
|
|
15
|
+
const DeleteMessageResponseSchema = APIResponseSchemaNoData();
|
|
16
|
+
const AckNackResponseSchema = APIResponseSchemaNoData();
|
|
17
|
+
const OffsetResponseSchema = APIResponseSchema(z.object({ offset: z.number() }));
|
|
18
|
+
const ReceiveResponseSchema = APIResponseSchema(z.object({
|
|
19
|
+
message: MessageSchema.nullable(),
|
|
20
|
+
}));
|
|
21
|
+
/**
|
|
22
|
+
* Publish a message to a queue.
|
|
23
|
+
*
|
|
24
|
+
* Publishes a single message to the specified queue. The message will be assigned
|
|
25
|
+
* a unique ID and offset.
|
|
26
|
+
*
|
|
27
|
+
* @param client - The API client instance
|
|
28
|
+
* @param queueName - The name of the queue to publish to
|
|
29
|
+
* @param params - Message parameters including payload
|
|
30
|
+
* @returns The published message with assigned ID and offset
|
|
31
|
+
* @throws {QueueValidationError} If validation fails
|
|
32
|
+
* @throws {QueueNotFoundError} If the queue does not exist
|
|
33
|
+
* @throws {QueueError} If the API request fails
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const message = await publishMessage(client, 'order-queue', {
|
|
38
|
+
* payload: { orderId: 123, action: 'process' },
|
|
39
|
+
* metadata: { priority: 'high' },
|
|
40
|
+
* idempotency_key: 'order-123-process',
|
|
41
|
+
* });
|
|
42
|
+
* console.log(`Published message ${message.id} at offset ${message.offset}`);
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export async function publishMessage(client, queueName, params, options) {
|
|
46
|
+
// Validate before sending to API
|
|
47
|
+
validateQueueName(queueName);
|
|
48
|
+
validatePayload(params.payload);
|
|
49
|
+
if (params.partition_key) {
|
|
50
|
+
validatePartitionKey(params.partition_key);
|
|
51
|
+
}
|
|
52
|
+
if (params.idempotency_key) {
|
|
53
|
+
validateIdempotencyKey(params.idempotency_key);
|
|
54
|
+
}
|
|
55
|
+
if (params.ttl_seconds !== undefined) {
|
|
56
|
+
validateTTL(params.ttl_seconds);
|
|
57
|
+
}
|
|
58
|
+
const url = queueApiPath('messages/publish', queueName);
|
|
59
|
+
const resp = await client.post(url, params, MessageResponseSchema, PublishMessageRequestSchema, undefined, buildQueueHeaders(options?.orgId));
|
|
60
|
+
if (resp.success) {
|
|
61
|
+
return resp.data.message;
|
|
62
|
+
}
|
|
63
|
+
if (resp.message?.includes('not found')) {
|
|
64
|
+
throw new QueueNotFoundError({
|
|
65
|
+
queueName,
|
|
66
|
+
message: resp.message,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
throw new QueueError({
|
|
70
|
+
queueName,
|
|
71
|
+
message: resp.message || 'Failed to publish message',
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Batch publish multiple messages to a queue.
|
|
76
|
+
*
|
|
77
|
+
* Publishes up to 1000 messages in a single API call. This is more efficient
|
|
78
|
+
* than publishing messages individually.
|
|
79
|
+
*
|
|
80
|
+
* @param client - The API client instance
|
|
81
|
+
* @param queueName - The name of the queue to publish to
|
|
82
|
+
* @param messages - Array of message parameters (max 1000)
|
|
83
|
+
* @returns Object containing the published messages and optionally failed indices
|
|
84
|
+
* @throws {QueueValidationError} If validation fails
|
|
85
|
+
* @throws {QueueNotFoundError} If the queue does not exist
|
|
86
|
+
* @throws {QueueError} If the API request fails
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* const result = await batchPublishMessages(client, 'order-queue', [
|
|
91
|
+
* { payload: { orderId: 1 } },
|
|
92
|
+
* { payload: { orderId: 2 } },
|
|
93
|
+
* { payload: { orderId: 3 } },
|
|
94
|
+
* ]);
|
|
95
|
+
* console.log(`Published ${result.messages.length} messages`);
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export async function batchPublishMessages(client, queueName, messages, options) {
|
|
99
|
+
// Validate before sending to API
|
|
100
|
+
validateQueueName(queueName);
|
|
101
|
+
validateBatchSize(messages.length);
|
|
102
|
+
for (const msg of messages) {
|
|
103
|
+
validatePayload(msg.payload);
|
|
104
|
+
if (msg.partition_key) {
|
|
105
|
+
validatePartitionKey(msg.partition_key);
|
|
106
|
+
}
|
|
107
|
+
if (msg.idempotency_key) {
|
|
108
|
+
validateIdempotencyKey(msg.idempotency_key);
|
|
109
|
+
}
|
|
110
|
+
if (msg.ttl_seconds !== undefined) {
|
|
111
|
+
validateTTL(msg.ttl_seconds);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const url = queueApiPath('messages/batch', queueName);
|
|
115
|
+
const resp = await client.post(url, { messages }, BatchPublishResponseSchema, BatchPublishMessagesRequestSchema, undefined, buildQueueHeaders(options?.orgId));
|
|
116
|
+
if (resp.success) {
|
|
117
|
+
return { messages: resp.data.messages, failed: resp.data.failed };
|
|
118
|
+
}
|
|
119
|
+
if (resp.message?.includes('not found')) {
|
|
120
|
+
throw new QueueNotFoundError({
|
|
121
|
+
queueName,
|
|
122
|
+
message: resp.message,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
throw new QueueError({
|
|
126
|
+
queueName,
|
|
127
|
+
message: resp.message || 'Failed to batch publish messages',
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Get a message by ID.
|
|
132
|
+
*
|
|
133
|
+
* Retrieves a specific message from a queue by its message ID.
|
|
134
|
+
*
|
|
135
|
+
* @param client - The API client instance
|
|
136
|
+
* @param queueName - The name of the queue
|
|
137
|
+
* @param messageId - The message ID (prefixed with msg_)
|
|
138
|
+
* @returns The message details
|
|
139
|
+
* @throws {QueueValidationError} If validation fails
|
|
140
|
+
* @throws {MessageNotFoundError} If the message does not exist
|
|
141
|
+
* @throws {QueueNotFoundError} If the queue does not exist
|
|
142
|
+
* @throws {QueueError} If the API request fails
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```typescript
|
|
146
|
+
* const message = await getMessage(client, 'order-queue', 'msg_abc123');
|
|
147
|
+
* console.log(`Message state: ${message.state}`);
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
export async function getMessage(client, queueName, messageId, options) {
|
|
151
|
+
validateQueueName(queueName);
|
|
152
|
+
validateMessageId(messageId);
|
|
153
|
+
const url = queueApiPath('messages/get', queueName, messageId);
|
|
154
|
+
const resp = await client.get(url, MessageResponseSchema, undefined, buildQueueHeaders(options?.orgId));
|
|
155
|
+
if (resp.success) {
|
|
156
|
+
return resp.data.message;
|
|
157
|
+
}
|
|
158
|
+
if (resp.message?.includes('message') && resp.message?.includes('not found')) {
|
|
159
|
+
throw new MessageNotFoundError({
|
|
160
|
+
queueName,
|
|
161
|
+
messageId,
|
|
162
|
+
message: resp.message,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
if (resp.message?.includes('queue') && resp.message?.includes('not found')) {
|
|
166
|
+
throw new QueueNotFoundError({
|
|
167
|
+
queueName,
|
|
168
|
+
message: resp.message,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
throw new QueueError({
|
|
172
|
+
queueName,
|
|
173
|
+
message: resp.message || 'Failed to get message',
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Get a message by its offset position.
|
|
178
|
+
*
|
|
179
|
+
* Retrieves a specific message from a queue by its offset (sequential position).
|
|
180
|
+
* Useful for log-style consumption where you track position by offset.
|
|
181
|
+
*
|
|
182
|
+
* @param client - The API client instance
|
|
183
|
+
* @param queueName - The name of the queue
|
|
184
|
+
* @param offset - The message offset (0-based sequential position)
|
|
185
|
+
* @returns The message at the specified offset
|
|
186
|
+
* @throws {QueueValidationError} If validation fails
|
|
187
|
+
* @throws {MessageNotFoundError} If no message exists at the offset
|
|
188
|
+
* @throws {QueueError} If the API request fails
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* ```typescript
|
|
192
|
+
* const message = await getMessageByOffset(client, 'events', 42);
|
|
193
|
+
* console.log(`Message at offset 42: ${message.id}`);
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
export async function getMessageByOffset(client, queueName, offset, options) {
|
|
197
|
+
validateQueueName(queueName);
|
|
198
|
+
validateOffset(offset);
|
|
199
|
+
const url = queueApiPath('messages/offset', queueName, String(offset));
|
|
200
|
+
const resp = await client.get(url, MessageResponseSchema, undefined, buildQueueHeaders(options?.orgId));
|
|
201
|
+
if (resp.success) {
|
|
202
|
+
return resp.data.message;
|
|
203
|
+
}
|
|
204
|
+
if (resp.message?.includes('not found')) {
|
|
205
|
+
throw new MessageNotFoundError({
|
|
206
|
+
queueName,
|
|
207
|
+
messageId: `offset:${offset}`,
|
|
208
|
+
message: resp.message,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
throw new QueueError({
|
|
212
|
+
queueName,
|
|
213
|
+
message: resp.message || 'Failed to get message by offset',
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* List messages in a queue.
|
|
218
|
+
*
|
|
219
|
+
* Retrieves messages from a queue with optional filtering and pagination.
|
|
220
|
+
* Supports filtering by state and pagination via limit/offset.
|
|
221
|
+
*
|
|
222
|
+
* @param client - The API client instance
|
|
223
|
+
* @param queueName - The name of the queue
|
|
224
|
+
* @param params - Optional filtering and pagination parameters
|
|
225
|
+
* @param params.limit - Maximum number of messages to return (1-1000)
|
|
226
|
+
* @param params.offset - Starting offset for pagination
|
|
227
|
+
* @param params.state - Filter by message state (pending, processing, completed, failed, dead)
|
|
228
|
+
* @returns Object containing messages array and optional total count
|
|
229
|
+
* @throws {QueueValidationError} If validation fails
|
|
230
|
+
* @throws {QueueNotFoundError} If the queue does not exist
|
|
231
|
+
* @throws {QueueError} If the API request fails
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```typescript
|
|
235
|
+
* // List first 10 pending messages
|
|
236
|
+
* const result = await listMessages(client, 'order-queue', {
|
|
237
|
+
* limit: 10,
|
|
238
|
+
* state: 'pending',
|
|
239
|
+
* });
|
|
240
|
+
* console.log(`Found ${result.messages.length} pending messages`);
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
export async function listMessages(client, queueName, params, options) {
|
|
244
|
+
validateQueueName(queueName);
|
|
245
|
+
if (params?.limit !== undefined) {
|
|
246
|
+
validateLimit(params.limit);
|
|
247
|
+
}
|
|
248
|
+
if (params?.offset !== undefined) {
|
|
249
|
+
validateOffset(params.offset);
|
|
250
|
+
}
|
|
251
|
+
const searchParams = new URLSearchParams();
|
|
252
|
+
if (params?.limit !== undefined) {
|
|
253
|
+
searchParams.set('limit', String(params.limit));
|
|
254
|
+
}
|
|
255
|
+
if (params?.offset !== undefined) {
|
|
256
|
+
searchParams.set('offset', String(params.offset));
|
|
257
|
+
}
|
|
258
|
+
if (params?.state !== undefined) {
|
|
259
|
+
searchParams.set('state', params.state);
|
|
260
|
+
}
|
|
261
|
+
const queryString = searchParams.toString();
|
|
262
|
+
const url = queueApiPathWithQuery('messages/list', queryString || undefined, queueName);
|
|
263
|
+
const resp = await client.get(url, MessagesListResponseSchema, undefined, buildQueueHeaders(options?.orgId));
|
|
264
|
+
if (resp.success) {
|
|
265
|
+
return { messages: resp.data.messages, total: resp.data.total };
|
|
266
|
+
}
|
|
267
|
+
if (resp.message?.includes('not found')) {
|
|
268
|
+
throw new QueueNotFoundError({
|
|
269
|
+
queueName,
|
|
270
|
+
message: resp.message,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
throw new QueueError({
|
|
274
|
+
queueName,
|
|
275
|
+
message: resp.message || 'Failed to list messages',
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Delete a message from a queue.
|
|
280
|
+
*
|
|
281
|
+
* Permanently removes a message from the queue. This operation cannot be undone.
|
|
282
|
+
*
|
|
283
|
+
* @param client - The API client instance
|
|
284
|
+
* @param queueName - The name of the queue
|
|
285
|
+
* @param messageId - The message ID to delete (prefixed with msg_)
|
|
286
|
+
* @returns void
|
|
287
|
+
* @throws {QueueValidationError} If validation fails
|
|
288
|
+
* @throws {MessageNotFoundError} If the message does not exist
|
|
289
|
+
* @throws {QueueError} If the API request fails
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* ```typescript
|
|
293
|
+
* await deleteMessage(client, 'order-queue', 'msg_abc123');
|
|
294
|
+
* console.log('Message deleted');
|
|
295
|
+
* ```
|
|
296
|
+
*/
|
|
297
|
+
export async function deleteMessage(client, queueName, messageId, options) {
|
|
298
|
+
validateQueueName(queueName);
|
|
299
|
+
validateMessageId(messageId);
|
|
300
|
+
const url = queueApiPath('messages/delete', queueName, messageId);
|
|
301
|
+
const resp = await client.delete(url, DeleteMessageResponseSchema, undefined, buildQueueHeaders(options?.orgId));
|
|
302
|
+
if (resp.success) {
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
if (resp.message?.includes('message') && resp.message?.includes('not found')) {
|
|
306
|
+
throw new MessageNotFoundError({
|
|
307
|
+
queueName,
|
|
308
|
+
messageId,
|
|
309
|
+
message: resp.message,
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
throw new QueueError({
|
|
313
|
+
queueName,
|
|
314
|
+
message: resp.message || 'Failed to delete message',
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Replay a message.
|
|
319
|
+
*
|
|
320
|
+
* Re-queues a previously processed message for reprocessing. The message
|
|
321
|
+
* is reset to pending state and will be delivered again to consumers.
|
|
322
|
+
* Useful for retrying failed messages or reprocessing historical data.
|
|
323
|
+
*
|
|
324
|
+
* @param client - The API client instance
|
|
325
|
+
* @param queueName - The name of the queue
|
|
326
|
+
* @param messageId - The message ID to replay (prefixed with msg_)
|
|
327
|
+
* @returns The replayed message with updated state
|
|
328
|
+
* @throws {QueueValidationError} If validation fails
|
|
329
|
+
* @throws {MessageNotFoundError} If the message does not exist
|
|
330
|
+
* @throws {QueueError} If the API request fails
|
|
331
|
+
*
|
|
332
|
+
* @example
|
|
333
|
+
* ```typescript
|
|
334
|
+
* const message = await replayMessage(client, 'order-queue', 'msg_abc123');
|
|
335
|
+
* console.log(`Message replayed, new state: ${message.state}`);
|
|
336
|
+
* ```
|
|
337
|
+
*/
|
|
338
|
+
export async function replayMessage(client, queueName, messageId, options) {
|
|
339
|
+
validateQueueName(queueName);
|
|
340
|
+
validateMessageId(messageId);
|
|
341
|
+
const url = queueApiPath('messages/replay', queueName, messageId);
|
|
342
|
+
const resp = await client.post(url, undefined, MessageResponseSchema, undefined, undefined, buildQueueHeaders(options?.orgId));
|
|
343
|
+
if (resp.success) {
|
|
344
|
+
return resp.data.message;
|
|
345
|
+
}
|
|
346
|
+
if (resp.message?.includes('message') && resp.message?.includes('not found')) {
|
|
347
|
+
throw new MessageNotFoundError({
|
|
348
|
+
queueName,
|
|
349
|
+
messageId,
|
|
350
|
+
message: resp.message,
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
throw new QueueError({
|
|
354
|
+
queueName,
|
|
355
|
+
message: resp.message || 'Failed to replay message',
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Consume messages from a queue starting at an offset.
|
|
360
|
+
*
|
|
361
|
+
* Retrieves messages for log-style consumption, starting from the specified
|
|
362
|
+
* offset. Unlike receive/ack flow, this does not mark messages as processing.
|
|
363
|
+
* Ideal for event sourcing or fan-out patterns where multiple consumers
|
|
364
|
+
* read the same messages.
|
|
365
|
+
*
|
|
366
|
+
* @param client - The API client instance
|
|
367
|
+
* @param queueName - The name of the queue
|
|
368
|
+
* @param params - Consume parameters
|
|
369
|
+
* @param params.offset - Starting offset (0-based)
|
|
370
|
+
* @param params.limit - Maximum messages to return (optional, 1-1000)
|
|
371
|
+
* @returns Object containing the messages array
|
|
372
|
+
* @throws {QueueValidationError} If validation fails
|
|
373
|
+
* @throws {QueueNotFoundError} If the queue does not exist
|
|
374
|
+
* @throws {QueueError} If the API request fails
|
|
375
|
+
*
|
|
376
|
+
* @example
|
|
377
|
+
* ```typescript
|
|
378
|
+
* // Consume 100 messages starting at offset 500
|
|
379
|
+
* const result = await consumeMessages(client, 'events', {
|
|
380
|
+
* offset: 500,
|
|
381
|
+
* limit: 100,
|
|
382
|
+
* });
|
|
383
|
+
* for (const msg of result.messages) {
|
|
384
|
+
* console.log(`Processing event at offset ${msg.offset}`);
|
|
385
|
+
* }
|
|
386
|
+
* ```
|
|
387
|
+
*/
|
|
388
|
+
export async function consumeMessages(client, queueName, params, options) {
|
|
389
|
+
validateQueueName(queueName);
|
|
390
|
+
validateOffset(params.offset);
|
|
391
|
+
if (params.limit !== undefined) {
|
|
392
|
+
validateLimit(params.limit);
|
|
393
|
+
}
|
|
394
|
+
const searchParams = new URLSearchParams();
|
|
395
|
+
searchParams.set('offset', String(params.offset));
|
|
396
|
+
if (params.limit !== undefined) {
|
|
397
|
+
searchParams.set('limit', String(params.limit));
|
|
398
|
+
}
|
|
399
|
+
const url = queueApiPathWithQuery('consume', searchParams.toString(), queueName);
|
|
400
|
+
const resp = await client.get(url, MessagesListResponseSchema, undefined, buildQueueHeaders(options?.orgId));
|
|
401
|
+
if (resp.success) {
|
|
402
|
+
return { messages: resp.data.messages };
|
|
403
|
+
}
|
|
404
|
+
if (resp.message?.includes('not found')) {
|
|
405
|
+
throw new QueueNotFoundError({
|
|
406
|
+
queueName,
|
|
407
|
+
message: resp.message,
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
throw new QueueError({
|
|
411
|
+
queueName,
|
|
412
|
+
message: resp.message || 'Failed to consume messages',
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Get the head offset of a queue.
|
|
417
|
+
*
|
|
418
|
+
* Returns the offset of the oldest (first) message in the queue.
|
|
419
|
+
* Useful for determining the starting point for log-style consumption.
|
|
420
|
+
*
|
|
421
|
+
* @param client - The API client instance
|
|
422
|
+
* @param queueName - The name of the queue
|
|
423
|
+
* @returns The head offset (oldest message position)
|
|
424
|
+
* @throws {QueueValidationError} If validation fails
|
|
425
|
+
* @throws {QueueNotFoundError} If the queue does not exist
|
|
426
|
+
* @throws {QueueError} If the API request fails
|
|
427
|
+
*
|
|
428
|
+
* @example
|
|
429
|
+
* ```typescript
|
|
430
|
+
* const head = await getQueueHead(client, 'events');
|
|
431
|
+
* console.log(`Queue starts at offset ${head}`);
|
|
432
|
+
* ```
|
|
433
|
+
*/
|
|
434
|
+
export async function getQueueHead(client, queueName, options) {
|
|
435
|
+
validateQueueName(queueName);
|
|
436
|
+
const url = queueApiPath('head', queueName);
|
|
437
|
+
const resp = await client.get(url, OffsetResponseSchema, undefined, buildQueueHeaders(options?.orgId));
|
|
438
|
+
if (resp.success) {
|
|
439
|
+
return resp.data.offset;
|
|
440
|
+
}
|
|
441
|
+
if (resp.message?.includes('not found')) {
|
|
442
|
+
throw new QueueNotFoundError({
|
|
443
|
+
queueName,
|
|
444
|
+
message: resp.message,
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
throw new QueueError({
|
|
448
|
+
queueName,
|
|
449
|
+
message: resp.message || 'Failed to get queue head',
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Get the tail offset of a queue.
|
|
454
|
+
*
|
|
455
|
+
* Returns the offset of the newest (last) message in the queue.
|
|
456
|
+
* The next published message will have offset = tail + 1.
|
|
457
|
+
*
|
|
458
|
+
* @param client - The API client instance
|
|
459
|
+
* @param queueName - The name of the queue
|
|
460
|
+
* @returns The tail offset (newest message position)
|
|
461
|
+
* @throws {QueueValidationError} If validation fails
|
|
462
|
+
* @throws {QueueNotFoundError} If the queue does not exist
|
|
463
|
+
* @throws {QueueError} If the API request fails
|
|
464
|
+
*
|
|
465
|
+
* @example
|
|
466
|
+
* ```typescript
|
|
467
|
+
* const tail = await getQueueTail(client, 'events');
|
|
468
|
+
* console.log(`Queue ends at offset ${tail}`);
|
|
469
|
+
* ```
|
|
470
|
+
*/
|
|
471
|
+
export async function getQueueTail(client, queueName, options) {
|
|
472
|
+
validateQueueName(queueName);
|
|
473
|
+
const url = queueApiPath('tail', queueName);
|
|
474
|
+
const resp = await client.get(url, OffsetResponseSchema, undefined, buildQueueHeaders(options?.orgId));
|
|
475
|
+
if (resp.success) {
|
|
476
|
+
return resp.data.offset;
|
|
477
|
+
}
|
|
478
|
+
if (resp.message?.includes('not found')) {
|
|
479
|
+
throw new QueueNotFoundError({
|
|
480
|
+
queueName,
|
|
481
|
+
message: resp.message,
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
throw new QueueError({
|
|
485
|
+
queueName,
|
|
486
|
+
message: resp.message || 'Failed to get queue tail',
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Receive the next available message from a queue.
|
|
491
|
+
*
|
|
492
|
+
* Atomically retrieves and locks the next pending message for processing.
|
|
493
|
+
* The message state transitions to "processing" and must be acknowledged
|
|
494
|
+
* (ack) or negative-acknowledged (nack) when done. Supports long polling
|
|
495
|
+
* with an optional timeout.
|
|
496
|
+
*
|
|
497
|
+
* @param client - The API client instance
|
|
498
|
+
* @param queueName - The name of the queue
|
|
499
|
+
* @param timeout - Optional timeout in seconds for long polling (0-30)
|
|
500
|
+
* @returns The received message, or null if no message is available
|
|
501
|
+
* @throws {QueueValidationError} If validation fails
|
|
502
|
+
* @throws {QueueNotFoundError} If the queue does not exist
|
|
503
|
+
* @throws {QueueError} If the API request fails
|
|
504
|
+
*
|
|
505
|
+
* @example
|
|
506
|
+
* ```typescript
|
|
507
|
+
* // Receive with 10 second long poll
|
|
508
|
+
* const message = await receiveMessage(client, 'tasks', 10);
|
|
509
|
+
* if (message) {
|
|
510
|
+
* console.log(`Received: ${message.id}`);
|
|
511
|
+
* // Process message...
|
|
512
|
+
* await ackMessage(client, 'tasks', message.id);
|
|
513
|
+
* }
|
|
514
|
+
* ```
|
|
515
|
+
*/
|
|
516
|
+
export async function receiveMessage(client, queueName, timeout, options) {
|
|
517
|
+
validateQueueName(queueName);
|
|
518
|
+
const searchParams = new URLSearchParams();
|
|
519
|
+
if (timeout !== undefined) {
|
|
520
|
+
searchParams.set('timeout', String(timeout));
|
|
521
|
+
}
|
|
522
|
+
const queryString = searchParams.toString();
|
|
523
|
+
const url = queueApiPathWithQuery('receive', queryString || undefined, queueName);
|
|
524
|
+
const resp = await client.get(url, ReceiveResponseSchema, undefined, buildQueueHeaders(options?.orgId));
|
|
525
|
+
if (resp.success) {
|
|
526
|
+
return resp.data.message;
|
|
527
|
+
}
|
|
528
|
+
if (resp.message?.includes('not found')) {
|
|
529
|
+
throw new QueueNotFoundError({
|
|
530
|
+
queueName,
|
|
531
|
+
message: resp.message,
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
throw new QueueError({
|
|
535
|
+
queueName,
|
|
536
|
+
message: resp.message || 'Failed to receive message',
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Acknowledge successful processing of a message.
|
|
541
|
+
*
|
|
542
|
+
* Marks a message as successfully processed (completed state).
|
|
543
|
+
* Should be called after successfully processing a message received
|
|
544
|
+
* via receiveMessage. The message will not be redelivered.
|
|
545
|
+
*
|
|
546
|
+
* @param client - The API client instance
|
|
547
|
+
* @param queueName - The name of the queue
|
|
548
|
+
* @param messageId - The message ID to acknowledge (prefixed with msg_)
|
|
549
|
+
* @returns void
|
|
550
|
+
* @throws {QueueValidationError} If validation fails
|
|
551
|
+
* @throws {MessageNotFoundError} If the message does not exist
|
|
552
|
+
* @throws {QueueError} If the API request fails
|
|
553
|
+
*
|
|
554
|
+
* @example
|
|
555
|
+
* ```typescript
|
|
556
|
+
* const message = await receiveMessage(client, 'tasks');
|
|
557
|
+
* if (message) {
|
|
558
|
+
* try {
|
|
559
|
+
* await processTask(message.payload);
|
|
560
|
+
* await ackMessage(client, 'tasks', message.id);
|
|
561
|
+
* } catch (error) {
|
|
562
|
+
* await nackMessage(client, 'tasks', message.id);
|
|
563
|
+
* }
|
|
564
|
+
* }
|
|
565
|
+
* ```
|
|
566
|
+
*/
|
|
567
|
+
export async function ackMessage(client, queueName, messageId, options) {
|
|
568
|
+
validateQueueName(queueName);
|
|
569
|
+
validateMessageId(messageId);
|
|
570
|
+
const url = queueApiPath('ack', queueName, messageId);
|
|
571
|
+
const resp = await client.post(url, undefined, AckNackResponseSchema, undefined, undefined, buildQueueHeaders(options?.orgId));
|
|
572
|
+
if (resp.success) {
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
if (resp.message?.includes('message') && resp.message?.includes('not found')) {
|
|
576
|
+
throw new MessageNotFoundError({
|
|
577
|
+
queueName,
|
|
578
|
+
messageId,
|
|
579
|
+
message: resp.message,
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
throw new QueueError({
|
|
583
|
+
queueName,
|
|
584
|
+
message: resp.message || 'Failed to acknowledge message',
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Negative acknowledge a message (mark as failed).
|
|
589
|
+
*
|
|
590
|
+
* Returns a message to the queue for retry. The message state returns
|
|
591
|
+
* to pending and will be redelivered. Use when processing fails and
|
|
592
|
+
* the message should be retried. After max retries, the message moves
|
|
593
|
+
* to the dead letter queue.
|
|
594
|
+
*
|
|
595
|
+
* @param client - The API client instance
|
|
596
|
+
* @param queueName - The name of the queue
|
|
597
|
+
* @param messageId - The message ID to nack (prefixed with msg_)
|
|
598
|
+
* @returns void
|
|
599
|
+
* @throws {QueueValidationError} If validation fails
|
|
600
|
+
* @throws {MessageNotFoundError} If the message does not exist
|
|
601
|
+
* @throws {QueueError} If the API request fails
|
|
602
|
+
*
|
|
603
|
+
* @example
|
|
604
|
+
* ```typescript
|
|
605
|
+
* const message = await receiveMessage(client, 'tasks');
|
|
606
|
+
* if (message) {
|
|
607
|
+
* try {
|
|
608
|
+
* await processTask(message.payload);
|
|
609
|
+
* await ackMessage(client, 'tasks', message.id);
|
|
610
|
+
* } catch (error) {
|
|
611
|
+
* // Processing failed, return to queue for retry
|
|
612
|
+
* await nackMessage(client, 'tasks', message.id);
|
|
613
|
+
* }
|
|
614
|
+
* }
|
|
615
|
+
* ```
|
|
616
|
+
*/
|
|
617
|
+
export async function nackMessage(client, queueName, messageId, options) {
|
|
618
|
+
validateQueueName(queueName);
|
|
619
|
+
validateMessageId(messageId);
|
|
620
|
+
const url = queueApiPath('nack', queueName, messageId);
|
|
621
|
+
const resp = await client.post(url, undefined, AckNackResponseSchema, undefined, undefined, buildQueueHeaders(options?.orgId));
|
|
622
|
+
if (resp.success) {
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
if (resp.message?.includes('message') && resp.message?.includes('not found')) {
|
|
626
|
+
throw new MessageNotFoundError({
|
|
627
|
+
queueName,
|
|
628
|
+
messageId,
|
|
629
|
+
message: resp.message,
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
throw new QueueError({
|
|
633
|
+
queueName,
|
|
634
|
+
message: resp.message || 'Failed to negative acknowledge message',
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../src/api/queue/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAa,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,QAAQ,CAAC;AAC/E,OAAO,EACN,aAAa,EAOb,2BAA2B,EAC3B,iCAAiC,GACjC,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,GACjB,MAAM,QAAQ,CAAC;AAChB,OAAO,EACN,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,WAAW,EACX,cAAc,EACd,aAAa,EACb,iBAAiB,GACjB,MAAM,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC;AACtF,MAAM,0BAA0B,GAAG,iBAAiB,CACnD,CAAC,CAAC,MAAM,CAAC;IACR,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC;IAChC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC5B,CAAC,CACF,CAAC;AACF,MAAM,0BAA0B,GAAG,iBAAiB,CACnD,CAAC,CAAC,MAAM,C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