@amqp-contract/contract 0.5.0 → 0.6.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/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L12)
15
+ Defined in: [types.ts:12](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L12)
16
16
 
17
17
  Any schema that conforms to Standard Schema v1.
18
18
 
@@ -32,7 +32,7 @@ https://github.com/standard-schema/standard-schema
32
32
  type BaseExchangeDefinition = object;
33
33
  ```
34
34
 
35
- Defined in: [types.ts:20](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L20)
35
+ Defined in: [types.ts:20](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L20)
36
36
 
37
37
  Base definition of an AMQP exchange.
38
38
 
@@ -43,11 +43,11 @@ type and routing rules. This type contains properties common to all exchange typ
43
43
 
44
44
  | Property | Type | Description | Defined in |
45
45
  | ------ | ------ | ------ | ------ |
46
- | <a id="arguments"></a> `arguments?` | `Record`\<`string`, `unknown`\> | Additional AMQP arguments for advanced configuration. Common arguments include alternate-exchange for handling unroutable messages. | [types.ts:49](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L49) |
47
- | <a id="autodelete"></a> `autoDelete?` | `boolean` | If true, the exchange is deleted when all queues have finished using it. **Default** `false` | [types.ts:36](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L36) |
48
- | <a id="durable"></a> `durable?` | `boolean` | If true, the exchange survives broker restarts. Durable exchanges are persisted to disk. **Default** `false` | [types.ts:30](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L30) |
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:43](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L43) |
50
- | <a id="name"></a> `name` | `string` | The name of the exchange. Must be unique within the RabbitMQ virtual host. | [types.ts:24](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L24) |
46
+ | <a id="arguments"></a> `arguments?` | `Record`\<`string`, `unknown`\> | Additional AMQP arguments for advanced configuration. Common arguments include alternate-exchange for handling unroutable messages. | [types.ts:49](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L49) |
47
+ | <a id="autodelete"></a> `autoDelete?` | `boolean` | If true, the exchange is deleted when all queues have finished using it. **Default** `false` | [types.ts:36](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L36) |
48
+ | <a id="durable"></a> `durable?` | `boolean` | If true, the exchange survives broker restarts. Durable exchanges are persisted to disk. **Default** `false` | [types.ts:30](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L30) |
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:43](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L43) |
50
+ | <a id="name"></a> `name` | `string` | The name of the exchange. Must be unique within the RabbitMQ virtual host. | [types.ts:24](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L24) |
51
51
 
52
52
  ***
53
53
 
@@ -59,7 +59,7 @@ type BindingDefinition =
59
59
  | ExchangeBindingDefinition;
60
60
  ```
61
61
 
62
- Defined in: [types.ts:298](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L298)
62
+ Defined in: [types.ts:340](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L340)
63
63
 
64
64
  Union type of all binding definitions.
65
65
 
@@ -75,7 +75,7 @@ A binding can be either:
75
75
  type BindingPattern<S> = S extends "" ? never : S;
76
76
  ```
77
77
 
78
- Defined in: [builder.ts:805](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/builder.ts#L805)
78
+ Defined in: [builder.ts:816](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/builder.ts#L816)
79
79
 
80
80
  Type-safe binding pattern that validates basic format and wildcards.
81
81
 
@@ -110,7 +110,7 @@ type Invalid = BindingPattern<"">; // never (empty string)
110
110
  type ConsumerDefinition<TMessage> = object;
111
111
  ```
112
112
 
113
- Defined in: [types.ts:354](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L354)
113
+ Defined in: [types.ts:396](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L396)
114
114
 
115
115
  Definition of a message consumer.
116
116
 
@@ -136,8 +136,8 @@ const consumer: ConsumerDefinition = {
136
136
 
137
137
  | Property | Type | Description | Defined in |
138
138
  | ------ | ------ | ------ | ------ |
139
- | <a id="message"></a> `message` | `TMessage` | The message definition including the payload schema | [types.ts:359](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L359) |
140
- | <a id="queue"></a> `queue` | [`QueueDefinition`](#queuedefinition) | The queue to consume messages from | [types.ts:356](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L356) |
139
+ | <a id="message"></a> `message` | `TMessage` | The message definition including the payload schema | [types.ts:401](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L401) |
140
+ | <a id="queue"></a> `queue` | [`QueueDefinition`](#queuedefinition) | The queue to consume messages from | [types.ts:398](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L398) |
141
141
 
142
142
  ***
143
143
 
@@ -147,7 +147,7 @@ const consumer: ConsumerDefinition = {
147
147
  type ConsumerFirstResult<TMessage, TConsumer, TBinding> = object;
148
148
  ```
149
149
 
150
- Defined in: [builder.ts:1182](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/builder.ts#L1182)
150
+ Defined in: [builder.ts:1193](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/builder.ts#L1193)
151
151
 
152
152
  Consumer-first builder result for fanout and direct exchanges.
153
153
 
@@ -166,9 +166,9 @@ a publisher that uses the same message schema and routing key.
166
166
 
167
167
  | Property | Type | Description | Defined in |
168
168
  | ------ | ------ | ------ | ------ |
169
- | <a id="binding"></a> `binding` | `TBinding` | The binding definition connecting the exchange to the queue | [builder.ts:1190](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/builder.ts#L1190) |
170
- | <a id="consumer"></a> `consumer` | `TConsumer` | The consumer definition | [builder.ts:1188](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/builder.ts#L1188) |
171
- | <a id="createpublisher"></a> `createPublisher` | () => `TBinding`\[`"exchange"`\] *extends* [`FanoutExchangeDefinition`](#fanoutexchangedefinition) ? `Extract`\<[`PublisherDefinition`](#publisherdefinition)\<`TMessage`\>, \{ `exchange`: [`FanoutExchangeDefinition`](#fanoutexchangedefinition); \}\> : `Extract`\<[`PublisherDefinition`](#publisherdefinition)\<`TMessage`\>, \{ `exchange`: \| [`DirectExchangeDefinition`](#directexchangedefinition) \| [`TopicExchangeDefinition`](#topicexchangedefinition); \}\> | Create a publisher that sends messages to this consumer. The publisher will automatically use the same message schema and routing key. | [builder.ts:1197](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/builder.ts#L1197) |
169
+ | <a id="binding"></a> `binding` | `TBinding` | The binding definition connecting the exchange to the queue | [builder.ts:1201](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/builder.ts#L1201) |
170
+ | <a id="consumer"></a> `consumer` | `TConsumer` | The consumer definition | [builder.ts:1199](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/builder.ts#L1199) |
171
+ | <a id="createpublisher"></a> `createPublisher` | () => `TBinding`\[`"exchange"`\] *extends* [`FanoutExchangeDefinition`](#fanoutexchangedefinition) ? `Extract`\<[`PublisherDefinition`](#publisherdefinition)\<`TMessage`\>, \{ `exchange`: [`FanoutExchangeDefinition`](#fanoutexchangedefinition); \}\> : `Extract`\<[`PublisherDefinition`](#publisherdefinition)\<`TMessage`\>, \{ `exchange`: \| [`DirectExchangeDefinition`](#directexchangedefinition) \| [`TopicExchangeDefinition`](#topicexchangedefinition); \}\> | Create a publisher that sends messages to this consumer. The publisher will automatically use the same message schema and routing key. | [builder.ts:1208](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/builder.ts#L1208) |
172
172
 
173
173
  ***
174
174
 
@@ -178,7 +178,7 @@ a publisher that uses the same message schema and routing key.
178
178
  type ConsumerFirstResultWithRoutingKey<TMessage, TConsumer, TBinding> = object;
179
179
  ```
180
180
 
181
- Defined in: [builder.ts:1215](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/builder.ts#L1215)
181
+ Defined in: [builder.ts:1226](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/builder.ts#L1226)
182
182
 
183
183
  Consumer-first builder result for topic exchanges.
184
184
 
@@ -197,9 +197,9 @@ a method to create a publisher with a concrete routing key that matches the patt
197
197
 
198
198
  | Property | Type | Description | Defined in |
199
199
  | ------ | ------ | ------ | ------ |
200
- | <a id="binding-1"></a> `binding` | `TBinding` | The binding definition connecting the exchange to the queue | [builder.ts:1223](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/builder.ts#L1223) |
201
- | <a id="consumer-1"></a> `consumer` | `TConsumer` | The consumer definition | [builder.ts:1221](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/builder.ts#L1221) |
202
- | <a id="createpublisher-1"></a> `createPublisher` | \<`TPublisherRoutingKey`\>(`routingKey`) => `Extract`\<[`PublisherDefinition`](#publisherdefinition)\<`TMessage`\>, \{ `exchange`: \| [`DirectExchangeDefinition`](#directexchangedefinition) \| [`TopicExchangeDefinition`](#topicexchangedefinition); \}\> | Create a publisher that sends messages to this consumer. For topic exchanges, the routing key can be specified to match the binding pattern. | [builder.ts:1231](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/builder.ts#L1231) |
200
+ | <a id="binding-1"></a> `binding` | `TBinding` | The binding definition connecting the exchange to the queue | [builder.ts:1234](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/builder.ts#L1234) |
201
+ | <a id="consumer-1"></a> `consumer` | `TConsumer` | The consumer definition | [builder.ts:1232](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/builder.ts#L1232) |
202
+ | <a id="createpublisher-1"></a> `createPublisher` | \<`TPublisherRoutingKey`\>(`routingKey`) => `Extract`\<[`PublisherDefinition`](#publisherdefinition)\<`TMessage`\>, \{ `exchange`: \| [`DirectExchangeDefinition`](#directexchangedefinition) \| [`TopicExchangeDefinition`](#topicexchangedefinition); \}\> | Create a publisher that sends messages to this consumer. For topic exchanges, the routing key can be specified to match the binding pattern. | [builder.ts:1242](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/builder.ts#L1242) |
203
203
 
204
204
  ***
205
205
 
@@ -209,7 +209,7 @@ a method to create a publisher with a concrete routing key that matches the patt
209
209
  type ContractDefinition = object;
210
210
  ```
211
211
 
212
- Defined in: [types.ts:395](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L395)
212
+ Defined in: [types.ts:437](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L437)
213
213
 
214
214
  Complete AMQP contract definition.
215
215
 
@@ -248,11 +248,34 @@ const contract: ContractDefinition = {
248
248
 
249
249
  | Property | Type | Description | Defined in |
250
250
  | ------ | ------ | ------ | ------ |
251
- | <a id="bindings"></a> `bindings?` | `Record`\<`string`, [`BindingDefinition`](#bindingdefinition)\> | Named binding definitions. Bindings can be queue-to-exchange or exchange-to-exchange. | [types.ts:412](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L412) |
252
- | <a id="consumers"></a> `consumers?` | `Record`\<`string`, [`ConsumerDefinition`](#consumerdefinition)\> | 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:426](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L426) |
253
- | <a id="exchanges"></a> `exchanges?` | `Record`\<`string`, [`ExchangeDefinition`](#exchangedefinition)\> | Named exchange definitions. Each key becomes available as a named resource in the contract. | [types.ts:400](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L400) |
254
- | <a id="publishers"></a> `publishers?` | `Record`\<`string`, [`PublisherDefinition`](#publisherdefinition)\> | 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:419](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L419) |
255
- | <a id="queues"></a> `queues?` | `Record`\<`string`, [`QueueDefinition`](#queuedefinition)\> | Named queue definitions. Each key becomes available as a named resource in the contract. | [types.ts:406](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L406) |
251
+ | <a id="bindings"></a> `bindings?` | `Record`\<`string`, [`BindingDefinition`](#bindingdefinition)\> | Named binding definitions. Bindings can be queue-to-exchange or exchange-to-exchange. | [types.ts:454](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L454) |
252
+ | <a id="consumers"></a> `consumers?` | `Record`\<`string`, [`ConsumerDefinition`](#consumerdefinition)\> | 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:468](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L468) |
253
+ | <a id="exchanges"></a> `exchanges?` | `Record`\<`string`, [`ExchangeDefinition`](#exchangedefinition)\> | Named exchange definitions. Each key becomes available as a named resource in the contract. | [types.ts:442](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L442) |
254
+ | <a id="publishers"></a> `publishers?` | `Record`\<`string`, [`PublisherDefinition`](#publisherdefinition)\> | 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:461](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L461) |
255
+ | <a id="queues"></a> `queues?` | `Record`\<`string`, [`QueueDefinition`](#queuedefinition)\> | Named queue definitions. Each key becomes available as a named resource in the contract. | [types.ts:448](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L448) |
256
+
257
+ ***
258
+
259
+ ### DeadLetterConfig
260
+
261
+ ```ts
262
+ type DeadLetterConfig = object;
263
+ ```
264
+
265
+ Defined in: [types.ts:124](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L124)
266
+
267
+ Configuration for dead letter exchange (DLX) on a queue.
268
+
269
+ When a message in a queue is rejected, expires, or exceeds the queue length limit,
270
+ it can be automatically forwarded to a dead letter exchange for further processing
271
+ or storage.
272
+
273
+ #### Properties
274
+
275
+ | Property | Type | Description | Defined in |
276
+ | ------ | ------ | ------ | ------ |
277
+ | <a id="exchange"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | The exchange to send dead-lettered messages to. This exchange must be declared in the contract. | [types.ts:129](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L129) |
278
+ | <a id="routingkey"></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:135](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L135) |
256
279
 
257
280
  ***
258
281
 
@@ -262,7 +285,7 @@ const contract: ContractDefinition = {
262
285
  type DirectExchangeDefinition = BaseExchangeDefinition & object;
263
286
  ```
264
287
 
265
- Defined in: [types.ts:82](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L82)
288
+ Defined in: [types.ts:82](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L82)
266
289
 
267
290
  A direct exchange definition.
268
291
 
@@ -273,7 +296,7 @@ This is ideal for point-to-point messaging where each message should go to speci
273
296
 
274
297
  | Name | Type | Defined in |
275
298
  | ------ | ------ | ------ |
276
- | `type` | `"direct"` | [types.ts:83](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L83) |
299
+ | `type` | `"direct"` | [types.ts:83](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L83) |
277
300
 
278
301
  #### Example
279
302
 
@@ -300,7 +323,7 @@ type ExchangeBindingDefinition = object &
300
323
  };
301
324
  ```
302
325
 
303
- Defined in: [types.ts:262](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L262)
326
+ Defined in: [types.ts:304](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L304)
304
327
 
305
328
  Binding between two exchanges (exchange-to-exchange routing).
306
329
 
@@ -311,9 +334,9 @@ This allows for more complex routing topologies.
311
334
 
312
335
  | Name | Type | Description | Defined in |
313
336
  | ------ | ------ | ------ | ------ |
314
- | `arguments?` | `Record`\<`string`, `unknown`\> | Additional AMQP arguments for the binding. | [types.ts:272](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L272) |
315
- | `destination` | [`ExchangeDefinition`](#exchangedefinition) | The destination exchange that will receive forwarded messages | [types.ts:267](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L267) |
316
- | `type` | `"exchange"` | Discriminator indicating this is an exchange-to-exchange binding | [types.ts:264](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L264) |
337
+ | `arguments?` | `Record`\<`string`, `unknown`\> | Additional AMQP arguments for the binding. | [types.ts:314](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L314) |
338
+ | `destination` | [`ExchangeDefinition`](#exchangedefinition) | The destination exchange that will receive forwarded messages | [types.ts:309](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L309) |
339
+ | `type` | `"exchange"` | Discriminator indicating this is an exchange-to-exchange binding | [types.ts:306](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L306) |
317
340
 
318
341
  #### Example
319
342
 
@@ -338,7 +361,7 @@ type ExchangeDefinition =
338
361
  | TopicExchangeDefinition;
339
362
  ```
340
363
 
341
- Defined in: [types.ts:112](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L112)
364
+ Defined in: [types.ts:112](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L112)
342
365
 
343
366
  Union type of all exchange definitions.
344
367
 
@@ -352,7 +375,7 @@ Represents any type of AMQP exchange: fanout, direct, or topic.
352
375
  type FanoutExchangeDefinition = BaseExchangeDefinition & object;
353
376
  ```
354
377
 
355
- Defined in: [types.ts:65](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L65)
378
+ Defined in: [types.ts:65](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L65)
356
379
 
357
380
  A fanout exchange definition.
358
381
 
@@ -363,7 +386,7 @@ This is the simplest exchange type for pub/sub messaging patterns.
363
386
 
364
387
  | Name | Type | Defined in |
365
388
  | ------ | ------ | ------ |
366
- | `type` | `"fanout"` | [types.ts:66](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L66) |
389
+ | `type` | `"fanout"` | [types.ts:66](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L66) |
367
390
 
368
391
  #### Example
369
392
 
@@ -381,7 +404,7 @@ const logsExchange: FanoutExchangeDefinition = defineExchange('logs', 'fanout',
381
404
  type InferConsumerNames<TContract> = TContract["consumers"] extends Record<string, unknown> ? keyof TContract["consumers"] : never;
382
405
  ```
383
406
 
384
- Defined in: [types.ts:462](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L462)
407
+ Defined in: [types.ts:504](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L504)
385
408
 
386
409
  Extract consumer names from a contract.
387
410
 
@@ -413,7 +436,7 @@ type ConsumerNames = InferConsumerNames<typeof myContract>;
413
436
  type InferPublisherNames<TContract> = TContract["publishers"] extends Record<string, unknown> ? keyof TContract["publishers"] : never;
414
437
  ```
415
438
 
416
- Defined in: [types.ts:444](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L444)
439
+ Defined in: [types.ts:486](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L486)
417
440
 
418
441
  Extract publisher names from a contract.
419
442
 
@@ -445,7 +468,7 @@ type PublisherNames = InferPublisherNames<typeof myContract>;
445
468
  type MatchingRoutingKey<Pattern, Key> = RoutingKey<Key> extends never ? never : BindingPattern<Pattern> extends never ? never : MatchesPattern<Key, Pattern> extends true ? Key : never;
446
469
  ```
447
470
 
448
- Defined in: [builder.ts:867](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/builder.ts#L867)
471
+ Defined in: [builder.ts:878](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/builder.ts#L878)
449
472
 
450
473
  Validate that a routing key matches a binding pattern.
451
474
 
@@ -477,7 +500,7 @@ type InvalidKey = MatchingRoutingKey<"order.*", "user.created">; // never
477
500
  type MessageDefinition<TPayload, THeaders> = object;
478
501
  ```
479
502
 
480
- Defined in: [types.ts:178](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L178)
503
+ Defined in: [types.ts:220](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L220)
481
504
 
482
505
  Definition of a message with typed payload and optional headers.
483
506
 
@@ -492,10 +515,10 @@ Definition of a message with typed payload and optional headers.
492
515
 
493
516
  | Property | Type | Description | Defined in |
494
517
  | ------ | ------ | ------ | ------ |
495
- | <a id="description"></a> `description?` | `string` | Detailed description of the message for documentation purposes. Used in AsyncAPI specification generation. | [types.ts:204](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L204) |
496
- | <a id="headers"></a> `headers?` | `THeaders` | Optional headers schema for validating message metadata. Must be a Standard Schema v1 compatible schema. | [types.ts:192](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L192) |
497
- | <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:186](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L186) |
498
- | <a id="summary"></a> `summary?` | `string` | Brief description of the message for documentation purposes. Used in AsyncAPI specification generation. | [types.ts:198](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L198) |
518
+ | <a id="description"></a> `description?` | `string` | Detailed description of the message for documentation purposes. Used in AsyncAPI specification generation. | [types.ts:246](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L246) |
519
+ | <a id="headers"></a> `headers?` | `THeaders` | Optional headers schema for validating message metadata. Must be a Standard Schema v1 compatible schema. | [types.ts:234](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L234) |
520
+ | <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:228](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L228) |
521
+ | <a id="summary"></a> `summary?` | `string` | Brief description of the message for documentation purposes. Used in AsyncAPI specification generation. | [types.ts:240](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L240) |
499
522
 
500
523
  ***
501
524
 
@@ -514,7 +537,7 @@ type PublisherDefinition<TMessage> = object &
514
537
  };
515
538
  ```
516
539
 
517
- Defined in: [types.ts:317](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L317)
540
+ Defined in: [types.ts:359](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L359)
518
541
 
519
542
  Definition of a message publisher.
520
543
 
@@ -525,7 +548,7 @@ The message payload is validated against the schema before being sent to RabbitM
525
548
 
526
549
  | Name | Type | Description | Defined in |
527
550
  | ------ | ------ | ------ | ------ |
528
- | `message` | `TMessage` | The message definition including the payload schema | [types.ts:319](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L319) |
551
+ | `message` | `TMessage` | The message definition including the payload schema | [types.ts:361](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L361) |
529
552
 
530
553
  #### Type Parameters
531
554
 
@@ -551,7 +574,7 @@ const publisher: PublisherDefinition = {
551
574
  type PublisherFirstResult<TMessage, TPublisher> = object;
552
575
  ```
553
576
 
554
- Defined in: [builder.ts:734](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/builder.ts#L734)
577
+ Defined in: [builder.ts:745](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/builder.ts#L745)
555
578
 
556
579
  Publisher-first builder result for fanout and direct exchanges.
557
580
 
@@ -572,8 +595,8 @@ emit events without knowing which queues will consume them.
572
595
 
573
596
  | Property | Type | Description | Defined in |
574
597
  | ------ | ------ | ------ | ------ |
575
- | <a id="createconsumer"></a> `createConsumer` | (`queue`) => `object` | Create a consumer that receives messages from this publisher. The consumer will automatically use the same message schema and a binding will be created with the same routing key. | [builder.ts:748](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/builder.ts#L748) |
576
- | <a id="publisher"></a> `publisher` | `TPublisher` | The publisher definition | [builder.ts:739](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/builder.ts#L739) |
598
+ | <a id="createconsumer"></a> `createConsumer` | (`queue`) => `object` | Create a consumer that receives messages from this publisher. The consumer will automatically use the same message schema and a binding will be created with the same routing key. | [builder.ts:759](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/builder.ts#L759) |
599
+ | <a id="publisher"></a> `publisher` | `TPublisher` | The publisher definition | [builder.ts:750](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/builder.ts#L750) |
577
600
 
578
601
  ***
579
602
 
@@ -583,7 +606,7 @@ emit events without knowing which queues will consume them.
583
606
  type PublisherFirstResultWithRoutingKey<TMessage, TPublisher, TRoutingKey> = object;
584
607
  ```
585
608
 
586
- Defined in: [builder.ts:886](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/builder.ts#L886)
609
+ Defined in: [builder.ts:897](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/builder.ts#L897)
587
610
 
588
611
  Publisher-first builder result for topic exchanges.
589
612
 
@@ -602,8 +625,8 @@ to create consumers that can use routing key patterns matching the publisher's k
602
625
 
603
626
  | Property | Type | Description | Defined in |
604
627
  | ------ | ------ | ------ | ------ |
605
- | <a id="createconsumer-1"></a> `createConsumer` | \<`TConsumerRoutingKey`\>(`queue`, `routingKey?`) => `object` | Create a consumer that receives messages from this publisher. For topic exchanges, the routing key pattern can be specified for the binding. | [builder.ts:901](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/builder.ts#L901) |
606
- | <a id="publisher-1"></a> `publisher` | `TPublisher` | The publisher definition | [builder.ts:892](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/builder.ts#L892) |
628
+ | <a id="createconsumer-1"></a> `createConsumer` | \<`TConsumerRoutingKey`\>(`queue`, `routingKey?`) => `object` | Create a consumer that receives messages from this publisher. For topic exchanges, the routing key pattern can be specified for the binding. | [builder.ts:912](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/builder.ts#L912) |
629
+ | <a id="publisher-1"></a> `publisher` | `TPublisher` | The publisher definition | [builder.ts:903](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/builder.ts#L903) |
607
630
 
608
631
  ***
609
632
 
@@ -622,7 +645,7 @@ type QueueBindingDefinition = object &
622
645
  };
623
646
  ```
624
647
 
625
- Defined in: [types.ts:214](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L214)
648
+ Defined in: [types.ts:256](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L256)
626
649
 
627
650
  Binding between a queue and an exchange.
628
651
 
@@ -634,9 +657,9 @@ For fanout exchanges, no routing key is needed as all messages are broadcast.
634
657
 
635
658
  | Name | Type | Description | Defined in |
636
659
  | ------ | ------ | ------ | ------ |
637
- | `arguments?` | `Record`\<`string`, `unknown`\> | Additional AMQP arguments for the binding. Can be used for advanced routing scenarios with the headers exchange type. | [types.ts:225](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L225) |
638
- | `queue` | [`QueueDefinition`](#queuedefinition) | The queue that will receive messages | [types.ts:219](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L219) |
639
- | `type` | `"queue"` | Discriminator indicating this is a queue-to-exchange binding | [types.ts:216](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L216) |
660
+ | `arguments?` | `Record`\<`string`, `unknown`\> | Additional AMQP arguments for the binding. Can be used for advanced routing scenarios with the headers exchange type. | [types.ts:267](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L267) |
661
+ | `queue` | [`QueueDefinition`](#queuedefinition) | The queue that will receive messages | [types.ts:261](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L261) |
662
+ | `type` | `"queue"` | Discriminator indicating this is a queue-to-exchange binding | [types.ts:258](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L258) |
640
663
 
641
664
  ***
642
665
 
@@ -646,7 +669,7 @@ For fanout exchanges, no routing key is needed as all messages are broadcast.
646
669
  type QueueDefinition = object;
647
670
  ```
648
671
 
649
- Defined in: [types.ts:123](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L123)
672
+ Defined in: [types.ts:144](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L144)
650
673
 
651
674
  Definition of an AMQP queue.
652
675
 
@@ -657,11 +680,12 @@ to receive messages based on routing rules.
657
680
 
658
681
  | Property | Type | Description | Defined in |
659
682
  | ------ | ------ | ------ | ------ |
660
- | <a id="arguments-1"></a> `arguments?` | `Record`\<`string`, `unknown`\> | Additional AMQP arguments for advanced configuration. Common arguments include: - `x-message-ttl`: Message time-to-live in milliseconds - `x-expires`: Queue expiration time in milliseconds - `x-max-length`: Maximum number of messages in the queue - `x-max-length-bytes`: Maximum size of the queue in bytes - `x-dead-letter-exchange`: Exchange for dead-lettered messages - `x-dead-letter-routing-key`: Routing key for dead-lettered messages - `x-max-priority`: Maximum priority level for priority queues **Example** `{ 'x-message-ttl': 86400000, // 24 hours 'x-dead-letter-exchange': 'dlx', 'x-max-priority': 10 }` | [types.ts:169](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L169) |
661
- | <a id="autodelete-1"></a> `autoDelete?` | `boolean` | If true, the queue is deleted when the last consumer unsubscribes. **Default** `false` | [types.ts:146](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L146) |
662
- | <a id="durable-1"></a> `durable?` | `boolean` | If true, the queue survives broker restarts. Durable queues are persisted to disk. **Default** `false` | [types.ts:133](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L133) |
663
- | <a id="exclusive"></a> `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:140](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L140) |
664
- | <a id="name-1"></a> `name` | `string` | The name of the queue. Must be unique within the RabbitMQ virtual host. | [types.ts:127](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L127) |
683
+ | <a id="arguments-1"></a> `arguments?` | `Record`\<`string`, `unknown`\> | Additional AMQP arguments for advanced configuration. Common arguments include: - `x-message-ttl`: Message time-to-live in milliseconds - `x-expires`: Queue expiration time in milliseconds - `x-max-length`: Maximum number of messages in the queue - `x-max-length-bytes`: Maximum size of the queue in bytes - `x-max-priority`: Maximum priority level for priority queues Note: When using the `deadLetter` property, the `x-dead-letter-exchange` and `x-dead-letter-routing-key` arguments are automatically set and should not be specified in this arguments object. **Example** `{ 'x-message-ttl': 86400000, // 24 hours 'x-max-priority': 10 }` | [types.ts:211](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L211) |
684
+ | <a id="autodelete-1"></a> `autoDelete?` | `boolean` | If true, the queue is deleted when the last consumer unsubscribes. **Default** `false` | [types.ts:167](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L167) |
685
+ | <a id="deadletter"></a> `deadLetter?` | [`DeadLetterConfig`](#deadletterconfig) | Dead letter configuration for handling failed or rejected messages. When configured, messages that are rejected, expire, or exceed queue limits will be automatically forwarded to the specified dead letter exchange. **Example** `const dlx = defineExchange('orders-dlx', 'topic', { durable: true }); const queue = defineQueue('order-processing', { durable: true, deadLetter: { exchange: dlx, routingKey: 'order.failed' } });` | [types.ts:187](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L187) |
686
+ | <a id="durable-1"></a> `durable?` | `boolean` | If true, the queue survives broker restarts. Durable queues are persisted to disk. **Default** `false` | [types.ts:154](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L154) |
687
+ | <a id="exclusive"></a> `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:161](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L161) |
688
+ | <a id="name-1"></a> `name` | `string` | The name of the queue. Must be unique within the RabbitMQ virtual host. | [types.ts:148](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L148) |
665
689
 
666
690
  ***
667
691
 
@@ -671,7 +695,7 @@ to receive messages based on routing rules.
671
695
  type RoutingKey<S> = S extends "" ? never : S extends `${string}*${string}` | `${string}#${string}` ? never : S;
672
696
  ```
673
697
 
674
- Defined in: [builder.ts:778](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/builder.ts#L778)
698
+ Defined in: [builder.ts:789](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/builder.ts#L789)
675
699
 
676
700
  Type-safe routing key that validates basic format.
677
701
 
@@ -705,7 +729,7 @@ type Invalid2 = RoutingKey<"">; // never (empty string)
705
729
  type TopicExchangeDefinition = BaseExchangeDefinition & object;
706
730
  ```
707
731
 
708
- Defined in: [types.ts:103](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L103)
732
+ Defined in: [types.ts:103](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L103)
709
733
 
710
734
  A topic exchange definition.
711
735
 
@@ -719,7 +743,7 @@ Words are separated by dots (e.g., `order.created.high-value`).
719
743
 
720
744
  | Name | Type | Defined in |
721
745
  | ------ | ------ | ------ |
722
- | `type` | `"topic"` | [types.ts:104](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/types.ts#L104) |
746
+ | `type` | `"topic"` | [types.ts:104](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/types.ts#L104) |
723
747
 
724
748
  #### Example
725
749
 
@@ -741,7 +765,7 @@ function defineConsumer<TMessage>(
741
765
  options?): ConsumerDefinition<TMessage>;
742
766
  ```
743
767
 
744
- Defined in: [builder.ts:595](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/builder.ts#L595)
768
+ Defined in: [builder.ts:606](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/builder.ts#L606)
745
769
 
746
770
  Define a message consumer.
747
771
 
@@ -808,7 +832,7 @@ const processOrderConsumer = defineConsumer(orderQueue, orderMessage);
808
832
  function defineContract<TContract>(definition): TContract;
809
833
  ```
810
834
 
811
- Defined in: [builder.ts:676](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/builder.ts#L676)
835
+ Defined in: [builder.ts:687](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/builder.ts#L687)
812
836
 
813
837
  Define an AMQP contract.
814
838
 
@@ -897,7 +921,7 @@ export const contract = defineContract({
897
921
  function defineMessage<TPayload, THeaders>(payload, options?): MessageDefinition<TPayload, THeaders>;
898
922
  ```
899
923
 
900
- Defined in: [builder.ts:197](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/builder.ts#L197)
924
+ Defined in: [builder.ts:208](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/builder.ts#L208)
901
925
 
902
926
  Define a message definition with payload and optional headers/metadata.
903
927
 
@@ -958,7 +982,7 @@ const orderMessage = defineMessage(
958
982
  function defineQueue(name, options?): QueueDefinition;
959
983
  ```
960
984
 
961
- Defined in: [builder.ts:152](https://github.com/btravers/amqp-contract/blob/2337be9d96ffc5b2bb77c6d63ca6e010efd8c2bc/packages/contract/src/builder.ts#L152)
985
+ Defined in: [builder.ts:163](https://github.com/btravers/amqp-contract/blob/8711ad20abb1d4e537ec473d43e85fac3ebd4d0b/packages/contract/src/builder.ts#L163)
962
986
 
963
987
  Define an AMQP queue.
964
988
 
@@ -981,11 +1005,21 @@ A queue definition
981
1005
  #### Example
982
1006
 
983
1007
  ```typescript
984
- const orderProcessingQueue = defineQueue('order-processing', {
1008
+ // Basic queue
1009
+ const orderQueue = defineQueue('order-processing', {
985
1010
  durable: true,
1011
+ });
1012
+
1013
+ // Queue with dead letter exchange
1014
+ const dlx = defineExchange('orders-dlx', 'topic', { durable: true });
1015
+ const orderQueueWithDLX = defineQueue('order-processing', {
1016
+ durable: true,
1017
+ deadLetter: {
1018
+ exchange: dlx,
1019
+ routingKey: 'order.failed'
1020
+ },
986
1021
  arguments: {
987
1022
  'x-message-ttl': 86400000, // 24 hours
988
- 'x-dead-letter-exchange': 'orders-dlx'
989
1023
  }
990
1024
  });
991
1025
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amqp-contract/contract",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Contract builder for amqp-contract",
5
5
  "keywords": [
6
6
  "amqp",