@amqp-contract/worker 0.19.0 → 0.20.0
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 +42 -42
- package/package.json +6 -6
package/docs/index.md
CHANGED
|
@@ -64,7 +64,7 @@ Error.constructor
|
|
|
64
64
|
| <a id="name"></a> `name` | `public` | `string` | - | `Error.name` | node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 |
|
|
65
65
|
| <a id="source"></a> `source` | `readonly` | `string` | - | - | packages/core/dist/index.d.mts:84 |
|
|
66
66
|
| <a id="stack"></a> `stack?` | `public` | `string` | - | `Error.stack` | node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 |
|
|
67
|
-
| <a id="stacktracelimit"></a> `stackTraceLimit` | `static` | `number` | The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | `Error.stackTraceLimit` | node\_modules/.pnpm/@types+node@25.
|
|
67
|
+
| <a id="stacktracelimit"></a> `stackTraceLimit` | `static` | `number` | The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | `Error.stackTraceLimit` | node\_modules/.pnpm/@types+node@25.3.0/node\_modules/@types/node/globals.d.ts:67 |
|
|
68
68
|
|
|
69
69
|
#### Methods
|
|
70
70
|
|
|
@@ -74,7 +74,7 @@ Error.constructor
|
|
|
74
74
|
static captureStackTrace(targetObject, constructorOpt?): void;
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
Defined in: node\_modules/.pnpm/@types+node@25.
|
|
77
|
+
Defined in: node\_modules/.pnpm/@types+node@25.3.0/node\_modules/@types/node/globals.d.ts:51
|
|
78
78
|
|
|
79
79
|
Creates a `.stack` property on `targetObject`, which when accessed returns
|
|
80
80
|
a string representing the location in the code at which
|
|
@@ -143,7 +143,7 @@ Error.captureStackTrace
|
|
|
143
143
|
static prepareStackTrace(err, stackTraces): any;
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
-
Defined in: node\_modules/.pnpm/@types+node@25.
|
|
146
|
+
Defined in: node\_modules/.pnpm/@types+node@25.3.0/node\_modules/@types/node/globals.d.ts:55
|
|
147
147
|
|
|
148
148
|
###### Parameters
|
|
149
149
|
|
|
@@ -170,7 +170,7 @@ Error.prepareStackTrace
|
|
|
170
170
|
|
|
171
171
|
### NonRetryableError
|
|
172
172
|
|
|
173
|
-
Defined in: [packages/worker/src/errors.ts:34](https://github.com/btravers/amqp-contract/blob/
|
|
173
|
+
Defined in: [packages/worker/src/errors.ts:34](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/errors.ts#L34)
|
|
174
174
|
|
|
175
175
|
Non-retryable errors - permanent failures that should not be retried
|
|
176
176
|
Examples: invalid data, business rule violations, permanent external failures
|
|
@@ -190,7 +190,7 @@ immediately sent to the dead letter queue (DLQ) if configured.
|
|
|
190
190
|
new NonRetryableError(message, cause?): NonRetryableError;
|
|
191
191
|
```
|
|
192
192
|
|
|
193
|
-
Defined in: [packages/worker/src/errors.ts:35](https://github.com/btravers/amqp-contract/blob/
|
|
193
|
+
Defined in: [packages/worker/src/errors.ts:35](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/errors.ts#L35)
|
|
194
194
|
|
|
195
195
|
###### Parameters
|
|
196
196
|
|
|
@@ -213,11 +213,11 @@ Error.constructor
|
|
|
213
213
|
|
|
214
214
|
| Property | Modifier | Type | Description | Inherited from | Defined in |
|
|
215
215
|
| ------ | ------ | ------ | ------ | ------ | ------ |
|
|
216
|
-
| <a id="cause-1"></a> `cause?` | `readonly` | `unknown` | - | `Error.cause` | [packages/worker/src/errors.ts:37](https://github.com/btravers/amqp-contract/blob/
|
|
216
|
+
| <a id="cause-1"></a> `cause?` | `readonly` | `unknown` | - | `Error.cause` | [packages/worker/src/errors.ts:37](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/errors.ts#L37) |
|
|
217
217
|
| <a id="message-1"></a> `message` | `public` | `string` | - | `Error.message` | node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 |
|
|
218
218
|
| <a id="name-1"></a> `name` | `public` | `string` | - | `Error.name` | node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 |
|
|
219
219
|
| <a id="stack-1"></a> `stack?` | `public` | `string` | - | `Error.stack` | node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 |
|
|
220
|
-
| <a id="stacktracelimit-1"></a> `stackTraceLimit` | `static` | `number` | The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | `Error.stackTraceLimit` | node\_modules/.pnpm/@types+node@25.
|
|
220
|
+
| <a id="stacktracelimit-1"></a> `stackTraceLimit` | `static` | `number` | The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | `Error.stackTraceLimit` | node\_modules/.pnpm/@types+node@25.3.0/node\_modules/@types/node/globals.d.ts:67 |
|
|
221
221
|
|
|
222
222
|
#### Methods
|
|
223
223
|
|
|
@@ -227,7 +227,7 @@ Error.constructor
|
|
|
227
227
|
static captureStackTrace(targetObject, constructorOpt?): void;
|
|
228
228
|
```
|
|
229
229
|
|
|
230
|
-
Defined in: node\_modules/.pnpm/@types+node@25.
|
|
230
|
+
Defined in: node\_modules/.pnpm/@types+node@25.3.0/node\_modules/@types/node/globals.d.ts:51
|
|
231
231
|
|
|
232
232
|
Creates a `.stack` property on `targetObject`, which when accessed returns
|
|
233
233
|
a string representing the location in the code at which
|
|
@@ -296,7 +296,7 @@ Error.captureStackTrace
|
|
|
296
296
|
static prepareStackTrace(err, stackTraces): any;
|
|
297
297
|
```
|
|
298
298
|
|
|
299
|
-
Defined in: node\_modules/.pnpm/@types+node@25.
|
|
299
|
+
Defined in: node\_modules/.pnpm/@types+node@25.3.0/node\_modules/@types/node/globals.d.ts:55
|
|
300
300
|
|
|
301
301
|
###### Parameters
|
|
302
302
|
|
|
@@ -323,7 +323,7 @@ Error.prepareStackTrace
|
|
|
323
323
|
|
|
324
324
|
### RetryableError
|
|
325
325
|
|
|
326
|
-
Defined in: [packages/worker/src/errors.ts:10](https://github.com/btravers/amqp-contract/blob/
|
|
326
|
+
Defined in: [packages/worker/src/errors.ts:10](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/errors.ts#L10)
|
|
327
327
|
|
|
328
328
|
Retryable errors - transient failures that may succeed on retry
|
|
329
329
|
Examples: network timeouts, rate limiting, temporary service unavailability
|
|
@@ -343,7 +343,7 @@ The worker will apply exponential backoff and retry the message.
|
|
|
343
343
|
new RetryableError(message, cause?): RetryableError;
|
|
344
344
|
```
|
|
345
345
|
|
|
346
|
-
Defined in: [packages/worker/src/errors.ts:11](https://github.com/btravers/amqp-contract/blob/
|
|
346
|
+
Defined in: [packages/worker/src/errors.ts:11](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/errors.ts#L11)
|
|
347
347
|
|
|
348
348
|
###### Parameters
|
|
349
349
|
|
|
@@ -366,11 +366,11 @@ Error.constructor
|
|
|
366
366
|
|
|
367
367
|
| Property | Modifier | Type | Description | Inherited from | Defined in |
|
|
368
368
|
| ------ | ------ | ------ | ------ | ------ | ------ |
|
|
369
|
-
| <a id="cause-2"></a> `cause?` | `readonly` | `unknown` | - | `Error.cause` | [packages/worker/src/errors.ts:13](https://github.com/btravers/amqp-contract/blob/
|
|
369
|
+
| <a id="cause-2"></a> `cause?` | `readonly` | `unknown` | - | `Error.cause` | [packages/worker/src/errors.ts:13](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/errors.ts#L13) |
|
|
370
370
|
| <a id="message-2"></a> `message` | `public` | `string` | - | `Error.message` | node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 |
|
|
371
371
|
| <a id="name-2"></a> `name` | `public` | `string` | - | `Error.name` | node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 |
|
|
372
372
|
| <a id="stack-2"></a> `stack?` | `public` | `string` | - | `Error.stack` | node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 |
|
|
373
|
-
| <a id="stacktracelimit-2"></a> `stackTraceLimit` | `static` | `number` | The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | `Error.stackTraceLimit` | node\_modules/.pnpm/@types+node@25.
|
|
373
|
+
| <a id="stacktracelimit-2"></a> `stackTraceLimit` | `static` | `number` | The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | `Error.stackTraceLimit` | node\_modules/.pnpm/@types+node@25.3.0/node\_modules/@types/node/globals.d.ts:67 |
|
|
374
374
|
|
|
375
375
|
#### Methods
|
|
376
376
|
|
|
@@ -380,7 +380,7 @@ Error.constructor
|
|
|
380
380
|
static captureStackTrace(targetObject, constructorOpt?): void;
|
|
381
381
|
```
|
|
382
382
|
|
|
383
|
-
Defined in: node\_modules/.pnpm/@types+node@25.
|
|
383
|
+
Defined in: node\_modules/.pnpm/@types+node@25.3.0/node\_modules/@types/node/globals.d.ts:51
|
|
384
384
|
|
|
385
385
|
Creates a `.stack` property on `targetObject`, which when accessed returns
|
|
386
386
|
a string representing the location in the code at which
|
|
@@ -449,7 +449,7 @@ Error.captureStackTrace
|
|
|
449
449
|
static prepareStackTrace(err, stackTraces): any;
|
|
450
450
|
```
|
|
451
451
|
|
|
452
|
-
Defined in: node\_modules/.pnpm/@types+node@25.
|
|
452
|
+
Defined in: node\_modules/.pnpm/@types+node@25.3.0/node\_modules/@types/node/globals.d.ts:55
|
|
453
453
|
|
|
454
454
|
###### Parameters
|
|
455
455
|
|
|
@@ -476,7 +476,7 @@ Error.prepareStackTrace
|
|
|
476
476
|
|
|
477
477
|
### TypedAmqpWorker
|
|
478
478
|
|
|
479
|
-
Defined in: [packages/worker/src/worker.ts:158](https://github.com/btravers/amqp-contract/blob/
|
|
479
|
+
Defined in: [packages/worker/src/worker.ts:158](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/worker.ts#L158)
|
|
480
480
|
|
|
481
481
|
Type-safe AMQP worker for consuming messages from RabbitMQ.
|
|
482
482
|
|
|
@@ -531,7 +531,7 @@ await worker.close().resultToPromise();
|
|
|
531
531
|
close(): Future<Result<void, TechnicalError>>;
|
|
532
532
|
```
|
|
533
533
|
|
|
534
|
-
Defined in: [packages/worker/src/worker.ts:278](https://github.com/btravers/amqp-contract/blob/
|
|
534
|
+
Defined in: [packages/worker/src/worker.ts:278](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/worker.ts#L278)
|
|
535
535
|
|
|
536
536
|
Close the AMQP channel and connection.
|
|
537
537
|
|
|
@@ -559,7 +559,7 @@ if (closeResult.isOk()) {
|
|
|
559
559
|
static create<TContract>(options): Future<Result<TypedAmqpWorker<TContract>, TechnicalError>>;
|
|
560
560
|
```
|
|
561
561
|
|
|
562
|
-
Defined in: [packages/worker/src/worker.ts:235](https://github.com/btravers/amqp-contract/blob/
|
|
562
|
+
Defined in: [packages/worker/src/worker.ts:235](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/worker.ts#L235)
|
|
563
563
|
|
|
564
564
|
Create a type-safe AMQP worker from a contract.
|
|
565
565
|
|
|
@@ -609,7 +609,7 @@ const worker = await TypedAmqpWorker.create({
|
|
|
609
609
|
type CreateWorkerOptions<TContract> = object;
|
|
610
610
|
```
|
|
611
611
|
|
|
612
|
-
Defined in: [packages/worker/src/worker.ts:94](https://github.com/btravers/amqp-contract/blob/
|
|
612
|
+
Defined in: [packages/worker/src/worker.ts:94](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/worker.ts#L94)
|
|
613
613
|
|
|
614
614
|
Options for creating a type-safe AMQP worker.
|
|
615
615
|
|
|
@@ -654,12 +654,12 @@ not at the handler level. See `QueueDefinition.retry` for configuration options.
|
|
|
654
654
|
|
|
655
655
|
| Property | Type | Description | Defined in |
|
|
656
656
|
| ------ | ------ | ------ | ------ |
|
|
657
|
-
| <a id="connectionoptions"></a> `connectionOptions?` | `AmqpConnectionManagerOptions` | Optional connection configuration (heartbeat, reconnect settings, etc.) | [packages/worker/src/worker.ts:106](https://github.com/btravers/amqp-contract/blob/
|
|
658
|
-
| <a id="contract"></a> `contract` | `TContract` | The AMQP contract definition specifying consumers and their message schemas | [packages/worker/src/worker.ts:96](https://github.com/btravers/amqp-contract/blob/
|
|
659
|
-
| <a id="handlers"></a> `handlers` | [`WorkerInferConsumerHandlers`](#workerinferconsumerhandlers)<`TContract`> | Handlers for each consumer defined in the contract. Handlers must return `Future<Result<void, HandlerError>>` for explicit error handling. Use defineHandler() to create handlers. | [packages/worker/src/worker.ts:102](https://github.com/btravers/amqp-contract/blob/
|
|
660
|
-
| <a id="logger"></a> `logger?` | `Logger` | Optional logger for logging message consumption and errors | [packages/worker/src/worker.ts:108](https://github.com/btravers/amqp-contract/blob/
|
|
661
|
-
| <a id="telemetry"></a> `telemetry?` | `TelemetryProvider` | Optional telemetry provider for tracing and metrics. If not provided, uses the default provider which attempts to load OpenTelemetry. OpenTelemetry instrumentation is automatically enabled if @opentelemetry/api is installed. | [packages/worker/src/worker.ts:114](https://github.com/btravers/amqp-contract/blob/
|
|
662
|
-
| <a id="urls"></a> `urls` | `ConnectionUrl`[] | AMQP broker URL(s). Multiple URLs provide failover support | [packages/worker/src/worker.ts:104](https://github.com/btravers/amqp-contract/blob/
|
|
657
|
+
| <a id="connectionoptions"></a> `connectionOptions?` | `AmqpConnectionManagerOptions` | Optional connection configuration (heartbeat, reconnect settings, etc.) | [packages/worker/src/worker.ts:106](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/worker.ts#L106) |
|
|
658
|
+
| <a id="contract"></a> `contract` | `TContract` | The AMQP contract definition specifying consumers and their message schemas | [packages/worker/src/worker.ts:96](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/worker.ts#L96) |
|
|
659
|
+
| <a id="handlers"></a> `handlers` | [`WorkerInferConsumerHandlers`](#workerinferconsumerhandlers)<`TContract`> | Handlers for each consumer defined in the contract. Handlers must return `Future<Result<void, HandlerError>>` for explicit error handling. Use defineHandler() to create handlers. | [packages/worker/src/worker.ts:102](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/worker.ts#L102) |
|
|
660
|
+
| <a id="logger"></a> `logger?` | `Logger` | Optional logger for logging message consumption and errors | [packages/worker/src/worker.ts:108](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/worker.ts#L108) |
|
|
661
|
+
| <a id="telemetry"></a> `telemetry?` | `TelemetryProvider` | Optional telemetry provider for tracing and metrics. If not provided, uses the default provider which attempts to load OpenTelemetry. OpenTelemetry instrumentation is automatically enabled if @opentelemetry/api is installed. | [packages/worker/src/worker.ts:114](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/worker.ts#L114) |
|
|
662
|
+
| <a id="urls"></a> `urls` | `ConnectionUrl`[] | AMQP broker URL(s). Multiple URLs provide failover support | [packages/worker/src/worker.ts:104](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/worker.ts#L104) |
|
|
663
663
|
|
|
664
664
|
***
|
|
665
665
|
|
|
@@ -671,7 +671,7 @@ type HandlerError =
|
|
|
671
671
|
| NonRetryableError;
|
|
672
672
|
```
|
|
673
673
|
|
|
674
|
-
Defined in: [packages/worker/src/errors.ts:55](https://github.com/btravers/amqp-contract/blob/
|
|
674
|
+
Defined in: [packages/worker/src/errors.ts:55](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/errors.ts#L55)
|
|
675
675
|
|
|
676
676
|
Union type representing all handler errors.
|
|
677
677
|
Use this type when defining handlers that explicitly signal error outcomes.
|
|
@@ -684,7 +684,7 @@ Use this type when defining handlers that explicitly signal error outcomes.
|
|
|
684
684
|
type WorkerConsumedMessage<TPayload, THeaders> = object;
|
|
685
685
|
```
|
|
686
686
|
|
|
687
|
-
Defined in: [packages/worker/src/types.ts:104](https://github.com/btravers/amqp-contract/blob/
|
|
687
|
+
Defined in: [packages/worker/src/types.ts:104](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/types.ts#L104)
|
|
688
688
|
|
|
689
689
|
A consumed message containing parsed payload and headers.
|
|
690
690
|
|
|
@@ -714,8 +714,8 @@ const handler = defineHandler(contract, 'processOrder', (message, rawMessage) =>
|
|
|
714
714
|
|
|
715
715
|
| Property | Type | Description | Defined in |
|
|
716
716
|
| ------ | ------ | ------ | ------ |
|
|
717
|
-
| <a id="headers"></a> `headers` | `THeaders` *extends* `undefined` ? `undefined` : `THeaders` | The validated message headers (present only when headers schema is defined) | [packages/worker/src/types.ts:108](https://github.com/btravers/amqp-contract/blob/
|
|
718
|
-
| <a id="payload"></a> `payload` | `TPayload` | The validated message payload | [packages/worker/src/types.ts:106](https://github.com/btravers/amqp-contract/blob/
|
|
717
|
+
| <a id="headers"></a> `headers` | `THeaders` *extends* `undefined` ? `undefined` : `THeaders` | The validated message headers (present only when headers schema is defined) | [packages/worker/src/types.ts:108](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/types.ts#L108) |
|
|
718
|
+
| <a id="payload"></a> `payload` | `TPayload` | The validated message payload | [packages/worker/src/types.ts:106](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/types.ts#L106) |
|
|
719
719
|
|
|
720
720
|
***
|
|
721
721
|
|
|
@@ -725,7 +725,7 @@ const handler = defineHandler(contract, 'processOrder', (message, rawMessage) =>
|
|
|
725
725
|
type WorkerInferConsumedMessage<TContract, TName> = WorkerConsumedMessage<WorkerInferConsumerPayload<TContract, TName>, WorkerInferConsumerHeaders<TContract, TName>>;
|
|
726
726
|
```
|
|
727
727
|
|
|
728
|
-
Defined in: [packages/worker/src/types.ts:115](https://github.com/btravers/amqp-contract/blob/
|
|
728
|
+
Defined in: [packages/worker/src/types.ts:115](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/types.ts#L115)
|
|
729
729
|
|
|
730
730
|
Infer the full consumed message type for a specific consumer.
|
|
731
731
|
Includes both payload and headers (if defined).
|
|
@@ -745,7 +745,7 @@ Includes both payload and headers (if defined).
|
|
|
745
745
|
type WorkerInferConsumerHandler<TContract, TName> = (message, rawMessage) => Future<Result<void, HandlerError>>;
|
|
746
746
|
```
|
|
747
747
|
|
|
748
|
-
Defined in: [packages/worker/src/types.ts:154](https://github.com/btravers/amqp-contract/blob/
|
|
748
|
+
Defined in: [packages/worker/src/types.ts:154](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/types.ts#L154)
|
|
749
749
|
|
|
750
750
|
Consumer handler type for a specific consumer.
|
|
751
751
|
Returns a `Future<Result<void, HandlerError>>` for explicit error handling.
|
|
@@ -798,7 +798,7 @@ type WorkerInferConsumerHandlerEntry<TContract, TName> =
|
|
|
798
798
|
}];
|
|
799
799
|
```
|
|
800
800
|
|
|
801
|
-
Defined in: [packages/worker/src/types.ts:172](https://github.com/btravers/amqp-contract/blob/
|
|
801
|
+
Defined in: [packages/worker/src/types.ts:172](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/types.ts#L172)
|
|
802
802
|
|
|
803
803
|
Handler entry for a consumer - either a function or a tuple of [handler, options].
|
|
804
804
|
|
|
@@ -824,7 +824,7 @@ not at the handler level. See `QueueDefinition.retry` for configuration options.
|
|
|
824
824
|
type WorkerInferConsumerHandlers<TContract> = { [K in InferConsumerNames<TContract>]: WorkerInferConsumerHandlerEntry<TContract, K> };
|
|
825
825
|
```
|
|
826
826
|
|
|
827
|
-
Defined in: [packages/worker/src/types.ts:193](https://github.com/btravers/amqp-contract/blob/
|
|
827
|
+
Defined in: [packages/worker/src/types.ts:193](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/types.ts#L193)
|
|
828
828
|
|
|
829
829
|
Consumer handlers for a contract.
|
|
830
830
|
All handlers return `Future<Result<void, HandlerError>>` for explicit error control.
|
|
@@ -854,7 +854,7 @@ const handlers: WorkerInferConsumerHandlers<typeof contract> = {
|
|
|
854
854
|
type WorkerInferConsumerHeaders<TContract, TName> = ConsumerInferHeadersInput<InferConsumer<TContract, TName>>;
|
|
855
855
|
```
|
|
856
856
|
|
|
857
|
-
Defined in: [packages/worker/src/types.ts:79](https://github.com/btravers/amqp-contract/blob/
|
|
857
|
+
Defined in: [packages/worker/src/types.ts:79](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/types.ts#L79)
|
|
858
858
|
|
|
859
859
|
Infer the headers type for a specific consumer
|
|
860
860
|
Returns undefined if no headers schema is defined
|
|
@@ -879,7 +879,7 @@ function defineHandler<TContract, TName>(
|
|
|
879
879
|
handler): WorkerInferConsumerHandlerEntry<TContract, TName>;
|
|
880
880
|
```
|
|
881
881
|
|
|
882
|
-
Defined in: [packages/worker/src/handlers.ts:103](https://github.com/btravers/amqp-contract/blob/
|
|
882
|
+
Defined in: [packages/worker/src/handlers.ts:103](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/handlers.ts#L103)
|
|
883
883
|
|
|
884
884
|
Define a type-safe handler for a specific consumer in a contract.
|
|
885
885
|
|
|
@@ -952,7 +952,7 @@ function defineHandler<TContract, TName>(
|
|
|
952
952
|
options): WorkerInferConsumerHandlerEntry<TContract, TName>;
|
|
953
953
|
```
|
|
954
954
|
|
|
955
|
-
Defined in: [packages/worker/src/handlers.ts:111](https://github.com/btravers/amqp-contract/blob/
|
|
955
|
+
Defined in: [packages/worker/src/handlers.ts:111](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/handlers.ts#L111)
|
|
956
956
|
|
|
957
957
|
Define a type-safe handler for a specific consumer in a contract.
|
|
958
958
|
|
|
@@ -1025,7 +1025,7 @@ const validateOrderHandler = defineHandler(
|
|
|
1025
1025
|
function defineHandlers<TContract>(contract, handlers): WorkerInferConsumerHandlers<TContract>;
|
|
1026
1026
|
```
|
|
1027
1027
|
|
|
1028
|
-
Defined in: [packages/worker/src/handlers.ts:166](https://github.com/btravers/amqp-contract/blob/
|
|
1028
|
+
Defined in: [packages/worker/src/handlers.ts:166](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/handlers.ts#L166)
|
|
1029
1029
|
|
|
1030
1030
|
Define multiple type-safe handlers for consumers in a contract.
|
|
1031
1031
|
|
|
@@ -1078,7 +1078,7 @@ const handlers = defineHandlers(orderContract, {
|
|
|
1078
1078
|
function isHandlerError(error): error is HandlerError;
|
|
1079
1079
|
```
|
|
1080
1080
|
|
|
1081
|
-
Defined in: [packages/worker/src/errors.ts:131](https://github.com/btravers/amqp-contract/blob/
|
|
1081
|
+
Defined in: [packages/worker/src/errors.ts:131](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/errors.ts#L131)
|
|
1082
1082
|
|
|
1083
1083
|
Type guard to check if an error is any HandlerError (RetryableError or NonRetryableError).
|
|
1084
1084
|
|
|
@@ -1115,7 +1115,7 @@ function handleError(error: unknown) {
|
|
|
1115
1115
|
function isNonRetryableError(error): error is NonRetryableError;
|
|
1116
1116
|
```
|
|
1117
1117
|
|
|
1118
|
-
Defined in: [packages/worker/src/errors.ts:109](https://github.com/btravers/amqp-contract/blob/
|
|
1118
|
+
Defined in: [packages/worker/src/errors.ts:109](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/errors.ts#L109)
|
|
1119
1119
|
|
|
1120
1120
|
Type guard to check if an error is a NonRetryableError.
|
|
1121
1121
|
|
|
@@ -1155,7 +1155,7 @@ try {
|
|
|
1155
1155
|
function isRetryableError(error): error is RetryableError;
|
|
1156
1156
|
```
|
|
1157
1157
|
|
|
1158
|
-
Defined in: [packages/worker/src/errors.ts:84](https://github.com/btravers/amqp-contract/blob/
|
|
1158
|
+
Defined in: [packages/worker/src/errors.ts:84](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/errors.ts#L84)
|
|
1159
1159
|
|
|
1160
1160
|
Type guard to check if an error is a RetryableError.
|
|
1161
1161
|
|
|
@@ -1197,7 +1197,7 @@ try {
|
|
|
1197
1197
|
function nonRetryable(message, cause?): NonRetryableError;
|
|
1198
1198
|
```
|
|
1199
1199
|
|
|
1200
|
-
Defined in: [packages/worker/src/errors.ts:193](https://github.com/btravers/amqp-contract/blob/
|
|
1200
|
+
Defined in: [packages/worker/src/errors.ts:193](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/errors.ts#L193)
|
|
1201
1201
|
|
|
1202
1202
|
Create a NonRetryableError with less verbosity.
|
|
1203
1203
|
|
|
@@ -1242,7 +1242,7 @@ const handler = ({ payload }) => {
|
|
|
1242
1242
|
function retryable(message, cause?): RetryableError;
|
|
1243
1243
|
```
|
|
1244
1244
|
|
|
1245
|
-
Defined in: [packages/worker/src/errors.ts:163](https://github.com/btravers/amqp-contract/blob/
|
|
1245
|
+
Defined in: [packages/worker/src/errors.ts:163](https://github.com/btravers/amqp-contract/blob/04791f62e768b84b07aa5288adb8ab72296d6663/packages/worker/src/errors.ts#L163)
|
|
1246
1246
|
|
|
1247
1247
|
Create a RetryableError with less verbosity.
|
|
1248
1248
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amqp-contract/worker",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Worker utilities for consuming messages using amqp-contract",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"amqp",
|
|
@@ -52,22 +52,22 @@
|
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@standard-schema/spec": "1.1.0",
|
|
54
54
|
"@swan-io/boxed": "3.2.1",
|
|
55
|
-
"@amqp-contract/
|
|
56
|
-
"@amqp-contract/
|
|
55
|
+
"@amqp-contract/core": "0.20.0",
|
|
56
|
+
"@amqp-contract/contract": "0.20.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/amqplib": "0.10.8",
|
|
60
|
-
"@types/node": "25.
|
|
60
|
+
"@types/node": "25.3.0",
|
|
61
61
|
"@vitest/coverage-v8": "4.0.18",
|
|
62
62
|
"amqp-connection-manager": "5.0.0",
|
|
63
63
|
"amqplib": "0.10.9",
|
|
64
64
|
"tsdown": "0.20.3",
|
|
65
|
-
"typedoc": "0.28.
|
|
65
|
+
"typedoc": "0.28.17",
|
|
66
66
|
"typedoc-plugin-markdown": "4.10.0",
|
|
67
67
|
"typescript": "5.9.3",
|
|
68
68
|
"vitest": "4.0.18",
|
|
69
69
|
"zod": "4.3.6",
|
|
70
|
-
"@amqp-contract/testing": "0.
|
|
70
|
+
"@amqp-contract/testing": "0.20.0",
|
|
71
71
|
"@amqp-contract/tsconfig": "0.1.0",
|
|
72
72
|
"@amqp-contract/typedoc": "0.1.0"
|
|
73
73
|
},
|