@amqp-contract/contract 2.3.0 → 2.4.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/README.md +1 -1
- package/dist/index.cjs +144 -11
- package/dist/index.d.cts +66 -13
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +66 -13
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +143 -12
- package/dist/index.mjs.map +1 -1
- package/docs/index.md +292 -204
- package/package.json +5 -2
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/btravstack/amqp-contract/blob/
|
|
15
|
+
Defined in: [types.ts:12](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/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<TName> = object;
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
Defined in: [types.ts:394](https://github.com/btravstack/amqp-contract/blob/
|
|
35
|
+
Defined in: [types.ts:394](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L394)
|
|
36
36
|
|
|
37
37
|
Base definition of an AMQP exchange.
|
|
38
38
|
|
|
@@ -49,11 +49,11 @@ type and routing rules. This type contains properties common to all exchange typ
|
|
|
49
49
|
|
|
50
50
|
| Property | Type | Description | Defined in |
|
|
51
51
|
| ------ | ------ | ------ | ------ |
|
|
52
|
-
| <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:421](https://github.com/btravstack/amqp-contract/blob/
|
|
53
|
-
| <a id="autodelete"></a> `autoDelete?` | `boolean` | If true, the exchange is deleted when all queues have finished using it. | [types.ts:409](https://github.com/btravstack/amqp-contract/blob/
|
|
54
|
-
| <a id="durable"></a> `durable?` | `boolean` | If true, the exchange survives broker restarts. Durable exchanges are persisted to disk. **Default** `true` | [types.ts:404](https://github.com/btravstack/amqp-contract/blob/
|
|
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. | [types.ts:415](https://github.com/btravstack/amqp-contract/blob/
|
|
56
|
-
| <a id="name"></a> `name` | `TName` | The name of the exchange. Must be unique within the RabbitMQ virtual host. | [types.ts:398](https://github.com/btravstack/amqp-contract/blob/
|
|
52
|
+
| <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:421](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L421) |
|
|
53
|
+
| <a id="autodelete"></a> `autoDelete?` | `boolean` | If true, the exchange is deleted when all queues have finished using it. | [types.ts:409](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L409) |
|
|
54
|
+
| <a id="durable"></a> `durable?` | `boolean` | If true, the exchange survives broker restarts. Durable exchanges are persisted to disk. **Default** `true` | [types.ts:404](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L404) |
|
|
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. | [types.ts:415](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L415) |
|
|
56
|
+
| <a id="name"></a> `name` | `TName` | The name of the exchange. Must be unique within the RabbitMQ virtual host. | [types.ts:398](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L398) |
|
|
57
57
|
|
|
58
58
|
***
|
|
59
59
|
|
|
@@ -65,7 +65,7 @@ type BindingDefinition =
|
|
|
65
65
|
| ExchangeBindingDefinition;
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
Defined in: [types.ts:891](https://github.com/btravstack/amqp-contract/blob/
|
|
68
|
+
Defined in: [types.ts:891](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L891)
|
|
69
69
|
|
|
70
70
|
Union type of all binding definitions.
|
|
71
71
|
|
|
@@ -81,7 +81,7 @@ A binding can be either:
|
|
|
81
81
|
type BindingPattern<S> = S extends "" ? never : S;
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
Defined in: [builder/routing-types.ts:52](https://github.com/btravstack/amqp-contract/blob/
|
|
84
|
+
Defined in: [builder/routing-types.ts:52](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/routing-types.ts#L52)
|
|
85
85
|
|
|
86
86
|
Type-safe binding pattern that validates basic format and wildcards.
|
|
87
87
|
|
|
@@ -116,7 +116,7 @@ type Invalid = BindingPattern<"">; // never (empty string)
|
|
|
116
116
|
type BridgedPublisherConfig<TMessage, TBridgeExchange, TTargetExchange> = object;
|
|
117
117
|
```
|
|
118
118
|
|
|
119
|
-
Defined in: [builder/command.ts:61](https://github.com/btravstack/amqp-contract/blob/
|
|
119
|
+
Defined in: [builder/command.ts:61](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/command.ts#L61)
|
|
120
120
|
|
|
121
121
|
Configuration for a bridged command publisher.
|
|
122
122
|
|
|
@@ -135,11 +135,11 @@ messages to the target exchange (remote domain) via an exchange-to-exchange bind
|
|
|
135
135
|
|
|
136
136
|
| Property | Type | Description | Defined in |
|
|
137
137
|
| ------ | ------ | ------ | ------ |
|
|
138
|
-
| <a id="__brand"></a> `__brand` | `"BridgedPublisherConfig"` | Discriminator to identify this as a bridged publisher config | [builder/command.ts:67](https://github.com/btravstack/amqp-contract/blob/
|
|
139
|
-
| <a id="bridgeexchange"></a> `bridgeExchange` | `TBridgeExchange` | The bridge (local domain) exchange | [builder/command.ts:73](https://github.com/btravstack/amqp-contract/blob/
|
|
140
|
-
| <a id="exchangebinding"></a> `exchangeBinding` | [`ExchangeBindingDefinition`](#exchangebindingdefinition) | The exchange-to-exchange binding (bridge → target) | [builder/command.ts:71](https://github.com/btravstack/amqp-contract/blob/
|
|
141
|
-
| <a id="publisher"></a> `publisher` | [`PublisherDefinition`](#publisherdefinition)<`TMessage`> | The publisher definition (publishes to bridge exchange) | [builder/command.ts:69](https://github.com/btravstack/amqp-contract/blob/
|
|
142
|
-
| <a id="targetexchange"></a> `targetExchange` | `TTargetExchange` | The target (remote domain) exchange | [builder/command.ts:75](https://github.com/btravstack/amqp-contract/blob/
|
|
138
|
+
| <a id="__brand"></a> `__brand` | `"BridgedPublisherConfig"` | Discriminator to identify this as a bridged publisher config | [builder/command.ts:67](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/command.ts#L67) |
|
|
139
|
+
| <a id="bridgeexchange"></a> `bridgeExchange` | `TBridgeExchange` | The bridge (local domain) exchange | [builder/command.ts:73](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/command.ts#L73) |
|
|
140
|
+
| <a id="exchangebinding"></a> `exchangeBinding` | [`ExchangeBindingDefinition`](#exchangebindingdefinition) | The exchange-to-exchange binding (bridge → target) | [builder/command.ts:71](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/command.ts#L71) |
|
|
141
|
+
| <a id="publisher"></a> `publisher` | [`PublisherDefinition`](#publisherdefinition)<`TMessage`> | The publisher definition (publishes to bridge exchange) | [builder/command.ts:69](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/command.ts#L69) |
|
|
142
|
+
| <a id="targetexchange"></a> `targetExchange` | `TTargetExchange` | The target (remote domain) exchange | [builder/command.ts:75](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/command.ts#L75) |
|
|
143
143
|
|
|
144
144
|
***
|
|
145
145
|
|
|
@@ -149,7 +149,7 @@ messages to the target exchange (remote domain) via an exchange-to-exchange bind
|
|
|
149
149
|
type BridgedPublisherConfigBase = object;
|
|
150
150
|
```
|
|
151
151
|
|
|
152
|
-
Defined in: [types.ts:1024](https://github.com/btravstack/amqp-contract/blob/
|
|
152
|
+
Defined in: [types.ts:1024](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1024)
|
|
153
153
|
|
|
154
154
|
Base type for bridged publisher configuration.
|
|
155
155
|
|
|
@@ -164,11 +164,11 @@ defineCommandPublisher with bridgeExchange option
|
|
|
164
164
|
|
|
165
165
|
| Property | Type | Defined in |
|
|
166
166
|
| ------ | ------ | ------ |
|
|
167
|
-
| <a id="__brand-1"></a> `__brand` | `"BridgedPublisherConfig"` | [types.ts:1025](https://github.com/btravstack/amqp-contract/blob/
|
|
168
|
-
| <a id="bridgeexchange-1"></a> `bridgeExchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:1028](https://github.com/btravstack/amqp-contract/blob/
|
|
169
|
-
| <a id="exchangebinding-1"></a> `exchangeBinding` | [`ExchangeBindingDefinition`](#exchangebindingdefinition) | [types.ts:1027](https://github.com/btravstack/amqp-contract/blob/
|
|
170
|
-
| <a id="publisher-1"></a> `publisher` | [`PublisherDefinition`](#publisherdefinition) | [types.ts:1026](https://github.com/btravstack/amqp-contract/blob/
|
|
171
|
-
| <a id="targetexchange-1"></a> `targetExchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:1029](https://github.com/btravstack/amqp-contract/blob/
|
|
167
|
+
| <a id="__brand-1"></a> `__brand` | `"BridgedPublisherConfig"` | [types.ts:1025](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1025) |
|
|
168
|
+
| <a id="bridgeexchange-1"></a> `bridgeExchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:1028](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1028) |
|
|
169
|
+
| <a id="exchangebinding-1"></a> `exchangeBinding` | [`ExchangeBindingDefinition`](#exchangebindingdefinition) | [types.ts:1027](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1027) |
|
|
170
|
+
| <a id="publisher-1"></a> `publisher` | [`PublisherDefinition`](#publisherdefinition) | [types.ts:1026](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1026) |
|
|
171
|
+
| <a id="targetexchange-1"></a> `targetExchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:1029](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1029) |
|
|
172
172
|
|
|
173
173
|
***
|
|
174
174
|
|
|
@@ -178,7 +178,7 @@ defineCommandPublisher with bridgeExchange option
|
|
|
178
178
|
type ClassicQueueDefinition<TName> = BaseQueueDefinition<TName> & object;
|
|
179
179
|
```
|
|
180
180
|
|
|
181
|
-
Defined in: [types.ts:608](https://github.com/btravstack/amqp-contract/blob/
|
|
181
|
+
Defined in: [types.ts:608](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L608)
|
|
182
182
|
|
|
183
183
|
Definition of a classic queue.
|
|
184
184
|
|
|
@@ -189,11 +189,11 @@ specific features not supported by quorum queues (e.g., exclusive queues, auto-d
|
|
|
189
189
|
|
|
190
190
|
| Name | Type | Description | Defined in |
|
|
191
191
|
| ------ | ------ | ------ | ------ |
|
|
192
|
-
| `autoDelete?` | `boolean` | If true, the queue is deleted when the last consumer unsubscribes. | [types.ts:628](https://github.com/btravstack/amqp-contract/blob/
|
|
193
|
-
| `durable` | `boolean` | If true, the queue survives broker restarts. Durable queues are persisted to disk. | [types.ts:617](https://github.com/btravstack/amqp-contract/blob/
|
|
194
|
-
| `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. | [types.ts:623](https://github.com/btravstack/amqp-contract/blob/
|
|
195
|
-
| `maxPriority?` | `number` | Maximum priority level for priority queue (1-255, recommended: 1-10). Sets x-max-priority argument. | [types.ts:634](https://github.com/btravstack/amqp-contract/blob/
|
|
196
|
-
| `type` | `"classic"` | Queue type discriminator: classic queue. | [types.ts:612](https://github.com/btravstack/amqp-contract/blob/
|
|
192
|
+
| `autoDelete?` | `boolean` | If true, the queue is deleted when the last consumer unsubscribes. | [types.ts:628](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L628) |
|
|
193
|
+
| `durable` | `boolean` | If true, the queue survives broker restarts. Durable queues are persisted to disk. | [types.ts:617](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L617) |
|
|
194
|
+
| `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. | [types.ts:623](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L623) |
|
|
195
|
+
| `maxPriority?` | `number` | Maximum priority level for priority queue (1-255, recommended: 1-10). Sets x-max-priority argument. | [types.ts:634](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L634) |
|
|
196
|
+
| `type` | `"classic"` | Queue type discriminator: classic queue. | [types.ts:612](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L612) |
|
|
197
197
|
|
|
198
198
|
#### Type Parameters
|
|
199
199
|
|
|
@@ -209,7 +209,7 @@ specific features not supported by quorum queues (e.g., exclusive queues, auto-d
|
|
|
209
209
|
type ClassicQueueOptions = BaseQueueOptions & object;
|
|
210
210
|
```
|
|
211
211
|
|
|
212
|
-
Defined in: [types.ts:342](https://github.com/btravstack/amqp-contract/blob/
|
|
212
|
+
Defined in: [types.ts:342](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L342)
|
|
213
213
|
|
|
214
214
|
Options for creating a classic queue.
|
|
215
215
|
|
|
@@ -223,11 +223,11 @@ Classic queues support all traditional RabbitMQ features including:
|
|
|
223
223
|
|
|
224
224
|
| Name | Type | Description | Defined in |
|
|
225
225
|
| ------ | ------ | ------ | ------ |
|
|
226
|
-
| `autoDelete?` | `boolean` | If true, the queue is deleted when the last consumer unsubscribes. | [types.ts:363](https://github.com/btravstack/amqp-contract/blob/
|
|
227
|
-
| `durable?` | `boolean` | If true, the queue survives broker restarts. Durable queues are persisted to disk. **Default** `true` | [types.ts:352](https://github.com/btravstack/amqp-contract/blob/
|
|
228
|
-
| `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. | [types.ts:358](https://github.com/btravstack/amqp-contract/blob/
|
|
229
|
-
| `maxPriority?` | `number` | Maximum priority level for priority queue (1-255, recommended: 1-10). Sets x-max-priority argument. | [types.ts:369](https://github.com/btravstack/amqp-contract/blob/
|
|
230
|
-
| `type` | `"classic"` | Queue type: classic (for special cases) | [types.ts:346](https://github.com/btravstack/amqp-contract/blob/
|
|
226
|
+
| `autoDelete?` | `boolean` | If true, the queue is deleted when the last consumer unsubscribes. | [types.ts:363](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L363) |
|
|
227
|
+
| `durable?` | `boolean` | If true, the queue survives broker restarts. Durable queues are persisted to disk. **Default** `true` | [types.ts:352](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L352) |
|
|
228
|
+
| `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. | [types.ts:358](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L358) |
|
|
229
|
+
| `maxPriority?` | `number` | Maximum priority level for priority queue (1-255, recommended: 1-10). Sets x-max-priority argument. | [types.ts:369](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L369) |
|
|
230
|
+
| `type` | `"classic"` | Queue type: classic (for special cases) | [types.ts:346](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L346) |
|
|
231
231
|
|
|
232
232
|
#### Example
|
|
233
233
|
|
|
@@ -246,7 +246,7 @@ const priorityQueue = defineQueue('tasks', {
|
|
|
246
246
|
type CommandConsumerConfig<TMessage, TExchange, TRoutingKey, TQueue> = object;
|
|
247
247
|
```
|
|
248
248
|
|
|
249
|
-
Defined in: [builder/command.ts:29](https://github.com/btravstack/amqp-contract/blob/
|
|
249
|
+
Defined in: [builder/command.ts:29](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/command.ts#L29)
|
|
250
250
|
|
|
251
251
|
Configuration for a command consumer.
|
|
252
252
|
|
|
@@ -266,13 +266,13 @@ The consumer "owns" the queue, and publishers send commands to it.
|
|
|
266
266
|
|
|
267
267
|
| Property | Type | Description | Defined in |
|
|
268
268
|
| ------ | ------ | ------ | ------ |
|
|
269
|
-
| <a id="__brand-2"></a> `__brand` | `"CommandConsumerConfig"` | Discriminator to identify this as a command consumer config | [builder/command.ts:36](https://github.com/btravstack/amqp-contract/blob/
|
|
270
|
-
| <a id="binding"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | The binding connecting the queue to the exchange | [builder/command.ts:40](https://github.com/btravstack/amqp-contract/blob/
|
|
271
|
-
| <a id="consumer"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition)<`TMessage`> | The consumer definition for processing commands | [builder/command.ts:38](https://github.com/btravstack/amqp-contract/blob/
|
|
272
|
-
| <a id="exchange"></a> `exchange` | `TExchange` | The exchange that receives commands | [builder/command.ts:42](https://github.com/btravstack/amqp-contract/blob/
|
|
273
|
-
| <a id="message"></a> `message` | `TMessage` | The message definition | [builder/command.ts:46](https://github.com/btravstack/amqp-contract/blob/
|
|
274
|
-
| <a id="queue"></a> `queue` | `TQueue` | The queue this consumer reads from | [builder/command.ts:44](https://github.com/btravstack/amqp-contract/blob/
|
|
275
|
-
| <a id="routingkey"></a> `routingKey` | `TRoutingKey` | The routing key pattern for the binding | [builder/command.ts:48](https://github.com/btravstack/amqp-contract/blob/
|
|
269
|
+
| <a id="__brand-2"></a> `__brand` | `"CommandConsumerConfig"` | Discriminator to identify this as a command consumer config | [builder/command.ts:36](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/command.ts#L36) |
|
|
270
|
+
| <a id="binding"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | The binding connecting the queue to the exchange | [builder/command.ts:40](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/command.ts#L40) |
|
|
271
|
+
| <a id="consumer"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition)<`TMessage`> | The consumer definition for processing commands | [builder/command.ts:38](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/command.ts#L38) |
|
|
272
|
+
| <a id="exchange"></a> `exchange` | `TExchange` | The exchange that receives commands | [builder/command.ts:42](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/command.ts#L42) |
|
|
273
|
+
| <a id="message"></a> `message` | `TMessage` | The message definition | [builder/command.ts:46](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/command.ts#L46) |
|
|
274
|
+
| <a id="queue"></a> `queue` | `TQueue` | The queue this consumer reads from | [builder/command.ts:44](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/command.ts#L44) |
|
|
275
|
+
| <a id="routingkey"></a> `routingKey` | `TRoutingKey` | The routing key pattern for the binding | [builder/command.ts:48](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/command.ts#L48) |
|
|
276
276
|
|
|
277
277
|
***
|
|
278
278
|
|
|
@@ -282,7 +282,7 @@ The consumer "owns" the queue, and publishers send commands to it.
|
|
|
282
282
|
type CommandConsumerConfigBase = object;
|
|
283
283
|
```
|
|
284
284
|
|
|
285
|
-
Defined in: [types.ts:988](https://github.com/btravstack/amqp-contract/blob/
|
|
285
|
+
Defined in: [types.ts:988](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L988)
|
|
286
286
|
|
|
287
287
|
Base type for command consumer configuration.
|
|
288
288
|
|
|
@@ -297,13 +297,13 @@ defineCommandConsumer for creating command consumers
|
|
|
297
297
|
|
|
298
298
|
| Property | Type | Defined in |
|
|
299
299
|
| ------ | ------ | ------ |
|
|
300
|
-
| <a id="__brand-3"></a> `__brand` | `"CommandConsumerConfig"` | [types.ts:989](https://github.com/btravstack/amqp-contract/blob/
|
|
301
|
-
| <a id="binding-1"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | [types.ts:991](https://github.com/btravstack/amqp-contract/blob/
|
|
302
|
-
| <a id="consumer-1"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition) | [types.ts:990](https://github.com/btravstack/amqp-contract/blob/
|
|
303
|
-
| <a id="exchange-1"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:992](https://github.com/btravstack/amqp-contract/blob/
|
|
304
|
-
| <a id="message-1"></a> `message` | [`MessageDefinition`](#messagedefinition) | [types.ts:994](https://github.com/btravstack/amqp-contract/blob/
|
|
305
|
-
| <a id="queue-1"></a> `queue` | [`QueueEntry`](#queueentry) | [types.ts:993](https://github.com/btravstack/amqp-contract/blob/
|
|
306
|
-
| <a id="routingkey-1"></a> `routingKey` | `string` \| `undefined` | [types.ts:995](https://github.com/btravstack/amqp-contract/blob/
|
|
300
|
+
| <a id="__brand-3"></a> `__brand` | `"CommandConsumerConfig"` | [types.ts:989](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L989) |
|
|
301
|
+
| <a id="binding-1"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | [types.ts:991](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L991) |
|
|
302
|
+
| <a id="consumer-1"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition) | [types.ts:990](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L990) |
|
|
303
|
+
| <a id="exchange-1"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:992](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L992) |
|
|
304
|
+
| <a id="message-1"></a> `message` | [`MessageDefinition`](#messagedefinition) | [types.ts:994](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L994) |
|
|
305
|
+
| <a id="queue-1"></a> `queue` | [`QueueEntry`](#queueentry) | [types.ts:993](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L993) |
|
|
306
|
+
| <a id="routingkey-1"></a> `routingKey` | `string` \| `undefined` | [types.ts:995](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L995) |
|
|
307
307
|
|
|
308
308
|
***
|
|
309
309
|
|
|
@@ -313,7 +313,7 @@ defineCommandConsumer for creating command consumers
|
|
|
313
313
|
type CompressionAlgorithm = "gzip" | "deflate";
|
|
314
314
|
```
|
|
315
315
|
|
|
316
|
-
Defined in: [types.ts:199](https://github.com/btravstack/amqp-contract/blob/
|
|
316
|
+
Defined in: [types.ts:199](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L199)
|
|
317
317
|
|
|
318
318
|
Supported compression algorithms for message payloads.
|
|
319
319
|
|
|
@@ -351,7 +351,7 @@ await client.publish("orderCreated", payload, {
|
|
|
351
351
|
type ConsumerDefinition<TMessage> = object;
|
|
352
352
|
```
|
|
353
353
|
|
|
354
|
-
Defined in: [types.ts:952](https://github.com/btravstack/amqp-contract/blob/
|
|
354
|
+
Defined in: [types.ts:952](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L952)
|
|
355
355
|
|
|
356
356
|
Definition of a message consumer.
|
|
357
357
|
|
|
@@ -379,8 +379,8 @@ const consumer: ConsumerDefinition = {
|
|
|
379
379
|
|
|
380
380
|
| Property | Type | Description | Defined in |
|
|
381
381
|
| ------ | ------ | ------ | ------ |
|
|
382
|
-
| <a id="message-2"></a> `message` | `TMessage` | The message definition including the payload schema | [types.ts:957](https://github.com/btravstack/amqp-contract/blob/
|
|
383
|
-
| <a id="queue-2"></a> `queue` | [`QueueEntry`](#queueentry) | The queue to consume messages from | [types.ts:954](https://github.com/btravstack/amqp-contract/blob/
|
|
382
|
+
| <a id="message-2"></a> `message` | `TMessage` | The message definition including the payload schema | [types.ts:957](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L957) |
|
|
383
|
+
| <a id="queue-2"></a> `queue` | [`QueueEntry`](#queueentry) | The queue to consume messages from | [types.ts:954](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L954) |
|
|
384
384
|
|
|
385
385
|
***
|
|
386
386
|
|
|
@@ -393,7 +393,7 @@ type ConsumerEntry =
|
|
|
393
393
|
| CommandConsumerConfigBase;
|
|
394
394
|
```
|
|
395
395
|
|
|
396
|
-
Defined in: [types.ts:
|
|
396
|
+
Defined in: [types.ts:1184](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1184)
|
|
397
397
|
|
|
398
398
|
Consumer entry that can be passed to defineContract's consumers section.
|
|
399
399
|
|
|
@@ -410,7 +410,7 @@ Can be either:
|
|
|
410
410
|
type ContractDefinition = object;
|
|
411
411
|
```
|
|
412
412
|
|
|
413
|
-
Defined in: [types.ts:
|
|
413
|
+
Defined in: [types.ts:1115](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1115)
|
|
414
414
|
|
|
415
415
|
Complete AMQP contract definition (output type).
|
|
416
416
|
|
|
@@ -449,12 +449,12 @@ const contract: ContractDefinition = {
|
|
|
449
449
|
|
|
450
450
|
| Property | Type | Description | Defined in |
|
|
451
451
|
| ------ | ------ | ------ | ------ |
|
|
452
|
-
| <a id="bindings"></a> `bindings?` | `Record`<`string`, [`BindingDefinition`](#bindingdefinition)> | Named binding definitions. Bindings can be queue-to-exchange or exchange-to-exchange. | [types.ts:
|
|
453
|
-
| <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:
|
|
454
|
-
| <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:
|
|
455
|
-
| <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:
|
|
456
|
-
| <a id="queues"></a> `queues?` | `Record`<`string`, [`QueueEntry`](#queueentry)> | 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, exchanges, and bindings will be automatically added. | [types.ts:
|
|
457
|
-
| <a id="rpcs"></a> `rpcs?` | `Record`<`string`, [`RpcDefinition`](#rpcdefinition)> | Named RPC definitions. Each key gets: - A handler in the TypedAmqpWorker that returns the typed response. - A `client.call(name, request, options)` method on the TypedAmqpClient. RPC entries do not appear in `publishers` or `consumers` because each end of an RPC plays both roles (publisher of one direction, consumer of the other). | [types.ts:
|
|
452
|
+
| <a id="bindings"></a> `bindings?` | `Record`<`string`, [`BindingDefinition`](#bindingdefinition)> | Named binding definitions. Bindings can be queue-to-exchange or exchange-to-exchange. | [types.ts:1135](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1135) |
|
|
453
|
+
| <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:1149](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1149) |
|
|
454
|
+
| <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:1120](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1120) |
|
|
455
|
+
| <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:1142](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1142) |
|
|
456
|
+
| <a id="queues"></a> `queues?` | `Record`<`string`, [`QueueEntry`](#queueentry)> | 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, exchanges, and bindings will be automatically added. | [types.ts:1129](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1129) |
|
|
457
|
+
| <a id="rpcs"></a> `rpcs?` | `Record`<`string`, [`RpcDefinition`](#rpcdefinition)> | Named RPC definitions. Each key gets: - A handler in the TypedAmqpWorker that returns the typed response. - A `client.call(name, request, options)` method on the TypedAmqpClient. RPC entries do not appear in `publishers` or `consumers` because each end of an RPC plays both roles (publisher of one direction, consumer of the other). | [types.ts:1160](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1160) |
|
|
458
458
|
|
|
459
459
|
***
|
|
460
460
|
|
|
@@ -464,7 +464,7 @@ const contract: ContractDefinition = {
|
|
|
464
464
|
type ContractDefinitionInput = object;
|
|
465
465
|
```
|
|
466
466
|
|
|
467
|
-
Defined in: [types.ts:
|
|
467
|
+
Defined in: [types.ts:1213](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1213)
|
|
468
468
|
|
|
469
469
|
Contract definition input type with automatic extraction of event/command patterns.
|
|
470
470
|
|
|
@@ -496,9 +496,9 @@ defineContract - Processes this input and returns a ContractDefinition
|
|
|
496
496
|
|
|
497
497
|
| Property | Type | Description | Defined in |
|
|
498
498
|
| ------ | ------ | ------ | ------ |
|
|
499
|
-
| <a id="consumers-1"></a> `consumers?` | `Record`<`string`, [`ConsumerEntry`](#consumerentry)> | Named consumer definitions. Can accept: - ConsumerDefinition from defineConsumer - EventConsumerResult from defineEventConsumer (binding auto-extracted) - CommandConsumerConfig from defineCommandConsumer (binding auto-extracted) | [types.ts:
|
|
500
|
-
| <a id="publishers-1"></a> `publishers?` | `Record`<`string`, [`PublisherEntry`](#publisherentry)> | Named publisher definitions. Can accept: - PublisherDefinition from definePublisher - EventPublisherConfig from defineEventPublisher (auto-extracted to publisher) | [types.ts:
|
|
501
|
-
| <a id="rpcs-1"></a> `rpcs?` | `Record`<`string`, [`RpcDefinition`](#rpcdefinition)> | Named RPC definitions from `defineRpc`. Each entry contributes its queue (and DLX if any) to the contract topology and exposes a typed `client.call(name, ...)` / worker handler pair. | [types.ts:
|
|
499
|
+
| <a id="consumers-1"></a> `consumers?` | `Record`<`string`, [`ConsumerEntry`](#consumerentry)> | Named consumer definitions. Can accept: - ConsumerDefinition from defineConsumer - EventConsumerResult from defineEventConsumer (binding auto-extracted) - CommandConsumerConfig from defineCommandConsumer (binding auto-extracted) | [types.ts:1231](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1231) |
|
|
500
|
+
| <a id="publishers-1"></a> `publishers?` | `Record`<`string`, [`PublisherEntry`](#publisherentry)> | Named publisher definitions. Can accept: - PublisherDefinition from definePublisher - EventPublisherConfig from defineEventPublisher (auto-extracted to publisher) | [types.ts:1221](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1221) |
|
|
501
|
+
| <a id="rpcs-1"></a> `rpcs?` | `Record`<`string`, [`RpcDefinition`](#rpcdefinition)> | Named RPC definitions from `defineRpc`. Each entry contributes its queue (and DLX if any) to the contract topology and exposes a typed `client.call(name, ...)` / worker handler pair. | [types.ts:1238](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1238) |
|
|
502
502
|
|
|
503
503
|
***
|
|
504
504
|
|
|
@@ -508,7 +508,7 @@ defineContract - Processes this input and returns a ContractDefinition
|
|
|
508
508
|
type ContractOutput<TContract> = object;
|
|
509
509
|
```
|
|
510
510
|
|
|
511
|
-
Defined in: [types.ts:
|
|
511
|
+
Defined in: [types.ts:1555](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1555)
|
|
512
512
|
|
|
513
513
|
Contract output type with all resources extracted and properly typed.
|
|
514
514
|
|
|
@@ -529,12 +529,12 @@ This type represents the fully expanded contract with:
|
|
|
529
529
|
|
|
530
530
|
| Property | Type | Defined in |
|
|
531
531
|
| ------ | ------ | ------ |
|
|
532
|
-
| <a id="bindings-1"></a> `bindings` | `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractBindingsFromConsumers`<`TContract`\[`"consumers"`\]> : `object` & `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractExchangeBindingsFromConsumers`<`TContract`\[`"consumers"`\]> : `object` & `TContract`\[`"publishers"`\] *extends* `Record`<`string`, [`PublisherEntry`](#publisherentry)> ? `ExtractExchangeBindingsFromPublishers`<`TContract`\[`"publishers"`\]> : `object` | [types.ts:
|
|
533
|
-
| <a id="consumers-2"></a> `consumers` | `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractConsumerDefinitions`<`TContract`\[`"consumers"`\]> : `object` | [types.ts:
|
|
534
|
-
| <a id="exchanges-1"></a> `exchanges` | `TContract`\[`"publishers"`\] *extends* `Record`<`string`, [`PublisherEntry`](#publisherentry)> ? `ExtractExchangesFromPublishers`<`TContract`\[`"publishers"`\]> : `object` & `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractExchangesFromConsumers`<`TContract`\[`"consumers"`\]> : `object` & `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractDeadLetterExchangesFromConsumers`<`TContract`\[`"consumers"`\]> : `object` & `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractBridgeExchangesFromConsumers`<`TContract`\[`"consumers"`\]> : `object` & `TContract`\[`"publishers"`\] *extends* `Record`<`string`, [`PublisherEntry`](#publisherentry)> ? `ExtractTargetExchangesFromPublishers`<`TContract`\[`"publishers"`\]> : `object` & `TContract`\[`"rpcs"`\] *extends* `Record`<`string`, [`RpcDefinition`](#rpcdefinition)> ? `ExtractDeadLetterExchangesFromRpcs`<`TContract`\[`"rpcs"`\]> : `object` | [types.ts:
|
|
535
|
-
| <a id="publishers-2"></a> `publishers` | `TContract`\[`"publishers"`\] *extends* `Record`<`string`, [`PublisherEntry`](#publisherentry)> ? `ExtractPublisherDefinitions`<`TContract`\[`"publishers"`\]> : `object` | [types.ts:
|
|
536
|
-
| <a id="queues-1"></a> `queues` | `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractQueuesFromConsumers`<`TContract`\[`"consumers"`\]> : `object` & `TContract`\[`"rpcs"`\] *extends* `Record`<`string`, [`RpcDefinition`](#rpcdefinition)> ? `ExtractQueuesFromRpcs`<`TContract`\[`"rpcs"`\]> : `object` | [types.ts:
|
|
537
|
-
| <a id="rpcs-2"></a> `rpcs` | `TContract`\[`"rpcs"`\] *extends* `Record`<`string`, [`RpcDefinition`](#rpcdefinition)> ? `TContract`\[`"rpcs"`\] : `object` | [types.ts:
|
|
532
|
+
| <a id="bindings-1"></a> `bindings` | `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractBindingsFromConsumers`<`TContract`\[`"consumers"`\]> : `object` & `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractExchangeBindingsFromConsumers`<`TContract`\[`"consumers"`\]> : `object` & `TContract`\[`"publishers"`\] *extends* `Record`<`string`, [`PublisherEntry`](#publisherentry)> ? `ExtractExchangeBindingsFromPublishers`<`TContract`\[`"publishers"`\]> : `object` | [types.ts:1580](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1580) |
|
|
533
|
+
| <a id="consumers-2"></a> `consumers` | `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractConsumerDefinitions`<`TContract`\[`"consumers"`\]> : `object` | [types.ts:1592](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1592) |
|
|
534
|
+
| <a id="exchanges-1"></a> `exchanges` | `TContract`\[`"publishers"`\] *extends* `Record`<`string`, [`PublisherEntry`](#publisherentry)> ? `ExtractExchangesFromPublishers`<`TContract`\[`"publishers"`\]> : `object` & `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractExchangesFromConsumers`<`TContract`\[`"consumers"`\]> : `object` & `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractDeadLetterExchangesFromConsumers`<`TContract`\[`"consumers"`\]> : `object` & `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractBridgeExchangesFromConsumers`<`TContract`\[`"consumers"`\]> : `object` & `TContract`\[`"publishers"`\] *extends* `Record`<`string`, [`PublisherEntry`](#publisherentry)> ? `ExtractTargetExchangesFromPublishers`<`TContract`\[`"publishers"`\]> : `object` & `TContract`\[`"rpcs"`\] *extends* `Record`<`string`, [`RpcDefinition`](#rpcdefinition)> ? `ExtractDeadLetterExchangesFromRpcs`<`TContract`\[`"rpcs"`\]> : `object` | [types.ts:1556](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1556) |
|
|
535
|
+
| <a id="publishers-2"></a> `publishers` | `TContract`\[`"publishers"`\] *extends* `Record`<`string`, [`PublisherEntry`](#publisherentry)> ? `ExtractPublisherDefinitions`<`TContract`\[`"publishers"`\]> : `object` | [types.ts:1589](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1589) |
|
|
536
|
+
| <a id="queues-1"></a> `queues` | `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractQueuesFromConsumers`<`TContract`\[`"consumers"`\]> : `object` & `TContract`\[`"rpcs"`\] *extends* `Record`<`string`, [`RpcDefinition`](#rpcdefinition)> ? `ExtractQueuesFromRpcs`<`TContract`\[`"rpcs"`\]> : `object` | [types.ts:1574](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1574) |
|
|
537
|
+
| <a id="rpcs-2"></a> `rpcs` | `TContract`\[`"rpcs"`\] *extends* `Record`<`string`, [`RpcDefinition`](#rpcdefinition)> ? `TContract`\[`"rpcs"`\] : `object` | [types.ts:1595](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1595) |
|
|
538
538
|
|
|
539
539
|
***
|
|
540
540
|
|
|
@@ -544,7 +544,7 @@ This type represents the fully expanded contract with:
|
|
|
544
544
|
type DeadLetterConfig = object;
|
|
545
545
|
```
|
|
546
546
|
|
|
547
|
-
Defined in: [types.ts:518](https://github.com/btravstack/amqp-contract/blob/
|
|
547
|
+
Defined in: [types.ts:518](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L518)
|
|
548
548
|
|
|
549
549
|
Configuration for dead letter exchange (DLX) on a queue.
|
|
550
550
|
|
|
@@ -556,8 +556,8 @@ or storage.
|
|
|
556
556
|
|
|
557
557
|
| Property | Type | Description | Defined in |
|
|
558
558
|
| ------ | ------ | ------ | ------ |
|
|
559
|
-
| <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:523](https://github.com/btravstack/amqp-contract/blob/
|
|
560
|
-
| <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:529](https://github.com/btravstack/amqp-contract/blob/
|
|
559
|
+
| <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:523](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L523) |
|
|
560
|
+
| <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:529](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L529) |
|
|
561
561
|
|
|
562
562
|
***
|
|
563
563
|
|
|
@@ -569,7 +569,7 @@ type DefineQueueOptions =
|
|
|
569
569
|
| ClassicQueueOptions;
|
|
570
570
|
```
|
|
571
571
|
|
|
572
|
-
Defined in: [types.ts:379](https://github.com/btravstack/amqp-contract/blob/
|
|
572
|
+
Defined in: [types.ts:379](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L379)
|
|
573
573
|
|
|
574
574
|
Options for defining a queue. Uses a discriminated union based on the `type` property
|
|
575
575
|
to enforce quorum queue constraints at compile time.
|
|
@@ -585,7 +585,7 @@ to enforce quorum queue constraints at compile time.
|
|
|
585
585
|
type DirectExchangeDefinition<TName> = BaseExchangeDefinition<TName> & object;
|
|
586
586
|
```
|
|
587
587
|
|
|
588
|
-
Defined in: [types.ts:459](https://github.com/btravstack/amqp-contract/blob/
|
|
588
|
+
Defined in: [types.ts:459](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L459)
|
|
589
589
|
|
|
590
590
|
A direct exchange definition.
|
|
591
591
|
|
|
@@ -596,7 +596,7 @@ This is ideal for point-to-point messaging where each message should go to speci
|
|
|
596
596
|
|
|
597
597
|
| Name | Type | Defined in |
|
|
598
598
|
| ------ | ------ | ------ |
|
|
599
|
-
| `type` | `"direct"` | [types.ts:461](https://github.com/btravstack/amqp-contract/blob/
|
|
599
|
+
| `type` | `"direct"` | [types.ts:461](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L461) |
|
|
600
600
|
|
|
601
601
|
#### Type Parameters
|
|
602
602
|
|
|
@@ -620,7 +620,7 @@ const tasksExchange: DirectExchangeDefinition = defineExchange('tasks', {
|
|
|
620
620
|
type EventConsumerResult<TMessage, TExchange, TQueue, TExchangeBinding, TBridgeExchange> = object;
|
|
621
621
|
```
|
|
622
622
|
|
|
623
|
-
Defined in: [builder/event.ts:54](https://github.com/btravstack/amqp-contract/blob/
|
|
623
|
+
Defined in: [builder/event.ts:54](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/event.ts#L54)
|
|
624
624
|
|
|
625
625
|
Result from defineEventConsumer.
|
|
626
626
|
|
|
@@ -642,13 +642,13 @@ will be automatically extracted.
|
|
|
642
642
|
|
|
643
643
|
| Property | Type | Description | Defined in |
|
|
644
644
|
| ------ | ------ | ------ | ------ |
|
|
645
|
-
| <a id="__brand-4"></a> `__brand` | `"EventConsumerResult"` | Discriminator to identify this as an event consumer result | [builder/event.ts:64](https://github.com/btravstack/amqp-contract/blob/
|
|
646
|
-
| <a id="binding-2"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | The binding connecting the queue to the exchange | [builder/event.ts:68](https://github.com/btravstack/amqp-contract/blob/
|
|
647
|
-
| <a id="bridgeexchange-2"></a> `bridgeExchange` | `TBridgeExchange` | The bridge (local domain) exchange when bridging, if configured | [builder/event.ts:76](https://github.com/btravstack/amqp-contract/blob/
|
|
648
|
-
| <a id="consumer-2"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition)<`TMessage`> | The consumer definition for processing messages | [builder/event.ts:66](https://github.com/btravstack/amqp-contract/blob/
|
|
649
|
-
| <a id="exchange-3"></a> `exchange` | `TExchange` | The source exchange this consumer subscribes to | [builder/event.ts:70](https://github.com/btravstack/amqp-contract/blob/
|
|
650
|
-
| <a id="exchangebinding-2"></a> `exchangeBinding` | `TExchangeBinding` | The exchange-to-exchange binding when bridging, if configured | [builder/event.ts:74](https://github.com/btravstack/amqp-contract/blob/
|
|
651
|
-
| <a id="queue-3"></a> `queue` | `TQueue` | The queue this consumer reads from | [builder/event.ts:72](https://github.com/btravstack/amqp-contract/blob/
|
|
645
|
+
| <a id="__brand-4"></a> `__brand` | `"EventConsumerResult"` | Discriminator to identify this as an event consumer result | [builder/event.ts:64](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/event.ts#L64) |
|
|
646
|
+
| <a id="binding-2"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | The binding connecting the queue to the exchange | [builder/event.ts:68](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/event.ts#L68) |
|
|
647
|
+
| <a id="bridgeexchange-2"></a> `bridgeExchange` | `TBridgeExchange` | The bridge (local domain) exchange when bridging, if configured | [builder/event.ts:76](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/event.ts#L76) |
|
|
648
|
+
| <a id="consumer-2"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition)<`TMessage`> | The consumer definition for processing messages | [builder/event.ts:66](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/event.ts#L66) |
|
|
649
|
+
| <a id="exchange-3"></a> `exchange` | `TExchange` | The source exchange this consumer subscribes to | [builder/event.ts:70](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/event.ts#L70) |
|
|
650
|
+
| <a id="exchangebinding-2"></a> `exchangeBinding` | `TExchangeBinding` | The exchange-to-exchange binding when bridging, if configured | [builder/event.ts:74](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/event.ts#L74) |
|
|
651
|
+
| <a id="queue-3"></a> `queue` | `TQueue` | The queue this consumer reads from | [builder/event.ts:72](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/event.ts#L72) |
|
|
652
652
|
|
|
653
653
|
***
|
|
654
654
|
|
|
@@ -658,7 +658,7 @@ will be automatically extracted.
|
|
|
658
658
|
type EventConsumerResultBase = object;
|
|
659
659
|
```
|
|
660
660
|
|
|
661
|
-
Defined in: [types.ts:1006](https://github.com/btravstack/amqp-contract/blob/
|
|
661
|
+
Defined in: [types.ts:1006](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1006)
|
|
662
662
|
|
|
663
663
|
Base type for event consumer result.
|
|
664
664
|
|
|
@@ -673,13 +673,13 @@ defineEventConsumer for creating event consumers
|
|
|
673
673
|
|
|
674
674
|
| Property | Type | Defined in |
|
|
675
675
|
| ------ | ------ | ------ |
|
|
676
|
-
| <a id="__brand-5"></a> `__brand` | `"EventConsumerResult"` | [types.ts:1007](https://github.com/btravstack/amqp-contract/blob/
|
|
677
|
-
| <a id="binding-3"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | [types.ts:1009](https://github.com/btravstack/amqp-contract/blob/
|
|
678
|
-
| <a id="bridgeexchange-3"></a> `bridgeExchange` | [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | [types.ts:1013](https://github.com/btravstack/amqp-contract/blob/
|
|
679
|
-
| <a id="consumer-3"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition) | [types.ts:1008](https://github.com/btravstack/amqp-contract/blob/
|
|
680
|
-
| <a id="exchange-4"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:1010](https://github.com/btravstack/amqp-contract/blob/
|
|
681
|
-
| <a id="exchangebinding-3"></a> `exchangeBinding` | [`ExchangeBindingDefinition`](#exchangebindingdefinition) \| `undefined` | [types.ts:1012](https://github.com/btravstack/amqp-contract/blob/
|
|
682
|
-
| <a id="queue-4"></a> `queue` | [`QueueEntry`](#queueentry) | [types.ts:1011](https://github.com/btravstack/amqp-contract/blob/
|
|
676
|
+
| <a id="__brand-5"></a> `__brand` | `"EventConsumerResult"` | [types.ts:1007](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1007) |
|
|
677
|
+
| <a id="binding-3"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | [types.ts:1009](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1009) |
|
|
678
|
+
| <a id="bridgeexchange-3"></a> `bridgeExchange` | [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | [types.ts:1013](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1013) |
|
|
679
|
+
| <a id="consumer-3"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition) | [types.ts:1008](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1008) |
|
|
680
|
+
| <a id="exchange-4"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:1010](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1010) |
|
|
681
|
+
| <a id="exchangebinding-3"></a> `exchangeBinding` | [`ExchangeBindingDefinition`](#exchangebindingdefinition) \| `undefined` | [types.ts:1012](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1012) |
|
|
682
|
+
| <a id="queue-4"></a> `queue` | [`QueueEntry`](#queueentry) | [types.ts:1011](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1011) |
|
|
683
683
|
|
|
684
684
|
***
|
|
685
685
|
|
|
@@ -689,7 +689,7 @@ defineEventConsumer for creating event consumers
|
|
|
689
689
|
type EventPublisherConfig<TMessage, TExchange, TRoutingKey> = object;
|
|
690
690
|
```
|
|
691
691
|
|
|
692
|
-
Defined in: [builder/event.ts:28](https://github.com/btravstack/amqp-contract/blob/
|
|
692
|
+
Defined in: [builder/event.ts:28](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/event.ts#L28)
|
|
693
693
|
|
|
694
694
|
Configuration for an event publisher.
|
|
695
695
|
|
|
@@ -709,11 +709,11 @@ publishers broadcast events and consumers subscribe to receive them.
|
|
|
709
709
|
|
|
710
710
|
| Property | Type | Description | Defined in |
|
|
711
711
|
| ------ | ------ | ------ | ------ |
|
|
712
|
-
| <a id="__brand-6"></a> `__brand` | `"EventPublisherConfig"` | Discriminator to identify this as an event publisher config | [builder/event.ts:34](https://github.com/btravstack/amqp-contract/blob/
|
|
713
|
-
| <a id="arguments-1"></a> `arguments?` | `Record`<`string`, `unknown`> | Additional AMQP arguments | [builder/event.ts:42](https://github.com/btravstack/amqp-contract/blob/
|
|
714
|
-
| <a id="exchange-5"></a> `exchange` | `TExchange` | The exchange to publish to | [builder/event.ts:36](https://github.com/btravstack/amqp-contract/blob/
|
|
715
|
-
| <a id="message-3"></a> `message` | `TMessage` | The message definition | [builder/event.ts:38](https://github.com/btravstack/amqp-contract/blob/
|
|
716
|
-
| <a id="routingkey-3"></a> `routingKey` | `TRoutingKey` | The routing key for direct/topic exchanges | [builder/event.ts:40](https://github.com/btravstack/amqp-contract/blob/
|
|
712
|
+
| <a id="__brand-6"></a> `__brand` | `"EventPublisherConfig"` | Discriminator to identify this as an event publisher config | [builder/event.ts:34](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/event.ts#L34) |
|
|
713
|
+
| <a id="arguments-1"></a> `arguments?` | `Record`<`string`, `unknown`> | Additional AMQP arguments | [builder/event.ts:42](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/event.ts#L42) |
|
|
714
|
+
| <a id="exchange-5"></a> `exchange` | `TExchange` | The exchange to publish to | [builder/event.ts:36](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/event.ts#L36) |
|
|
715
|
+
| <a id="message-3"></a> `message` | `TMessage` | The message definition | [builder/event.ts:38](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/event.ts#L38) |
|
|
716
|
+
| <a id="routingkey-3"></a> `routingKey` | `TRoutingKey` | The routing key for direct/topic exchanges | [builder/event.ts:40](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/event.ts#L40) |
|
|
717
717
|
|
|
718
718
|
***
|
|
719
719
|
|
|
@@ -723,7 +723,7 @@ publishers broadcast events and consumers subscribe to receive them.
|
|
|
723
723
|
type EventPublisherConfigBase = object;
|
|
724
724
|
```
|
|
725
725
|
|
|
726
|
-
Defined in: [types.ts:972](https://github.com/btravstack/amqp-contract/blob/
|
|
726
|
+
Defined in: [types.ts:972](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L972)
|
|
727
727
|
|
|
728
728
|
Base type for event publisher configuration.
|
|
729
729
|
|
|
@@ -738,11 +738,11 @@ defineEventPublisher for creating event publishers
|
|
|
738
738
|
|
|
739
739
|
| Property | Type | Defined in |
|
|
740
740
|
| ------ | ------ | ------ |
|
|
741
|
-
| <a id="__brand-7"></a> `__brand` | `"EventPublisherConfig"` | [types.ts:973](https://github.com/btravstack/amqp-contract/blob/
|
|
742
|
-
| <a id="arguments-2"></a> `arguments?` | `Record`<`string`, `unknown`> | [types.ts:977](https://github.com/btravstack/amqp-contract/blob/
|
|
743
|
-
| <a id="exchange-6"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:974](https://github.com/btravstack/amqp-contract/blob/
|
|
744
|
-
| <a id="message-4"></a> `message` | [`MessageDefinition`](#messagedefinition) | [types.ts:975](https://github.com/btravstack/amqp-contract/blob/
|
|
745
|
-
| <a id="routingkey-4"></a> `routingKey` | `string` \| `undefined` | [types.ts:976](https://github.com/btravstack/amqp-contract/blob/
|
|
741
|
+
| <a id="__brand-7"></a> `__brand` | `"EventPublisherConfig"` | [types.ts:973](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L973) |
|
|
742
|
+
| <a id="arguments-2"></a> `arguments?` | `Record`<`string`, `unknown`> | [types.ts:977](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L977) |
|
|
743
|
+
| <a id="exchange-6"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:974](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L974) |
|
|
744
|
+
| <a id="message-4"></a> `message` | [`MessageDefinition`](#messagedefinition) | [types.ts:975](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L975) |
|
|
745
|
+
| <a id="routingkey-4"></a> `routingKey` | `string` \| `undefined` | [types.ts:976](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L976) |
|
|
746
746
|
|
|
747
747
|
***
|
|
748
748
|
|
|
@@ -762,7 +762,7 @@ type ExchangeBindingDefinition = object &
|
|
|
762
762
|
};
|
|
763
763
|
```
|
|
764
764
|
|
|
765
|
-
Defined in: [types.ts:855](https://github.com/btravstack/amqp-contract/blob/
|
|
765
|
+
Defined in: [types.ts:855](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L855)
|
|
766
766
|
|
|
767
767
|
Binding between two exchanges (exchange-to-exchange routing).
|
|
768
768
|
|
|
@@ -773,9 +773,9 @@ This allows for more complex routing topologies.
|
|
|
773
773
|
|
|
774
774
|
| Name | Type | Description | Defined in |
|
|
775
775
|
| ------ | ------ | ------ | ------ |
|
|
776
|
-
| `arguments?` | `Record`<`string`, `unknown`> | Additional AMQP arguments for the binding. | [types.ts:865](https://github.com/btravstack/amqp-contract/blob/
|
|
777
|
-
| `destination` | [`ExchangeDefinition`](#exchangedefinition) | The destination exchange that will receive forwarded messages | [types.ts:860](https://github.com/btravstack/amqp-contract/blob/
|
|
778
|
-
| `type` | `"exchange"` | Discriminator indicating this is an exchange-to-exchange binding | [types.ts:857](https://github.com/btravstack/amqp-contract/blob/
|
|
776
|
+
| `arguments?` | `Record`<`string`, `unknown`> | Additional AMQP arguments for the binding. | [types.ts:865](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L865) |
|
|
777
|
+
| `destination` | [`ExchangeDefinition`](#exchangedefinition) | The destination exchange that will receive forwarded messages | [types.ts:860](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L860) |
|
|
778
|
+
| `type` | `"exchange"` | Discriminator indicating this is an exchange-to-exchange binding | [types.ts:857](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L857) |
|
|
779
779
|
|
|
780
780
|
#### Example
|
|
781
781
|
|
|
@@ -801,7 +801,7 @@ type ExchangeDefinition<TName> =
|
|
|
801
801
|
| HeadersExchangeDefinition<TName>;
|
|
802
802
|
```
|
|
803
803
|
|
|
804
|
-
Defined in: [types.ts:505](https://github.com/btravstack/amqp-contract/blob/
|
|
804
|
+
Defined in: [types.ts:505](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L505)
|
|
805
805
|
|
|
806
806
|
Union type of all exchange definitions.
|
|
807
807
|
|
|
@@ -821,7 +821,7 @@ Represents any type of AMQP exchange: topic, direct, fanout, headers.
|
|
|
821
821
|
type FanoutExchangeDefinition<TName> = BaseExchangeDefinition<TName> & object;
|
|
822
822
|
```
|
|
823
823
|
|
|
824
|
-
Defined in: [types.ts:477](https://github.com/btravstack/amqp-contract/blob/
|
|
824
|
+
Defined in: [types.ts:477](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L477)
|
|
825
825
|
|
|
826
826
|
A fanout exchange definition.
|
|
827
827
|
|
|
@@ -832,7 +832,7 @@ This is the simplest exchange type for pub/sub messaging patterns.
|
|
|
832
832
|
|
|
833
833
|
| Name | Type | Defined in |
|
|
834
834
|
| ------ | ------ | ------ |
|
|
835
|
-
| `type` | `"fanout"` | [types.ts:479](https://github.com/btravstack/amqp-contract/blob/
|
|
835
|
+
| `type` | `"fanout"` | [types.ts:479](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L479) |
|
|
836
836
|
|
|
837
837
|
#### Type Parameters
|
|
838
838
|
|
|
@@ -856,7 +856,7 @@ const logsExchange: FanoutExchangeDefinition = defineExchange('logs', {
|
|
|
856
856
|
type HeadersExchangeDefinition<TName> = BaseExchangeDefinition<TName> & object;
|
|
857
857
|
```
|
|
858
858
|
|
|
859
|
-
Defined in: [types.ts:495](https://github.com/btravstack/amqp-contract/blob/
|
|
859
|
+
Defined in: [types.ts:495](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L495)
|
|
860
860
|
|
|
861
861
|
A headers exchange definition.
|
|
862
862
|
|
|
@@ -867,7 +867,7 @@ This is useful for more complex routing scenarios where metadata is important.
|
|
|
867
867
|
|
|
868
868
|
| Name | Type | Defined in |
|
|
869
869
|
| ------ | ------ | ------ |
|
|
870
|
-
| `type` | `"headers"` | [types.ts:497](https://github.com/btravstack/amqp-contract/blob/
|
|
870
|
+
| `type` | `"headers"` | [types.ts:497](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L497) |
|
|
871
871
|
|
|
872
872
|
#### Type Parameters
|
|
873
873
|
|
|
@@ -891,7 +891,7 @@ const routesExchange: HeadersExchangeDefinition = defineExchange('routes', {
|
|
|
891
891
|
type ImmediateRequeueRetryOptions = object;
|
|
892
892
|
```
|
|
893
893
|
|
|
894
|
-
Defined in: [types.ts:88](https://github.com/btravstack/amqp-contract/blob/
|
|
894
|
+
Defined in: [types.ts:88](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L88)
|
|
895
895
|
|
|
896
896
|
Immediate-Requeue retry options.
|
|
897
897
|
|
|
@@ -911,8 +911,8 @@ https://www.rabbitmq.com/docs/quorum-queues#poison-message-handling
|
|
|
911
911
|
|
|
912
912
|
| Property | Type | Description | Defined in |
|
|
913
913
|
| ------ | ------ | ------ | ------ |
|
|
914
|
-
| <a id="maxretries"></a> `maxRetries?` | `number` | Maximum retry attempts before sending to DLQ. **Minimum** 1 - Must be a positive integer (1 or greater) **Default** `3` | [types.ts:98](https://github.com/btravstack/amqp-contract/blob/
|
|
915
|
-
| <a id="mode"></a> `mode` | `"immediate-requeue"` | Immediate-Requeue mode. | [types.ts:92](https://github.com/btravstack/amqp-contract/blob/
|
|
914
|
+
| <a id="maxretries"></a> `maxRetries?` | `number` | Maximum retry attempts before sending to DLQ. **Minimum** 1 - Must be a positive integer (1 or greater) **Default** `3` | [types.ts:98](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L98) |
|
|
915
|
+
| <a id="mode"></a> `mode` | `"immediate-requeue"` | Immediate-Requeue mode. | [types.ts:92](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L92) |
|
|
916
916
|
|
|
917
917
|
***
|
|
918
918
|
|
|
@@ -922,7 +922,7 @@ https://www.rabbitmq.com/docs/quorum-queues#poison-message-handling
|
|
|
922
922
|
type InferConsumerNames<TContract> = TContract["consumers"] extends Record<string, unknown> ? keyof TContract["consumers"] : never;
|
|
923
923
|
```
|
|
924
924
|
|
|
925
|
-
Defined in: [types.ts:
|
|
925
|
+
Defined in: [types.ts:1631](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1631)
|
|
926
926
|
|
|
927
927
|
Extract consumer names from a contract.
|
|
928
928
|
|
|
@@ -954,7 +954,7 @@ type ConsumerNames = InferConsumerNames<typeof myContract>;
|
|
|
954
954
|
type InferPublisherNames<TContract> = TContract["publishers"] extends Record<string, unknown> ? keyof TContract["publishers"] : never;
|
|
955
955
|
```
|
|
956
956
|
|
|
957
|
-
Defined in: [types.ts:
|
|
957
|
+
Defined in: [types.ts:1613](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1613)
|
|
958
958
|
|
|
959
959
|
Extract publisher names from a contract.
|
|
960
960
|
|
|
@@ -986,7 +986,7 @@ type PublisherNames = InferPublisherNames<typeof myContract>;
|
|
|
986
986
|
type InferRpcNames<TContract> = TContract["rpcs"] extends Record<string, RpcDefinition> ? keyof TContract["rpcs"] : never;
|
|
987
987
|
```
|
|
988
988
|
|
|
989
|
-
Defined in: [types.ts:
|
|
989
|
+
Defined in: [types.ts:1643](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1643)
|
|
990
990
|
|
|
991
991
|
Extract RPC names from a contract.
|
|
992
992
|
|
|
@@ -1011,7 +1011,7 @@ Union of RPC names, or never if no RPCs defined
|
|
|
1011
1011
|
type MatchingRoutingKey<Pattern, Key> = RoutingKey<Key> extends never ? never : BindingPattern<Pattern> extends never ? never : MatchesPattern<Key, Pattern> extends true ? Key : never;
|
|
1012
1012
|
```
|
|
1013
1013
|
|
|
1014
|
-
Defined in: [builder/routing-types.ts:114](https://github.com/btravstack/amqp-contract/blob/
|
|
1014
|
+
Defined in: [builder/routing-types.ts:114](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/routing-types.ts#L114)
|
|
1015
1015
|
|
|
1016
1016
|
Validate that a routing key matches a binding pattern.
|
|
1017
1017
|
|
|
@@ -1043,7 +1043,7 @@ type InvalidKey = MatchingRoutingKey<"order.*", "user.created">; // never
|
|
|
1043
1043
|
type MessageDefinition<TPayload, THeaders> = object;
|
|
1044
1044
|
```
|
|
1045
1045
|
|
|
1046
|
-
Defined in: [types.ts:769](https://github.com/btravstack/amqp-contract/blob/
|
|
1046
|
+
Defined in: [types.ts:769](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L769)
|
|
1047
1047
|
|
|
1048
1048
|
Definition of a message with typed payload and optional headers.
|
|
1049
1049
|
|
|
@@ -1058,10 +1058,10 @@ Definition of a message with typed payload and optional headers.
|
|
|
1058
1058
|
|
|
1059
1059
|
| Property | Type | Description | Defined in |
|
|
1060
1060
|
| ------ | ------ | ------ | ------ |
|
|
1061
|
-
| <a id="description"></a> `description?` | `string` | Detailed description of the message for documentation purposes. Used in AsyncAPI specification generation. | [types.ts:797](https://github.com/btravstack/amqp-contract/blob/
|
|
1062
|
-
| <a id="headers"></a> `headers?` | `THeaders` | Optional headers schema for validating message metadata. Must be a Standard Schema v1 compatible schema. | [types.ts:785](https://github.com/btravstack/amqp-contract/blob/
|
|
1063
|
-
| <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:779](https://github.com/btravstack/amqp-contract/blob/
|
|
1064
|
-
| <a id="summary"></a> `summary?` | `string` | Brief description of the message for documentation purposes. Used in AsyncAPI specification generation. | [types.ts:791](https://github.com/btravstack/amqp-contract/blob/
|
|
1061
|
+
| <a id="description"></a> `description?` | `string` | Detailed description of the message for documentation purposes. Used in AsyncAPI specification generation. | [types.ts:797](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L797) |
|
|
1062
|
+
| <a id="headers"></a> `headers?` | `THeaders` | Optional headers schema for validating message metadata. Must be a Standard Schema v1 compatible schema. | [types.ts:785](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L785) |
|
|
1063
|
+
| <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:779](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L779) |
|
|
1064
|
+
| <a id="summary"></a> `summary?` | `string` | Brief description of the message for documentation purposes. Used in AsyncAPI specification generation. | [types.ts:791](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L791) |
|
|
1065
1065
|
|
|
1066
1066
|
***
|
|
1067
1067
|
|
|
@@ -1081,7 +1081,7 @@ type PublisherDefinition<TMessage> = object &
|
|
|
1081
1081
|
};
|
|
1082
1082
|
```
|
|
1083
1083
|
|
|
1084
|
-
Defined in: [types.ts:913](https://github.com/btravstack/amqp-contract/blob/
|
|
1084
|
+
Defined in: [types.ts:913](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L913)
|
|
1085
1085
|
|
|
1086
1086
|
Definition of a message publisher.
|
|
1087
1087
|
|
|
@@ -1095,7 +1095,7 @@ algorithm when calling the publish method.
|
|
|
1095
1095
|
|
|
1096
1096
|
| Name | Type | Description | Defined in |
|
|
1097
1097
|
| ------ | ------ | ------ | ------ |
|
|
1098
|
-
| `message` | `TMessage` | The message definition including the payload schema | [types.ts:915](https://github.com/btravstack/amqp-contract/blob/
|
|
1098
|
+
| `message` | `TMessage` | The message definition including the payload schema | [types.ts:915](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L915) |
|
|
1099
1099
|
|
|
1100
1100
|
#### Type Parameters
|
|
1101
1101
|
|
|
@@ -1124,7 +1124,7 @@ type PublisherEntry =
|
|
|
1124
1124
|
| BridgedPublisherConfigBase;
|
|
1125
1125
|
```
|
|
1126
1126
|
|
|
1127
|
-
Defined in: [types.ts:
|
|
1127
|
+
Defined in: [types.ts:1171](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1171)
|
|
1128
1128
|
|
|
1129
1129
|
Publisher entry that can be passed to defineContract's publishers section.
|
|
1130
1130
|
|
|
@@ -1151,7 +1151,7 @@ type QueueBindingDefinition = object &
|
|
|
1151
1151
|
};
|
|
1152
1152
|
```
|
|
1153
1153
|
|
|
1154
|
-
Defined in: [types.ts:807](https://github.com/btravstack/amqp-contract/blob/
|
|
1154
|
+
Defined in: [types.ts:807](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L807)
|
|
1155
1155
|
|
|
1156
1156
|
Binding between a queue and an exchange.
|
|
1157
1157
|
|
|
@@ -1163,9 +1163,9 @@ For fanout and headers exchanges, no routing key is needed.
|
|
|
1163
1163
|
|
|
1164
1164
|
| Name | Type | Description | Defined in |
|
|
1165
1165
|
| ------ | ------ | ------ | ------ |
|
|
1166
|
-
| `arguments?` | `Record`<`string`, `unknown`> | Additional AMQP arguments for the binding. Can be used for advanced routing scenarios with the headers exchange type. | [types.ts:818](https://github.com/btravstack/amqp-contract/blob/
|
|
1167
|
-
| `queue` | [`QueueDefinition`](#queuedefinition) | The queue that will receive messages | [types.ts:812](https://github.com/btravstack/amqp-contract/blob/
|
|
1168
|
-
| `type` | `"queue"` | Discriminator indicating this is a queue-to-exchange binding | [types.ts:809](https://github.com/btravstack/amqp-contract/blob/
|
|
1166
|
+
| `arguments?` | `Record`<`string`, `unknown`> | Additional AMQP arguments for the binding. Can be used for advanced routing scenarios with the headers exchange type. | [types.ts:818](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L818) |
|
|
1167
|
+
| `queue` | [`QueueDefinition`](#queuedefinition) | The queue that will receive messages | [types.ts:812](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L812) |
|
|
1168
|
+
| `type` | `"queue"` | Discriminator indicating this is a queue-to-exchange binding | [types.ts:809](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L809) |
|
|
1169
1169
|
|
|
1170
1170
|
***
|
|
1171
1171
|
|
|
@@ -1177,7 +1177,7 @@ type QueueDefinition<TName> =
|
|
|
1177
1177
|
| ClassicQueueDefinition<TName>;
|
|
1178
1178
|
```
|
|
1179
1179
|
|
|
1180
|
-
Defined in: [types.ts:646](https://github.com/btravstack/amqp-contract/blob/
|
|
1180
|
+
Defined in: [types.ts:646](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L646)
|
|
1181
1181
|
|
|
1182
1182
|
Definition of an AMQP queue.
|
|
1183
1183
|
|
|
@@ -1203,7 +1203,7 @@ type QueueEntry<TName> =
|
|
|
1203
1203
|
| QueueWithTtlBackoffInfrastructure<TName>;
|
|
1204
1204
|
```
|
|
1205
1205
|
|
|
1206
|
-
Defined in: [types.ts:749](https://github.com/btravstack/amqp-contract/blob/
|
|
1206
|
+
Defined in: [types.ts:749](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L749)
|
|
1207
1207
|
|
|
1208
1208
|
A queue entry that can be passed to `defineContract`.
|
|
1209
1209
|
|
|
@@ -1223,7 +1223,7 @@ Can be either a plain queue definition or a queue with TTL-backoff infrastructur
|
|
|
1223
1223
|
type QueueType = "quorum" | "classic";
|
|
1224
1224
|
```
|
|
1225
1225
|
|
|
1226
|
-
Defined in: [types.ts:227](https://github.com/btravstack/amqp-contract/blob/
|
|
1226
|
+
Defined in: [types.ts:227](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L227)
|
|
1227
1227
|
|
|
1228
1228
|
Supported queue types in RabbitMQ.
|
|
1229
1229
|
|
|
@@ -1261,7 +1261,7 @@ const tempQueue = defineQueue('temp-queue', {
|
|
|
1261
1261
|
type QueueWithTtlBackoffInfrastructure<TName> = object;
|
|
1262
1262
|
```
|
|
1263
1263
|
|
|
1264
|
-
Defined in: [types.ts:706](https://github.com/btravstack/amqp-contract/blob/
|
|
1264
|
+
Defined in: [types.ts:706](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L706)
|
|
1265
1265
|
|
|
1266
1266
|
A queue with automatically generated TTL-backoff retry infrastructure.
|
|
1267
1267
|
|
|
@@ -1297,12 +1297,12 @@ const contract = defineContract({
|
|
|
1297
1297
|
|
|
1298
1298
|
| Property | Type | Description | Defined in |
|
|
1299
1299
|
| ------ | ------ | ------ | ------ |
|
|
1300
|
-
| <a id="queue-5"></a> `queue` | [`QueueDefinition`](#queuedefinition)<`TName`> | The main queue definition. | [types.ts:716](https://github.com/btravstack/amqp-contract/blob/
|
|
1301
|
-
| <a id="retryexchange"></a> `retryExchange` | [`HeadersExchangeDefinition`](#headersexchangedefinition) | Retry exchange used to route messages to retry back to the main queue. | [types.ts:731](https://github.com/btravstack/amqp-contract/blob/
|
|
1302
|
-
| <a id="retryqueuebinding"></a> `retryQueueBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes messages to retry back to the main queue. | [types.ts:741](https://github.com/btravstack/amqp-contract/blob/
|
|
1303
|
-
| <a id="waitexchange"></a> `waitExchange` | [`HeadersExchangeDefinition`](#headersexchangedefinition) | Wait exchange used to route failed messages to the wait queue. | [types.ts:726](https://github.com/btravstack/amqp-contract/blob/
|
|
1304
|
-
| <a id="waitqueue"></a> `waitQueue` | [`QueueDefinition`](#queuedefinition) | The wait queue for holding messages during backoff delay. | [types.ts:721](https://github.com/btravstack/amqp-contract/blob/
|
|
1305
|
-
| <a id="waitqueuebinding"></a> `waitQueueBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes failed messages to the wait queue. | [types.ts:736](https://github.com/btravstack/amqp-contract/blob/
|
|
1300
|
+
| <a id="queue-5"></a> `queue` | [`QueueDefinition`](#queuedefinition)<`TName`> | The main queue definition. | [types.ts:716](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L716) |
|
|
1301
|
+
| <a id="retryexchange"></a> `retryExchange` | [`HeadersExchangeDefinition`](#headersexchangedefinition) | Retry exchange used to route messages to retry back to the main queue. | [types.ts:731](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L731) |
|
|
1302
|
+
| <a id="retryqueuebinding"></a> `retryQueueBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes messages to retry back to the main queue. | [types.ts:741](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L741) |
|
|
1303
|
+
| <a id="waitexchange"></a> `waitExchange` | [`HeadersExchangeDefinition`](#headersexchangedefinition) | Wait exchange used to route failed messages to the wait queue. | [types.ts:726](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L726) |
|
|
1304
|
+
| <a id="waitqueue"></a> `waitQueue` | [`QueueDefinition`](#queuedefinition) | The wait queue for holding messages during backoff delay. | [types.ts:721](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L721) |
|
|
1305
|
+
| <a id="waitqueuebinding"></a> `waitQueueBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes failed messages to the wait queue. | [types.ts:736](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L736) |
|
|
1306
1306
|
|
|
1307
1307
|
***
|
|
1308
1308
|
|
|
@@ -1312,7 +1312,7 @@ const contract = defineContract({
|
|
|
1312
1312
|
type QuorumQueueDefinition<TName> = BaseQueueDefinition<TName> & object;
|
|
1313
1313
|
```
|
|
1314
1314
|
|
|
1315
|
-
Defined in: [types.ts:572](https://github.com/btravstack/amqp-contract/blob/
|
|
1315
|
+
Defined in: [types.ts:572](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L572)
|
|
1316
1316
|
|
|
1317
1317
|
Definition of a quorum queue.
|
|
1318
1318
|
|
|
@@ -1322,11 +1322,11 @@ Quorum queues provide better durability and high-availability using the Raft con
|
|
|
1322
1322
|
|
|
1323
1323
|
| Name | Type | Description | Defined in |
|
|
1324
1324
|
| ------ | ------ | ------ | ------ |
|
|
1325
|
-
| `autoDelete?` | `never` | Quorum queues do not support auto-delete mode. Use type: 'classic' if you need auto-deleting queues. | [types.ts:593](https://github.com/btravstack/amqp-contract/blob/
|
|
1326
|
-
| `durable` | `true` | Quorum queues only support durable queues. | [types.ts:581](https://github.com/btravstack/amqp-contract/blob/
|
|
1327
|
-
| `exclusive?` | `never` | Quorum queues do not support exclusive mode. Use type: 'classic' if you need exclusive queues. | [types.ts:587](https://github.com/btravstack/amqp-contract/blob/
|
|
1328
|
-
| `maxPriority?` | `never` | Quorum queues do not support priority queues. Use type: 'classic' if you need priority queues. | [types.ts:599](https://github.com/btravstack/amqp-contract/blob/
|
|
1329
|
-
| `type` | `"quorum"` | Queue type discriminator: quorum queue. | [types.ts:576](https://github.com/btravstack/amqp-contract/blob/
|
|
1325
|
+
| `autoDelete?` | `never` | Quorum queues do not support auto-delete mode. Use type: 'classic' if you need auto-deleting queues. | [types.ts:593](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L593) |
|
|
1326
|
+
| `durable` | `true` | Quorum queues only support durable queues. | [types.ts:581](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L581) |
|
|
1327
|
+
| `exclusive?` | `never` | Quorum queues do not support exclusive mode. Use type: 'classic' if you need exclusive queues. | [types.ts:587](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L587) |
|
|
1328
|
+
| `maxPriority?` | `never` | Quorum queues do not support priority queues. Use type: 'classic' if you need priority queues. | [types.ts:599](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L599) |
|
|
1329
|
+
| `type` | `"quorum"` | Queue type discriminator: quorum queue. | [types.ts:576](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L576) |
|
|
1330
1330
|
|
|
1331
1331
|
#### Type Parameters
|
|
1332
1332
|
|
|
@@ -1342,7 +1342,7 @@ Quorum queues provide better durability and high-availability using the Raft con
|
|
|
1342
1342
|
type QuorumQueueOptions = BaseQueueOptions & object;
|
|
1343
1343
|
```
|
|
1344
1344
|
|
|
1345
|
-
Defined in: [types.ts:295](https://github.com/btravstack/amqp-contract/blob/
|
|
1345
|
+
Defined in: [types.ts:295](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L295)
|
|
1346
1346
|
|
|
1347
1347
|
Options for creating a quorum queue.
|
|
1348
1348
|
|
|
@@ -1361,11 +1361,11 @@ Quorum queues provide native retry support for immediate-requeue retry mode:
|
|
|
1361
1361
|
|
|
1362
1362
|
| Name | Type | Description | Defined in |
|
|
1363
1363
|
| ------ | ------ | ------ | ------ |
|
|
1364
|
-
| `autoDelete?` | `never` | Quorum queues do not support auto-delete mode. Use type: 'classic' if you need auto-deleting queues. | [types.ts:316](https://github.com/btravstack/amqp-contract/blob/
|
|
1365
|
-
| `durable?` | `true` | Quorum queues only support durable queues. | [types.ts:304](https://github.com/btravstack/amqp-contract/blob/
|
|
1366
|
-
| `exclusive?` | `never` | Quorum queues do not support exclusive mode. Use type: 'classic' if you need exclusive queues. | [types.ts:310](https://github.com/btravstack/amqp-contract/blob/
|
|
1367
|
-
| `maxPriority?` | `never` | Quorum queues do not support priority queues. Use type: 'classic' if you need priority queues. | [types.ts:322](https://github.com/btravstack/amqp-contract/blob/
|
|
1368
|
-
| `type?` | `"quorum"` | Queue type: quorum (default, recommended) | [types.ts:299](https://github.com/btravstack/amqp-contract/blob/
|
|
1364
|
+
| `autoDelete?` | `never` | Quorum queues do not support auto-delete mode. Use type: 'classic' if you need auto-deleting queues. | [types.ts:316](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L316) |
|
|
1365
|
+
| `durable?` | `true` | Quorum queues only support durable queues. | [types.ts:304](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L304) |
|
|
1366
|
+
| `exclusive?` | `never` | Quorum queues do not support exclusive mode. Use type: 'classic' if you need exclusive queues. | [types.ts:310](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L310) |
|
|
1367
|
+
| `maxPriority?` | `never` | Quorum queues do not support priority queues. Use type: 'classic' if you need priority queues. | [types.ts:322](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L322) |
|
|
1368
|
+
| `type?` | `"quorum"` | Queue type: quorum (default, recommended) | [types.ts:299](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L299) |
|
|
1369
1369
|
|
|
1370
1370
|
#### Example
|
|
1371
1371
|
|
|
@@ -1388,7 +1388,7 @@ type ResolvedRetryOptions =
|
|
|
1388
1388
|
| ResolvedTtlBackoffRetryOptions;
|
|
1389
1389
|
```
|
|
1390
1390
|
|
|
1391
|
-
Defined in: [types.ts:166](https://github.com/btravstack/amqp-contract/blob/
|
|
1391
|
+
Defined in: [types.ts:166](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L166)
|
|
1392
1392
|
|
|
1393
1393
|
Resolved retry configuration stored in queue definitions.
|
|
1394
1394
|
|
|
@@ -1408,7 +1408,7 @@ a wait queue and the necessary exchanges and bindings.
|
|
|
1408
1408
|
type RoutingKey<S> = S extends "" ? never : S extends `${string}*${string}` | `${string}#${string}` ? never : S;
|
|
1409
1409
|
```
|
|
1410
1410
|
|
|
1411
|
-
Defined in: [builder/routing-types.ts:25](https://github.com/btravstack/amqp-contract/blob/
|
|
1411
|
+
Defined in: [builder/routing-types.ts:25](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/routing-types.ts#L25)
|
|
1412
1412
|
|
|
1413
1413
|
Type-safe routing key that validates basic format.
|
|
1414
1414
|
|
|
@@ -1439,10 +1439,10 @@ type Invalid2 = RoutingKey<"">; // never (empty string)
|
|
|
1439
1439
|
### RpcDefinition
|
|
1440
1440
|
|
|
1441
1441
|
```ts
|
|
1442
|
-
type RpcDefinition<TRequestMessage, TResponseMessage, TQueue> = object;
|
|
1442
|
+
type RpcDefinition<TRequestMessage, TResponseMessage, TQueue, TErrors> = object;
|
|
1443
1443
|
```
|
|
1444
1444
|
|
|
1445
|
-
Defined in: [types.ts:
|
|
1445
|
+
Defined in: [types.ts:1061](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1061)
|
|
1446
1446
|
|
|
1447
1447
|
Definition of an RPC operation: a request/response pair flowing over a
|
|
1448
1448
|
request queue with replies routed back via direct reply-to.
|
|
@@ -1463,14 +1463,38 @@ defineRpc for creating RPC definitions
|
|
|
1463
1463
|
| `TRequestMessage` *extends* [`MessageDefinition`](#messagedefinition) | [`MessageDefinition`](#messagedefinition) | The request message definition |
|
|
1464
1464
|
| `TResponseMessage` *extends* [`MessageDefinition`](#messagedefinition) | [`MessageDefinition`](#messagedefinition) | The response message definition |
|
|
1465
1465
|
| `TQueue` *extends* [`QueueEntry`](#queueentry) | [`QueueEntry`](#queueentry) | The request queue entry |
|
|
1466
|
+
| `TErrors` *extends* [`RpcErrorMap`](#rpcerrormap) \| `undefined` | [`RpcErrorMap`](#rpcerrormap) \| `undefined` | The typed error map (undefined when the RPC declares none) |
|
|
1466
1467
|
|
|
1467
1468
|
#### Properties
|
|
1468
1469
|
|
|
1469
1470
|
| Property | Type | Description | Defined in |
|
|
1470
1471
|
| ------ | ------ | ------ | ------ |
|
|
1471
|
-
| <a id="
|
|
1472
|
-
| <a id="
|
|
1473
|
-
| <a id="
|
|
1472
|
+
| <a id="errors"></a> `errors?` | `TErrors` | Typed business errors the handler may return via `Err(rpcError(code, data))`. Error data is validated against the declared schema on the worker before the error reply is published, and re-validated on the client when it arrives. Business errors are replied and acked — never retried. | [types.ts:1079](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1079) |
|
|
1473
|
+
| <a id="queue-6"></a> `queue` | `TQueue` | The queue that receives RPC requests. Replies are routed back via direct reply-to. | [types.ts:1068](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1068) |
|
|
1474
|
+
| <a id="request"></a> `request` | `TRequestMessage` | Schema for the request payload (validated on both publish and consume). | [types.ts:1070](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1070) |
|
|
1475
|
+
| <a id="response"></a> `response` | `TResponseMessage` | Schema for the response payload (validated on both worker reply and client receive). | [types.ts:1072](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1072) |
|
|
1476
|
+
|
|
1477
|
+
***
|
|
1478
|
+
|
|
1479
|
+
### RpcErrorMap
|
|
1480
|
+
|
|
1481
|
+
```ts
|
|
1482
|
+
type RpcErrorMap = Record<string, MessageDefinition>;
|
|
1483
|
+
```
|
|
1484
|
+
|
|
1485
|
+
Defined in: [types.ts:1043](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L1043)
|
|
1486
|
+
|
|
1487
|
+
Typed error map for an RPC: error code → message definition validating the
|
|
1488
|
+
error's `data` payload.
|
|
1489
|
+
|
|
1490
|
+
Reuses [MessageDefinition](#messagedefinition) so error data gets the same Standard Schema
|
|
1491
|
+
validation and AsyncAPI metadata (`summary` / `description`) as request and
|
|
1492
|
+
response payloads. The `headers` slot of an error's message definition is
|
|
1493
|
+
ignored — error replies carry the code in a fixed AMQP header instead.
|
|
1494
|
+
|
|
1495
|
+
#### See
|
|
1496
|
+
|
|
1497
|
+
defineRpc for declaring errors on an RPC
|
|
1474
1498
|
|
|
1475
1499
|
***
|
|
1476
1500
|
|
|
@@ -1480,7 +1504,7 @@ defineRpc for creating RPC definitions
|
|
|
1480
1504
|
type TopicExchangeDefinition<TName> = BaseExchangeDefinition<TName> & object;
|
|
1481
1505
|
```
|
|
1482
1506
|
|
|
1483
|
-
Defined in: [types.ts:441](https://github.com/btravstack/amqp-contract/blob/
|
|
1507
|
+
Defined in: [types.ts:441](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L441)
|
|
1484
1508
|
|
|
1485
1509
|
A topic exchange definition.
|
|
1486
1510
|
|
|
@@ -1494,7 +1518,7 @@ Words are separated by dots (e.g., `order.created.high-value`).
|
|
|
1494
1518
|
|
|
1495
1519
|
| Name | Type | Defined in |
|
|
1496
1520
|
| ------ | ------ | ------ |
|
|
1497
|
-
| `type` | `"topic"` | [types.ts:443](https://github.com/btravstack/amqp-contract/blob/
|
|
1521
|
+
| `type` | `"topic"` | [types.ts:443](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L443) |
|
|
1498
1522
|
|
|
1499
1523
|
#### Type Parameters
|
|
1500
1524
|
|
|
@@ -1519,7 +1543,7 @@ const ordersExchange: TopicExchangeDefinition = defineExchange('orders', {
|
|
|
1519
1543
|
type TtlBackoffRetryOptions = object;
|
|
1520
1544
|
```
|
|
1521
1545
|
|
|
1522
|
-
Defined in: [types.ts:27](https://github.com/btravstack/amqp-contract/blob/
|
|
1546
|
+
Defined in: [types.ts:27](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L27)
|
|
1523
1547
|
|
|
1524
1548
|
TTL-Backoff retry options for exponential backoff with configurable delays.
|
|
1525
1549
|
|
|
@@ -1533,15 +1557,15 @@ per-message TTL, then dead-lettered back to the main queue after the TTL expires
|
|
|
1533
1557
|
|
|
1534
1558
|
| Property | Type | Description | Defined in |
|
|
1535
1559
|
| ------ | ------ | ------ | ------ |
|
|
1536
|
-
| <a id="backoffmultiplier"></a> `backoffMultiplier?` | `number` | Exponential backoff multiplier. **Default** `2` | [types.ts:52](https://github.com/btravstack/amqp-contract/blob/
|
|
1537
|
-
| <a id="initialdelayms"></a> `initialDelayMs?` | `number` | Initial delay in ms before first retry. **Default** `1000` | [types.ts:42](https://github.com/btravstack/amqp-contract/blob/
|
|
1538
|
-
| <a id="jitter"></a> `jitter?` | `boolean` | Add jitter to prevent thundering herd. **Default** `true` | [types.ts:57](https://github.com/btravstack/amqp-contract/blob/
|
|
1539
|
-
| <a id="maxdelayms"></a> `maxDelayMs?` | `number` | Maximum delay in ms between retries. **Default** `30000` | [types.ts:47](https://github.com/btravstack/amqp-contract/blob/
|
|
1540
|
-
| <a id="maxretries-1"></a> `maxRetries?` | `number` | Maximum retry attempts before sending to DLQ. **Minimum** 1 - Must be a positive integer (1 or greater) **Default** `3` | [types.ts:37](https://github.com/btravstack/amqp-contract/blob/
|
|
1541
|
-
| <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/btravstack/amqp-contract/blob/
|
|
1542
|
-
| <a id="retryexchangename"></a> `retryExchangeName?` | `string` | Name of the retry exchange. **Default** `'retry-exchange'` | [types.ts:72](https://github.com/btravstack/amqp-contract/blob/
|
|
1543
|
-
| <a id="waitexchangename"></a> `waitExchangeName?` | `string` | Name of the wait exchange. **Default** `'wait-exchange'` | [types.ts:67](https://github.com/btravstack/amqp-contract/blob/
|
|
1544
|
-
| <a id="waitqueuename"></a> `waitQueueName?` | `string` | Name of the wait queue. **Default** `'{queueName}-wait'` | [types.ts:62](https://github.com/btravstack/amqp-contract/blob/
|
|
1560
|
+
| <a id="backoffmultiplier"></a> `backoffMultiplier?` | `number` | Exponential backoff multiplier. **Default** `2` | [types.ts:52](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L52) |
|
|
1561
|
+
| <a id="initialdelayms"></a> `initialDelayMs?` | `number` | Initial delay in ms before first retry. **Default** `1000` | [types.ts:42](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L42) |
|
|
1562
|
+
| <a id="jitter"></a> `jitter?` | `boolean` | Add jitter to prevent thundering herd. **Default** `true` | [types.ts:57](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L57) |
|
|
1563
|
+
| <a id="maxdelayms"></a> `maxDelayMs?` | `number` | Maximum delay in ms between retries. **Default** `30000` | [types.ts:47](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L47) |
|
|
1564
|
+
| <a id="maxretries-1"></a> `maxRetries?` | `number` | Maximum retry attempts before sending to DLQ. **Minimum** 1 - Must be a positive integer (1 or greater) **Default** `3` | [types.ts:37](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L37) |
|
|
1565
|
+
| <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/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L31) |
|
|
1566
|
+
| <a id="retryexchangename"></a> `retryExchangeName?` | `string` | Name of the retry exchange. **Default** `'retry-exchange'` | [types.ts:72](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L72) |
|
|
1567
|
+
| <a id="waitexchangename"></a> `waitExchangeName?` | `string` | Name of the wait exchange. **Default** `'wait-exchange'` | [types.ts:67](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L67) |
|
|
1568
|
+
| <a id="waitqueuename"></a> `waitQueueName?` | `string` | Name of the wait queue. **Default** `'{queueName}-wait'` | [types.ts:62](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/types.ts#L62) |
|
|
1545
1569
|
|
|
1546
1570
|
## Functions
|
|
1547
1571
|
|
|
@@ -1554,7 +1578,7 @@ function defineConsumer<TMessage>(
|
|
|
1554
1578
|
options?): ConsumerDefinition<TMessage>;
|
|
1555
1579
|
```
|
|
1556
1580
|
|
|
1557
|
-
Defined in: [builder/consumer.ts:120](https://github.com/btravstack/amqp-contract/blob/
|
|
1581
|
+
Defined in: [builder/consumer.ts:120](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/consumer.ts#L120)
|
|
1558
1582
|
|
|
1559
1583
|
Define a message consumer.
|
|
1560
1584
|
|
|
@@ -1639,7 +1663,7 @@ const processOrderConsumer = defineConsumer(orderQueue, orderMessage);
|
|
|
1639
1663
|
function defineContract<TContract>(definition): ContractOutput<TContract>;
|
|
1640
1664
|
```
|
|
1641
1665
|
|
|
1642
|
-
Defined in: [builder/contract.ts:136](https://github.com/btravstack/amqp-contract/blob/
|
|
1666
|
+
Defined in: [builder/contract.ts:136](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/contract.ts#L136)
|
|
1643
1667
|
|
|
1644
1668
|
Define an AMQP contract.
|
|
1645
1669
|
|
|
@@ -1727,7 +1751,7 @@ export const contract = defineContract({
|
|
|
1727
1751
|
function defineMessage<TPayload, THeaders>(payload, options?): MessageDefinition<TPayload, THeaders>;
|
|
1728
1752
|
```
|
|
1729
1753
|
|
|
1730
|
-
Defined in: [builder/message.ts:
|
|
1754
|
+
Defined in: [builder/message.ts:40](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/message.ts#L40)
|
|
1731
1755
|
|
|
1732
1756
|
Define a message definition with payload and optional headers/metadata.
|
|
1733
1757
|
|
|
@@ -1790,7 +1814,7 @@ const orderMessage = defineMessage(
|
|
|
1790
1814
|
function defineQueue<TName, TDlx>(name, options): QueueEntryWithDeadLetterExchange<TName, TDlx>;
|
|
1791
1815
|
```
|
|
1792
1816
|
|
|
1793
|
-
Defined in: [builder/queue.ts:
|
|
1817
|
+
Defined in: [builder/queue.ts:114](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/queue.ts#L114)
|
|
1794
1818
|
|
|
1795
1819
|
Define an AMQP queue.
|
|
1796
1820
|
|
|
@@ -1868,7 +1892,7 @@ const orderQueue = defineQueue('order-processing', {
|
|
|
1868
1892
|
function defineQueue<TName>(name, options?): QueueEntry<TName>;
|
|
1869
1893
|
```
|
|
1870
1894
|
|
|
1871
|
-
Defined in: [builder/queue.ts:
|
|
1895
|
+
Defined in: [builder/queue.ts:119](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/queue.ts#L119)
|
|
1872
1896
|
|
|
1873
1897
|
Define an AMQP queue.
|
|
1874
1898
|
|
|
@@ -1944,10 +1968,10 @@ const orderQueue = defineQueue('order-processing', {
|
|
|
1944
1968
|
### defineRpc()
|
|
1945
1969
|
|
|
1946
1970
|
```ts
|
|
1947
|
-
function defineRpc<TRequestMessage, TResponseMessage, TQueue>(queue, messages): RpcDefinition<TRequestMessage, TResponseMessage, TQueue>;
|
|
1971
|
+
function defineRpc<TRequestMessage, TResponseMessage, TQueue, TErrors>(queue, messages): RpcDefinition<TRequestMessage, TResponseMessage, TQueue, TErrors>;
|
|
1948
1972
|
```
|
|
1949
1973
|
|
|
1950
|
-
Defined in: [builder/rpc.ts:
|
|
1974
|
+
Defined in: [builder/rpc.ts:56](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/rpc.ts#L56)
|
|
1951
1975
|
|
|
1952
1976
|
Define an RPC operation: a request/response pair flowing over a request
|
|
1953
1977
|
queue with replies routed back via RabbitMQ direct reply-to.
|
|
@@ -1962,24 +1986,26 @@ appear in `publishers` or `consumers`.
|
|
|
1962
1986
|
|
|
1963
1987
|
#### Type Parameters
|
|
1964
1988
|
|
|
1965
|
-
| Type Parameter |
|
|
1966
|
-
| ------ |
|
|
1967
|
-
| `TRequestMessage` *extends* [`MessageDefinition`](#messagedefinition) |
|
|
1968
|
-
| `TResponseMessage` *extends* [`MessageDefinition`](#messagedefinition) |
|
|
1969
|
-
| `TQueue` *extends* [`QueueEntry`](#queueentry) |
|
|
1989
|
+
| Type Parameter | Default type |
|
|
1990
|
+
| ------ | ------ |
|
|
1991
|
+
| `TRequestMessage` *extends* [`MessageDefinition`](#messagedefinition) | - |
|
|
1992
|
+
| `TResponseMessage` *extends* [`MessageDefinition`](#messagedefinition) | - |
|
|
1993
|
+
| `TQueue` *extends* [`QueueEntry`](#queueentry) | - |
|
|
1994
|
+
| `TErrors` *extends* [`RpcErrorMap`](#rpcerrormap) \| `undefined` | `undefined` |
|
|
1970
1995
|
|
|
1971
1996
|
#### Parameters
|
|
1972
1997
|
|
|
1973
1998
|
| Parameter | Type | Description |
|
|
1974
1999
|
| ------ | ------ | ------ |
|
|
1975
2000
|
| `queue` | `TQueue` | The queue that receives RPC requests. The queue name is used as the routing key on the AMQP default direct exchange. |
|
|
1976
|
-
| `messages` | \{ `request`: `TRequestMessage`; `response`: `TResponseMessage`; \} | - |
|
|
2001
|
+
| `messages` | \{ `errors?`: `TErrors`; `request`: `TRequestMessage`; `response`: `TResponseMessage`; \} | - |
|
|
2002
|
+
| `messages.errors?` | `TErrors` | Optional typed error map: error code → message definition for the error's `data` payload. Declared errors widen the handler's `Err` channel (return `Err(rpcError(code, data))`) and the client's `call()` error union; error data is schema-validated on both sides. Business errors are replied and acked — never retried. |
|
|
1977
2003
|
| `messages.request` | `TRequestMessage` | Schema validated against incoming request payloads (server side) and outgoing requests (client side). |
|
|
1978
2004
|
| `messages.response` | `TResponseMessage` | Schema validated against handler return values (server side) and incoming replies (client side). |
|
|
1979
2005
|
|
|
1980
2006
|
#### Returns
|
|
1981
2007
|
|
|
1982
|
-
[`RpcDefinition`](#rpcdefinition)<`TRequestMessage`, `TResponseMessage`, `TQueue`>
|
|
2008
|
+
[`RpcDefinition`](#rpcdefinition)<`TRequestMessage`, `TResponseMessage`, `TQueue`, `TErrors`>
|
|
1983
2009
|
|
|
1984
2010
|
#### Example
|
|
1985
2011
|
|
|
@@ -1987,18 +2013,27 @@ appear in `publishers` or `consumers`.
|
|
|
1987
2013
|
import { defineQueue, defineMessage, defineRpc, defineContract } from '@amqp-contract/contract';
|
|
1988
2014
|
import { z } from 'zod';
|
|
1989
2015
|
|
|
1990
|
-
const
|
|
1991
|
-
request: defineMessage(z.object({
|
|
1992
|
-
response: defineMessage(z.object({
|
|
2016
|
+
const getOrder = defineRpc(defineQueue('rpc.get-order'), {
|
|
2017
|
+
request: defineMessage(z.object({ orderId: z.string() })),
|
|
2018
|
+
response: defineMessage(z.object({ orderId: z.string(), status: z.string() })),
|
|
2019
|
+
errors: {
|
|
2020
|
+
ORDER_NOT_FOUND: defineMessage(z.object({ orderId: z.string() })),
|
|
2021
|
+
},
|
|
1993
2022
|
});
|
|
1994
2023
|
|
|
1995
|
-
const contract = defineContract({ rpcs: {
|
|
2024
|
+
const contract = defineContract({ rpcs: { getOrder } });
|
|
1996
2025
|
|
|
1997
|
-
// Server (worker):
|
|
1998
|
-
// handlers: {
|
|
2026
|
+
// Server (worker): return the response, or a declared typed error
|
|
2027
|
+
// handlers: {
|
|
2028
|
+
// getOrder: ({ payload }) =>
|
|
2029
|
+
// orders.has(payload.orderId)
|
|
2030
|
+
// ? OkAsync(orders.get(payload.orderId))
|
|
2031
|
+
// : ErrAsync(rpcError('ORDER_NOT_FOUND', { orderId: payload.orderId })),
|
|
2032
|
+
// }
|
|
1999
2033
|
|
|
2000
|
-
// Client: typed call
|
|
2001
|
-
// const result = await client.call('
|
|
2034
|
+
// Client: typed call — the error union includes RpcError<'ORDER_NOT_FOUND', { orderId: string }>
|
|
2035
|
+
// const result = await client.call('getOrder', { orderId: '42' }, { timeoutMs: 5_000 });
|
|
2036
|
+
// if (result.isErr() && isRpcError(result.error)) console.log(result.error.code);
|
|
2002
2037
|
```
|
|
2003
2038
|
|
|
2004
2039
|
***
|
|
@@ -2009,7 +2044,7 @@ const contract = defineContract({ rpcs: { calculate } });
|
|
|
2009
2044
|
function extractConsumer(entry): ConsumerDefinition;
|
|
2010
2045
|
```
|
|
2011
2046
|
|
|
2012
|
-
Defined in: [builder/consumer.ts:54](https://github.com/btravstack/amqp-contract/blob/
|
|
2047
|
+
Defined in: [builder/consumer.ts:54](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/consumer.ts#L54)
|
|
2013
2048
|
|
|
2014
2049
|
Extract the ConsumerDefinition from any ConsumerEntry type.
|
|
2015
2050
|
|
|
@@ -2058,7 +2093,7 @@ extractConsumer(consumer3).queue.name; // "my-queue"
|
|
|
2058
2093
|
function extractQueue<T>(entry): ExtractQueueFromEntry<T>;
|
|
2059
2094
|
```
|
|
2060
2095
|
|
|
2061
|
-
Defined in: [builder/queue-utils.ts:60](https://github.com/btravstack/amqp-contract/blob/
|
|
2096
|
+
Defined in: [builder/queue-utils.ts:60](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/queue-utils.ts#L60)
|
|
2062
2097
|
|
|
2063
2098
|
Extract the plain QueueDefinition from a QueueEntry.
|
|
2064
2099
|
|
|
@@ -2124,13 +2159,40 @@ isQueueWithTtlBackoffInfrastructure - Type guard to check if extraction is neede
|
|
|
2124
2159
|
|
|
2125
2160
|
***
|
|
2126
2161
|
|
|
2162
|
+
### formatIssue()
|
|
2163
|
+
|
|
2164
|
+
```ts
|
|
2165
|
+
function formatIssue(issue): string;
|
|
2166
|
+
```
|
|
2167
|
+
|
|
2168
|
+
Defined in: [issues.ts:11](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/issues.ts#L11)
|
|
2169
|
+
|
|
2170
|
+
Render a single Standard Schema issue as `path.to.field: message` (or just
|
|
2171
|
+
the message for root-level issues). Path segments may be raw property keys
|
|
2172
|
+
or `{ key }` objects per the Standard Schema spec; both are handled.
|
|
2173
|
+
|
|
2174
|
+
Single source of truth for issue rendering across the client and worker —
|
|
2175
|
+
mirrors temporal-contract's shared formatter (org DNA).
|
|
2176
|
+
|
|
2177
|
+
#### Parameters
|
|
2178
|
+
|
|
2179
|
+
| Parameter | Type |
|
|
2180
|
+
| ------ | ------ |
|
|
2181
|
+
| `issue` | `Issue` |
|
|
2182
|
+
|
|
2183
|
+
#### Returns
|
|
2184
|
+
|
|
2185
|
+
`string`
|
|
2186
|
+
|
|
2187
|
+
***
|
|
2188
|
+
|
|
2127
2189
|
### isBridgedPublisherConfig()
|
|
2128
2190
|
|
|
2129
2191
|
```ts
|
|
2130
2192
|
function isBridgedPublisherConfig(value): value is BridgedPublisherConfig<MessageDefinition, ExchangeDefinition, ExchangeDefinition>;
|
|
2131
2193
|
```
|
|
2132
2194
|
|
|
2133
|
-
Defined in: [builder/command.ts:514](https://github.com/btravstack/amqp-contract/blob/
|
|
2195
|
+
Defined in: [builder/command.ts:514](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/command.ts#L514)
|
|
2134
2196
|
|
|
2135
2197
|
Type guard to check if a value is a BridgedPublisherConfig.
|
|
2136
2198
|
|
|
@@ -2154,7 +2216,7 @@ True if the value is a BridgedPublisherConfig
|
|
|
2154
2216
|
function isCommandConsumerConfig(value): value is CommandConsumerConfig<MessageDefinition, ExchangeDefinition, string | undefined, QueueEntry>;
|
|
2155
2217
|
```
|
|
2156
2218
|
|
|
2157
|
-
Defined in: [builder/command.ts:497](https://github.com/btravstack/amqp-contract/blob/
|
|
2219
|
+
Defined in: [builder/command.ts:497](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/command.ts#L497)
|
|
2158
2220
|
|
|
2159
2221
|
Type guard to check if a value is a CommandConsumerConfig.
|
|
2160
2222
|
|
|
@@ -2178,7 +2240,7 @@ True if the value is a CommandConsumerConfig
|
|
|
2178
2240
|
function isEventConsumerResult(value): value is EventConsumerResult<MessageDefinition, ExchangeDefinition, QueueEntry, ExchangeBindingDefinition | undefined, ExchangeDefinition | undefined>;
|
|
2179
2241
|
```
|
|
2180
2242
|
|
|
2181
|
-
Defined in: [builder/event.ts:616](https://github.com/btravstack/amqp-contract/blob/
|
|
2243
|
+
Defined in: [builder/event.ts:616](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/event.ts#L616)
|
|
2182
2244
|
|
|
2183
2245
|
Type guard to check if a value is an EventConsumerResult.
|
|
2184
2246
|
|
|
@@ -2202,7 +2264,7 @@ True if the value is an EventConsumerResult
|
|
|
2202
2264
|
function isEventPublisherConfig(value): value is EventPublisherConfig<MessageDefinition, ExchangeDefinition, string | undefined>;
|
|
2203
2265
|
```
|
|
2204
2266
|
|
|
2205
|
-
Defined in: [builder/event.ts:599](https://github.com/btravstack/amqp-contract/blob/
|
|
2267
|
+
Defined in: [builder/event.ts:599](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/event.ts#L599)
|
|
2206
2268
|
|
|
2207
2269
|
Type guard to check if a value is an EventPublisherConfig.
|
|
2208
2270
|
|
|
@@ -2226,7 +2288,7 @@ True if the value is an EventPublisherConfig
|
|
|
2226
2288
|
function isQueueWithTtlBackoffInfrastructure(entry): entry is QueueWithTtlBackoffInfrastructure;
|
|
2227
2289
|
```
|
|
2228
2290
|
|
|
2229
|
-
Defined in: [builder/ttl-backoff.ts:43](https://github.com/btravstack/amqp-contract/blob/
|
|
2291
|
+
Defined in: [builder/ttl-backoff.ts:43](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/builder/ttl-backoff.ts#L43)
|
|
2230
2292
|
|
|
2231
2293
|
Type guard to check if a queue entry is a QueueWithTtlBackoffInfrastructure.
|
|
2232
2294
|
|
|
@@ -2268,3 +2330,29 @@ if (isQueueWithTtlBackoffInfrastructure(queue)) {
|
|
|
2268
2330
|
console.log('Queue:', queue.name);
|
|
2269
2331
|
}
|
|
2270
2332
|
```
|
|
2333
|
+
|
|
2334
|
+
***
|
|
2335
|
+
|
|
2336
|
+
### summarizeIssues()
|
|
2337
|
+
|
|
2338
|
+
```ts
|
|
2339
|
+
function summarizeIssues(issues, limit?): string;
|
|
2340
|
+
```
|
|
2341
|
+
|
|
2342
|
+
Defined in: [issues.ts:28](https://github.com/btravstack/amqp-contract/blob/1948ac0d26ba5aafc2d473bf2820eb2e5408fd7a/packages/contract/src/issues.ts#L28)
|
|
2343
|
+
|
|
2344
|
+
Render a list of Standard Schema issues as a single human-readable line:
|
|
2345
|
+
the first `limit` issues joined with `; `, plus a `(+N more)` suffix when
|
|
2346
|
+
truncated. Empty input renders as `"no issues"` (defensive — validation
|
|
2347
|
+
failures always carry at least one issue).
|
|
2348
|
+
|
|
2349
|
+
#### Parameters
|
|
2350
|
+
|
|
2351
|
+
| Parameter | Type | Default value |
|
|
2352
|
+
| ------ | ------ | ------ |
|
|
2353
|
+
| `issues` | readonly `Issue`[] | `undefined` |
|
|
2354
|
+
| `limit` | `number` | `3` |
|
|
2355
|
+
|
|
2356
|
+
#### Returns
|
|
2357
|
+
|
|
2358
|
+
`string`
|