@amqp-contract/contract 0.13.0 → 0.15.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 CHANGED
@@ -12,7 +12,7 @@
12
12
  type AnySchema = StandardSchemaV1;
13
13
  ```
14
14
 
15
- Defined in: [types.ts:12](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L12)
15
+ Defined in: [types.ts:12](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L12)
16
16
 
17
17
  Any schema that conforms to Standard Schema v1.
18
18
 
@@ -29,25 +29,31 @@ https://github.com/standard-schema/standard-schema
29
29
  ### BaseExchangeDefinition
30
30
 
31
31
  ```ts
32
- type BaseExchangeDefinition = object;
32
+ type BaseExchangeDefinition<TName> = object;
33
33
  ```
34
34
 
35
- Defined in: [types.ts:376](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L376)
35
+ Defined in: [types.ts:376](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L376)
36
36
 
37
37
  Base definition of an AMQP exchange.
38
38
 
39
39
  An exchange receives messages from publishers and routes them to queues based on the exchange
40
40
  type and routing rules. This type contains properties common to all exchange types.
41
41
 
42
+ #### Type Parameters
43
+
44
+ | Type Parameter | Default type |
45
+ | ------ | ------ |
46
+ | `TName` *extends* `string` | `string` |
47
+
42
48
  #### Properties
43
49
 
44
50
  | Property | Type | Description | Defined in |
45
51
  | ------ | ------ | ------ | ------ |
46
- | <a id="arguments"></a> `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments for advanced configuration. Common arguments include alternate-exchange for handling unroutable messages. | [types.ts:405](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L405) |
47
- | <a id="autodelete"></a> `autoDelete?` | `boolean` | If true, the exchange is deleted when all queues have finished using it. **Default** `false` | [types.ts:392](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L392) |
48
- | <a id="durable"></a> `durable?` | `boolean` | If true, the exchange survives broker restarts. Durable exchanges are persisted to disk. **Default** `false` | [types.ts:386](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L386) |
49
- | <a id="internal"></a> `internal?` | `boolean` | If true, the exchange cannot be directly published to by clients. It can only receive messages from other exchanges via exchange-to-exchange bindings. **Default** `false` | [types.ts:399](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L399) |
50
- | <a id="name"></a> `name` | `string` | The name of the exchange. Must be unique within the RabbitMQ virtual host. | [types.ts:380](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L380) |
52
+ | <a id="arguments"></a> `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments for advanced configuration. Common arguments include alternate-exchange for handling unroutable messages. | [types.ts:405](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L405) |
53
+ | <a id="autodelete"></a> `autoDelete?` | `boolean` | If true, the exchange is deleted when all queues have finished using it. **Default** `false` | [types.ts:392](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L392) |
54
+ | <a id="durable"></a> `durable?` | `boolean` | If true, the exchange survives broker restarts. Durable exchanges are persisted to disk. **Default** `false` | [types.ts:386](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L386) |
55
+ | <a id="internal"></a> `internal?` | `boolean` | If true, the exchange cannot be directly published to by clients. It can only receive messages from other exchanges via exchange-to-exchange bindings. **Default** `false` | [types.ts:399](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L399) |
56
+ | <a id="name"></a> `name` | `TName` | The name of the exchange. Must be unique within the RabbitMQ virtual host. | [types.ts:380](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L380) |
51
57
 
52
58
  ***
53
59
 
@@ -59,7 +65,7 @@ type BindingDefinition =
59
65
  | ExchangeBindingDefinition;
60
66
  ```
61
67
 
62
- Defined in: [types.ts:815](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L815)
68
+ Defined in: [types.ts:831](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L831)
63
69
 
64
70
  Union type of all binding definitions.
65
71
 
@@ -75,7 +81,7 @@ A binding can be either:
75
81
  type BindingPattern<S> = S extends "" ? never : S;
76
82
  ```
77
83
 
78
- Defined in: [builder/routing-types.ts:52](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/routing-types.ts#L52)
84
+ Defined in: [builder/routing-types.ts:52](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/routing-types.ts#L52)
79
85
 
80
86
  Type-safe binding pattern that validates basic format and wildcards.
81
87
 
@@ -107,10 +113,10 @@ type Invalid = BindingPattern<"">; // never (empty string)
107
113
  ### ClassicQueueDefinition
108
114
 
109
115
  ```ts
110
- type ClassicQueueDefinition = BaseQueueDefinition & object;
116
+ type ClassicQueueDefinition<TName> = BaseQueueDefinition<TName> & object;
111
117
  ```
112
118
 
113
- Defined in: [types.ts:592](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L592)
119
+ Defined in: [types.ts:595](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L595)
114
120
 
115
121
  Definition of a classic queue.
116
122
 
@@ -121,10 +127,16 @@ specific features not supported by quorum queues (e.g., exclusive queues, priori
121
127
 
122
128
  | Name | Type | Description | Defined in |
123
129
  | ------ | ------ | ------ | ------ |
124
- | `deliveryLimit?` | `never` | Classic queues do not support delivery limits. Use type: 'quorum' if you need native retry with delivery limits. | [types.ts:602](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L602) |
125
- | `exclusive?` | `boolean` | If true, the queue can only be used by the declaring connection and is deleted when that connection closes. Exclusive queues are private to the connection. **Default** `false` | [types.ts:609](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L609) |
126
- | `retry` | `ResolvedTtlBackoffRetryOptions` | Retry configuration for handling failed message processing. Classic queues only support TTL-backoff retry mode (default). When the queue is created, defaults are applied. | [types.ts:617](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L617) |
127
- | `type` | `"classic"` | Queue type discriminator: classic queue. | [types.ts:596](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L596) |
130
+ | `deliveryLimit?` | `never` | Classic queues do not support delivery limits. Use type: 'quorum' if you need native retry with delivery limits. | [types.ts:605](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L605) |
131
+ | `exclusive?` | `boolean` | If true, the queue can only be used by the declaring connection and is deleted when that connection closes. Exclusive queues are private to the connection. **Default** `false` | [types.ts:612](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L612) |
132
+ | `retry` | `ResolvedTtlBackoffRetryOptions` | Retry configuration for handling failed message processing. Classic queues only support TTL-backoff retry mode (default). When the queue is created, defaults are applied. | [types.ts:620](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L620) |
133
+ | `type` | `"classic"` | Queue type discriminator: classic queue. | [types.ts:599](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L599) |
134
+
135
+ #### Type Parameters
136
+
137
+ | Type Parameter | Default type |
138
+ | ------ | ------ |
139
+ | `TName` *extends* `string` | `string` |
128
140
 
129
141
  ***
130
142
 
@@ -134,7 +146,7 @@ specific features not supported by quorum queues (e.g., exclusive queues, priori
134
146
  type ClassicQueueOptions = BaseQueueOptions & object;
135
147
  ```
136
148
 
137
- Defined in: [types.ts:318](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L318)
149
+ Defined in: [types.ts:318](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L318)
138
150
 
139
151
  Options for creating a classic queue.
140
152
 
@@ -147,10 +159,10 @@ Classic queues support all traditional RabbitMQ features including:
147
159
 
148
160
  | Name | Type | Description | Defined in |
149
161
  | ------ | ------ | ------ | ------ |
150
- | `exclusive?` | `boolean` | If true, the queue can only be used by the declaring connection and is deleted when that connection closes. Exclusive queues are private to the connection. **Default** `false` | [types.ts:329](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L329) |
151
- | `maxPriority?` | `number` | Maximum priority level for priority queue (1-255, recommended: 1-10). Sets x-max-priority argument. Only supported with classic queues. | [types.ts:336](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L336) |
152
- | `retry?` | [`TtlBackoffRetryOptions`](#ttlbackoffretryoptions) | Retry configuration for handling failed message processing. Classic queues only support TTL-backoff retry mode, which uses wait queues with exponential backoff. For quorum-native retry, use quorum queues instead. **Example** `const orderQueue = defineQueue('order-processing', { type: 'classic', durable: true, deadLetter: { exchange: dlx }, retry: { maxRetries: 5, initialDelayMs: 1000, maxDelayMs: 30000, }, });` | [types.ts:358](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L358) |
153
- | `type` | `"classic"` | Queue type: classic (for special cases) | [types.ts:322](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L322) |
162
+ | `exclusive?` | `boolean` | If true, the queue can only be used by the declaring connection and is deleted when that connection closes. Exclusive queues are private to the connection. **Default** `false` | [types.ts:329](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L329) |
163
+ | `maxPriority?` | `number` | Maximum priority level for priority queue (1-255, recommended: 1-10). Sets x-max-priority argument. Only supported with classic queues. | [types.ts:336](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L336) |
164
+ | `retry?` | [`TtlBackoffRetryOptions`](#ttlbackoffretryoptions) | Retry configuration for handling failed message processing. Classic queues only support TTL-backoff retry mode, which uses wait queues with exponential backoff. For quorum-native retry, use quorum queues instead. **Example** `const orderQueue = defineQueue('order-processing', { type: 'classic', durable: true, deadLetter: { exchange: dlx }, retry: { maxRetries: 5, initialDelayMs: 1000, maxDelayMs: 30000, }, });` | [types.ts:358](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L358) |
165
+ | `type` | `"classic"` | Queue type: classic (for special cases) | [types.ts:322](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L322) |
154
166
 
155
167
  #### Example
156
168
 
@@ -167,10 +179,10 @@ const priorityQueue = defineQueue('tasks', {
167
179
  ### CommandConsumerConfig
168
180
 
169
181
  ```ts
170
- type CommandConsumerConfig<TMessage, TExchange, TRoutingKey> = object;
182
+ type CommandConsumerConfig<TMessage, TExchange, TRoutingKey, TQueue, TDlxExchange> = object;
171
183
  ```
172
184
 
173
- Defined in: [builder/command.ts:27](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/command.ts#L27)
185
+ Defined in: [builder/command.ts:30](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/command.ts#L30)
174
186
 
175
187
  Configuration for a command consumer.
176
188
 
@@ -184,17 +196,21 @@ The consumer "owns" the queue, and publishers send commands to it.
184
196
  | `TMessage` *extends* [`MessageDefinition`](#messagedefinition) | - | The message definition |
185
197
  | `TExchange` *extends* [`ExchangeDefinition`](#exchangedefinition) | - | The exchange definition |
186
198
  | `TRoutingKey` *extends* `string` \| `undefined` | `undefined` | The routing key type (undefined for fanout) |
199
+ | `TQueue` *extends* [`QueueDefinition`](#queuedefinition) | [`QueueDefinition`](#queuedefinition) | - |
200
+ | `TDlxExchange` *extends* [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | - |
187
201
 
188
202
  #### Properties
189
203
 
190
204
  | Property | Type | Description | Defined in |
191
205
  | ------ | ------ | ------ | ------ |
192
- | <a id="__brand"></a> `__brand` | `"CommandConsumerConfig"` | Discriminator to identify this as a command consumer config | [builder/command.ts:33](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/command.ts#L33) |
193
- | <a id="binding"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | The binding connecting the queue to the exchange | [builder/command.ts:37](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/command.ts#L37) |
194
- | <a id="consumer"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition)&lt;`TMessage`&gt; | The consumer definition for processing commands | [builder/command.ts:35](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/command.ts#L35) |
195
- | <a id="exchange"></a> `exchange` | `TExchange` | The exchange that receives commands | [builder/command.ts:39](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/command.ts#L39) |
196
- | <a id="message"></a> `message` | `TMessage` | The message definition | [builder/command.ts:41](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/command.ts#L41) |
197
- | <a id="routingkey"></a> `routingKey` | `TRoutingKey` | The routing key pattern for the binding | [builder/command.ts:43](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/command.ts#L43) |
206
+ | <a id="__brand"></a> `__brand` | `"CommandConsumerConfig"` | Discriminator to identify this as a command consumer config | [builder/command.ts:38](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/command.ts#L38) |
207
+ | <a id="binding"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | The binding connecting the queue to the exchange | [builder/command.ts:42](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/command.ts#L42) |
208
+ | <a id="consumer"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition)&lt;`TMessage`&gt; | The consumer definition for processing commands | [builder/command.ts:40](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/command.ts#L40) |
209
+ | <a id="deadletterexchange"></a> `deadLetterExchange` | `TDlxExchange` | The dead letter exchange from the queue, if configured | [builder/command.ts:48](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/command.ts#L48) |
210
+ | <a id="exchange"></a> `exchange` | `TExchange` | The exchange that receives commands | [builder/command.ts:44](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/command.ts#L44) |
211
+ | <a id="message"></a> `message` | `TMessage` | The message definition | [builder/command.ts:50](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/command.ts#L50) |
212
+ | <a id="queue"></a> `queue` | `TQueue` | The queue this consumer reads from | [builder/command.ts:46](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/command.ts#L46) |
213
+ | <a id="routingkey"></a> `routingKey` | `TRoutingKey` | The routing key pattern for the binding | [builder/command.ts:52](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/command.ts#L52) |
198
214
 
199
215
  ***
200
216
 
@@ -204,7 +220,7 @@ The consumer "owns" the queue, and publishers send commands to it.
204
220
  type CommandConsumerConfigBase = object;
205
221
  ```
206
222
 
207
- Defined in: [types.ts:912](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L912)
223
+ Defined in: [types.ts:928](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L928)
208
224
 
209
225
  Base type for command consumer configuration.
210
226
 
@@ -219,12 +235,14 @@ defineCommandConsumer for creating command consumers
219
235
 
220
236
  | Property | Type | Defined in |
221
237
  | ------ | ------ | ------ |
222
- | <a id="__brand-1"></a> `__brand` | `"CommandConsumerConfig"` | [types.ts:913](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L913) |
223
- | <a id="binding-1"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | [types.ts:915](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L915) |
224
- | <a id="consumer-1"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition) | [types.ts:914](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L914) |
225
- | <a id="exchange-1"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:916](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L916) |
226
- | <a id="message-1"></a> `message` | [`MessageDefinition`](#messagedefinition) | [types.ts:917](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L917) |
227
- | <a id="routingkey-1"></a> `routingKey` | `string` \| `undefined` | [types.ts:918](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L918) |
238
+ | <a id="__brand-1"></a> `__brand` | `"CommandConsumerConfig"` | [types.ts:929](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L929) |
239
+ | <a id="binding-1"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | [types.ts:931](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L931) |
240
+ | <a id="consumer-1"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition) | [types.ts:930](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L930) |
241
+ | <a id="deadletterexchange-1"></a> `deadLetterExchange` | [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | [types.ts:934](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L934) |
242
+ | <a id="exchange-1"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:932](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L932) |
243
+ | <a id="message-1"></a> `message` | [`MessageDefinition`](#messagedefinition) | [types.ts:935](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L935) |
244
+ | <a id="queue-1"></a> `queue` | [`QueueDefinition`](#queuedefinition) | [types.ts:933](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L933) |
245
+ | <a id="routingkey-1"></a> `routingKey` | `string` \| `undefined` | [types.ts:936](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L936) |
228
246
 
229
247
  ***
230
248
 
@@ -234,7 +252,7 @@ defineCommandConsumer for creating command consumers
234
252
  type CompressionAlgorithm = "gzip" | "deflate";
235
253
  ```
236
254
 
237
- Defined in: [types.ts:134](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L134)
255
+ Defined in: [types.ts:134](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L134)
238
256
 
239
257
  Supported compression algorithms for message payloads.
240
258
 
@@ -272,7 +290,7 @@ await client.publish("orderCreated", payload, {
272
290
  type ConsumerDefinition<TMessage> = object;
273
291
  ```
274
292
 
275
- Defined in: [types.ts:876](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L876)
293
+ Defined in: [types.ts:892](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L892)
276
294
 
277
295
  Definition of a message consumer.
278
296
 
@@ -300,8 +318,8 @@ const consumer: ConsumerDefinition = {
300
318
 
301
319
  | Property | Type | Description | Defined in |
302
320
  | ------ | ------ | ------ | ------ |
303
- | <a id="message-2"></a> `message` | `TMessage` | The message definition including the payload schema | [types.ts:881](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L881) |
304
- | <a id="queue"></a> `queue` | [`QueueDefinition`](#queuedefinition) | The queue to consume messages from | [types.ts:878](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L878) |
321
+ | <a id="message-2"></a> `message` | `TMessage` | The message definition including the payload schema | [types.ts:897](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L897) |
322
+ | <a id="queue-2"></a> `queue` | [`QueueDefinition`](#queuedefinition) | The queue to consume messages from | [types.ts:894](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L894) |
305
323
 
306
324
  ***
307
325
 
@@ -314,7 +332,7 @@ type ConsumerEntry =
314
332
  | CommandConsumerConfigBase;
315
333
  ```
316
334
 
317
- Defined in: [types.ts:1022](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L1022)
335
+ Defined in: [types.ts:1043](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L1043)
318
336
 
319
337
  Consumer entry that can be passed to defineContract's consumers section.
320
338
 
@@ -331,7 +349,7 @@ Can be either:
331
349
  type ContractDefinition = object;
332
350
  ```
333
351
 
334
- Defined in: [types.ts:968](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L968)
352
+ Defined in: [types.ts:989](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L989)
335
353
 
336
354
  Complete AMQP contract definition (output type).
337
355
 
@@ -370,41 +388,31 @@ const contract: ContractDefinition = {
370
388
 
371
389
  | Property | Type | Description | Defined in |
372
390
  | ------ | ------ | ------ | ------ |
373
- | <a id="bindings"></a> `bindings?` | `Record`&lt;`string`, [`BindingDefinition`](#bindingdefinition)&gt; | Named binding definitions. Bindings can be queue-to-exchange or exchange-to-exchange. | [types.ts:988](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L988) |
374
- | <a id="consumers"></a> `consumers?` | `Record`&lt;`string`, [`ConsumerDefinition`](#consumerdefinition)&gt; | Named consumer definitions. Each key requires a corresponding handler in the TypedAmqpWorker. The handler will be fully typed based on the message schema. | [types.ts:1002](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L1002) |
375
- | <a id="exchanges"></a> `exchanges?` | `Record`&lt;`string`, [`ExchangeDefinition`](#exchangedefinition)&gt; | Named exchange definitions. Each key becomes available as a named resource in the contract. | [types.ts:973](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L973) |
376
- | <a id="publishers"></a> `publishers?` | `Record`&lt;`string`, [`PublisherDefinition`](#publisherdefinition)&gt; | Named publisher definitions. Each key becomes a method on the TypedAmqpClient for publishing messages. The method will be fully typed based on the message schema. | [types.ts:995](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L995) |
377
- | <a id="queues"></a> `queues?` | `Record`&lt;`string`, [`QueueEntry`](#queueentry)&gt; | Named queue definitions. Each key becomes available as a named resource in the contract. When a queue has TTL-backoff retry configured, pass the `QueueWithTtlBackoffInfrastructure` object returned by `defineQueue`. The wait queue and bindings will be automatically added. | [types.ts:982](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L982) |
391
+ | <a id="bindings"></a> `bindings?` | `Record`&lt;`string`, [`BindingDefinition`](#bindingdefinition)&gt; | Named binding definitions. Bindings can be queue-to-exchange or exchange-to-exchange. | [types.ts:1009](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L1009) |
392
+ | <a id="consumers"></a> `consumers?` | `Record`&lt;`string`, [`ConsumerDefinition`](#consumerdefinition)&gt; | Named consumer definitions. Each key requires a corresponding handler in the TypedAmqpWorker. The handler will be fully typed based on the message schema. | [types.ts:1023](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L1023) |
393
+ | <a id="exchanges"></a> `exchanges?` | `Record`&lt;`string`, [`ExchangeDefinition`](#exchangedefinition)&gt; | Named exchange definitions. Each key becomes available as a named resource in the contract. | [types.ts:994](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L994) |
394
+ | <a id="publishers"></a> `publishers?` | `Record`&lt;`string`, [`PublisherDefinition`](#publisherdefinition)&gt; | Named publisher definitions. Each key becomes a method on the TypedAmqpClient for publishing messages. The method will be fully typed based on the message schema. | [types.ts:1016](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L1016) |
395
+ | <a id="queues"></a> `queues?` | `Record`&lt;`string`, [`QueueEntry`](#queueentry)&gt; | Named queue definitions. Each key becomes available as a named resource in the contract. When a queue has TTL-backoff retry configured, pass the `QueueWithTtlBackoffInfrastructure` object returned by `defineQueue`. The wait queue and bindings will be automatically added. | [types.ts:1003](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L1003) |
378
396
 
379
397
  ***
380
398
 
381
399
  ### ContractDefinitionInput
382
400
 
383
401
  ```ts
384
- type ContractDefinitionInput = Omit<ContractDefinition, "publishers" | "consumers"> & object;
402
+ type ContractDefinitionInput = object;
385
403
  ```
386
404
 
387
- Defined in: [types.ts:1054](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L1054)
405
+ Defined in: [types.ts:1072](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L1072)
388
406
 
389
407
  Contract definition input type with automatic extraction of event/command patterns.
390
408
 
391
- This type allows passing event and command configs directly to the publishers
392
- and consumers sections. `defineContract` will automatically extract the appropriate
393
- definitions and generate bindings.
394
-
395
- #### Type Declaration
396
-
397
- | Name | Type | Description | Defined in |
398
- | ------ | ------ | ------ | ------ |
399
- | `consumers?` | `Record`&lt;`string`, [`ConsumerEntry`](#consumerentry)&gt; | Named consumer definitions. Can accept: - ConsumerDefinition from defineConsumer - EventConsumerResult from defineEventConsumer (binding auto-extracted) - CommandConsumerConfig from defineCommandConsumer (binding auto-extracted) | [types.ts:1072](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L1072) |
400
- | `publishers?` | `Record`&lt;`string`, [`PublisherEntry`](#publisherentry)&gt; | Named publisher definitions. Can accept: - PublisherDefinition from definePublisher - EventPublisherConfig from defineEventPublisher (auto-extracted to publisher) | [types.ts:1062](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L1062) |
409
+ Users only define publishers and consumers. Exchanges, queues, and bindings are
410
+ automatically extracted from these definitions.
401
411
 
402
412
  #### Example
403
413
 
404
414
  ```typescript
405
415
  const contract = defineContract({
406
- exchanges: { orders: ordersExchange },
407
- queues: { processing: processingQueue },
408
416
  publishers: {
409
417
  // EventPublisherConfig → auto-extracted to publisher
410
418
  orderCreated: defineEventPublisher(ordersExchange, orderMessage, { routingKey: "order.created" }),
@@ -422,6 +430,48 @@ const contract = defineContract({
422
430
 
423
431
  defineContract - Processes this input and returns a ContractDefinition
424
432
 
433
+ #### Properties
434
+
435
+ | Property | Type | Description | Defined in |
436
+ | ------ | ------ | ------ | ------ |
437
+ | <a id="consumers-1"></a> `consumers?` | `Record`&lt;`string`, [`ConsumerEntry`](#consumerentry)&gt; | Named consumer definitions. Can accept: - ConsumerDefinition from defineConsumer - EventConsumerResult from defineEventConsumer (binding auto-extracted) - CommandConsumerConfig from defineCommandConsumer (binding auto-extracted) | [types.ts:1090](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L1090) |
438
+ | <a id="publishers-1"></a> `publishers?` | `Record`&lt;`string`, [`PublisherEntry`](#publisherentry)&gt; | Named publisher definitions. Can accept: - PublisherDefinition from definePublisher - EventPublisherConfig from defineEventPublisher (auto-extracted to publisher) | [types.ts:1080](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L1080) |
439
+
440
+ ***
441
+
442
+ ### ContractOutput
443
+
444
+ ```ts
445
+ type ContractOutput<TContract> = object;
446
+ ```
447
+
448
+ Defined in: [types.ts:1299](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L1299)
449
+
450
+ Contract output type with all resources extracted and properly typed.
451
+
452
+ This type represents the fully expanded contract with:
453
+ - exchanges: Extracted from publishers and consumer bindings
454
+ - queues: Extracted from consumers
455
+ - bindings: Extracted from event/command consumers
456
+ - publishers: Normalized publisher definitions
457
+ - consumers: Normalized consumer definitions
458
+
459
+ #### Type Parameters
460
+
461
+ | Type Parameter |
462
+ | ------ |
463
+ | `TContract` *extends* [`ContractDefinitionInput`](#contractdefinitioninput) |
464
+
465
+ #### Properties
466
+
467
+ | Property | Type | Defined in |
468
+ | ------ | ------ | ------ |
469
+ | <a id="bindings-1"></a> `bindings` | `TContract`\[`"consumers"`\] *extends* `Record`&lt;`string`, [`ConsumerEntry`](#consumerentry)&gt; ? `ExtractBindingsFromConsumers`&lt;`TContract`\[`"consumers"`\]&gt; : `object` | [types.ts:1312](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L1312) |
470
+ | <a id="consumers-2"></a> `consumers` | `TContract`\[`"consumers"`\] *extends* `Record`&lt;`string`, [`ConsumerEntry`](#consumerentry)&gt; ? `ExtractConsumerDefinitions`&lt;`TContract`\[`"consumers"`\]&gt; : `object` | [types.ts:1318](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L1318) |
471
+ | <a id="exchanges-1"></a> `exchanges` | `TContract`\[`"publishers"`\] *extends* `Record`&lt;`string`, [`PublisherEntry`](#publisherentry)&gt; ? `ExtractExchangesFromPublishers`&lt;`TContract`\[`"publishers"`\]&gt; : `object` & `TContract`\[`"consumers"`\] *extends* `Record`&lt;`string`, [`ConsumerEntry`](#consumerentry)&gt; ? `ExtractExchangesFromConsumers`&lt;`TContract`\[`"consumers"`\]&gt; : `object` & `TContract`\[`"consumers"`\] *extends* `Record`&lt;`string`, [`ConsumerEntry`](#consumerentry)&gt; ? `ExtractDeadLetterExchangesFromConsumers`&lt;`TContract`\[`"consumers"`\]&gt; : `object` | [types.ts:1300](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L1300) |
472
+ | <a id="publishers-2"></a> `publishers` | `TContract`\[`"publishers"`\] *extends* `Record`&lt;`string`, [`PublisherEntry`](#publisherentry)&gt; ? `ExtractPublisherDefinitions`&lt;`TContract`\[`"publishers"`\]&gt; : `object` | [types.ts:1315](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L1315) |
473
+ | <a id="queues-1"></a> `queues` | `TContract`\[`"consumers"`\] *extends* `Record`&lt;`string`, [`ConsumerEntry`](#consumerentry)&gt; ? `ExtractQueuesFromConsumers`&lt;`TContract`\[`"consumers"`\]&gt; : `object` | [types.ts:1309](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L1309) |
474
+
425
475
  ***
426
476
 
427
477
  ### DeadLetterConfig
@@ -430,7 +480,7 @@ defineContract - Processes this input and returns a ContractDefinition
430
480
  type DeadLetterConfig = object;
431
481
  ```
432
482
 
433
- Defined in: [types.ts:480](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L480)
483
+ Defined in: [types.ts:483](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L483)
434
484
 
435
485
  Configuration for dead letter exchange (DLX) on a queue.
436
486
 
@@ -442,8 +492,8 @@ or storage.
442
492
 
443
493
  | Property | Type | Description | Defined in |
444
494
  | ------ | ------ | ------ | ------ |
445
- | <a id="exchange-2"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | The exchange to send dead-lettered messages to. This exchange must be declared in the contract. | [types.ts:485](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L485) |
446
- | <a id="routingkey-2"></a> `routingKey?` | `string` | Optional routing key to use when forwarding messages to the dead letter exchange. If not specified, the original message routing key is used. | [types.ts:491](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L491) |
495
+ | <a id="exchange-2"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | The exchange to send dead-lettered messages to. This exchange must be declared in the contract. | [types.ts:488](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L488) |
496
+ | <a id="routingkey-2"></a> `routingKey?` | `string` | Optional routing key to use when forwarding messages to the dead letter exchange. If not specified, the original message routing key is used. | [types.ts:494](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L494) |
447
497
 
448
498
  ***
449
499
 
@@ -455,7 +505,7 @@ type DefineQueueOptions =
455
505
  | ClassicQueueOptions;
456
506
  ```
457
507
 
458
- Defined in: [types.ts:368](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L368)
508
+ Defined in: [types.ts:368](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L368)
459
509
 
460
510
  Options for defining a queue. Uses a discriminated union based on the `type` property
461
511
  to enforce quorum queue constraints at compile time.
@@ -471,7 +521,7 @@ to enforce quorum queue constraints at compile time.
471
521
  type DefineQuorumQueueOptions = object;
472
522
  ```
473
523
 
474
- Defined in: [builder/queue.ts:376](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L376)
524
+ Defined in: [builder/queue.ts:390](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/queue.ts#L390)
475
525
 
476
526
  Options for creating a quorum queue with quorum-native retry.
477
527
 
@@ -483,11 +533,11 @@ This simplified helper enforces the required configuration for quorum-native ret
483
533
 
484
534
  | Property | Type | Description | Defined in |
485
535
  | ------ | ------ | ------ | ------ |
486
- | <a id="arguments-1"></a> `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments for advanced configuration. | [builder/queue.ts:403](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L403) |
487
- | <a id="autodelete-1"></a> `autoDelete?` | `boolean` | If true, the queue is deleted when the last consumer unsubscribes. **Default** `false` | [builder/queue.ts:398](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L398) |
488
- | <a id="deadletterexchange"></a> `deadLetterExchange` | [`ExchangeDefinition`](#exchangedefinition) | Dead letter configuration - required for retry support. Failed messages will be sent to this exchange. | [builder/queue.ts:381](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L381) |
489
- | <a id="deadletterroutingkey"></a> `deadLetterRoutingKey?` | `string` | Optional routing key for dead-lettered messages. | [builder/queue.ts:386](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L386) |
490
- | <a id="deliverylimit"></a> `deliveryLimit` | `number` | Maximum number of delivery attempts before dead-lettering. **Minimum** 1 | [builder/queue.ts:392](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L392) |
536
+ | <a id="arguments-1"></a> `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments for advanced configuration. | [builder/queue.ts:417](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/queue.ts#L417) |
537
+ | <a id="autodelete-1"></a> `autoDelete?` | `boolean` | If true, the queue is deleted when the last consumer unsubscribes. **Default** `false` | [builder/queue.ts:412](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/queue.ts#L412) |
538
+ | <a id="deadletterexchange-2"></a> `deadLetterExchange` | [`ExchangeDefinition`](#exchangedefinition) | Dead letter configuration - required for retry support. Failed messages will be sent to this exchange. | [builder/queue.ts:395](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/queue.ts#L395) |
539
+ | <a id="deadletterroutingkey"></a> `deadLetterRoutingKey?` | `string` | Optional routing key for dead-lettered messages. | [builder/queue.ts:400](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/queue.ts#L400) |
540
+ | <a id="deliverylimit"></a> `deliveryLimit` | `number` | Maximum number of delivery attempts before dead-lettering. **Minimum** 1 | [builder/queue.ts:406](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/queue.ts#L406) |
491
541
 
492
542
  ***
493
543
 
@@ -497,7 +547,7 @@ This simplified helper enforces the required configuration for quorum-native ret
497
547
  type DefineTtlBackoffQueueOptions = object;
498
548
  ```
499
549
 
500
- Defined in: [builder/queue.ts:478](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L478)
550
+ Defined in: [builder/queue.ts:492](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/queue.ts#L492)
501
551
 
502
552
  Options for creating a queue with TTL-backoff retry.
503
553
 
@@ -509,25 +559,25 @@ This simplified helper enforces the required configuration for TTL-backoff retry
509
559
 
510
560
  | Property | Type | Description | Defined in |
511
561
  | ------ | ------ | ------ | ------ |
512
- | <a id="arguments-2"></a> `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments for advanced configuration. | [builder/queue.ts:529](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L529) |
513
- | <a id="autodelete-2"></a> `autoDelete?` | `boolean` | If true, the queue is deleted when the last consumer unsubscribes. **Default** `false` | [builder/queue.ts:524](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L524) |
514
- | <a id="backoffmultiplier"></a> `backoffMultiplier?` | `number` | Exponential backoff multiplier. **Default** `2` | [builder/queue.ts:512](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L512) |
515
- | <a id="deadletterexchange-1"></a> `deadLetterExchange` | [`ExchangeDefinition`](#exchangedefinition) | Dead letter exchange - required for TTL-backoff retry. Used for routing messages to the wait queue and back. | [builder/queue.ts:483](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L483) |
516
- | <a id="deadletterroutingkey-1"></a> `deadLetterRoutingKey?` | `string` | Optional routing key for dead-lettered messages. | [builder/queue.ts:488](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L488) |
517
- | <a id="initialdelayms"></a> `initialDelayMs?` | `number` | Initial delay in ms before first retry. **Default** `1000` | [builder/queue.ts:500](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L500) |
518
- | <a id="jitter"></a> `jitter?` | `boolean` | Add jitter to prevent thundering herd. **Default** `true` | [builder/queue.ts:518](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L518) |
519
- | <a id="maxdelayms"></a> `maxDelayMs?` | `number` | Maximum delay in ms between retries. **Default** `30000` | [builder/queue.ts:506](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L506) |
520
- | <a id="maxretries"></a> `maxRetries?` | `number` | Maximum retry attempts before sending to DLQ. **Default** `3` | [builder/queue.ts:494](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L494) |
562
+ | <a id="arguments-2"></a> `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments for advanced configuration. | [builder/queue.ts:543](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/queue.ts#L543) |
563
+ | <a id="autodelete-2"></a> `autoDelete?` | `boolean` | If true, the queue is deleted when the last consumer unsubscribes. **Default** `false` | [builder/queue.ts:538](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/queue.ts#L538) |
564
+ | <a id="backoffmultiplier"></a> `backoffMultiplier?` | `number` | Exponential backoff multiplier. **Default** `2` | [builder/queue.ts:526](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/queue.ts#L526) |
565
+ | <a id="deadletterexchange-3"></a> `deadLetterExchange` | [`ExchangeDefinition`](#exchangedefinition) | Dead letter exchange - required for TTL-backoff retry. Used for routing messages to the wait queue and back. | [builder/queue.ts:497](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/queue.ts#L497) |
566
+ | <a id="deadletterroutingkey-1"></a> `deadLetterRoutingKey?` | `string` | Optional routing key for dead-lettered messages. | [builder/queue.ts:502](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/queue.ts#L502) |
567
+ | <a id="initialdelayms"></a> `initialDelayMs?` | `number` | Initial delay in ms before first retry. **Default** `1000` | [builder/queue.ts:514](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/queue.ts#L514) |
568
+ | <a id="jitter"></a> `jitter?` | `boolean` | Add jitter to prevent thundering herd. **Default** `true` | [builder/queue.ts:532](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/queue.ts#L532) |
569
+ | <a id="maxdelayms"></a> `maxDelayMs?` | `number` | Maximum delay in ms between retries. **Default** `30000` | [builder/queue.ts:520](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/queue.ts#L520) |
570
+ | <a id="maxretries"></a> `maxRetries?` | `number` | Maximum retry attempts before sending to DLQ. **Default** `3` | [builder/queue.ts:508](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/queue.ts#L508) |
521
571
 
522
572
  ***
523
573
 
524
574
  ### DirectExchangeDefinition
525
575
 
526
576
  ```ts
527
- type DirectExchangeDefinition = BaseExchangeDefinition & object;
577
+ type DirectExchangeDefinition<TName> = BaseExchangeDefinition<TName> & object;
528
578
  ```
529
579
 
530
- Defined in: [types.ts:438](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L438)
580
+ Defined in: [types.ts:439](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L439)
531
581
 
532
582
  A direct exchange definition.
533
583
 
@@ -538,7 +588,13 @@ This is ideal for point-to-point messaging where each message should go to speci
538
588
 
539
589
  | Name | Type | Defined in |
540
590
  | ------ | ------ | ------ |
541
- | `type` | `"direct"` | [types.ts:439](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L439) |
591
+ | `type` | `"direct"` | [types.ts:441](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L441) |
592
+
593
+ #### Type Parameters
594
+
595
+ | Type Parameter | Default type |
596
+ | ------ | ------ |
597
+ | `TName` *extends* `string` | `string` |
542
598
 
543
599
  #### Example
544
600
 
@@ -553,10 +609,10 @@ const tasksExchange: DirectExchangeDefinition = defineExchange('tasks', 'direct'
553
609
  ### EventConsumerResult
554
610
 
555
611
  ```ts
556
- type EventConsumerResult<TMessage> = object;
612
+ type EventConsumerResult<TMessage, TExchange, TQueue, TDlxExchange> = object;
557
613
  ```
558
614
 
559
- Defined in: [builder/event.ts:52](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/event.ts#L52)
615
+ Defined in: [builder/event.ts:55](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/event.ts#L55)
560
616
 
561
617
  Result from defineEventConsumer.
562
618
 
@@ -566,17 +622,23 @@ will be automatically extracted.
566
622
 
567
623
  #### Type Parameters
568
624
 
569
- | Type Parameter | Description |
570
- | ------ | ------ |
571
- | `TMessage` *extends* [`MessageDefinition`](#messagedefinition) | The message definition |
625
+ | Type Parameter | Default type | Description |
626
+ | ------ | ------ | ------ |
627
+ | `TMessage` *extends* [`MessageDefinition`](#messagedefinition) | - | The message definition |
628
+ | `TExchange` *extends* [`ExchangeDefinition`](#exchangedefinition) | [`ExchangeDefinition`](#exchangedefinition) | - |
629
+ | `TQueue` *extends* [`QueueDefinition`](#queuedefinition) | [`QueueDefinition`](#queuedefinition) | - |
630
+ | `TDlxExchange` *extends* [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | - |
572
631
 
573
632
  #### Properties
574
633
 
575
634
  | Property | Type | Description | Defined in |
576
635
  | ------ | ------ | ------ | ------ |
577
- | <a id="__brand-2"></a> `__brand` | `"EventConsumerResult"` | Discriminator to identify this as an event consumer result | [builder/event.ts:54](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/event.ts#L54) |
578
- | <a id="binding-2"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | The binding connecting the queue to the exchange | [builder/event.ts:58](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/event.ts#L58) |
579
- | <a id="consumer-2"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition)&lt;`TMessage`&gt; | The consumer definition for processing messages | [builder/event.ts:56](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/event.ts#L56) |
636
+ | <a id="__brand-2"></a> `__brand` | `"EventConsumerResult"` | Discriminator to identify this as an event consumer result | [builder/event.ts:62](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/event.ts#L62) |
637
+ | <a id="binding-2"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | The binding connecting the queue to the exchange | [builder/event.ts:66](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/event.ts#L66) |
638
+ | <a id="consumer-2"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition)&lt;`TMessage`&gt; | The consumer definition for processing messages | [builder/event.ts:64](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/event.ts#L64) |
639
+ | <a id="deadletterexchange-4"></a> `deadLetterExchange` | `TDlxExchange` | The dead letter exchange from the queue, if configured | [builder/event.ts:72](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/event.ts#L72) |
640
+ | <a id="exchange-3"></a> `exchange` | `TExchange` | The exchange this consumer subscribes to | [builder/event.ts:68](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/event.ts#L68) |
641
+ | <a id="queue-3"></a> `queue` | `TQueue` | The queue this consumer reads from | [builder/event.ts:70](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/event.ts#L70) |
580
642
 
581
643
  ***
582
644
 
@@ -586,7 +648,7 @@ will be automatically extracted.
586
648
  type EventConsumerResultBase = object;
587
649
  ```
588
650
 
589
- Defined in: [types.ts:929](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L929)
651
+ Defined in: [types.ts:947](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L947)
590
652
 
591
653
  Base type for event consumer result.
592
654
 
@@ -601,9 +663,12 @@ defineEventConsumer for creating event consumers
601
663
 
602
664
  | Property | Type | Defined in |
603
665
  | ------ | ------ | ------ |
604
- | <a id="__brand-3"></a> `__brand` | `"EventConsumerResult"` | [types.ts:930](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L930) |
605
- | <a id="binding-3"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | [types.ts:932](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L932) |
606
- | <a id="consumer-3"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition) | [types.ts:931](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L931) |
666
+ | <a id="__brand-3"></a> `__brand` | `"EventConsumerResult"` | [types.ts:948](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L948) |
667
+ | <a id="binding-3"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | [types.ts:950](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L950) |
668
+ | <a id="consumer-3"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition) | [types.ts:949](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L949) |
669
+ | <a id="deadletterexchange-5"></a> `deadLetterExchange` | [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | [types.ts:953](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L953) |
670
+ | <a id="exchange-4"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:951](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L951) |
671
+ | <a id="queue-4"></a> `queue` | [`QueueDefinition`](#queuedefinition) | [types.ts:952](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L952) |
607
672
 
608
673
  ***
609
674
 
@@ -613,7 +678,7 @@ defineEventConsumer for creating event consumers
613
678
  type EventPublisherConfig<TMessage, TExchange, TRoutingKey> = object;
614
679
  ```
615
680
 
616
- Defined in: [builder/event.ts:26](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/event.ts#L26)
681
+ Defined in: [builder/event.ts:29](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/event.ts#L29)
617
682
 
618
683
  Configuration for an event publisher.
619
684
 
@@ -633,11 +698,11 @@ publishers broadcast events and consumers subscribe to receive them.
633
698
 
634
699
  | Property | Type | Description | Defined in |
635
700
  | ------ | ------ | ------ | ------ |
636
- | <a id="__brand-4"></a> `__brand` | `"EventPublisherConfig"` | Discriminator to identify this as an event publisher config | [builder/event.ts:32](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/event.ts#L32) |
637
- | <a id="arguments-3"></a> `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments | [builder/event.ts:40](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/event.ts#L40) |
638
- | <a id="exchange-3"></a> `exchange` | `TExchange` | The exchange to publish to | [builder/event.ts:34](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/event.ts#L34) |
639
- | <a id="message-3"></a> `message` | `TMessage` | The message definition | [builder/event.ts:36](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/event.ts#L36) |
640
- | <a id="routingkey-3"></a> `routingKey` | `TRoutingKey` | The routing key for direct/topic exchanges | [builder/event.ts:38](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/event.ts#L38) |
701
+ | <a id="__brand-4"></a> `__brand` | `"EventPublisherConfig"` | Discriminator to identify this as an event publisher config | [builder/event.ts:35](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/event.ts#L35) |
702
+ | <a id="arguments-3"></a> `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments | [builder/event.ts:43](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/event.ts#L43) |
703
+ | <a id="exchange-5"></a> `exchange` | `TExchange` | The exchange to publish to | [builder/event.ts:37](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/event.ts#L37) |
704
+ | <a id="message-3"></a> `message` | `TMessage` | The message definition | [builder/event.ts:39](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/event.ts#L39) |
705
+ | <a id="routingkey-3"></a> `routingKey` | `TRoutingKey` | The routing key for direct/topic exchanges | [builder/event.ts:41](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/event.ts#L41) |
641
706
 
642
707
  ***
643
708
 
@@ -647,7 +712,7 @@ publishers broadcast events and consumers subscribe to receive them.
647
712
  type EventPublisherConfigBase = object;
648
713
  ```
649
714
 
650
- Defined in: [types.ts:896](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L896)
715
+ Defined in: [types.ts:912](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L912)
651
716
 
652
717
  Base type for event publisher configuration.
653
718
 
@@ -662,11 +727,11 @@ defineEventPublisher for creating event publishers
662
727
 
663
728
  | Property | Type | Defined in |
664
729
  | ------ | ------ | ------ |
665
- | <a id="__brand-5"></a> `__brand` | `"EventPublisherConfig"` | [types.ts:897](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L897) |
666
- | <a id="arguments-4"></a> `arguments?` | `Record`&lt;`string`, `unknown`&gt; | [types.ts:901](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L901) |
667
- | <a id="exchange-4"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:898](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L898) |
668
- | <a id="message-4"></a> `message` | [`MessageDefinition`](#messagedefinition) | [types.ts:899](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L899) |
669
- | <a id="routingkey-4"></a> `routingKey` | `string` \| `undefined` | [types.ts:900](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L900) |
730
+ | <a id="__brand-5"></a> `__brand` | `"EventPublisherConfig"` | [types.ts:913](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L913) |
731
+ | <a id="arguments-4"></a> `arguments?` | `Record`&lt;`string`, `unknown`&gt; | [types.ts:917](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L917) |
732
+ | <a id="exchange-6"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:914](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L914) |
733
+ | <a id="message-4"></a> `message` | [`MessageDefinition`](#messagedefinition) | [types.ts:915](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L915) |
734
+ | <a id="routingkey-4"></a> `routingKey` | `string` \| `undefined` | [types.ts:916](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L916) |
670
735
 
671
736
  ***
672
737
 
@@ -685,7 +750,7 @@ type ExchangeBindingDefinition = object &
685
750
  };
686
751
  ```
687
752
 
688
- Defined in: [types.ts:779](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L779)
753
+ Defined in: [types.ts:795](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L795)
689
754
 
690
755
  Binding between two exchanges (exchange-to-exchange routing).
691
756
 
@@ -696,9 +761,9 @@ This allows for more complex routing topologies.
696
761
 
697
762
  | Name | Type | Description | Defined in |
698
763
  | ------ | ------ | ------ | ------ |
699
- | `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments for the binding. | [types.ts:789](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L789) |
700
- | `destination` | [`ExchangeDefinition`](#exchangedefinition) | The destination exchange that will receive forwarded messages | [types.ts:784](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L784) |
701
- | `type` | `"exchange"` | Discriminator indicating this is an exchange-to-exchange binding | [types.ts:781](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L781) |
764
+ | `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments for the binding. | [types.ts:805](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L805) |
765
+ | `destination` | [`ExchangeDefinition`](#exchangedefinition) | The destination exchange that will receive forwarded messages | [types.ts:800](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L800) |
766
+ | `type` | `"exchange"` | Discriminator indicating this is an exchange-to-exchange binding | [types.ts:797](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L797) |
702
767
 
703
768
  #### Example
704
769
 
@@ -717,27 +782,33 @@ const binding: ExchangeBindingDefinition = {
717
782
  ### ExchangeDefinition
718
783
 
719
784
  ```ts
720
- type ExchangeDefinition =
721
- | FanoutExchangeDefinition
722
- | DirectExchangeDefinition
723
- | TopicExchangeDefinition;
785
+ type ExchangeDefinition<TName> =
786
+ | FanoutExchangeDefinition<TName>
787
+ | DirectExchangeDefinition<TName>
788
+ | TopicExchangeDefinition<TName>;
724
789
  ```
725
790
 
726
- Defined in: [types.ts:468](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L468)
791
+ Defined in: [types.ts:471](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L471)
727
792
 
728
793
  Union type of all exchange definitions.
729
794
 
730
795
  Represents any type of AMQP exchange: fanout, direct, or topic.
731
796
 
797
+ #### Type Parameters
798
+
799
+ | Type Parameter | Default type |
800
+ | ------ | ------ |
801
+ | `TName` *extends* `string` | `string` |
802
+
732
803
  ***
733
804
 
734
805
  ### FanoutExchangeDefinition
735
806
 
736
807
  ```ts
737
- type FanoutExchangeDefinition = BaseExchangeDefinition & object;
808
+ type FanoutExchangeDefinition<TName> = BaseExchangeDefinition<TName> & object;
738
809
  ```
739
810
 
740
- Defined in: [types.ts:421](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L421)
811
+ Defined in: [types.ts:421](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L421)
741
812
 
742
813
  A fanout exchange definition.
743
814
 
@@ -748,7 +819,13 @@ This is the simplest exchange type for pub/sub messaging patterns.
748
819
 
749
820
  | Name | Type | Defined in |
750
821
  | ------ | ------ | ------ |
751
- | `type` | `"fanout"` | [types.ts:422](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L422) |
822
+ | `type` | `"fanout"` | [types.ts:423](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L423) |
823
+
824
+ #### Type Parameters
825
+
826
+ | Type Parameter | Default type |
827
+ | ------ | ------ |
828
+ | `TName` *extends* `string` | `string` |
752
829
 
753
830
  #### Example
754
831
 
@@ -766,7 +843,7 @@ const logsExchange: FanoutExchangeDefinition = defineExchange('logs', 'fanout',
766
843
  type InferConsumerNames<TContract> = TContract["consumers"] extends Record<string, unknown> ? keyof TContract["consumers"] : never;
767
844
  ```
768
845
 
769
- Defined in: [types.ts:1108](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L1108)
846
+ Defined in: [types.ts:1356](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L1356)
770
847
 
771
848
  Extract consumer names from a contract.
772
849
 
@@ -798,7 +875,7 @@ type ConsumerNames = InferConsumerNames<typeof myContract>;
798
875
  type InferPublisherNames<TContract> = TContract["publishers"] extends Record<string, unknown> ? keyof TContract["publishers"] : never;
799
876
  ```
800
877
 
801
- Defined in: [types.ts:1090](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L1090)
878
+ Defined in: [types.ts:1338](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L1338)
802
879
 
803
880
  Extract publisher names from a contract.
804
881
 
@@ -830,7 +907,7 @@ type PublisherNames = InferPublisherNames<typeof myContract>;
830
907
  type MatchingRoutingKey<Pattern, Key> = RoutingKey<Key> extends never ? never : BindingPattern<Pattern> extends never ? never : MatchesPattern<Key, Pattern> extends true ? Key : never;
831
908
  ```
832
909
 
833
- Defined in: [builder/routing-types.ts:114](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/routing-types.ts#L114)
910
+ Defined in: [builder/routing-types.ts:114](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/routing-types.ts#L114)
834
911
 
835
912
  Validate that a routing key matches a binding pattern.
836
913
 
@@ -862,7 +939,7 @@ type InvalidKey = MatchingRoutingKey<"order.*", "user.created">; // never
862
939
  type MessageDefinition<TPayload, THeaders> = object;
863
940
  ```
864
941
 
865
- Defined in: [types.ts:695](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L695)
942
+ Defined in: [types.ts:711](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L711)
866
943
 
867
944
  Definition of a message with typed payload and optional headers.
868
945
 
@@ -877,10 +954,10 @@ Definition of a message with typed payload and optional headers.
877
954
 
878
955
  | Property | Type | Description | Defined in |
879
956
  | ------ | ------ | ------ | ------ |
880
- | <a id="description"></a> `description?` | `string` | Detailed description of the message for documentation purposes. Used in AsyncAPI specification generation. | [types.ts:721](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L721) |
881
- | <a id="headers"></a> `headers?` | `THeaders` | Optional headers schema for validating message metadata. Must be a Standard Schema v1 compatible schema. | [types.ts:709](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L709) |
882
- | <a id="payload"></a> `payload` | `TPayload` | The payload schema for validating message content. Must be a Standard Schema v1 compatible schema (Zod, Valibot, ArkType, etc.). | [types.ts:703](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L703) |
883
- | <a id="summary"></a> `summary?` | `string` | Brief description of the message for documentation purposes. Used in AsyncAPI specification generation. | [types.ts:715](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L715) |
957
+ | <a id="description"></a> `description?` | `string` | Detailed description of the message for documentation purposes. Used in AsyncAPI specification generation. | [types.ts:737](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L737) |
958
+ | <a id="headers"></a> `headers?` | `THeaders` | Optional headers schema for validating message metadata. Must be a Standard Schema v1 compatible schema. | [types.ts:725](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L725) |
959
+ | <a id="payload"></a> `payload` | `TPayload` | The payload schema for validating message content. Must be a Standard Schema v1 compatible schema (Zod, Valibot, ArkType, etc.). | [types.ts:719](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L719) |
960
+ | <a id="summary"></a> `summary?` | `string` | Brief description of the message for documentation purposes. Used in AsyncAPI specification generation. | [types.ts:731](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L731) |
884
961
 
885
962
  ***
886
963
 
@@ -899,7 +976,7 @@ type PublisherDefinition<TMessage> = object &
899
976
  };
900
977
  ```
901
978
 
902
- Defined in: [types.ts:837](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L837)
979
+ Defined in: [types.ts:853](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L853)
903
980
 
904
981
  Definition of a message publisher.
905
982
 
@@ -913,7 +990,7 @@ algorithm when calling the publish method.
913
990
 
914
991
  | Name | Type | Description | Defined in |
915
992
  | ------ | ------ | ------ | ------ |
916
- | `message` | `TMessage` | The message definition including the payload schema | [types.ts:839](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L839) |
993
+ | `message` | `TMessage` | The message definition including the payload schema | [types.ts:855](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L855) |
917
994
 
918
995
  #### Type Parameters
919
996
 
@@ -941,7 +1018,7 @@ type PublisherEntry =
941
1018
  | EventPublisherConfigBase;
942
1019
  ```
943
1020
 
944
- Defined in: [types.ts:1012](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L1012)
1021
+ Defined in: [types.ts:1033](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L1033)
945
1022
 
946
1023
  Publisher entry that can be passed to defineContract's publishers section.
947
1024
 
@@ -966,7 +1043,7 @@ type QueueBindingDefinition = object &
966
1043
  };
967
1044
  ```
968
1045
 
969
- Defined in: [types.ts:731](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L731)
1046
+ Defined in: [types.ts:747](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L747)
970
1047
 
971
1048
  Binding between a queue and an exchange.
972
1049
 
@@ -978,21 +1055,21 @@ For fanout exchanges, no routing key is needed as all messages are broadcast.
978
1055
 
979
1056
  | Name | Type | Description | Defined in |
980
1057
  | ------ | ------ | ------ | ------ |
981
- | `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments for the binding. Can be used for advanced routing scenarios with the headers exchange type. | [types.ts:742](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L742) |
982
- | `queue` | [`QueueDefinition`](#queuedefinition) | The queue that will receive messages | [types.ts:736](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L736) |
983
- | `type` | `"queue"` | Discriminator indicating this is a queue-to-exchange binding | [types.ts:733](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L733) |
1058
+ | `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments for the binding. Can be used for advanced routing scenarios with the headers exchange type. | [types.ts:758](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L758) |
1059
+ | `queue` | [`QueueDefinition`](#queuedefinition) | The queue that will receive messages | [types.ts:752](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L752) |
1060
+ | `type` | `"queue"` | Discriminator indicating this is a queue-to-exchange binding | [types.ts:749](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L749) |
984
1061
 
985
1062
  ***
986
1063
 
987
1064
  ### QueueDefinition
988
1065
 
989
1066
  ```ts
990
- type QueueDefinition =
991
- | QuorumQueueDefinition
992
- | ClassicQueueDefinition;
1067
+ type QueueDefinition<TName> =
1068
+ | QuorumQueueDefinition<TName>
1069
+ | ClassicQueueDefinition<TName>;
993
1070
  ```
994
1071
 
995
- Defined in: [types.ts:629](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L629)
1072
+ Defined in: [types.ts:632](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L632)
996
1073
 
997
1074
  Definition of an AMQP queue.
998
1075
 
@@ -1002,22 +1079,34 @@ A discriminated union based on queue type:
1002
1079
 
1003
1080
  Use `queue.type` as the discriminator to narrow the type.
1004
1081
 
1082
+ #### Type Parameters
1083
+
1084
+ | Type Parameter | Default type |
1085
+ | ------ | ------ |
1086
+ | `TName` *extends* `string` | `string` |
1087
+
1005
1088
  ***
1006
1089
 
1007
1090
  ### QueueEntry
1008
1091
 
1009
1092
  ```ts
1010
- type QueueEntry =
1011
- | QueueDefinition
1012
- | QueueWithTtlBackoffInfrastructure;
1093
+ type QueueEntry<TName> =
1094
+ | QueueDefinition<TName>
1095
+ | QueueWithTtlBackoffInfrastructure<TName>;
1013
1096
  ```
1014
1097
 
1015
- Defined in: [types.ts:687](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L687)
1098
+ Defined in: [types.ts:701](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L701)
1016
1099
 
1017
1100
  A queue entry that can be passed to `defineContract`.
1018
1101
 
1019
1102
  Can be either a plain queue definition or a queue with TTL-backoff infrastructure.
1020
1103
 
1104
+ #### Type Parameters
1105
+
1106
+ | Type Parameter | Default type |
1107
+ | ------ | ------ |
1108
+ | `TName` *extends* `string` | `string` |
1109
+
1021
1110
  ***
1022
1111
 
1023
1112
  ### QueueType
@@ -1026,7 +1115,7 @@ Can be either a plain queue definition or a queue with TTL-backoff infrastructur
1026
1115
  type QueueType = "quorum" | "classic";
1027
1116
  ```
1028
1117
 
1029
- Defined in: [types.ts:163](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L163)
1118
+ Defined in: [types.ts:163](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L163)
1030
1119
 
1031
1120
  Supported queue types in RabbitMQ.
1032
1121
 
@@ -1062,10 +1151,10 @@ const tempQueue = defineQueue('temp-queue', {
1062
1151
  ### QueueWithTtlBackoffInfrastructure
1063
1152
 
1064
1153
  ```ts
1065
- type QueueWithTtlBackoffInfrastructure = object;
1154
+ type QueueWithTtlBackoffInfrastructure<TName> = object;
1066
1155
  ```
1067
1156
 
1068
- Defined in: [types.ts:654](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L654)
1157
+ Defined in: [types.ts:662](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L662)
1069
1158
 
1070
1159
  A queue with automatically generated TTL-backoff retry infrastructure.
1071
1160
 
@@ -1077,27 +1166,37 @@ and bindings are automatically added to the contract.
1077
1166
 
1078
1167
  ```typescript
1079
1168
  const dlx = defineExchange('orders-dlx', 'direct', { durable: true });
1169
+ const exchange = defineExchange('orders', 'topic', { durable: true });
1080
1170
  const queue = defineQueue('order-processing', {
1081
1171
  deadLetter: { exchange: dlx },
1082
1172
  retry: { mode: 'ttl-backoff', maxRetries: 5 },
1083
1173
  });
1084
1174
  // queue is QueueWithTtlBackoffInfrastructure
1175
+ const message = defineMessage(z.object({ orderId: z.string() }));
1176
+ const orderCreated = defineEventPublisher(exchange, message, { routingKey: 'order.created' });
1085
1177
 
1178
+ // Wait queue, bindings, and DLX exchange are automatically extracted
1086
1179
  const contract = defineContract({
1087
- exchanges: { dlx },
1088
- queues: { orderProcessing: queue }, // Automatically adds wait queue
1089
- // ... bindings are automatically generated
1180
+ publishers: { orderCreated },
1181
+ consumers: { processOrder: defineEventConsumer(orderCreated, extractQueue(queue)) },
1090
1182
  });
1091
1183
  ```
1092
1184
 
1185
+ #### Type Parameters
1186
+
1187
+ | Type Parameter | Default type |
1188
+ | ------ | ------ |
1189
+ | `TName` *extends* `string` | `string` |
1190
+
1093
1191
  #### Properties
1094
1192
 
1095
1193
  | Property | Type | Description | Defined in |
1096
1194
  | ------ | ------ | ------ | ------ |
1097
- | <a id="mainqueueretrybinding"></a> `mainQueueRetryBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes retried messages back to the main queue. | [types.ts:679](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L679) |
1098
- | <a id="queue-1"></a> `queue` | [`QueueDefinition`](#queuedefinition) | The main queue definition. | [types.ts:664](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L664) |
1099
- | <a id="waitqueue"></a> `waitQueue` | [`QueueDefinition`](#queuedefinition) | The wait queue for holding messages during backoff delay. | [types.ts:669](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L669) |
1100
- | <a id="waitqueuebinding"></a> `waitQueueBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes failed messages to the wait queue. | [types.ts:674](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L674) |
1195
+ | <a id="deadletter"></a> `deadLetter` | [`DeadLetterConfig`](#deadletterconfig) | Dead letter configuration from the main queue. Always present since TTL-backoff infrastructure requires a dead letter exchange. | [types.ts:678](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L678) |
1196
+ | <a id="mainqueueretrybinding"></a> `mainQueueRetryBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes retried messages back to the main queue. | [types.ts:693](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L693) |
1197
+ | <a id="queue-5"></a> `queue` | [`QueueDefinition`](#queuedefinition)&lt;`TName`&gt; | The main queue definition. | [types.ts:672](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L672) |
1198
+ | <a id="waitqueue"></a> `waitQueue` | [`QueueDefinition`](#queuedefinition) | The wait queue for holding messages during backoff delay. | [types.ts:683](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L683) |
1199
+ | <a id="waitqueuebinding"></a> `waitQueueBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes failed messages to the wait queue. | [types.ts:688](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L688) |
1101
1200
 
1102
1201
  ***
1103
1202
 
@@ -1107,7 +1206,7 @@ const contract = defineContract({
1107
1206
  type QuorumNativeRetryOptions = object;
1108
1207
  ```
1109
1208
 
1110
- Defined in: [types.ts:72](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L72)
1209
+ Defined in: [types.ts:72](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L72)
1111
1210
 
1112
1211
  Quorum-Native retry options using RabbitMQ's native delivery limit feature.
1113
1212
 
@@ -1127,17 +1226,17 @@ https://www.rabbitmq.com/docs/quorum-queues#poison-message-handling
1127
1226
 
1128
1227
  | Property | Type | Description | Defined in |
1129
1228
  | ------ | ------ | ------ | ------ |
1130
- | <a id="mode"></a> `mode` | `"quorum-native"` | Quorum-Native mode uses RabbitMQ's native delivery limit feature. Requires the queue to be a quorum queue with `deliveryLimit` configured. | [types.ts:77](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L77) |
1229
+ | <a id="mode"></a> `mode` | `"quorum-native"` | Quorum-Native mode uses RabbitMQ's native delivery limit feature. Requires the queue to be a quorum queue with `deliveryLimit` configured. | [types.ts:77](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L77) |
1131
1230
 
1132
1231
  ***
1133
1232
 
1134
1233
  ### QuorumQueueDefinition
1135
1234
 
1136
1235
  ```ts
1137
- type QuorumQueueDefinition = BaseQueueDefinition & object;
1236
+ type QuorumQueueDefinition<TName> = BaseQueueDefinition<TName> & object;
1138
1237
  ```
1139
1238
 
1140
- Defined in: [types.ts:542](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L542)
1239
+ Defined in: [types.ts:545](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L545)
1141
1240
 
1142
1241
  Definition of a quorum queue.
1143
1242
 
@@ -1148,11 +1247,17 @@ They support native retry handling via `deliveryLimit` and both TTL-backoff and
1148
1247
 
1149
1248
  | Name | Type | Description | Defined in |
1150
1249
  | ------ | ------ | ------ | ------ |
1151
- | `deliveryLimit?` | `number` | Maximum number of delivery attempts before the message is dead-lettered. This is a quorum queue-specific feature. When a message is rejected (nacked) and requeued, RabbitMQ increments the `x-delivery-count` header. When this count reaches the delivery limit, the message is automatically dead-lettered (if DLX is configured) or dropped. **Minimum** 1 - Must be a positive integer (1 or greater) **See** https://www.rabbitmq.com/docs/quorum-queues#poison-message-handling | [types.ts:572](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L572) |
1152
- | `exclusive?` | `never` | Quorum queues do not support exclusive mode. Use type: 'classic' if you need exclusive queues. | [types.ts:552](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L552) |
1153
- | `maxPriority?` | `never` | Quorum queues do not support priority queues. Use type: 'classic' if you need priority queues. | [types.ts:558](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L558) |
1154
- | `retry` | [`ResolvedRetryOptions`](#resolvedretryoptions) | Retry configuration for handling failed message processing. Quorum queues support both: - `ttl-backoff`: Uses wait queues with exponential backoff (default) - `quorum-native`: Uses RabbitMQ's native delivery limit feature When the queue is created, defaults are applied for TTL-backoff options. | [types.ts:583](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L583) |
1155
- | `type` | `"quorum"` | Queue type discriminator: quorum queue. | [types.ts:546](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L546) |
1250
+ | `deliveryLimit?` | `number` | Maximum number of delivery attempts before the message is dead-lettered. This is a quorum queue-specific feature. When a message is rejected (nacked) and requeued, RabbitMQ increments the `x-delivery-count` header. When this count reaches the delivery limit, the message is automatically dead-lettered (if DLX is configured) or dropped. **Minimum** 1 - Must be a positive integer (1 or greater) **See** https://www.rabbitmq.com/docs/quorum-queues#poison-message-handling | [types.ts:575](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L575) |
1251
+ | `exclusive?` | `never` | Quorum queues do not support exclusive mode. Use type: 'classic' if you need exclusive queues. | [types.ts:555](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L555) |
1252
+ | `maxPriority?` | `never` | Quorum queues do not support priority queues. Use type: 'classic' if you need priority queues. | [types.ts:561](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L561) |
1253
+ | `retry` | [`ResolvedRetryOptions`](#resolvedretryoptions) | Retry configuration for handling failed message processing. Quorum queues support both: - `ttl-backoff`: Uses wait queues with exponential backoff (default) - `quorum-native`: Uses RabbitMQ's native delivery limit feature When the queue is created, defaults are applied for TTL-backoff options. | [types.ts:586](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L586) |
1254
+ | `type` | `"quorum"` | Queue type discriminator: quorum queue. | [types.ts:549](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L549) |
1255
+
1256
+ #### Type Parameters
1257
+
1258
+ | Type Parameter | Default type |
1259
+ | ------ | ------ |
1260
+ | `TName` *extends* `string` | `string` |
1156
1261
 
1157
1262
  ***
1158
1263
 
@@ -1162,7 +1267,7 @@ They support native retry handling via `deliveryLimit` and both TTL-backoff and
1162
1267
  type QuorumQueueOptions = BaseQueueOptions & object;
1163
1268
  ```
1164
1269
 
1165
- Defined in: [types.ts:214](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L214)
1270
+ Defined in: [types.ts:214](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L214)
1166
1271
 
1167
1272
  Options for creating a quorum queue.
1168
1273
 
@@ -1179,11 +1284,11 @@ Quorum queues provide native retry support via `deliveryLimit`:
1179
1284
 
1180
1285
  | Name | Type | Description | Defined in |
1181
1286
  | ------ | ------ | ------ | ------ |
1182
- | `deliveryLimit?` | `number` | Maximum number of delivery attempts before the message is dead-lettered. When a message is rejected (nacked) and requeued, RabbitMQ increments the `x-delivery-count` header. When this count reaches the delivery limit, the message is automatically dead-lettered (if DLX is configured) or dropped. This is a quorum queue-specific feature that provides native retry handling without the complexity of TTL-based wait queues. **Benefits over TTL-based retry:** - Simpler architecture (no wait queues needed) - No head-of-queue blocking issues (TTL only works at queue head) - Native RabbitMQ feature with atomic guarantees **Minimum** 1 - Must be a positive integer (1 or greater) **See** https://www.rabbitmq.com/docs/quorum-queues#poison-message-handling **Example** `const orderQueue = defineQueue('order-processing', { type: 'quorum', deliveryLimit: 5, // Allow up to 5 delivery attempts deadLetter: { exchange: dlx, routingKey: 'order.failed', }, });` | [types.ts:263](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L263) |
1183
- | `exclusive?` | `never` | Quorum queues do not support exclusive mode. Use type: 'classic' if you need exclusive queues. | [types.ts:224](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L224) |
1184
- | `maxPriority?` | `never` | Quorum queues do not support priority queues. Use type: 'classic' if you need priority queues. | [types.ts:230](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L230) |
1185
- | `retry?` | \| [`TtlBackoffRetryOptions`](#ttlbackoffretryoptions) \| [`QuorumNativeRetryOptions`](#quorumnativeretryoptions) | Retry configuration for handling failed message processing. Determines how the worker handles retries for consumers using this queue: - `"ttl-backoff"` (default): Uses wait queues with exponential backoff - `"quorum-native"`: Uses RabbitMQ's native delivery limit feature When using `"ttl-backoff"` mode, the core package will automatically create a wait queue (`{queueName}-wait`) and the necessary bindings. **Example** `// TTL-backoff mode with custom options const orderQueue = defineQueue('order-processing', { type: 'quorum', deadLetter: { exchange: dlx }, retry: { mode: 'ttl-backoff', maxRetries: 5, initialDelayMs: 1000, maxDelayMs: 30000, }, }); // Quorum-native mode const orderQueue = defineQueue('order-processing', { type: 'quorum', deliveryLimit: 5, deadLetter: { exchange: dlx }, retry: { mode: 'quorum-native' }, });` | [types.ts:298](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L298) |
1186
- | `type?` | `"quorum"` | Queue type: quorum (default, recommended) | [types.ts:218](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L218) |
1287
+ | `deliveryLimit?` | `number` | Maximum number of delivery attempts before the message is dead-lettered. When a message is rejected (nacked) and requeued, RabbitMQ increments the `x-delivery-count` header. When this count reaches the delivery limit, the message is automatically dead-lettered (if DLX is configured) or dropped. This is a quorum queue-specific feature that provides native retry handling without the complexity of TTL-based wait queues. **Benefits over TTL-based retry:** - Simpler architecture (no wait queues needed) - No head-of-queue blocking issues (TTL only works at queue head) - Native RabbitMQ feature with atomic guarantees **Minimum** 1 - Must be a positive integer (1 or greater) **See** https://www.rabbitmq.com/docs/quorum-queues#poison-message-handling **Example** `const orderQueue = defineQueue('order-processing', { type: 'quorum', deliveryLimit: 5, // Allow up to 5 delivery attempts deadLetter: { exchange: dlx, routingKey: 'order.failed', }, });` | [types.ts:263](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L263) |
1288
+ | `exclusive?` | `never` | Quorum queues do not support exclusive mode. Use type: 'classic' if you need exclusive queues. | [types.ts:224](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L224) |
1289
+ | `maxPriority?` | `never` | Quorum queues do not support priority queues. Use type: 'classic' if you need priority queues. | [types.ts:230](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L230) |
1290
+ | `retry?` | \| [`TtlBackoffRetryOptions`](#ttlbackoffretryoptions) \| [`QuorumNativeRetryOptions`](#quorumnativeretryoptions) | Retry configuration for handling failed message processing. Determines how the worker handles retries for consumers using this queue: - `"ttl-backoff"` (default): Uses wait queues with exponential backoff - `"quorum-native"`: Uses RabbitMQ's native delivery limit feature When using `"ttl-backoff"` mode, the core package will automatically create a wait queue (`{queueName}-wait`) and the necessary bindings. **Example** `// TTL-backoff mode with custom options const orderQueue = defineQueue('order-processing', { type: 'quorum', deadLetter: { exchange: dlx }, retry: { mode: 'ttl-backoff', maxRetries: 5, initialDelayMs: 1000, maxDelayMs: 30000, }, }); // Quorum-native mode const orderQueue = defineQueue('order-processing', { type: 'quorum', deliveryLimit: 5, deadLetter: { exchange: dlx }, retry: { mode: 'quorum-native' }, });` | [types.ts:298](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L298) |
1291
+ | `type?` | `"quorum"` | Queue type: quorum (default, recommended) | [types.ts:218](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L218) |
1187
1292
 
1188
1293
  #### Example
1189
1294
 
@@ -1205,7 +1310,7 @@ type ResolvedRetryOptions =
1205
1310
  | QuorumNativeRetryOptions;
1206
1311
  ```
1207
1312
 
1208
- Defined in: [types.ts:104](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L104)
1313
+ Defined in: [types.ts:104](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L104)
1209
1314
 
1210
1315
  Resolved retry configuration stored in queue definitions.
1211
1316
 
@@ -1221,7 +1326,7 @@ This is a discriminated union based on the `mode` field:
1221
1326
  type RoutingKey<S> = S extends "" ? never : S extends `${string}*${string}` | `${string}#${string}` ? never : S;
1222
1327
  ```
1223
1328
 
1224
- Defined in: [builder/routing-types.ts:25](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/routing-types.ts#L25)
1329
+ Defined in: [builder/routing-types.ts:25](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/routing-types.ts#L25)
1225
1330
 
1226
1331
  Type-safe routing key that validates basic format.
1227
1332
 
@@ -1252,10 +1357,10 @@ type Invalid2 = RoutingKey<"">; // never (empty string)
1252
1357
  ### TopicExchangeDefinition
1253
1358
 
1254
1359
  ```ts
1255
- type TopicExchangeDefinition = BaseExchangeDefinition & object;
1360
+ type TopicExchangeDefinition<TName> = BaseExchangeDefinition<TName> & object;
1256
1361
  ```
1257
1362
 
1258
- Defined in: [types.ts:459](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L459)
1363
+ Defined in: [types.ts:461](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L461)
1259
1364
 
1260
1365
  A topic exchange definition.
1261
1366
 
@@ -1269,7 +1374,13 @@ Words are separated by dots (e.g., `order.created.high-value`).
1269
1374
 
1270
1375
  | Name | Type | Defined in |
1271
1376
  | ------ | ------ | ------ |
1272
- | `type` | `"topic"` | [types.ts:460](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L460) |
1377
+ | `type` | `"topic"` | [types.ts:463](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L463) |
1378
+
1379
+ #### Type Parameters
1380
+
1381
+ | Type Parameter | Default type |
1382
+ | ------ | ------ |
1383
+ | `TName` *extends* `string` | `string` |
1273
1384
 
1274
1385
  #### Example
1275
1386
 
@@ -1288,7 +1399,7 @@ const ordersExchange: TopicExchangeDefinition = defineExchange('orders', 'topic'
1288
1399
  type TtlBackoffRetryInfrastructure = object;
1289
1400
  ```
1290
1401
 
1291
- Defined in: [builder/ttl-backoff.ts:10](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/ttl-backoff.ts#L10)
1402
+ Defined in: [builder/ttl-backoff.ts:10](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/ttl-backoff.ts#L10)
1292
1403
 
1293
1404
  Result type for TTL-backoff retry infrastructure builder.
1294
1405
 
@@ -1298,9 +1409,9 @@ Contains the wait queue and bindings needed for TTL-backoff retry.
1298
1409
 
1299
1410
  | Property | Type | Description | Defined in |
1300
1411
  | ------ | ------ | ------ | ------ |
1301
- | <a id="mainqueueretrybinding-1"></a> `mainQueueRetryBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes retried messages back to the main queue. | [builder/ttl-backoff.ts:23](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/ttl-backoff.ts#L23) |
1302
- | <a id="waitqueue-1"></a> `waitQueue` | [`QueueDefinition`](#queuedefinition) | The wait queue for holding messages during backoff delay. This is a classic queue with a dead letter exchange pointing back to the main queue. | [builder/ttl-backoff.ts:15](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/ttl-backoff.ts#L15) |
1303
- | <a id="waitqueuebinding-1"></a> `waitQueueBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes failed messages to the wait queue. | [builder/ttl-backoff.ts:19](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/ttl-backoff.ts#L19) |
1412
+ | <a id="mainqueueretrybinding-1"></a> `mainQueueRetryBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes retried messages back to the main queue. | [builder/ttl-backoff.ts:23](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/ttl-backoff.ts#L23) |
1413
+ | <a id="waitqueue-1"></a> `waitQueue` | [`QueueDefinition`](#queuedefinition) | The wait queue for holding messages during backoff delay. This is a classic queue with a dead letter exchange pointing back to the main queue. | [builder/ttl-backoff.ts:15](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/ttl-backoff.ts#L15) |
1414
+ | <a id="waitqueuebinding-1"></a> `waitQueueBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes failed messages to the wait queue. | [builder/ttl-backoff.ts:19](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/ttl-backoff.ts#L19) |
1304
1415
 
1305
1416
  ***
1306
1417
 
@@ -1310,7 +1421,7 @@ Contains the wait queue and bindings needed for TTL-backoff retry.
1310
1421
  type TtlBackoffRetryOptions = object;
1311
1422
  ```
1312
1423
 
1313
- Defined in: [types.ts:27](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L27)
1424
+ Defined in: [types.ts:27](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L27)
1314
1425
 
1315
1426
  TTL-Backoff retry options for exponential backoff with configurable delays.
1316
1427
 
@@ -1324,12 +1435,12 @@ per-message TTL, then dead-lettered back to the main queue after the TTL expires
1324
1435
 
1325
1436
  | Property | Type | Description | Defined in |
1326
1437
  | ------ | ------ | ------ | ------ |
1327
- | <a id="backoffmultiplier-1"></a> `backoffMultiplier?` | `number` | Exponential backoff multiplier. **Default** `2` | [types.ts:51](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L51) |
1328
- | <a id="initialdelayms-1"></a> `initialDelayMs?` | `number` | Initial delay in ms before first retry. **Default** `1000` | [types.ts:41](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L41) |
1329
- | <a id="jitter-1"></a> `jitter?` | `boolean` | Add jitter to prevent thundering herd. **Default** `true` | [types.ts:56](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L56) |
1330
- | <a id="maxdelayms-1"></a> `maxDelayMs?` | `number` | Maximum delay in ms between retries. **Default** `30000` | [types.ts:46](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L46) |
1331
- | <a id="maxretries-1"></a> `maxRetries?` | `number` | Maximum retry attempts before sending to DLQ. **Default** `3` | [types.ts:36](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L36) |
1332
- | <a id="mode-1"></a> `mode` | `"ttl-backoff"` | TTL-Backoff mode uses wait queues with per-message TTL for exponential backoff. | [types.ts:31](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L31) |
1438
+ | <a id="backoffmultiplier-1"></a> `backoffMultiplier?` | `number` | Exponential backoff multiplier. **Default** `2` | [types.ts:51](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L51) |
1439
+ | <a id="initialdelayms-1"></a> `initialDelayMs?` | `number` | Initial delay in ms before first retry. **Default** `1000` | [types.ts:41](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L41) |
1440
+ | <a id="jitter-1"></a> `jitter?` | `boolean` | Add jitter to prevent thundering herd. **Default** `true` | [types.ts:56](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L56) |
1441
+ | <a id="maxdelayms-1"></a> `maxDelayMs?` | `number` | Maximum delay in ms between retries. **Default** `30000` | [types.ts:46](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L46) |
1442
+ | <a id="maxretries-1"></a> `maxRetries?` | `number` | Maximum retry attempts before sending to DLQ. **Default** `3` | [types.ts:36](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L36) |
1443
+ | <a id="mode-1"></a> `mode` | `"ttl-backoff"` | TTL-Backoff mode uses wait queues with per-message TTL for exponential backoff. | [types.ts:31](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/types.ts#L31) |
1333
1444
 
1334
1445
  ## Functions
1335
1446
 
@@ -1342,7 +1453,7 @@ function defineConsumer<TMessage>(
1342
1453
  options?): ConsumerDefinition<TMessage>;
1343
1454
  ```
1344
1455
 
1345
- Defined in: [builder/consumer.ts:62](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/consumer.ts#L62)
1456
+ Defined in: [builder/consumer.ts:121](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/consumer.ts#L121)
1346
1457
 
1347
1458
  Define a message consumer.
1348
1459
 
@@ -1424,15 +1535,16 @@ const processOrderConsumer = defineConsumer(orderQueue, orderMessage);
1424
1535
  ### defineContract()
1425
1536
 
1426
1537
  ```ts
1427
- function defineContract<TContract>(definition): TContract;
1538
+ function defineContract<TContract>(definition): ContractOutput<TContract>;
1428
1539
  ```
1429
1540
 
1430
- Defined in: [builder/contract.ts:90](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/contract.ts#L90)
1541
+ Defined in: [builder/contract.ts:84](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/contract.ts#L84)
1431
1542
 
1432
1543
  Define an AMQP contract.
1433
1544
 
1434
1545
  A contract is the central definition of your AMQP messaging topology. It brings together
1435
- all exchanges, queues, bindings, publishers, and consumers in a single, type-safe definition.
1546
+ publishers and consumers in a single, type-safe definition. Exchanges, queues, and bindings
1547
+ are automatically extracted from publishers and consumers.
1436
1548
 
1437
1549
  The contract is used by both clients (for publishing) and workers (for consuming) to ensure
1438
1550
  type safety throughout your messaging infrastructure. TypeScript will infer all message types
@@ -1448,13 +1560,13 @@ and publisher/consumer names from the contract.
1448
1560
 
1449
1561
  | Parameter | Type | Description |
1450
1562
  | ------ | ------ | ------ |
1451
- | `definition` | `TContract` | The contract definition containing all AMQP resources |
1563
+ | `definition` | `TContract` | The contract definition containing publishers and consumers |
1452
1564
 
1453
1565
  #### Returns
1454
1566
 
1455
- `TContract`
1567
+ [`ContractOutput`](#contractoutput)&lt;`TContract`&gt;
1456
1568
 
1457
- The same contract definition with full type inference
1569
+ The contract definition with fully inferred exchanges, queues, bindings, publishers, and consumers
1458
1570
 
1459
1571
  #### Example
1460
1572
 
@@ -1463,16 +1575,20 @@ import {
1463
1575
  defineContract,
1464
1576
  defineExchange,
1465
1577
  defineQueue,
1466
- defineQueueBinding,
1467
- definePublisher,
1468
- defineConsumer,
1578
+ defineEventPublisher,
1579
+ defineEventConsumer,
1469
1580
  defineMessage,
1470
1581
  } from '@amqp-contract/contract';
1471
1582
  import { z } from 'zod';
1472
1583
 
1473
1584
  // Define resources
1474
1585
  const ordersExchange = defineExchange('orders', 'topic', { durable: true });
1475
- const orderQueue = defineQueue('order-processing', { durable: true });
1586
+ const dlx = defineExchange('orders-dlx', 'direct', { durable: true });
1587
+ const orderQueue = defineQueue('order-processing', {
1588
+ deadLetter: { exchange: dlx },
1589
+ retry: { mode: 'quorum-native' },
1590
+ deliveryLimit: 3,
1591
+ });
1476
1592
  const orderMessage = defineMessage(
1477
1593
  z.object({
1478
1594
  orderId: z.string(),
@@ -1480,32 +1596,27 @@ const orderMessage = defineMessage(
1480
1596
  })
1481
1597
  );
1482
1598
 
1483
- // Compose contract
1599
+ // Define event publisher
1600
+ const orderCreatedEvent = defineEventPublisher(ordersExchange, orderMessage, {
1601
+ routingKey: 'order.created',
1602
+ });
1603
+
1604
+ // Compose contract - exchanges, queues, bindings are auto-extracted
1484
1605
  export const contract = defineContract({
1485
- exchanges: {
1486
- orders: ordersExchange,
1487
- },
1488
- queues: {
1489
- orderProcessing: orderQueue,
1490
- },
1491
- bindings: {
1492
- orderBinding: defineQueueBinding(orderQueue, ordersExchange, {
1493
- routingKey: 'order.created',
1494
- }),
1495
- },
1496
1606
  publishers: {
1497
- orderCreated: definePublisher(ordersExchange, orderMessage, {
1498
- routingKey: 'order.created',
1499
- }),
1607
+ orderCreated: orderCreatedEvent,
1500
1608
  },
1501
1609
  consumers: {
1502
- processOrder: defineConsumer(orderQueue, orderMessage),
1610
+ processOrder: defineEventConsumer(orderCreatedEvent, orderQueue),
1503
1611
  },
1504
1612
  });
1505
1613
 
1506
1614
  // TypeScript now knows:
1615
+ // - contract.exchanges.orders, contract.exchanges['orders-dlx']
1616
+ // - contract.queues['order-processing']
1617
+ // - contract.bindings.processOrderBinding
1507
1618
  // - client.publish('orderCreated', { orderId: string, amount: number })
1508
- // - handler: async (message: { orderId: string, amount: number }) => void
1619
+ // - handler: (message: { orderId: string, amount: number }) => Future<Result<void, HandlerError>>
1509
1620
  ```
1510
1621
 
1511
1622
  ***
@@ -1516,7 +1627,7 @@ export const contract = defineContract({
1516
1627
  function defineMessage<TPayload, THeaders>(payload, options?): MessageDefinition<TPayload, THeaders>;
1517
1628
  ```
1518
1629
 
1519
- Defined in: [builder/message.ts:39](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/message.ts#L39)
1630
+ Defined in: [builder/message.ts:39](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/message.ts#L39)
1520
1631
 
1521
1632
  Define a message definition with payload and optional headers/metadata.
1522
1633
 
@@ -1573,13 +1684,13 @@ const orderMessage = defineMessage(
1573
1684
 
1574
1685
  ### defineQueue()
1575
1686
 
1687
+ #### Call Signature
1688
+
1576
1689
  ```ts
1577
- function defineQueue(name, options?):
1578
- | QueueDefinition
1579
- | QueueWithTtlBackoffInfrastructure;
1690
+ function defineQueue<TName, TDlx>(name, options): QueueDefinition<TName> | QueueWithTtlBackoffInfrastructure<TName> & object;
1580
1691
  ```
1581
1692
 
1582
- Defined in: [builder/queue.ts:244](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L244)
1693
+ Defined in: [builder/queue.ts:246](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/queue.ts#L246)
1583
1694
 
1584
1695
  Define an AMQP queue.
1585
1696
 
@@ -1590,21 +1701,108 @@ By default, queues are created as quorum queues which provide better durability
1590
1701
  high-availability. Use `type: 'classic'` for special cases like non-durable queues
1591
1702
  or priority queues.
1592
1703
 
1593
- #### Parameters
1704
+ ##### Type Parameters
1705
+
1706
+ | Type Parameter |
1707
+ | ------ |
1708
+ | `TName` *extends* `string` |
1709
+ | `TDlx` *extends* [`ExchangeDefinition`](#exchangedefinition) |
1710
+
1711
+ ##### Parameters
1594
1712
 
1595
1713
  | Parameter | Type | Description |
1596
1714
  | ------ | ------ | ------ |
1597
- | `name` | `string` | The name of the queue |
1715
+ | `name` | `TName` | The name of the queue |
1716
+ | `options` | [`DefineQueueOptions`](#definequeueoptions) & `object` | Optional queue configuration |
1717
+
1718
+ ##### Returns
1719
+
1720
+ QueueDefinition\<TName\> \| QueueWithTtlBackoffInfrastructure\<TName\> & `object`
1721
+
1722
+ A queue definition
1723
+
1724
+ ##### Example
1725
+
1726
+ ```typescript
1727
+ // Quorum queue (default, recommended for production)
1728
+ const orderQueue = defineQueue('order-processing');
1729
+
1730
+ // Explicit quorum queue with dead letter exchange
1731
+ const dlx = defineExchange('orders-dlx', 'topic', { durable: true });
1732
+ const orderQueueWithDLX = defineQueue('order-processing', {
1733
+ type: 'quorum',
1734
+ deadLetter: {
1735
+ exchange: dlx,
1736
+ routingKey: 'order.failed'
1737
+ },
1738
+ arguments: {
1739
+ 'x-message-ttl': 86400000, // 24 hours
1740
+ }
1741
+ });
1742
+
1743
+ // Classic queue (for special cases)
1744
+ const tempQueue = defineQueue('temp-queue', {
1745
+ type: 'classic',
1746
+ durable: false,
1747
+ autoDelete: true,
1748
+ });
1749
+
1750
+ // Priority queue (requires classic type)
1751
+ const taskQueue = defineQueue('urgent-tasks', {
1752
+ type: 'classic',
1753
+ durable: true,
1754
+ maxPriority: 10,
1755
+ });
1756
+
1757
+ // Queue with TTL-backoff retry (returns infrastructure automatically)
1758
+ const dlx = defineExchange('orders-dlx', 'direct', { durable: true });
1759
+ const orderQueue = defineQueue('order-processing', {
1760
+ deadLetter: { exchange: dlx },
1761
+ retry: { mode: 'ttl-backoff', maxRetries: 5 },
1762
+ });
1763
+ // orderQueue is QueueWithTtlBackoffInfrastructure, pass directly to defineContract
1764
+ ```
1765
+
1766
+ #### Call Signature
1767
+
1768
+ ```ts
1769
+ function defineQueue<TName>(name, options?):
1770
+ | QueueDefinition<TName>
1771
+ | QueueWithTtlBackoffInfrastructure<TName>;
1772
+ ```
1773
+
1774
+ Defined in: [builder/queue.ts:253](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/queue.ts#L253)
1775
+
1776
+ Define an AMQP queue.
1777
+
1778
+ A queue stores messages until they are consumed by workers. Queues can be bound to exchanges
1779
+ to receive messages based on routing rules.
1780
+
1781
+ By default, queues are created as quorum queues which provide better durability and
1782
+ high-availability. Use `type: 'classic'` for special cases like non-durable queues
1783
+ or priority queues.
1784
+
1785
+ ##### Type Parameters
1786
+
1787
+ | Type Parameter |
1788
+ | ------ |
1789
+ | `TName` *extends* `string` |
1790
+
1791
+ ##### Parameters
1792
+
1793
+ | Parameter | Type | Description |
1794
+ | ------ | ------ | ------ |
1795
+ | `name` | `TName` | The name of the queue |
1598
1796
  | `options?` | [`DefineQueueOptions`](#definequeueoptions) | Optional queue configuration |
1599
1797
 
1600
- #### Returns
1798
+ ##### Returns
1601
1799
 
1602
- \| [`QueueDefinition`](#queuedefinition)
1603
- \| [`QueueWithTtlBackoffInfrastructure`](#queuewithttlbackoffinfrastructure)
1800
+ \| [`QueueDefinition`](#queuedefinition)&lt;`TName`&gt;
1801
+ \| [`QueueWithTtlBackoffInfrastructure`](#queuewithttlbackoffinfrastructure)&lt;`TName`&gt;
1604
1802
 
1605
1803
  A queue definition
1606
1804
 
1607
- #### Example
1805
+ ##### Example
1608
1806
 
1609
1807
  ```typescript
1610
1808
  // Quorum queue (default, recommended for production)
@@ -1651,10 +1849,10 @@ const orderQueue = defineQueue('order-processing', {
1651
1849
  ### defineQuorumQueue()
1652
1850
 
1653
1851
  ```ts
1654
- function defineQuorumQueue(name, options): QuorumQueueDefinition;
1852
+ function defineQuorumQueue<TName>(name, options): QuorumQueueDefinition<TName>;
1655
1853
  ```
1656
1854
 
1657
- Defined in: [builder/queue.ts:442](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L442)
1855
+ Defined in: [builder/queue.ts:456](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/queue.ts#L456)
1658
1856
 
1659
1857
  Create a quorum queue with quorum-native retry.
1660
1858
 
@@ -1668,16 +1866,22 @@ This is a simplified helper that enforces best practices:
1668
1866
  - You don't need configurable delays between retries
1669
1867
  - You want the simplest retry configuration
1670
1868
 
1869
+ #### Type Parameters
1870
+
1871
+ | Type Parameter |
1872
+ | ------ |
1873
+ | `TName` *extends* `string` |
1874
+
1671
1875
  #### Parameters
1672
1876
 
1673
1877
  | Parameter | Type | Description |
1674
1878
  | ------ | ------ | ------ |
1675
- | `name` | `string` | The queue name |
1879
+ | `name` | `TName` | The queue name |
1676
1880
  | `options` | [`DefineQuorumQueueOptions`](#definequorumqueueoptions) | Configuration options |
1677
1881
 
1678
1882
  #### Returns
1679
1883
 
1680
- [`QuorumQueueDefinition`](#quorumqueuedefinition)
1884
+ [`QuorumQueueDefinition`](#quorumqueuedefinition)&lt;`TName`&gt;
1681
1885
 
1682
1886
  A quorum queue definition with quorum-native retry
1683
1887
 
@@ -1691,10 +1895,10 @@ const orderQueue = defineQuorumQueue('order-processing', {
1691
1895
  deliveryLimit: 3, // Retry up to 3 times
1692
1896
  });
1693
1897
 
1898
+ // Use in a contract — exchanges, queues, and bindings are auto-extracted
1694
1899
  const contract = defineContract({
1695
- exchanges: { dlx },
1696
- queues: { orderProcessing: orderQueue },
1697
- // ...
1900
+ publishers: { ... },
1901
+ consumers: { processOrder: defineEventConsumer(event, orderQueue) },
1698
1902
  });
1699
1903
  ```
1700
1904
 
@@ -1708,10 +1912,10 @@ const contract = defineContract({
1708
1912
  ### defineTtlBackoffQueue()
1709
1913
 
1710
1914
  ```ts
1711
- function defineTtlBackoffQueue(name, options): QueueWithTtlBackoffInfrastructure;
1915
+ function defineTtlBackoffQueue<TName>(name, options): QueueWithTtlBackoffInfrastructure<TName>;
1712
1916
  ```
1713
1917
 
1714
- Defined in: [builder/queue.ts:580](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L580)
1918
+ Defined in: [builder/queue.ts:594](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/queue.ts#L594)
1715
1919
 
1716
1920
  Create a queue with TTL-backoff retry (exponential backoff).
1717
1921
 
@@ -1730,16 +1934,22 @@ This is a simplified helper that enforces best practices:
1730
1934
  main queue, wait queue, and bindings. Pass this directly to `defineContract`
1731
1935
  and it will be expanded automatically.
1732
1936
 
1937
+ #### Type Parameters
1938
+
1939
+ | Type Parameter |
1940
+ | ------ |
1941
+ | `TName` *extends* `string` |
1942
+
1733
1943
  #### Parameters
1734
1944
 
1735
1945
  | Parameter | Type | Description |
1736
1946
  | ------ | ------ | ------ |
1737
- | `name` | `string` | The queue name |
1947
+ | `name` | `TName` | The queue name |
1738
1948
  | `options` | [`DefineTtlBackoffQueueOptions`](#definettlbackoffqueueoptions) | Configuration options |
1739
1949
 
1740
1950
  #### Returns
1741
1951
 
1742
- [`QueueWithTtlBackoffInfrastructure`](#queuewithttlbackoffinfrastructure)
1952
+ [`QueueWithTtlBackoffInfrastructure`](#queuewithttlbackoffinfrastructure)&lt;`TName`&gt;
1743
1953
 
1744
1954
  A queue with TTL-backoff infrastructure
1745
1955
 
@@ -1755,10 +1965,10 @@ const orderQueue = defineTtlBackoffQueue('order-processing', {
1755
1965
  maxDelayMs: 30000, // Cap at 30s
1756
1966
  });
1757
1967
 
1968
+ // Use in a contract — wait queue, bindings, and DLX are auto-extracted
1758
1969
  const contract = defineContract({
1759
- exchanges: { dlx },
1760
- queues: { orderProcessing: orderQueue }, // Wait queue auto-added
1761
- // ... bindings auto-generated
1970
+ publishers: { ... },
1971
+ consumers: { processOrder: defineEventConsumer(event, extractQueue(orderQueue)) },
1762
1972
  });
1763
1973
 
1764
1974
  // To access the underlying queue definition (e.g., for the queue name):
@@ -1780,7 +1990,7 @@ const queueName = extractQueue(orderQueue).name;
1780
1990
  function defineTtlBackoffRetryInfrastructure(queueEntry, options?): TtlBackoffRetryInfrastructure;
1781
1991
  ```
1782
1992
 
1783
- Defined in: [builder/ttl-backoff.ts:76](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/ttl-backoff.ts#L76)
1993
+ Defined in: [builder/ttl-backoff.ts:68](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/ttl-backoff.ts#L68)
1784
1994
 
1785
1995
  Create TTL-backoff retry infrastructure for a queue.
1786
1996
 
@@ -1825,23 +2035,64 @@ const orderQueue = defineQueue('order-processing', {
1825
2035
  },
1826
2036
  });
1827
2037
 
1828
- // Generate TTL-backoff infrastructure
1829
- const retryInfra = defineTtlBackoffRetryInfrastructure(orderQueue);
1830
-
1831
- // Spread into contract
2038
+ // Infrastructure is auto-extracted when using defineContract:
1832
2039
  const contract = defineContract({
1833
- exchanges: { dlx },
1834
- queues: {
1835
- orderProcessing: orderQueue,
1836
- orderProcessingWait: retryInfra.waitQueue,
1837
- },
1838
- bindings: {
1839
- ...// your other bindings
1840
- orderWaitBinding: retryInfra.waitQueueBinding,
1841
- orderRetryBinding: retryInfra.mainQueueRetryBinding,
1842
- },
1843
- // ... publishers and consumers
2040
+ publishers: { ... },
2041
+ consumers: { processOrder: defineEventConsumer(event, extractQueue(orderQueue)) },
1844
2042
  });
2043
+ // contract.queues includes the wait queue, contract.bindings includes retry bindings
2044
+
2045
+ // Or generate manually for advanced use cases:
2046
+ const retryInfra = defineTtlBackoffRetryInfrastructure(orderQueue);
2047
+ ```
2048
+
2049
+ ***
2050
+
2051
+ ### extractConsumer()
2052
+
2053
+ ```ts
2054
+ function extractConsumer(entry): ConsumerDefinition;
2055
+ ```
2056
+
2057
+ Defined in: [builder/consumer.ts:55](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/consumer.ts#L55)
2058
+
2059
+ Extract the ConsumerDefinition from any ConsumerEntry type.
2060
+
2061
+ Handles the following entry types:
2062
+ - ConsumerDefinition: returned as-is
2063
+ - EventConsumerResult: returns the nested `.consumer` property
2064
+ - CommandConsumerConfig: returns the nested `.consumer` property
2065
+
2066
+ Use this function when you need to access the underlying ConsumerDefinition
2067
+ from a consumer entry that may have been created with defineEventConsumer
2068
+ or defineCommandConsumer.
2069
+
2070
+ #### Parameters
2071
+
2072
+ | Parameter | Type | Description |
2073
+ | ------ | ------ | ------ |
2074
+ | `entry` | [`ConsumerEntry`](#consumerentry) | The consumer entry to extract from |
2075
+
2076
+ #### Returns
2077
+
2078
+ [`ConsumerDefinition`](#consumerdefinition)
2079
+
2080
+ The underlying ConsumerDefinition
2081
+
2082
+ #### Example
2083
+
2084
+ ```typescript
2085
+ // Works with plain ConsumerDefinition
2086
+ const consumer1 = defineConsumer(queue, message);
2087
+ extractConsumer(consumer1).queue.name; // "my-queue"
2088
+
2089
+ // Works with EventConsumerResult
2090
+ const consumer2 = defineEventConsumer(eventPublisher, queue);
2091
+ extractConsumer(consumer2).queue.name; // "my-queue"
2092
+
2093
+ // Works with CommandConsumerConfig
2094
+ const consumer3 = defineCommandConsumer(queue, exchange, message, { routingKey: "cmd" });
2095
+ extractConsumer(consumer3).queue.name; // "my-queue"
1845
2096
  ```
1846
2097
 
1847
2098
  ***
@@ -1849,10 +2100,10 @@ const contract = defineContract({
1849
2100
  ### extractQueue()
1850
2101
 
1851
2102
  ```ts
1852
- function extractQueue(entry): QueueDefinition;
2103
+ function extractQueue<T>(entry): ExtractQueueFromEntry<T>;
1853
2104
  ```
1854
2105
 
1855
- Defined in: [builder/queue.ts:126](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L126)
2106
+ Defined in: [builder/queue.ts:127](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/queue.ts#L127)
1856
2107
 
1857
2108
  Extract the plain QueueDefinition from a QueueEntry.
1858
2109
 
@@ -1871,15 +2122,21 @@ queue definition so you can access properties like `name`, `type`, etc.
1871
2122
  - If the entry is a `QueueWithTtlBackoffInfrastructure`, returns `entry.queue`
1872
2123
  - Otherwise, returns the entry as-is (it's already a plain QueueDefinition)
1873
2124
 
2125
+ #### Type Parameters
2126
+
2127
+ | Type Parameter |
2128
+ | ------ |
2129
+ | `T` *extends* [`QueueEntry`](#queueentry) |
2130
+
1874
2131
  #### Parameters
1875
2132
 
1876
2133
  | Parameter | Type | Description |
1877
2134
  | ------ | ------ | ------ |
1878
- | `entry` | [`QueueEntry`](#queueentry) | The queue entry (either plain QueueDefinition or QueueWithTtlBackoffInfrastructure) |
2135
+ | `entry` | `T` | The queue entry (either plain QueueDefinition or QueueWithTtlBackoffInfrastructure) |
1879
2136
 
1880
2137
  #### Returns
1881
2138
 
1882
- [`QueueDefinition`](#queuedefinition)
2139
+ `ExtractQueueFromEntry`&lt;`T`&gt;
1883
2140
 
1884
2141
  The plain QueueDefinition
1885
2142
 
@@ -1918,10 +2175,10 @@ console.log(queueDef.deadLetter); // { exchange: dlx, ... }
1918
2175
  ### isCommandConsumerConfig()
1919
2176
 
1920
2177
  ```ts
1921
- function isCommandConsumerConfig(value): value is CommandConsumerConfig<MessageDefinition, ExchangeDefinition, string | undefined>;
2178
+ function isCommandConsumerConfig(value): value is CommandConsumerConfig<MessageDefinition, ExchangeDefinition, string | undefined, QueueDefinition, ExchangeDefinition | undefined>;
1922
2179
  ```
1923
2180
 
1924
- Defined in: [builder/command.ts:279](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/command.ts#L279)
2181
+ Defined in: [builder/command.ts:316](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/command.ts#L316)
1925
2182
 
1926
2183
  Type guard to check if a value is a CommandConsumerConfig.
1927
2184
 
@@ -1933,7 +2190,7 @@ Type guard to check if a value is a CommandConsumerConfig.
1933
2190
 
1934
2191
  #### Returns
1935
2192
 
1936
- value is CommandConsumerConfig\<MessageDefinition, ExchangeDefinition, string \| undefined\>
2193
+ value is CommandConsumerConfig\<MessageDefinition, ExchangeDefinition, string \| undefined, QueueDefinition, ExchangeDefinition \| undefined\>
1937
2194
 
1938
2195
  True if the value is a CommandConsumerConfig
1939
2196
 
@@ -1942,10 +2199,10 @@ True if the value is a CommandConsumerConfig
1942
2199
  ### isEventConsumerResult()
1943
2200
 
1944
2201
  ```ts
1945
- function isEventConsumerResult(value): value is EventConsumerResult<MessageDefinition>;
2202
+ function isEventConsumerResult(value): value is EventConsumerResult<MessageDefinition, ExchangeDefinition, QueueDefinition, ExchangeDefinition | undefined>;
1946
2203
  ```
1947
2204
 
1948
- Defined in: [builder/event.ts:338](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/event.ts#L338)
2205
+ Defined in: [builder/event.ts:383](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/event.ts#L383)
1949
2206
 
1950
2207
  Type guard to check if a value is an EventConsumerResult.
1951
2208
 
@@ -1957,7 +2214,7 @@ Type guard to check if a value is an EventConsumerResult.
1957
2214
 
1958
2215
  #### Returns
1959
2216
 
1960
- `value is EventConsumerResult<MessageDefinition>`
2217
+ value is EventConsumerResult\<MessageDefinition, ExchangeDefinition, QueueDefinition, ExchangeDefinition \| undefined\>
1961
2218
 
1962
2219
  True if the value is an EventConsumerResult
1963
2220
 
@@ -1969,7 +2226,7 @@ True if the value is an EventConsumerResult
1969
2226
  function isEventPublisherConfig(value): value is EventPublisherConfig<MessageDefinition, ExchangeDefinition, string | undefined>;
1970
2227
  ```
1971
2228
 
1972
- Defined in: [builder/event.ts:321](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/event.ts#L321)
2229
+ Defined in: [builder/event.ts:366](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/event.ts#L366)
1973
2230
 
1974
2231
  Type guard to check if a value is an EventPublisherConfig.
1975
2232
 
@@ -1993,7 +2250,7 @@ True if the value is an EventPublisherConfig
1993
2250
  function isQueueWithTtlBackoffInfrastructure(entry): entry is QueueWithTtlBackoffInfrastructure;
1994
2251
  ```
1995
2252
 
1996
- Defined in: [builder/queue.ts:67](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L67)
2253
+ Defined in: [builder/queue.ts:68](https://github.com/btravers/amqp-contract/blob/a7c4b48f76ed6c3c5c7a9d457229c7ba475af3b1/packages/contract/src/builder/queue.ts#L68)
1997
2254
 
1998
2255
  Type guard to check if a queue entry is a QueueWithTtlBackoffInfrastructure.
1999
2256