@amqp-contract/worker 0.3.3 → 0.3.5
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/docs/index.md +21 -21
- package/package.json +5 -5
package/docs/index.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
### MessageValidationError
|
|
10
10
|
|
|
11
|
-
Defined in: [packages/worker/src/errors.ts:35](https://github.com/btravers/amqp-contract/blob/
|
|
11
|
+
Defined in: [packages/worker/src/errors.ts:35](https://github.com/btravers/amqp-contract/blob/d4ba5adf1e580179e8e0a4a6505d50b03f1a9b29/packages/worker/src/errors.ts#L35)
|
|
12
12
|
|
|
13
13
|
Error thrown when message validation fails
|
|
14
14
|
|
|
@@ -24,7 +24,7 @@ Error thrown when message validation fails
|
|
|
24
24
|
new MessageValidationError(consumerName, issues): MessageValidationError;
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
Defined in: [packages/worker/src/errors.ts:36](https://github.com/btravers/amqp-contract/blob/
|
|
27
|
+
Defined in: [packages/worker/src/errors.ts:36](https://github.com/btravers/amqp-contract/blob/d4ba5adf1e580179e8e0a4a6505d50b03f1a9b29/packages/worker/src/errors.ts#L36)
|
|
28
28
|
|
|
29
29
|
###### Parameters
|
|
30
30
|
|
|
@@ -48,8 +48,8 @@ WorkerError.constructor
|
|
|
48
48
|
| Property | Modifier | Type | Description | Inherited from | Defined in |
|
|
49
49
|
| ------ | ------ | ------ | ------ | ------ | ------ |
|
|
50
50
|
| <a id="cause"></a> `cause?` | `public` | `unknown` | - | `WorkerError.cause` | node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 |
|
|
51
|
-
| <a id="consumername"></a> `consumerName` | `readonly` | `string` | - | - | [packages/worker/src/errors.ts:37](https://github.com/btravers/amqp-contract/blob/
|
|
52
|
-
| <a id="issues"></a> `issues` | `readonly` | `unknown` | - | - | [packages/worker/src/errors.ts:38](https://github.com/btravers/amqp-contract/blob/
|
|
51
|
+
| <a id="consumername"></a> `consumerName` | `readonly` | `string` | - | - | [packages/worker/src/errors.ts:37](https://github.com/btravers/amqp-contract/blob/d4ba5adf1e580179e8e0a4a6505d50b03f1a9b29/packages/worker/src/errors.ts#L37) |
|
|
52
|
+
| <a id="issues"></a> `issues` | `readonly` | `unknown` | - | - | [packages/worker/src/errors.ts:38](https://github.com/btravers/amqp-contract/blob/d4ba5adf1e580179e8e0a4a6505d50b03f1a9b29/packages/worker/src/errors.ts#L38) |
|
|
53
53
|
| <a id="message"></a> `message` | `public` | `string` | - | `WorkerError.message` | node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 |
|
|
54
54
|
| <a id="name"></a> `name` | `public` | `string` | - | `WorkerError.name` | node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 |
|
|
55
55
|
| <a id="stack"></a> `stack?` | `public` | `string` | - | `WorkerError.stack` | node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 |
|
|
@@ -159,7 +159,7 @@ WorkerError.prepareStackTrace
|
|
|
159
159
|
|
|
160
160
|
### TechnicalError
|
|
161
161
|
|
|
162
|
-
Defined in: [packages/worker/src/errors.ts:22](https://github.com/btravers/amqp-contract/blob/
|
|
162
|
+
Defined in: [packages/worker/src/errors.ts:22](https://github.com/btravers/amqp-contract/blob/d4ba5adf1e580179e8e0a4a6505d50b03f1a9b29/packages/worker/src/errors.ts#L22)
|
|
163
163
|
|
|
164
164
|
Error for technical/runtime failures in worker operations
|
|
165
165
|
This includes validation failures, parsing failures, and processing failures
|
|
@@ -176,7 +176,7 @@ This includes validation failures, parsing failures, and processing failures
|
|
|
176
176
|
new TechnicalError(message, cause?): TechnicalError;
|
|
177
177
|
```
|
|
178
178
|
|
|
179
|
-
Defined in: [packages/worker/src/errors.ts:23](https://github.com/btravers/amqp-contract/blob/
|
|
179
|
+
Defined in: [packages/worker/src/errors.ts:23](https://github.com/btravers/amqp-contract/blob/d4ba5adf1e580179e8e0a4a6505d50b03f1a9b29/packages/worker/src/errors.ts#L23)
|
|
180
180
|
|
|
181
181
|
###### Parameters
|
|
182
182
|
|
|
@@ -199,7 +199,7 @@ WorkerError.constructor
|
|
|
199
199
|
|
|
200
200
|
| Property | Modifier | Type | Description | Inherited from | Defined in |
|
|
201
201
|
| ------ | ------ | ------ | ------ | ------ | ------ |
|
|
202
|
-
| <a id="cause-1"></a> `cause?` | `readonly` | `unknown` | - | `WorkerError.cause` | [packages/worker/src/errors.ts:25](https://github.com/btravers/amqp-contract/blob/
|
|
202
|
+
| <a id="cause-1"></a> `cause?` | `readonly` | `unknown` | - | `WorkerError.cause` | [packages/worker/src/errors.ts:25](https://github.com/btravers/amqp-contract/blob/d4ba5adf1e580179e8e0a4a6505d50b03f1a9b29/packages/worker/src/errors.ts#L25) |
|
|
203
203
|
| <a id="message-1"></a> `message` | `public` | `string` | - | `WorkerError.message` | node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 |
|
|
204
204
|
| <a id="name-1"></a> `name` | `public` | `string` | - | `WorkerError.name` | node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 |
|
|
205
205
|
| <a id="stack-1"></a> `stack?` | `public` | `string` | - | `WorkerError.stack` | node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 |
|
|
@@ -309,7 +309,7 @@ WorkerError.prepareStackTrace
|
|
|
309
309
|
|
|
310
310
|
### TypedAmqpWorker
|
|
311
311
|
|
|
312
|
-
Defined in: [packages/worker/src/worker.ts:83](https://github.com/btravers/amqp-contract/blob/
|
|
312
|
+
Defined in: [packages/worker/src/worker.ts:83](https://github.com/btravers/amqp-contract/blob/d4ba5adf1e580179e8e0a4a6505d50b03f1a9b29/packages/worker/src/worker.ts#L83)
|
|
313
313
|
|
|
314
314
|
Type-safe AMQP worker for consuming messages from RabbitMQ.
|
|
315
315
|
|
|
@@ -363,7 +363,7 @@ await worker.close().resultToPromise();
|
|
|
363
363
|
close(): Future<Result<void, TechnicalError>>;
|
|
364
364
|
```
|
|
365
365
|
|
|
366
|
-
Defined in: [packages/worker/src/worker.ts:156](https://github.com/btravers/amqp-contract/blob/
|
|
366
|
+
Defined in: [packages/worker/src/worker.ts:156](https://github.com/btravers/amqp-contract/blob/d4ba5adf1e580179e8e0a4a6505d50b03f1a9b29/packages/worker/src/worker.ts#L156)
|
|
367
367
|
|
|
368
368
|
Close the AMQP channel and connection.
|
|
369
369
|
|
|
@@ -391,7 +391,7 @@ if (closeResult.isOk()) {
|
|
|
391
391
|
static create<TContract>(options): Future<Result<TypedAmqpWorker<TContract>, TechnicalError>>;
|
|
392
392
|
```
|
|
393
393
|
|
|
394
|
-
Defined in: [packages/worker/src/worker.ts:117](https://github.com/btravers/amqp-contract/blob/
|
|
394
|
+
Defined in: [packages/worker/src/worker.ts:117](https://github.com/btravers/amqp-contract/blob/d4ba5adf1e580179e8e0a4a6505d50b03f1a9b29/packages/worker/src/worker.ts#L117)
|
|
395
395
|
|
|
396
396
|
Create a type-safe AMQP worker from a contract.
|
|
397
397
|
|
|
@@ -442,7 +442,7 @@ if (workerResult.isError()) {
|
|
|
442
442
|
type CreateWorkerOptions<TContract> = object;
|
|
443
443
|
```
|
|
444
444
|
|
|
445
|
-
Defined in: [packages/worker/src/worker.ts:30](https://github.com/btravers/amqp-contract/blob/
|
|
445
|
+
Defined in: [packages/worker/src/worker.ts:30](https://github.com/btravers/amqp-contract/blob/d4ba5adf1e580179e8e0a4a6505d50b03f1a9b29/packages/worker/src/worker.ts#L30)
|
|
446
446
|
|
|
447
447
|
Options for creating a type-safe AMQP worker.
|
|
448
448
|
|
|
@@ -474,11 +474,11 @@ const options: CreateWorkerOptions<typeof contract> = {
|
|
|
474
474
|
|
|
475
475
|
| Property | Type | Description | Defined in |
|
|
476
476
|
| ------ | ------ | ------ | ------ |
|
|
477
|
-
| <a id="connectionoptions"></a> `connectionOptions?` | `AmqpConnectionManagerOptions` | Optional connection configuration (heartbeat, reconnect settings, etc.) | [packages/worker/src/worker.ts:38](https://github.com/btravers/amqp-contract/blob/
|
|
478
|
-
| <a id="contract"></a> `contract` | `TContract` | The AMQP contract definition specifying consumers and their message schemas | [packages/worker/src/worker.ts:32](https://github.com/btravers/amqp-contract/blob/
|
|
479
|
-
| <a id="handlers"></a> `handlers` | [`WorkerInferConsumerHandlers`](#workerinferconsumerhandlers)\<`TContract`\> | Handlers for each consumer defined in the contract | [packages/worker/src/worker.ts:34](https://github.com/btravers/amqp-contract/blob/
|
|
480
|
-
| <a id="logger"></a> `logger?` | `Logger` | Optional logger for logging message consumption and errors | [packages/worker/src/worker.ts:40](https://github.com/btravers/amqp-contract/blob/
|
|
481
|
-
| <a id="urls"></a> `urls` | `ConnectionUrl`[] | AMQP broker URL(s). Multiple URLs provide failover support | [packages/worker/src/worker.ts:36](https://github.com/btravers/amqp-contract/blob/
|
|
477
|
+
| <a id="connectionoptions"></a> `connectionOptions?` | `AmqpConnectionManagerOptions` | Optional connection configuration (heartbeat, reconnect settings, etc.) | [packages/worker/src/worker.ts:38](https://github.com/btravers/amqp-contract/blob/d4ba5adf1e580179e8e0a4a6505d50b03f1a9b29/packages/worker/src/worker.ts#L38) |
|
|
478
|
+
| <a id="contract"></a> `contract` | `TContract` | The AMQP contract definition specifying consumers and their message schemas | [packages/worker/src/worker.ts:32](https://github.com/btravers/amqp-contract/blob/d4ba5adf1e580179e8e0a4a6505d50b03f1a9b29/packages/worker/src/worker.ts#L32) |
|
|
479
|
+
| <a id="handlers"></a> `handlers` | [`WorkerInferConsumerHandlers`](#workerinferconsumerhandlers)\<`TContract`\> | Handlers for each consumer defined in the contract | [packages/worker/src/worker.ts:34](https://github.com/btravers/amqp-contract/blob/d4ba5adf1e580179e8e0a4a6505d50b03f1a9b29/packages/worker/src/worker.ts#L34) |
|
|
480
|
+
| <a id="logger"></a> `logger?` | `Logger` | Optional logger for logging message consumption and errors | [packages/worker/src/worker.ts:40](https://github.com/btravers/amqp-contract/blob/d4ba5adf1e580179e8e0a4a6505d50b03f1a9b29/packages/worker/src/worker.ts#L40) |
|
|
481
|
+
| <a id="urls"></a> `urls` | `ConnectionUrl`[] | AMQP broker URL(s). Multiple URLs provide failover support | [packages/worker/src/worker.ts:36](https://github.com/btravers/amqp-contract/blob/d4ba5adf1e580179e8e0a4a6505d50b03f1a9b29/packages/worker/src/worker.ts#L36) |
|
|
482
482
|
|
|
483
483
|
***
|
|
484
484
|
|
|
@@ -488,7 +488,7 @@ const options: CreateWorkerOptions<typeof contract> = {
|
|
|
488
488
|
type WorkerInferConsumerHandler<TContract, TName> = (message) => Promise<void>;
|
|
489
489
|
```
|
|
490
490
|
|
|
491
|
-
Defined in: [packages/worker/src/types.ts:45](https://github.com/btravers/amqp-contract/blob/
|
|
491
|
+
Defined in: [packages/worker/src/types.ts:45](https://github.com/btravers/amqp-contract/blob/d4ba5adf1e580179e8e0a4a6505d50b03f1a9b29/packages/worker/src/types.ts#L45)
|
|
492
492
|
|
|
493
493
|
Infer consumer handler type for a specific consumer
|
|
494
494
|
|
|
@@ -517,7 +517,7 @@ Infer consumer handler type for a specific consumer
|
|
|
517
517
|
type WorkerInferConsumerHandlers<TContract> = { [K in InferConsumerNames<TContract>]: WorkerInferConsumerHandler<TContract, K> };
|
|
518
518
|
```
|
|
519
519
|
|
|
520
|
-
Defined in: [packages/worker/src/types.ts:53](https://github.com/btravers/amqp-contract/blob/
|
|
520
|
+
Defined in: [packages/worker/src/types.ts:53](https://github.com/btravers/amqp-contract/blob/d4ba5adf1e580179e8e0a4a6505d50b03f1a9b29/packages/worker/src/types.ts#L53)
|
|
521
521
|
|
|
522
522
|
Infer all consumer handlers for a contract
|
|
523
523
|
|
|
@@ -535,7 +535,7 @@ Infer all consumer handlers for a contract
|
|
|
535
535
|
type WorkerInferConsumerInput<TContract, TName> = ConsumerInferInput<InferConsumer<TContract, TName>>;
|
|
536
536
|
```
|
|
537
537
|
|
|
538
|
-
Defined in: [packages/worker/src/types.ts:37](https://github.com/btravers/amqp-contract/blob/
|
|
538
|
+
Defined in: [packages/worker/src/types.ts:37](https://github.com/btravers/amqp-contract/blob/d4ba5adf1e580179e8e0a4a6505d50b03f1a9b29/packages/worker/src/types.ts#L37)
|
|
539
539
|
|
|
540
540
|
Worker perspective types - for consuming messages
|
|
541
541
|
|
|
@@ -557,7 +557,7 @@ function defineHandler<TContract, TName>(
|
|
|
557
557
|
handler): WorkerInferConsumerHandler<TContract, TName>;
|
|
558
558
|
```
|
|
559
559
|
|
|
560
|
-
Defined in: [packages/worker/src/handlers.ts:73](https://github.com/btravers/amqp-contract/blob/
|
|
560
|
+
Defined in: [packages/worker/src/handlers.ts:73](https://github.com/btravers/amqp-contract/blob/d4ba5adf1e580179e8e0a4a6505d50b03f1a9b29/packages/worker/src/handlers.ts#L73)
|
|
561
561
|
|
|
562
562
|
Define a type-safe handler for a specific consumer in a contract.
|
|
563
563
|
|
|
@@ -649,7 +649,7 @@ const worker = await TypedAmqpWorker.create({
|
|
|
649
649
|
function defineHandlers<TContract>(contract, handlers): WorkerInferConsumerHandlers<TContract>;
|
|
650
650
|
```
|
|
651
651
|
|
|
652
|
-
Defined in: [packages/worker/src/handlers.ts:152](https://github.com/btravers/amqp-contract/blob/
|
|
652
|
+
Defined in: [packages/worker/src/handlers.ts:152](https://github.com/btravers/amqp-contract/blob/d4ba5adf1e580179e8e0a4a6505d50b03f1a9b29/packages/worker/src/handlers.ts#L152)
|
|
653
653
|
|
|
654
654
|
Define multiple type-safe handlers for consumers in a contract.
|
|
655
655
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amqp-contract/worker",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "Worker utilities for consuming messages using amqp-contract",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"amqp",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@standard-schema/spec": "1.1.0",
|
|
46
46
|
"@swan-io/boxed": "3.2.1",
|
|
47
|
-
"@amqp-contract/contract": "0.3.
|
|
48
|
-
"@amqp-contract/core": "0.3.
|
|
47
|
+
"@amqp-contract/contract": "0.3.5",
|
|
48
|
+
"@amqp-contract/core": "0.3.5"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/amqplib": "0.10.8",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"typescript": "5.9.3",
|
|
60
60
|
"vitest": "4.0.16",
|
|
61
61
|
"zod": "4.2.1",
|
|
62
|
-
"@amqp-contract/client": "0.3.
|
|
63
|
-
"@amqp-contract/testing": "0.3.
|
|
62
|
+
"@amqp-contract/client": "0.3.5",
|
|
63
|
+
"@amqp-contract/testing": "0.3.5",
|
|
64
64
|
"@amqp-contract/tsconfig": "0.0.0",
|
|
65
65
|
"@amqp-contract/typedoc": "0.0.1"
|
|
66
66
|
},
|