@agentuity/server 0.1.16 → 0.1.17
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 +44 -1
- package/dist/api/sandbox/snapshot.d.ts.map +1 -1
- package/dist/api/sandbox/snapshot.js +77 -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 +9 -1
- package/src/api/sandbox/run.ts +5 -2
- package/src/api/sandbox/snapshot-build.ts +4 -0
- package/src/api/sandbox/snapshot.ts +96 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../../src/api/queue/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAa,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EACN,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,GAOnB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,0BAA0B,GAAG,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC;AAClG,MAAM,4BAA4B,GAAG,iBAAiB,CACrD,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC,CAC7C,CAAC;AACF,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,oBAAoB,EAAE,CAAC,CAAC,CAAC;AAEnG;;GAEG;AACH,SAAS,mBAAmB,CAAC,OAA0B;IACtD,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IAE/B,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;IACrC,IAAI,OAAO,CAAC,KAAK;QAAE,MAAM,CAAC,GAAG,CAAC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AAE,CAAC;YAC5C,IAAI,IAAI;gBAAE,MAAM;YAEhB,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;YAClD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACjC,MAAM,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;YAE3B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBAC1B,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;oBAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;oBACrC,IAAI,OAAO,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;wBACjC,IAAI,CAAC;4BACJ,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;4BACnC,MAAM,KAAK,GAAG,mBAAmB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;4BAChD,MAAM,KAAK,CAAC;wBACb,CAAC;wBAAC,MAAM,CAAC;4BACR,wBAAwB;wBACzB,CAAC;oBACF,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;YAAS,CAAC;QACV,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;QACtB,MAAM,CAAC,WAAW,EAAE,CAAC;IACtB,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { APIClient } from '../api';
|
|
2
|
+
import { type Destination, type CreateDestinationRequest, type UpdateDestinationRequest, type QueueApiOptions } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Create a destination for a queue.
|
|
5
|
+
*
|
|
6
|
+
* Destinations are webhook endpoints that automatically receive messages when
|
|
7
|
+
* they are published to a queue. When a message is published, it will be
|
|
8
|
+
* delivered via HTTP POST to all active destinations configured for that queue.
|
|
9
|
+
*
|
|
10
|
+
* @param client - The API client instance
|
|
11
|
+
* @param queueName - The name of the queue to add the destination to
|
|
12
|
+
* @param params - Destination configuration including URL and optional settings
|
|
13
|
+
* @returns The created destination with assigned ID
|
|
14
|
+
* @throws {QueueValidationError} If validation fails (invalid queue name or config)
|
|
15
|
+
* @throws {QueueNotFoundError} If the queue does not exist
|
|
16
|
+
* @throws {QueueError} If the API request fails
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const destination = await createDestination(client, 'order-events', {
|
|
21
|
+
* url: 'https://api.example.com/webhooks/orders',
|
|
22
|
+
* config: {
|
|
23
|
+
* retry_attempts: 3,
|
|
24
|
+
* timeout_seconds: 30,
|
|
25
|
+
* },
|
|
26
|
+
* });
|
|
27
|
+
* console.log(`Created destination ${destination.id}`);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function createDestination(client: APIClient, queueName: string, params: CreateDestinationRequest, options?: QueueApiOptions): Promise<Destination>;
|
|
31
|
+
/**
|
|
32
|
+
* List all destinations for a queue.
|
|
33
|
+
*
|
|
34
|
+
* Retrieves all webhook destinations configured for a queue. Each destination
|
|
35
|
+
* represents an endpoint that receives messages when they are published.
|
|
36
|
+
*
|
|
37
|
+
* @param client - The API client instance
|
|
38
|
+
* @param queueName - The name of the queue
|
|
39
|
+
* @returns Array of destinations configured for the queue
|
|
40
|
+
* @throws {QueueValidationError} If validation fails (invalid queue name)
|
|
41
|
+
* @throws {QueueNotFoundError} If the queue does not exist
|
|
42
|
+
* @throws {QueueError} If the API request fails
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const destinations = await listDestinations(client, 'order-events');
|
|
47
|
+
* for (const dest of destinations) {
|
|
48
|
+
* console.log(`Destination ${dest.id}: ${dest.url} (${dest.enabled ? 'enabled' : 'disabled'})`);
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function listDestinations(client: APIClient, queueName: string, options?: QueueApiOptions): Promise<Destination[]>;
|
|
53
|
+
/**
|
|
54
|
+
* Update a destination's configuration.
|
|
55
|
+
*
|
|
56
|
+
* Modifies an existing destination's settings such as URL, enabled status,
|
|
57
|
+
* or retry configuration. Only the fields provided in params will be updated.
|
|
58
|
+
*
|
|
59
|
+
* @param client - The API client instance
|
|
60
|
+
* @param queueName - The name of the queue
|
|
61
|
+
* @param destinationId - The destination ID to update (prefixed with dest_)
|
|
62
|
+
* @param params - Fields to update (partial update supported)
|
|
63
|
+
* @returns The updated destination
|
|
64
|
+
* @throws {QueueValidationError} If validation fails (invalid queue name, destination ID, or config)
|
|
65
|
+
* @throws {DestinationNotFoundError} If the destination does not exist
|
|
66
|
+
* @throws {QueueNotFoundError} If the queue does not exist
|
|
67
|
+
* @throws {QueueError} If the API request fails
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* // Disable a destination temporarily
|
|
72
|
+
* const updated = await updateDestination(client, 'order-events', 'dest_abc123', {
|
|
73
|
+
* enabled: false,
|
|
74
|
+
* });
|
|
75
|
+
*
|
|
76
|
+
* // Update URL and retry settings
|
|
77
|
+
* const updated = await updateDestination(client, 'order-events', 'dest_abc123', {
|
|
78
|
+
* url: 'https://api.example.com/v2/webhooks/orders',
|
|
79
|
+
* config: {
|
|
80
|
+
* retry_attempts: 5,
|
|
81
|
+
* },
|
|
82
|
+
* });
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export declare function updateDestination(client: APIClient, queueName: string, destinationId: string, params: UpdateDestinationRequest, options?: QueueApiOptions): Promise<Destination>;
|
|
86
|
+
/**
|
|
87
|
+
* Delete a destination from a queue.
|
|
88
|
+
*
|
|
89
|
+
* Permanently removes a webhook destination. Messages will no longer be
|
|
90
|
+
* delivered to this endpoint. This action cannot be undone.
|
|
91
|
+
*
|
|
92
|
+
* @param client - The API client instance
|
|
93
|
+
* @param queueName - The name of the queue
|
|
94
|
+
* @param destinationId - The destination ID to delete (prefixed with dest_)
|
|
95
|
+
* @returns void
|
|
96
|
+
* @throws {QueueValidationError} If validation fails (invalid queue name or destination ID)
|
|
97
|
+
* @throws {DestinationNotFoundError} If the destination does not exist
|
|
98
|
+
* @throws {QueueNotFoundError} If the queue does not exist
|
|
99
|
+
* @throws {QueueError} If the API request fails
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```typescript
|
|
103
|
+
* await deleteDestination(client, 'order-events', 'dest_abc123');
|
|
104
|
+
* console.log('Destination deleted');
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
export declare function deleteDestination(client: APIClient, queueName: string, destinationId: string, options?: QueueApiOptions): Promise<void>;
|
|
108
|
+
//# sourceMappingURL=destinations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"destinations.d.ts","sourceRoot":"","sources":["../../../src/api/queue/destinations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAwD,MAAM,QAAQ,CAAC;AACzF,OAAO,EAEN,KAAK,WAAW,EAChB,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,eAAe,EAGpB,MAAM,SAAS,CAAC;AAmBjB;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,iBAAiB,CACtC,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,wBAAwB,EAChC,OAAO,CAAC,EAAE,eAAe,GACvB,OAAO,CAAC,WAAW,CAAC,CAgEtB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,gBAAgB,CACrC,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,eAAe,GACvB,OAAO,CAAC,WAAW,EAAE,CAAC,CAyBxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,iBAAiB,CACtC,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,wBAAwB,EAChC,OAAO,CAAC,EAAE,eAAe,GACvB,OAAO,CAAC,WAAW,CAAC,CAwCtB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,iBAAiB,CACtC,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,eAAe,GACvB,OAAO,CAAC,IAAI,CAAC,CAmCf"}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { APIResponseSchema, APIResponseSchemaNoData, APIError } from '../api';
|
|
3
|
+
import { DestinationSchema, CreateDestinationRequestSchema, UpdateDestinationRequestSchema, } from './types';
|
|
4
|
+
import { QueueError, QueueNotFoundError, DestinationNotFoundError, DestinationAlreadyExistsError, queueApiPath, buildQueueHeaders, } from './util';
|
|
5
|
+
import { validateQueueName, validateDestinationId, validateDestinationConfig } from './validation';
|
|
6
|
+
const DestinationResponseSchema = APIResponseSchema(z.object({ destination: DestinationSchema }));
|
|
7
|
+
const DestinationsListResponseSchema = APIResponseSchema(z.object({
|
|
8
|
+
destinations: z.array(DestinationSchema),
|
|
9
|
+
}));
|
|
10
|
+
const DeleteDestinationResponseSchema = APIResponseSchemaNoData();
|
|
11
|
+
/**
|
|
12
|
+
* Create a destination for a queue.
|
|
13
|
+
*
|
|
14
|
+
* Destinations are webhook endpoints that automatically receive messages when
|
|
15
|
+
* they are published to a queue. When a message is published, it will be
|
|
16
|
+
* delivered via HTTP POST to all active destinations configured for that queue.
|
|
17
|
+
*
|
|
18
|
+
* @param client - The API client instance
|
|
19
|
+
* @param queueName - The name of the queue to add the destination to
|
|
20
|
+
* @param params - Destination configuration including URL and optional settings
|
|
21
|
+
* @returns The created destination with assigned ID
|
|
22
|
+
* @throws {QueueValidationError} If validation fails (invalid queue name or config)
|
|
23
|
+
* @throws {QueueNotFoundError} If the queue does not exist
|
|
24
|
+
* @throws {QueueError} If the API request fails
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const destination = await createDestination(client, 'order-events', {
|
|
29
|
+
* url: 'https://api.example.com/webhooks/orders',
|
|
30
|
+
* config: {
|
|
31
|
+
* retry_attempts: 3,
|
|
32
|
+
* timeout_seconds: 30,
|
|
33
|
+
* },
|
|
34
|
+
* });
|
|
35
|
+
* console.log(`Created destination ${destination.id}`);
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export async function createDestination(client, queueName, params, options) {
|
|
39
|
+
validateQueueName(queueName);
|
|
40
|
+
if (params.config) {
|
|
41
|
+
validateDestinationConfig(params.config);
|
|
42
|
+
}
|
|
43
|
+
const url = queueApiPath('destinations/create', queueName);
|
|
44
|
+
try {
|
|
45
|
+
const resp = await client.post(url, params, DestinationResponseSchema, CreateDestinationRequestSchema, undefined, buildQueueHeaders(options?.orgId));
|
|
46
|
+
if (resp.success) {
|
|
47
|
+
return resp.data.destination;
|
|
48
|
+
}
|
|
49
|
+
if (resp.message?.includes('queue') && resp.message?.includes('not found')) {
|
|
50
|
+
throw new QueueNotFoundError({
|
|
51
|
+
queueName,
|
|
52
|
+
message: resp.message,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (resp.message?.includes('already exists')) {
|
|
56
|
+
throw new DestinationAlreadyExistsError({
|
|
57
|
+
queueName,
|
|
58
|
+
url: params.config?.url,
|
|
59
|
+
message: `A destination with URL "${params.config?.url}" already exists for queue "${queueName}"`,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
throw new QueueError({
|
|
63
|
+
queueName,
|
|
64
|
+
message: resp.message || 'Failed to create destination',
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
if (error instanceof APIError) {
|
|
69
|
+
const message = error.message || '';
|
|
70
|
+
if (message.includes('already exists')) {
|
|
71
|
+
throw new DestinationAlreadyExistsError({
|
|
72
|
+
queueName,
|
|
73
|
+
url: params.config?.url,
|
|
74
|
+
message: `A destination with URL "${params.config?.url}" already exists for queue "${queueName}"`,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
if (message.includes('queue') && message.includes('not found')) {
|
|
78
|
+
throw new QueueNotFoundError({
|
|
79
|
+
queueName,
|
|
80
|
+
message,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
throw new QueueError({
|
|
84
|
+
queueName,
|
|
85
|
+
message: message || 'Failed to create destination',
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
throw error;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* List all destinations for a queue.
|
|
93
|
+
*
|
|
94
|
+
* Retrieves all webhook destinations configured for a queue. Each destination
|
|
95
|
+
* represents an endpoint that receives messages when they are published.
|
|
96
|
+
*
|
|
97
|
+
* @param client - The API client instance
|
|
98
|
+
* @param queueName - The name of the queue
|
|
99
|
+
* @returns Array of destinations configured for the queue
|
|
100
|
+
* @throws {QueueValidationError} If validation fails (invalid queue name)
|
|
101
|
+
* @throws {QueueNotFoundError} If the queue does not exist
|
|
102
|
+
* @throws {QueueError} If the API request fails
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const destinations = await listDestinations(client, 'order-events');
|
|
107
|
+
* for (const dest of destinations) {
|
|
108
|
+
* console.log(`Destination ${dest.id}: ${dest.url} (${dest.enabled ? 'enabled' : 'disabled'})`);
|
|
109
|
+
* }
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
export async function listDestinations(client, queueName, options) {
|
|
113
|
+
validateQueueName(queueName);
|
|
114
|
+
const url = queueApiPath('destinations/list', queueName);
|
|
115
|
+
const resp = await client.get(url, DestinationsListResponseSchema, undefined, buildQueueHeaders(options?.orgId));
|
|
116
|
+
if (resp.success) {
|
|
117
|
+
return resp.data.destinations;
|
|
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 list destinations',
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Update a destination's configuration.
|
|
132
|
+
*
|
|
133
|
+
* Modifies an existing destination's settings such as URL, enabled status,
|
|
134
|
+
* or retry configuration. Only the fields provided in params will be updated.
|
|
135
|
+
*
|
|
136
|
+
* @param client - The API client instance
|
|
137
|
+
* @param queueName - The name of the queue
|
|
138
|
+
* @param destinationId - The destination ID to update (prefixed with dest_)
|
|
139
|
+
* @param params - Fields to update (partial update supported)
|
|
140
|
+
* @returns The updated destination
|
|
141
|
+
* @throws {QueueValidationError} If validation fails (invalid queue name, destination ID, or config)
|
|
142
|
+
* @throws {DestinationNotFoundError} If the destination does not exist
|
|
143
|
+
* @throws {QueueNotFoundError} If the queue does not exist
|
|
144
|
+
* @throws {QueueError} If the API request fails
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```typescript
|
|
148
|
+
* // Disable a destination temporarily
|
|
149
|
+
* const updated = await updateDestination(client, 'order-events', 'dest_abc123', {
|
|
150
|
+
* enabled: false,
|
|
151
|
+
* });
|
|
152
|
+
*
|
|
153
|
+
* // Update URL and retry settings
|
|
154
|
+
* const updated = await updateDestination(client, 'order-events', 'dest_abc123', {
|
|
155
|
+
* url: 'https://api.example.com/v2/webhooks/orders',
|
|
156
|
+
* config: {
|
|
157
|
+
* retry_attempts: 5,
|
|
158
|
+
* },
|
|
159
|
+
* });
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
export async function updateDestination(client, queueName, destinationId, params, options) {
|
|
163
|
+
validateQueueName(queueName);
|
|
164
|
+
validateDestinationId(destinationId);
|
|
165
|
+
if (params.config) {
|
|
166
|
+
validateDestinationConfig(params.config);
|
|
167
|
+
}
|
|
168
|
+
const url = queueApiPath('destinations/update', queueName, destinationId);
|
|
169
|
+
const resp = await client.patch(url, params, DestinationResponseSchema, UpdateDestinationRequestSchema, undefined, buildQueueHeaders(options?.orgId));
|
|
170
|
+
if (resp.success) {
|
|
171
|
+
return resp.data.destination;
|
|
172
|
+
}
|
|
173
|
+
if (resp.message?.includes('destination') && resp.message?.includes('not found')) {
|
|
174
|
+
throw new DestinationNotFoundError({
|
|
175
|
+
queueName,
|
|
176
|
+
destinationId,
|
|
177
|
+
message: resp.message,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
if (resp.message?.includes('queue') && resp.message?.includes('not found')) {
|
|
181
|
+
throw new QueueNotFoundError({
|
|
182
|
+
queueName,
|
|
183
|
+
message: resp.message,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
throw new QueueError({
|
|
187
|
+
queueName,
|
|
188
|
+
message: resp.message || 'Failed to update destination',
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Delete a destination from a queue.
|
|
193
|
+
*
|
|
194
|
+
* Permanently removes a webhook destination. Messages will no longer be
|
|
195
|
+
* delivered to this endpoint. This action cannot be undone.
|
|
196
|
+
*
|
|
197
|
+
* @param client - The API client instance
|
|
198
|
+
* @param queueName - The name of the queue
|
|
199
|
+
* @param destinationId - The destination ID to delete (prefixed with dest_)
|
|
200
|
+
* @returns void
|
|
201
|
+
* @throws {QueueValidationError} If validation fails (invalid queue name or destination ID)
|
|
202
|
+
* @throws {DestinationNotFoundError} If the destination does not exist
|
|
203
|
+
* @throws {QueueNotFoundError} If the queue does not exist
|
|
204
|
+
* @throws {QueueError} If the API request fails
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* ```typescript
|
|
208
|
+
* await deleteDestination(client, 'order-events', 'dest_abc123');
|
|
209
|
+
* console.log('Destination deleted');
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
export async function deleteDestination(client, queueName, destinationId, options) {
|
|
213
|
+
validateQueueName(queueName);
|
|
214
|
+
validateDestinationId(destinationId);
|
|
215
|
+
const url = queueApiPath('destinations/delete', queueName, destinationId);
|
|
216
|
+
const resp = await client.delete(url, DeleteDestinationResponseSchema, undefined, buildQueueHeaders(options?.orgId));
|
|
217
|
+
if (resp.success) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
if (resp.message?.includes('destination') && resp.message?.includes('not found')) {
|
|
221
|
+
throw new DestinationNotFoundError({
|
|
222
|
+
queueName,
|
|
223
|
+
destinationId,
|
|
224
|
+
message: resp.message,
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
if (resp.message?.includes('queue') && resp.message?.includes('not found')) {
|
|
228
|
+
throw new QueueNotFoundError({
|
|
229
|
+
queueName,
|
|
230
|
+
message: resp.message,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
throw new QueueError({
|
|
234
|
+
queueName,
|
|
235
|
+
message: resp.message || 'Failed to delete destination',
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
//# sourceMappingURL=destinations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"destinations.js","sourceRoot":"","sources":["../../../src/api/queue/destinations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAa,iBAAiB,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACzF,OAAO,EACN,iBAAiB,EAKjB,8BAA8B,EAC9B,8BAA8B,GAC9B,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,UAAU,EACV,kBAAkB,EAClB,wBAAwB,EACxB,6BAA6B,EAC7B,YAAY,EACZ,iBAAiB,GACjB,MAAM,QAAQ,CAAC;AAChB,O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C,OAAO,EAAE,CAAC;QAClB,OAAO;IACR,CAAC;IAED,IAAI,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QAClF,MAAM,IAAI,wBAAwB,CAAC;YAClC,SAAS;YACT,aAAa;YACb,OAAO,EAAE,IAAI,CAAC,OAAO;SACrB,CAAC,CAAC;IACJ,CAAC;IAED,IAAI,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QAC5E,MAAM,IAAI,kBAAkB,CAAC;YAC5B,SAAS;YACT,OAAO,EAAE,IAAI,CAAC,OAAO;SACrB,CAAC,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,UAAU,CAAC;QACpB,SAAS;QACT,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,8BAA8B;KACvD,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { APIClient } from '../api';
|
|
2
|
+
import { type DeadLetterMessage, type Message, type ListDlqRequest, type QueueApiOptions } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* List messages in the dead letter queue.
|
|
5
|
+
*
|
|
6
|
+
* Retrieves messages that failed processing after exhausting all retries.
|
|
7
|
+
* These messages can be inspected, replayed back to the main queue, or deleted.
|
|
8
|
+
*
|
|
9
|
+
* @param client - The API client instance
|
|
10
|
+
* @param queueName - The name of the queue whose DLQ to list
|
|
11
|
+
* @param params - Optional pagination parameters (limit, offset)
|
|
12
|
+
* @returns Object containing dead letter messages and optional total count
|
|
13
|
+
* @throws {QueueValidationError} If validation fails (invalid queue name, limit, or offset)
|
|
14
|
+
* @throws {QueueNotFoundError} If the queue does not exist
|
|
15
|
+
* @throws {QueueError} If the API request fails
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* // List first 10 dead letter messages
|
|
20
|
+
* const result = await listDeadLetterMessages(client, 'order-queue', { limit: 10 });
|
|
21
|
+
* for (const msg of result.messages) {
|
|
22
|
+
* console.log(`Failed message ${msg.id}: ${msg.failure_reason}`);
|
|
23
|
+
* console.log(`Attempts: ${msg.delivery_attempts}, Moved at: ${msg.moved_at}`);
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function listDeadLetterMessages(client: APIClient, queueName: string, params?: ListDlqRequest, options?: QueueApiOptions): Promise<{
|
|
28
|
+
messages: DeadLetterMessage[];
|
|
29
|
+
total?: number;
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Replay a dead letter message back to the main queue.
|
|
33
|
+
*
|
|
34
|
+
* Moves a message from the dead letter queue back to the main queue for
|
|
35
|
+
* reprocessing. The message state is reset to pending and retry count is
|
|
36
|
+
* preserved. Use this after fixing the underlying issue that caused the failure.
|
|
37
|
+
*
|
|
38
|
+
* @param client - The API client instance
|
|
39
|
+
* @param queueName - The name of the queue
|
|
40
|
+
* @param messageId - The message ID to replay (prefixed with msg_)
|
|
41
|
+
* @returns The replayed message with updated state
|
|
42
|
+
* @throws {QueueValidationError} If validation fails (invalid queue name or message ID)
|
|
43
|
+
* @throws {MessageNotFoundError} If the message does not exist in the DLQ
|
|
44
|
+
* @throws {QueueNotFoundError} If the queue does not exist
|
|
45
|
+
* @throws {QueueError} If the API request fails
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* // Replay a failed message after fixing the bug
|
|
50
|
+
* const message = await replayDeadLetterMessage(client, 'order-queue', 'msg_abc123');
|
|
51
|
+
* console.log(`Replayed message ${message.id}, now in state: ${message.state}`);
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function replayDeadLetterMessage(client: APIClient, queueName: string, messageId: string, options?: QueueApiOptions): Promise<Message>;
|
|
55
|
+
/**
|
|
56
|
+
* Purge all messages from a dead letter queue.
|
|
57
|
+
*
|
|
58
|
+
* Permanently deletes all messages in the dead letter queue. This operation
|
|
59
|
+
* cannot be undone. Use with caution - consider reviewing or exporting
|
|
60
|
+
* messages before purging.
|
|
61
|
+
*
|
|
62
|
+
* @param client - The API client instance
|
|
63
|
+
* @param queueName - The name of the queue whose DLQ to purge
|
|
64
|
+
* @returns void
|
|
65
|
+
* @throws {QueueValidationError} If validation fails (invalid queue name)
|
|
66
|
+
* @throws {QueueNotFoundError} If the queue does not exist
|
|
67
|
+
* @throws {QueueError} If the API request fails
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* // Purge all dead letter messages after investigation
|
|
72
|
+
* await purgeDeadLetter(client, 'order-queue');
|
|
73
|
+
* console.log('All dead letter messages have been deleted');
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export declare function purgeDeadLetter(client: APIClient, queueName: string, options?: QueueApiOptions): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Delete a specific message from the dead letter queue.
|
|
79
|
+
*
|
|
80
|
+
* Permanently removes a single message from the dead letter queue.
|
|
81
|
+
* Use this when you've determined that a specific failed message
|
|
82
|
+
* should not be retried and can be discarded.
|
|
83
|
+
*
|
|
84
|
+
* @param client - The API client instance
|
|
85
|
+
* @param queueName - The name of the queue
|
|
86
|
+
* @param messageId - The message ID to delete (prefixed with msg_)
|
|
87
|
+
* @returns void
|
|
88
|
+
* @throws {QueueValidationError} If validation fails (invalid queue name or message ID)
|
|
89
|
+
* @throws {MessageNotFoundError} If the message does not exist in the DLQ
|
|
90
|
+
* @throws {QueueError} If the API request fails
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* // Delete a message that cannot be recovered
|
|
95
|
+
* await deleteDeadLetterMessage(client, 'order-queue', 'msg_abc123');
|
|
96
|
+
* console.log('Dead letter message deleted');
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
export declare function deleteDeadLetterMessage(client: APIClient, queueName: string, messageId: string, options?: QueueApiOptions): Promise<void>;
|
|
100
|
+
//# sourceMappingURL=dlq.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dlq.d.ts","sourceRoot":"","sources":["../../../src/api/queue/dlq.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAA8C,MAAM,QAAQ,CAAC;AAC/E,OAAO,EAGN,KAAK,iBAAiB,EACtB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,MAAM,SAAS,CAAC;AAoBjB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,sBAAsB,CAC3C,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,eAAe,GACvB,OAAO,CAAC;IAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAyC5D;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,uBAAuB,CAC5C,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,eAAe,GACvB,OAAO,CAAC,OAAO,CAAC,CAqClB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,eAAe,CACpC,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,eAAe,GACvB,OAAO,CAAC,IAAI,CAAC,CAyBf;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,uBAAuB,CAC5C,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,eAAe,GACvB,OAAO,CAAC,IAAI,CAAC,CAmCf"}
|